Skip to contentSkip to conversation

whpx: arm64: check for physical address width after WHPX availability

PATCH Applied Mohamed Mediouni 2 participants 2 messages Sep 16 – Sep 28

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 whpx: arm64: check for physical address width after WHPX availability

In the case where WHPX isn't supported on the platform, makes the intended error appear instead of failing at getting the IPA width.

---
 target/arm/whpx/whpx-all.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
target/arm/whpx/whpx-all.c +8 -8
index d106400686..46f0b9524e 100644
@@ -879,14 +879,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
         goto error;
     }
 
-    if (mc->get_physical_address_range) {
-        pa_range = mc->get_physical_address_range(ms,
-            whpx_arm_get_ipa_bit_size(), whpx_arm_get_ipa_bit_size());
-        if (pa_range < 0) {
-            return -EINVAL;
-        }
-    }
-
     whpx->mem_quota = ms->ram_size;
 
     hr = whp_dispatch.WHvGetCapability(
@@ -914,6 +906,14 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
         goto error;
     }
 
+    if (mc->get_physical_address_range) {
+        pa_range = mc->get_physical_address_range(ms,
+            whpx_arm_get_ipa_bit_size(), whpx_arm_get_ipa_bit_size());
+        if (pa_range < 0) {
+            return -EINVAL;
+        }
+    }
+
     hr = whp_dispatch.WHvCreatePartition(&whpx->partition);
     if (FAILED(hr)) {
         error_report("WHPX: Failed to create partition, hr=%08lx", hr);
Signature · 1 line
2.54.0 (Apple Git-157)
#1 lore raw
Quoted 30 lines · Mohamed Mediouni

In the case where WHPX isn't supported on the platform, makes the intended error appear instead of failing at getting the IPA width.

---
 target/arm/whpx/whpx-all.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
target/arm/whpx/whpx-all.c +0 -8
index d106400686..46f0b9524e 100644
@@ -879,14 +879,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
         goto error;
     }
 
-    if (mc->get_physical_address_range) {
-        pa_range = mc->get_physical_address_range(ms,
-            whpx_arm_get_ipa_bit_size(), whpx_arm_get_ipa_bit_size());
-        if (pa_range < 0) {
-            return -EINVAL;
-        }
-    }
-
     whpx->mem_quota = ms->ram_size;
 
     hr = whp_dispatch.WHvGetCapability(
@@ -914,6 +906,14 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
         goto error;

target/arm/whpx/whpx-all.c int whpx_accel_init(AccelState *as, MachineState *ms) · line 916

Quoted 10 lines
target/arm/whpx/whpx-all.c +8 -0
     }
 
+    if (mc->get_physical_address_range) {
+        pa_range = mc->get_physical_address_range(ms,
+            whpx_arm_get_ipa_bit_size(), whpx_arm_get_ipa_bit_size());
+        if (pa_range < 0) {
+            return -EINVAL;
+        }
+    }
+

Applied to target-arm.next, thanks.

-- PMM