Re: [PATCH v5 06/15] KVM: arm64: Add support for FEAT_HDBSS

From: Leonardo Bras

Date: Mon Oct 26 2026 - 14:12:53 EST


On Tue, Sep 29, 2026 at 06:36:46PM +0800, Tian Zheng wrote:
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index 32102c3912fa..12fa37328dd2 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -2158,6 +2158,11 @@ static bool hvhe_possible(const struct arm64_cpu_capabilities *entry,
> return arm64_test_sw_feature_override(ARM64_SW_FEATURE_OVERRIDE_HVHE);
> }
>
> +static bool has_vhe_hdbss(const struct arm64_cpu_capabilities *entry, int scope)
> +{
> + return is_kernel_in_hyp_mode() && has_cpuid_feature(entry, scope);
> +}
> +

IIUC you run this on every cpu in the system, to make sure it's matching
the feature. Is there any chance the kernel is in EL2 only on some of the
cpus here?

If not, maybe we can run it on system_supports_hdbss() instead, which would
be easier for the user to understand it only runs in EL2, on top of not
needing the above.

Other than that, seems ok to me.

Thanks!
Leo