Re: [PATCH 07/18] arm64: Add system_supports_hvo
From: Catalin Marinas
Date: Tue Aug 18 2026 - 10:14:56 EST
On Wed, Jul 08, 2026 at 03:11:17AM +0000, James Houghton wrote:
> diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h
> index 25c61cda901c..6db3ef827f86 100644
> --- a/arch/arm64/include/asm/cpucaps.h
> +++ b/arch/arm64/include/asm/cpucaps.h
> @@ -75,6 +75,8 @@ cpucap_is_possible(const unsigned int cap)
> return IS_ENABLED(CONFIG_HW_PERF_EVENTS);
> case ARM64_HAS_LSUI:
> return IS_ENABLED(CONFIG_ARM64_LSUI);
> + case ARM64_HVO_COMPATIBLE:
> + return IS_ENABLED(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP);
> }
We shouldn't use HVO, a software feature, as a CPU capability name, even
if it's called HVO_COMPATIBLE. Maybe we can come up with a hardware
related name, e.g. BBM_THROUGH_AF.
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index 9a22df0c5120..3b9224b99a5f 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -2172,6 +2172,16 @@ static bool has_bbml2_noabort(const struct arm64_cpu_capabilities *caps, int sco
> return cpu_supports_bbml2_noabort();
> }
>
> +static bool hvo_compatible(const struct arm64_cpu_capabilities *caps, int scope)
> +{
> + /*
> + * We need BBML2 to support Block -> Table transitions without taking
> + * faults, and we need HW AF support to support changing the OA without
> + * taking faults.
> + */
> + return cpu_supports_bbml2_noabort() && supports_hw_af(scope);
> +}
I think this is wrong. cpu_supports_bbml2_noabort() only checks the
current CPU while hvo_compatible() will be run once on the sanitised
register values (SCOPE_SYSTEM). I should be something like:
cpus_have_cap(ARM64_HAS_BBML2_NOABORT) && supports_hw_af(scope)
--
Catalin