> On 11. Aug 2025, at 14:56, Philippe Mathieu-Daudé <phi...@linaro.org> wrote:
>
> On 8/8/25 09:01, Mohamed Mediouni wrote:
>> Signed-off-by: Mohamed Mediouni <moha...@unpredictable.fr>
>> ---
>> hw/arm/virt.c | 9 ++++++---
>> target/arm/hvf-stub.c | 15 +++++++++++++++
>> target/arm/hvf/hvf.c | 41 +++++++++++++++++++++++++++++++++++++++--
>> target/arm/hvf_arm.h | 3 +++
>> 4 files changed, 63 insertions(+), 5 deletions(-)
>> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
>> index 59e6c2b9df..91d8cd9363 100644
>> --- a/hw/arm/virt.c
>> +++ b/hw/arm/virt.c
>> @@ -817,8 +817,7 @@ static void create_gic(VirtMachineState *vms,
>> MemoryRegion *mem)
>> g_assert_not_reached();
>> }
>> - if (kvm_enabled() && vms->virt &&
>> - (revision != 3 || !kvm_irqchip_in_kernel())) {
>> + if (kvm_enabled() && vms->virt && (revision != 3 ||
>> !kvm_irqchip_in_kernel())) {
>> error_report("KVM EL2 is only supported with in-kernel GICv3");
>> exit(1);
>> }
>> @@ -2281,7 +2280,8 @@ static void machvirt_init(MachineState *machine)
>> exit(1);
>> }
>> - if (vms->virt && !kvm_enabled() && !tcg_enabled() && !qtest_enabled())
>> {
>> + if (vms->virt && !kvm_enabled() && !tcg_enabled()
>> + && !hvf_enabled() && !qtest_enabled()) {
>> error_report("mach-virt: %s does not support providing "
>> "Virtualization extensions to the guest CPU",
>> current_accel_name());
>> @@ -2553,6 +2553,9 @@ static void virt_set_virt(Object *obj, bool value,
>> Error **errp)
>> VirtMachineState *vms = VIRT_MACHINE(obj);
>> vms->virt = value;
>> +#if defined(CONFIG_HVF) && defined(__aarch64__)
>> + hvf_arm_el2_enable(value);
>> +#endif
>> }
> We don't have hvf_arm_el1_enable(). I think we just want to always
> provide the most performant configuration to users.
> IOW, we don't need hvf_arm_el2_enable(). I'd just always enable EL2
> (if supported) in hvf_arm_get_host_cpu_features().
A different feature set is exposed when EL2 is enabled. For example, SME is not
currently exposed in that mode.
(We currently disable SME in Qemu anyway but that’s something I plan to take
care of)