aboutsummaryrefslogtreecommitdiff
path: root/hw/arm
diff options
context:
space:
mode:
authorDanny Canter <danny_canter@apple.com>2024-09-13 15:31:46 +0100
committerPeter Maydell <peter.maydell@linaro.org>2024-09-13 15:31:46 +0100
commit81e3d93a9e3b3baa0e73e674ca3d1b93a672cc6d (patch)
treeb9aca1db6a50f8778b0521042fff812cd437f147 /hw/arm
parent6a8703aecb152ef4324dc95273eca864b78b3837 (diff)
downloadqemu-81e3d93a9e3b3baa0e73e674ca3d1b93a672cc6d.zip
qemu-81e3d93a9e3b3baa0e73e674ca3d1b93a672cc6d.tar.gz
qemu-81e3d93a9e3b3baa0e73e674ca3d1b93a672cc6d.tar.bz2
hw/boards: Add hvf_get_physical_address_range to MachineClass
This addition will be necessary for some HVF related work to follow. For HVF on ARM there exists a set of APIs in macOS 13 to be able to adjust the IPA size for a given VM. This is useful as by default HVF uses 36 bits as the IPA size, so to support guests with > 64GB of RAM we'll need to reach for this. To have all the info necessary to carry this out however, we need some plumbing to be able to grab the memory map and compute the highest GPA prior to creating the VM. This is almost exactly like what kvm_type is used for on ARM today, and is also what this will be used for. We will compute the highest GPA and find what IPA size we'd need to satisfy this, and if it's valid (macOS today caps at 40b) we'll set this to be the IPA size in coming patches. This new method is only needed (today at least) on ARM, and obviously only for HVF/macOS, so admittedly it is much less generic than kvm_type today, but it seemed a somewhat sane way to get the information we need from the memmap at VM creation time. Signed-off-by: Danny Canter <danny_canter@apple.com> Message-id: 20240828111552.93482-2-danny_canter@apple.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> [PMM: removed explicit setting of field to NULL on x86] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm')
-rw-r--r--hw/arm/virt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 7934b23..d284a60 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2111,7 +2111,8 @@ static void machvirt_init(MachineState *machine)
/*
* In accelerated mode, the memory map is computed earlier in kvm_type()
- * to create a VM with the right number of IPA bits.
+ * for Linux, or hvf_get_physical_address_range() for macOS to create a
+ * VM with the right number of IPA bits.
*/
if (!vms->memmap) {
Object *cpuobj;
@@ -3031,6 +3032,11 @@ static int virt_kvm_type(MachineState *ms, const char *type_str)
return fixed_ipa ? 0 : requested_pa_size;
}
+static int virt_hvf_get_physical_address_range(MachineState *ms)
+{
+ return 0;
+}
+
static void virt_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -3090,6 +3096,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
mc->valid_cpu_types = valid_cpu_types;
mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
mc->kvm_type = virt_kvm_type;
+ mc->hvf_get_physical_address_range = virt_hvf_get_physical_address_range;
assert(!mc->get_hotplug_handler);
mc->get_hotplug_handler = virt_machine_get_hotplug_handler;
hc->pre_plug = virt_machine_device_pre_plug_cb;