diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2025-07-10 11:39:33 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2025-07-10 16:18:43 +0100 |
commit | 851dcb8355cb3c37fbbf8cc99ae5fac4871d1a44 (patch) | |
tree | 9a7da00dbc8974868fb622f30ba7dbb7cda896d6 | |
parent | f36032440f5dd7ceb90833dd44600363b1472757 (diff) | |
download | qemu-851dcb8355cb3c37fbbf8cc99ae5fac4871d1a44.zip qemu-851dcb8355cb3c37fbbf8cc99ae5fac4871d1a44.tar.gz qemu-851dcb8355cb3c37fbbf8cc99ae5fac4871d1a44.tar.bz2 |
hw/arm/virt: Allow virt extensions with KVM
Up to now virt support on guest has been only supported with TCG.
Now it becomes feasible to use it with KVM acceleration.
Check neither in-kernel GICv3 nor aarch64=off is used along with KVM
EL2.
Signed-off-by: Haibo Xu <haibo.xu@linaro.org>
Signed-off-by: Miguel Luis <miguel.luis@oracle.com>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250707164129.1167837-6-eric.auger@redhat.com
[PMM: make "kernel doesn't have EL2 support" error message
distinct from the old "QEMU doesn't have KVM EL2 support" one]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | hw/arm/virt.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/hw/arm/virt.c b/hw/arm/virt.c index c9f3991..8070ff7 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -797,6 +797,13 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) default: g_assert_not_reached(); } + + if (kvm_enabled() && vms->virt && + (revision != 3 || !kvm_irqchip_in_kernel())) { + error_report("KVM EL2 is only supported with in-kernel GICv3"); + exit(1); + } + vms->gic = qdev_new(gictype); qdev_prop_set_uint32(vms->gic, "revision", revision); qdev_prop_set_uint32(vms->gic, "num-cpu", smp_cpus); @@ -2092,6 +2099,10 @@ static void virt_post_cpus_gic_realized(VirtMachineState *vms, memory_region_init_ram(pvtime, NULL, "pvtime", pvtime_size, NULL); memory_region_add_subregion(sysmem, pvtime_reg_base, pvtime); } + if (!aarch64 && vms->virt) { + error_report("KVM does not support EL2 on an AArch32 vCPU"); + exit(1); + } CPU_FOREACH(cpu) { if (pmu) { @@ -2237,7 +2248,13 @@ static void machvirt_init(MachineState *machine) exit(1); } - if (vms->virt && !tcg_enabled() && !qtest_enabled()) { + if (vms->virt && kvm_enabled() && !kvm_arm_el2_supported()) { + error_report("mach-virt: host kernel KVM does not support providing " + "Virtualization extensions to the guest CPU"); + exit(1); + } + + if (vms->virt && !kvm_enabled() && !tcg_enabled() && !qtest_enabled()) { error_report("mach-virt: %s does not support providing " "Virtualization extensions to the guest CPU", current_accel_name()); |