Skip to contentSkip to conversation

hvf: arm: remove SME2 stub code

PATCH In review Mohamed Mediouni 2 participants 3 messages Mar 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hvf: arm: remove SME2 stub code

Releases n and n-1 of macOS are supported. As such, macOS 15.x and 26.x are currently the baseline.

The QEMU CI still uses a newer SDK, just with an older default target as it's running on a macOS 14 host.

Note that this on its own doesn't prevent running on macOS 14. It just means that you have to use a newer SDK in order to do so.

Why do this? Because the stub code broke the x86 build... and it doesn't make much sense to keep it.

---
 target/arm/hvf/hvf.c           |  31 ++++++
 target/arm/hvf/hvf_sme_stubs.h | 172 ---------------------------------
 target/arm/hvf_arm.h           |  45 ---------
 3 files changed, 31 insertions(+), 217 deletions(-)
 delete mode 100644 target/arm/hvf/hvf_sme_stubs.h
target/arm/hvf/hvf.c +31 -0
index 4630d76930..7c68337567 100644
@@ -41,6 +41,37 @@
 
 #include "gdbstub/enums.h"
 
+static inline bool hvf_arm_sme2_supported(void)
+{
+    if (__builtin_available(macOS 15.2, *)) {
+        size_t svl_bytes;
+        hv_return_t result = hv_sme_config_get_max_svl_bytes(&svl_bytes);
+        /* Nested virt not supported together with SME right now. */
+        if (hvf_nested_virt_enabled()) {
+            return false;
+        }
+        if (result == HV_UNSUPPORTED) {
+            return false;
+        }
+        assert_hvf_ok(result);
+        return svl_bytes > 0;
+    } else {
+        return false;
+    }
+}
+
+static inline uint32_t hvf_arm_sme2_get_svl(void)
+{
+    if (__builtin_available(macOS 15.2, *)) {
+        size_t svl_bytes;
+        hv_return_t result = hv_sme_config_get_max_svl_bytes(&svl_bytes);
+        assert_hvf_ok(result);
+        return svl_bytes;
+    } else {
+        abort();
+    }
+}
+
 #define MDSCR_EL1_SS_SHIFT  0
 #define MDSCR_EL1_MDE_SHIFT 15
 
target/arm/hvf/hvf_sme_stubs.h deleted +0 -172

172 lines not on this page · raw message

target/arm/hvf_arm.h +0 -45

49 lines not on this page · raw message

Signature · 1 line
2.50.1 (Apple Git-155)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Mohamed Mediouni

Releases n and n-1 of macOS are supported. As such, macOS 15.x and 26.x are currently the baseline.

The QEMU CI still uses a newer SDK, just with an older default target as it's running on a macOS 14 host.

Note that this on its own doesn't prevent running on macOS 14. It just means that you have to use a newer SDK in order to do so.

Why do this? Because the stub code broke the x86 build... and it doesn't make much sense to keep it.

Quoted 7 lines
---
  target/arm/hvf/hvf.c           |  31 ++++++
  target/arm/hvf/hvf_sme_stubs.h | 172 ---------------------------------
  target/arm/hvf_arm.h           |  45 ---------
  3 files changed, 31 insertions(+), 217 deletions(-)

delete mode 100644 target/arm/hvf/hvf_sme_stubs.h

#2 lore raw
In reply to Mohamed Mediouni
Quoted 13 lines · Mohamed Mediouni

Releases n and n-1 of macOS are supported. As such, macOS 15.x and 26.x are currently the baseline.

The QEMU CI still uses a newer SDK, just with an older default target as it's running on a macOS 14 host.

Note that this on its own doesn't prevent running on macOS 14. It just means that you have to use a newer SDK in order to do so.

Why do this? Because the stub code broke the x86 build... and it doesn't make much sense to keep it.

Alright do not merge this with the current QEMU CI, it’ll break the build because:

The QEMU CI from the log https://gitlab.com/qemu-project/qemu/-/jobs/13389185563 uses:

Quoted 1 line

C compiler for the host machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.4)”)

Which corresponds to https://developer.apple.com/documentation/xcode-release-notes/xcode-16_1-release-notes

Which has the macOS 15.1 SDK instead of 15.2… which is the minimum for SME2 availability. But nested virt came with 15.0 so not a problem for the series there.

Ugh. Should we attempt to bump the CI version then? Or attempt another workaround for this?