[PATCH v5 06/15] KVM: arm64: Add support for FEAT_HDBSS
Tian Zheng
zhengtian10 at huawei.com
Thu Oct 29 19:53:57 PDT 2026
On 10/27/2026 2:12 AM, Leonardo Bras wrote:
> 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);
>> +}
>> +
>
Hi leo,
> 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?
>
It's impossible for the system to have only some CPUs in EL2 and others
not.
> 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.
>
However, The question is whether a cap should mean "this system can use
the feature" or "this hardware supports the feature". If the cap only
tracks hardware support, users may be confused when the hardware
supports HDBSS but the system runs in nVHE mode — they would mistakenly
believe they can use the feature.
So I think we should keep is_kernel_in_hyp_mode() in has_vhe_hdbss(),
and add a comment in system_supports_hdbss() explaining this.
Does that work for you? Looking forward to your reply.
Thanks,
Tian
More information about the linux-arm-kernel
mailing list