Skip to contentSkip to conversation

hw/arm/virt: Extend nested and mte checks to hvf

PATCH In review Alexander Graf 2 participants 4 messages Nov 23, 2021 – Nov 26, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm/virt: Extend nested and mte checks to hvf

The virt machine has properties to enable MTE and Nested Virtualization support. However, its check to ensure the backing accel implementation supports it today only looks for KVM and bails out if it finds it.

Extend the checks to HVF as well as it does not support either today.

---
 hw/arm/virt.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
hw/arm/virt.c +9 -6
index 369552ad45..30da05dfe0 100644
@@ -49,6 +49,7 @@
 #include "sysemu/runstate.h"
 #include "sysemu/tpm.h"
 #include "sysemu/kvm.h"
+#include "sysemu/hvf.h"
 #include "hw/loader.h"
 #include "qapi/error.h"
 #include "qemu/bitops.h"
@@ -1969,15 +1970,17 @@ static void machvirt_init(MachineState *machine)
         exit(1);
     }
 
-    if (vms->virt && kvm_enabled()) {
-        error_report("mach-virt: KVM does not support providing "
-                     "Virtualization extensions to the guest CPU");
+    if (vms->virt && (kvm_enabled() || hvf_enabled())) {
+        error_report("mach-virt: %s does not support providing "
+                     "Virtualization extensions to the guest CPU",
+                     kvm_enabled() ? "KVM" : "HVF");
         exit(1);
     }
 
-    if (vms->mte && kvm_enabled()) {
-        error_report("mach-virt: KVM does not support providing "
-                     "MTE to the guest CPU");
+    if (vms->mte && (kvm_enabled() || hvf_enabled())) {
+        error_report("mach-virt: %s does not support providing "
+                     "MTE to the guest CPU",
+                     kvm_enabled() ? "KVM" : "HVF");
         exit(1);
     }
 
Signature · 1 line
2.30.1 (Apple Git-130)
#1 lore raw
Quoted 9 lines · Alexander Graf

The virt machine has properties to enable MTE and Nested Virtualization support. However, its check to ensure the backing accel implementation supports it today only looks for KVM and bails out if it finds it.

Extend the checks to HVF as well as it does not support either today.

Without this check, what happens if you try to enable both eg virtualization and hvf? Crash, unhelpful error message, something else?

thanks
-- PMM

#2 lore raw
Quoted 5 lines · Peter Maydell
Quoted 4 lines · Alexander Graf

The virt machine has properties to enable MTE and Nested Virtualization support. However, its check to ensure the backing accel implementation supports it today only looks for KVM and bails out if it finds it.

Quoted 7 lines
Quoted 4 lines

Extend the checks to HVF as well as it does not support either today.

Without this check, what happens if you try to enable both eg virtualization and hvf? Crash, unhelpful error message, something else?

The guest just never gets either feature enabled. No crash, no error message.

Alex

#3 lore raw
Quoted 12 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Alexander Graf

The virt machine has properties to enable MTE and Nested Virtualization support. However, its check to ensure the backing accel implementation supports it today only looks for KVM and bails out if it finds it.

Extend the checks to HVF as well as it does not support either today.

Quoted 7 lines
Quoted 3 lines

Without this check, what happens if you try to enable both eg virtualization and hvf? Crash, unhelpful error message, something else?

The guest just never gets either feature enabled. No crash, no error message.

Thanks; I've added that info to the commit message and applied this to target-arm.next for 6.2.

-- PMM