[RFC v3 16/24] hw/arm/virt: Embed Realm VM type with IPA address space
Mathieu Poirier <[email protected]>
| Newsgroups | org.kernel.vger.kvm,org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
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 3418d75eccc4..fe195d145676 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -96,6 +96,8 @@ #include "hw/cxl/cxl_host.h" #include "qemu/guest-random.h" +#include <linux/kvm.h> + static GlobalProperty arm_virt_compat_defaults[] = { { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "48" }, }; @@ -3971,9 +3973,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); @@ -3998,7 +4003,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