[PATCH v2] arm: Support for the PXN CPU feature on ARMv7

Arnd Bergmann arnd at arndb.de
Wed Nov 26 00:48:52 PST 2014


On Wednesday 26 November 2014 15:05:21 Jungseung Lee wrote:
> +#if __LINUX_ARM_ARCH__ >= 6 && !defined(CONFIG_ARM_LPAE)
> +static inline bool cpu_has_classic_pxn(void)
> +{
> +       static unsigned int vmsa = ~0UL;
> +
> +       if (cpu_architecture() != CPU_ARCH_ARMv7)
> +               return false;
> +       if (vmsa == 4)
> +               return true;
> +
> +       vmsa = (read_cpuid_ext(CPUID_EXT_MMFR0) & 0xf) >> 0;
> +       return vmsa == 4;
> +}
> +#else
> +static inline bool cpu_has_classic_pxn(void)
> +{
> +       return false;
> +}
> +#endif
> +
> 

As mentioned before, please turn the #ifdef into an "if (IS_ENABLED(...))" check.

The 'if (vmsa == 4)' check above looks like it came from an earlier version
and is always false, so just drop that.

	Arnd



More information about the linux-arm-kernel mailing list