@@ -1002,10 +1002,10 @@ index 73bde4ba0e..6f0f8f4488 100644
10021002- -
100310032.41.0
10041004
1005- From 7c60f74fafee1658625d98f198ca14b9c71456c9 Mon Sep 17 00:00:00 2001
1005+ From 68c31798c0b148489fbca8924af418e894972ebf Mon Sep 17 00:00:00 2001
10061006From: Joelle van Dyne <
[email protected] >
10071007Date: Sun, 22 Dec 2024 19:49:20 -0800
1008- Subject: [PATCH] hvf: arm: disable unavailable features on older macOS
1008+ Subject: [PATCH 1/2 ] hvf: arm: disable unavailable features on older macOS
10091009
10101010IPA size queries were introduced in macOS 13. When QEMU is built targeting
10111011a lower version, the compile will fail. If targeting a higher version and
@@ -1015,11 +1015,11 @@ VMs with 64+ GB of RAM will not work if running on < macOS 13.
10151015
10161016Signed-off-by: Joelle van Dyne <
[email protected] >
10171017---
1018- target/arm/hvf/hvf.c | 59 ++++++++++++++++++++++++++++----------------
1019- 1 file changed, 38 insertions(+), 21 deletions(-)
1018+ target/arm/hvf/hvf.c | 69 ++++++++++++++++++++++++++++----------------
1019+ 1 file changed, 44 insertions(+), 25 deletions(-)
10201020
10211021diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
1022- index a63a7763a0..141fd35300 100644
1022+ index a63a7763a0..ec4821a61a 100644
10231023--- a/target/arm/hvf/hvf.c
10241024+++ b/target/arm/hvf/hvf.c
10251025@@ -907,7 +907,9 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
@@ -1120,6 +1120,56 @@ index a63a7763a0..141fd35300 100644
11201120 return ret;
11211121 }
11221122
1123+ @@ -1107,10 +1124,12 @@ int hvf_arch_init_vcpu(CPUState *cpu)
1124+ assert_hvf_ok(ret);
1125+
1126+ #if !defined(CONFIG_HVF_PRIVATE)
1127+ - clamp_id_aa64mmfr0_parange_to_ipa_size(&arm_cpu->isar.id_aa64mmfr0);
1128+ - ret = hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_ID_AA64MMFR0_EL1,
1129+ - arm_cpu->isar.id_aa64mmfr0);
1130+ - assert_hvf_ok(ret);
1131+ + if (__builtin_available(macOS 13.0, *)) {
1132+ + clamp_id_aa64mmfr0_parange_to_ipa_size(&arm_cpu->isar.id_aa64mmfr0);
1133+ + ret = hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_ID_AA64MMFR0_EL1,
1134+ + arm_cpu->isar.id_aa64mmfr0);
1135+ + assert_hvf_ok(ret);
1136+ + }
1137+ #endif
1138+
1139+ /* enable TSO mode */
1140+ - -
1141+ 2.41.0
1142+
1143+ From 540ba575f97a16518b96f760a6b1a2f1ee422c17 Mon Sep 17 00:00:00 2001
1144+ From: Joelle van Dyne <
[email protected] >
1145+ Date: Mon, 23 Dec 2024 00:15:08 -0800
1146+ Subject: [PATCH 2/2] hw/arm/virt: handle hvf with unknown max IPA size
1147+
1148+ When it is not possible to determine the max IPA bit size, the helper
1149+ function will return 0. We do not try to set up the memmap in this case
1150+ and instead fall back to the default in machvirt_init().
1151+
1152+ Signed-off-by: Joelle van Dyne <
[email protected] >
1153+ ---
1154+ hw/arm/virt.c | 5 +++++
1155+ 1 file changed, 5 insertions(+)
1156+
1157+ diff --git a/hw/arm/virt.c b/hw/arm/virt.c
1158+ index 5b1e375726..251fc58b42 100644
1159+ --- a/hw/arm/virt.c
1160+ +++ b/hw/arm/virt.c
1161+ @@ -3047,6 +3047,11 @@ static int virt_hvf_get_physical_address_range(MachineState *ms)
1162+ int default_ipa_size = hvf_arm_get_default_ipa_bit_size();
1163+ int max_ipa_size = hvf_arm_get_max_ipa_bit_size();
1164+
1165+ + /* Unknown max ipa size, we'll let the caller figure it out */
1166+ + if (max_ipa_size == 0) {
1167+ + return 0;
1168+ + }
1169+ +
1170+ /* We freeze the memory map to compute the highest gpa */
1171+ virt_set_memmap(vms, max_ipa_size);
1172+
11231173- -
112411742.41.0
11251175
0 commit comments