From: Eric Auger <eric.auger@redhat.com>
To: eric.auger.pro@gmail.com, eric.auger@redhat.com,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
miguel.luis@oracle.com, peter.maydell@linaro.org,
richard.henderson@linaro.org, maz@kernel.org,
gkulkarni@amperecomputing.com,
gankulkarni@os.amperecomputing.com
Cc: hi@alyssa.is
Subject: [PATCH v9 5/5] hw/arm/virt: Allow virt extensions with KVM
Date: Mon, 7 Jul 2025 18:40:31 +0200 [thread overview]
Message-ID: <20250707164129.1167837-6-eric.auger@redhat.com> (raw)
In-Reply-To: <20250707164129.1167837-1-eric.auger@redhat.com>
From: Haibo Xu <haibo.xu@linaro.org>
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>
---
v8 -> v9:
- remove the migration blocker from the machine code as
it is now in the GIC code itself.
v7 -> v8:
- add the migration blocker
- s/only is/is only
- check aarch64=off
- update the commit message
v6 -> v7:
- rebase on top of "hw/arm/virt: Make EL2 accelerator check an
accept-list". I dared to keep Richard's R-b though.
v2 -> v3:
- check gic version/in-kernel implementation when kvm el2 is set (Peter)
v1 -> v2:
- fixed test ordering: virt && ((kvm && !kvm_el2) || hvf) [Richard]
- tweeked the commit title & message
---
hw/arm/virt.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 550a272fbb..6f5339aade 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -792,6 +792,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);
@@ -2066,6 +2073,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("vcpu with both EL1_32BIT and HAS_EL2 is not supported");
+ exit(1);
+ }
CPU_FOREACH(cpu) {
if (pmu) {
@@ -2211,7 +2222,8 @@ static void machvirt_init(MachineState *machine)
exit(1);
}
- if (vms->virt && !tcg_enabled() && !qtest_enabled()) {
+ if (vms->virt && !(kvm_enabled() && kvm_arm_el2_supported()) &&
+ !tcg_enabled() && !qtest_enabled()) {
error_report("mach-virt: %s does not support providing "
"Virtualization extensions to the guest CPU",
current_accel_name());
--
2.49.0
next prev parent reply other threads:[~2025-07-07 16:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 16:40 [PATCH v9 0/5] ARM Nested Virt Support Eric Auger
2025-07-07 16:40 ` [PATCH v9 1/5] hw/arm: Allow setting KVM vGIC maintenance IRQ Eric Auger
2025-07-07 16:40 ` [PATCH v9 2/5] target/arm/kvm: Add helper to detect EL2 when using KVM Eric Auger
2025-07-07 16:40 ` [PATCH v9 3/5] target/arm: Enable feature ARM_FEATURE_EL2 if EL2 is supported Eric Auger
2025-07-07 16:40 ` [PATCH v9 4/5] hw/arm/arm_gicv3_kvm: Add a migration blocker with kvm nested virt Eric Auger
2025-07-10 14:04 ` Philippe Mathieu-Daudé
2025-07-10 14:10 ` Eric Auger
2025-07-10 15:18 ` Philippe Mathieu-Daudé
2025-07-10 15:18 ` Peter Maydell
2025-07-07 16:40 ` Eric Auger [this message]
2025-07-10 10:42 ` [PATCH v9 0/5] ARM Nested Virt Support Peter Maydell
2025-07-10 12:38 ` Eric Auger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250707164129.1167837-6-eric.auger@redhat.com \
--to=eric.auger@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=gankulkarni@os.amperecomputing.com \
--cc=gkulkarni@amperecomputing.com \
--cc=hi@alyssa.is \
--cc=maz@kernel.org \
--cc=miguel.luis@oracle.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).