[RFC PATCH 11/11] target/arm/hvf: Allow EL2/EL3 emulation on Silicon M1 / M2

Philippe Mathieu-Daudé posted 11 patches 3 months ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Alexander Graf <agraf@csgraf.de>, Mads Ynddal <mads@ynddal.dk>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
[RFC PATCH 11/11] target/arm/hvf: Allow EL2/EL3 emulation on Silicon M1 / M2
Posted by Philippe Mathieu-Daudé 3 months ago
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Another API PoC.
---
 target/arm/hvf/hvf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index d74f576b103..0519903c928 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -17,6 +17,7 @@
 #include "system/hvf.h"
 #include "system/hvf_int.h"
 #include "system/hw_accel.h"
+#include "system/tcg.h"
 #include "hvf_arm.h"
 #include "cpregs.h"
 #include "cpu-sysregs.h"
@@ -1014,11 +1015,14 @@ bool arm_hw_accel_cpu_feature_supported(enum arm_features feat, bool can_emulate
     case ARM_FEATURE_GENERIC_TIMER:
         return true;
     case ARM_FEATURE_EL2:
+        if (can_emulate) {
+            return true;
+        }
         ret = hv_vm_config_get_el2_supported(&supported);
         assert_hvf_ok(ret);
         return supported;
     case ARM_FEATURE_EL3:
-        return false;
+        return can_emulate && tcg_enabled();
     default:
         g_assert_not_reached();
     }
-- 
2.49.0


Re: [RFC PATCH 11/11] target/arm/hvf: Allow EL2/EL3 emulation on Silicon M1 / M2
Posted by Richard Henderson 3 months ago
On 8/12/25 03:06, Philippe Mathieu-Daudé wrote:
> @@ -1014,11 +1015,14 @@ bool arm_hw_accel_cpu_feature_supported(enum arm_features feat, bool can_emulate
>       case ARM_FEATURE_GENERIC_TIMER:
>           return true;
>       case ARM_FEATURE_EL2:
> +        if (can_emulate) {
> +            return true;
> +        }
>           ret = hv_vm_config_get_el2_supported(&supported);
>           assert_hvf_ok(ret);
>           return supported;
>       case ARM_FEATURE_EL3:
> -        return false;
> +        return can_emulate && tcg_enabled();

Surely the el2 portion needs the tcg_enabled check as well.


r~

Re: [RFC PATCH 11/11] target/arm/hvf: Allow EL2/EL3 emulation on Silicon M1 / M2
Posted by Philippe Mathieu-Daudé 3 months ago
On 12/8/25 02:23, Richard Henderson wrote:
> On 8/12/25 03:06, Philippe Mathieu-Daudé wrote:
>> @@ -1014,11 +1015,14 @@ bool arm_hw_accel_cpu_feature_supported(enum 
>> arm_features feat, bool can_emulate
>>       case ARM_FEATURE_GENERIC_TIMER:
>>           return true;
>>       case ARM_FEATURE_EL2:
>> +        if (can_emulate) {
>> +            return true;
>> +        }
>>           ret = hv_vm_config_get_el2_supported(&supported);
>>           assert_hvf_ok(ret);
>>           return supported;
>>       case ARM_FEATURE_EL3:
>> -        return false;
>> +        return can_emulate && tcg_enabled();
> 
> Surely the el2 portion needs the tcg_enabled check as well.

Oops, indeed.