Skip to content

Commit

Permalink
hw/arm/virt: Extend nested and mte checks to hvf
Browse files Browse the repository at this point in the history
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.
This will cause QEMU to print a useful error message rather than
silently ignoring the attempt by the user to enable either MTE or
the Virtualization extensions.

Reported-by: saar amar <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
Message-id: [email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
agraf authored and pm215 committed Nov 26, 2021
1 parent dd4b0de commit bede011
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions hw/arm/virt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit bede011

Please sign in to comment.