From: Jean-Philippe Brucker <[email protected]> Set the Ream VM bit in the IPA address space size when needed.
Signed-off-by: Jean-Philippe Brucker <[email protected]> Signed-off-by: Mathieu Poirier <[email protected]> --- hw/arm/virt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 27bed9755320..9123f46fae4a 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -97,6 +97,8 @@ #include "qemu/guest-random.h" #include "hw/watchdog/sbsa_gwdt.h" +#include <linux/kvm.h> + static GlobalProperty arm_virt_compat_defaults[] = { { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "48" }, }; @@ -4053,9 +4055,12 @@ static int virt_kvm_type(MachineState *ms, const char *type_str) VirtMachineState *vms = VIRT_MACHINE(ms); int max_vm_pa_size, requested_pa_size; bool fixed_ipa; + int vm_type; max_vm_pa_size = kvm_arm_get_max_vm_ipa_size(ms, &fixed_ipa); + vm_type = (ms->cgs ? KVM_VM_TYPE_ARM_REALM : KVM_VM_TYPE_ARM_NORMAL); + /* we freeze the memory map to compute the highest gpa */ virt_set_memmap(vms, max_vm_pa_size); @@ -4080,7 +4085,11 @@ static int virt_kvm_type(MachineState *ms, const char *type_str) * the implicit legacy 40b IPA setting, in which case the kvm_type * must be 0. */ - return fixed_ipa ? 0 : requested_pa_size; + if (fixed_ipa) { + return 0; + } + + return requested_pa_size | vm_type; } static int virt_get_physical_address_range(MachineState *ms, -- 2.43.0
