Re: [PATCH v5 1/3] arm64: cpufeature: introduce helper cpu_has_hw_af()
From: Catalin Marinas
Date: Thu Sep 19 2019 - 12:36:51 EST
On Fri, Sep 20, 2019 at 12:12:02AM +0800, Jia He wrote:
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index b1fdc486aed8..fb0e9425d286 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -1141,6 +1141,16 @@ static bool has_hw_dbm(const struct arm64_cpu_capabilities *cap,
> return true;
> }
>
> +/* Decouple AF from AFDBM. */
> +bool cpu_has_hw_af(void)
> +{
> + return (read_cpuid(ID_AA64MMFR1_EL1) & 0xf);
> +}
> +#else /* CONFIG_ARM64_HW_AFDBM */
> +bool cpu_has_hw_af(void)
> +{
> + return false;
> +}
> #endif
Please place this function in cpufeature.h directly, no need for an
additional function call. Something like:
static inline bool cpu_has_hw_af(void)
{
if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM))
return read_cpuid(ID_AA64MMFR1_EL1) & 0xf;
return false;
}
--
Catalin