On 12/8/25 06:49, Philippe Mathieu-Daudé wrote:
On 12/8/25 02:48, Richard Henderson wrote:
On 8/12/25 03:06, Philippe Mathieu-Daudé wrote:
+++ b/target/arm/kvm.c
@@ -288,7 +288,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
                               1 << KVM_ARM_VCPU_PTRAUTH_GENERIC);
      }
-    if (kvm_arm_pmu_supported()) {
+    if (host_cpu_feature_supported(ARM_FEATURE_PMU, false)) {

Why is false correct here?  Alternately, in the next patch, why is it correct to pass true for the EL2 test?

I think I copied to KVM the HVF use, adapted on top of:
https://lore.kernel.org/qemu-devel/20250808070137.48716-12- moha...@unpredictable.fr/


What is the purpose of the can_emulate parameter at all?

When using split-accel on pre-M3, we might emulate EL2:

        |   feat            |    can_emulate   |    retval
        +   ----            +      -----       +     ----
> M1/M2  | ARM_FEATURE_EL2         false            false> M1/M2  |  ARM_FEATURE_EL2         true             true
M3/M4  |  ARM_FEATURE_EL2         any              true

For example in hvf.c:

static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
{
    ...
    if (host_cpu_feature_supported(ARM_FEATURE_EL2, true)) {
        ahcf->features |= 1ULL << ARM_FEATURE_EL2;
    }

and then only when split-accel is not enabled:

hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range)
{
    ...
    if (host_cpu_feature_supported(ARM_FEATURE_EL2, false)) {
        ret = hv_vm_config_set_el2_enabled(config, true);
        if (ret != HV_SUCCESS) {
            goto cleanup;
        }
    }


Reply via email to