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.

Signed-off-by: Mohamed Mediouni <[email protected]>
---
 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

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 4630d76930..7c68337567 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -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
 
diff --git a/target/arm/hvf/hvf_sme_stubs.h b/target/arm/hvf/hvf_sme_stubs.h
deleted file mode 100644
index 43686f7824..0000000000
--- a/target/arm/hvf/hvf_sme_stubs.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-typedef int32_t hv_return_t;
-typedef uint64_t hv_vcpu_t;
-
-static inline bool hvf_arm_sme2_supported(void)
-{
-    return false;
-}
-
-static inline uint32_t hvf_arm_sme2_get_svl(void)
-{
-    g_assert_not_reached();
-}
-
-typedef enum hv_sme_p_reg_t {
-    HV_SME_P_REG_0,
-    HV_SME_P_REG_1,
-    HV_SME_P_REG_2,
-    HV_SME_P_REG_3,
-    HV_SME_P_REG_4,
-    HV_SME_P_REG_5,
-    HV_SME_P_REG_6,
-    HV_SME_P_REG_7,
-    HV_SME_P_REG_8,
-    HV_SME_P_REG_9,
-    HV_SME_P_REG_10,
-    HV_SME_P_REG_11,
-    HV_SME_P_REG_12,
-    HV_SME_P_REG_13,
-    HV_SME_P_REG_14,
-    HV_SME_P_REG_15,
-} hv_sme_p_reg_t;
-
-/*
- * The system version of this type declares it with
- *    __attribute__((ext_vector_type(64)))
- * However, that is clang specific and not supported by GCC.
- * Since these headers are only here for the case where the system
- * headers do not provide these types (including both older macos
- * and non-macos hosts), we don't need to make the type match
- * exactly, so we declare it as a uint8_t array.
- */
-typedef uint8_t hv_sme_zt0_uchar64_t[64];
-
-typedef enum hv_sme_z_reg_t {
-    HV_SME_Z_REG_0,
-    HV_SME_Z_REG_1,
-    HV_SME_Z_REG_2,
-    HV_SME_Z_REG_3,
-    HV_SME_Z_REG_4,
-    HV_SME_Z_REG_5,
-    HV_SME_Z_REG_6,
-    HV_SME_Z_REG_7,
-    HV_SME_Z_REG_8,
-    HV_SME_Z_REG_9,
-    HV_SME_Z_REG_10,
-    HV_SME_Z_REG_11,
-    HV_SME_Z_REG_12,
-    HV_SME_Z_REG_13,
-    HV_SME_Z_REG_14,
-    HV_SME_Z_REG_15,
-    HV_SME_Z_REG_16,
-    HV_SME_Z_REG_17,
-    HV_SME_Z_REG_18,
-    HV_SME_Z_REG_19,
-    HV_SME_Z_REG_20,
-    HV_SME_Z_REG_21,
-    HV_SME_Z_REG_22,
-    HV_SME_Z_REG_23,
-    HV_SME_Z_REG_24,
-    HV_SME_Z_REG_25,
-    HV_SME_Z_REG_26,
-    HV_SME_Z_REG_27,
-    HV_SME_Z_REG_28,
-    HV_SME_Z_REG_29,
-    HV_SME_Z_REG_30,
-    HV_SME_Z_REG_31,
-} hv_sme_z_reg_t;
-
-enum {
-  HV_SYS_REG_SMCR_EL1,
-  HV_SYS_REG_SMPRI_EL1,
-  HV_SYS_REG_TPIDR2_EL0,
-  HV_SYS_REG_ID_AA64ZFR0_EL1,
-  HV_SYS_REG_ID_AA64SMFR0_EL1,
-};
-
-enum {
-  HV_FEATURE_REG_ID_AA64SMFR0_EL1,
-  HV_FEATURE_REG_ID_AA64ZFR0_EL1,
-};
-
-typedef struct {
-    bool streaming_sve_mode_enabled;
-    bool za_storage_enabled;
-} hv_vcpu_sme_state_t;
-
-static inline hv_return_t hv_sme_config_get_max_svl_bytes(size_t *value)
-{
-    g_assert_not_reached();
-}
-
-static inline hv_return_t hv_vcpu_get_sme_state(hv_vcpu_t vcpu,
-                                                hv_vcpu_sme_state_t *sme_state)
-{
-    g_assert_not_reached();
-}
-
-static inline hv_return_t hv_vcpu_set_sme_state(hv_vcpu_t vcpu,
-                                                const hv_vcpu_sme_state_t 
*sme_state)
-{
-    g_assert_not_reached();
-}
-
-static inline hv_return_t hv_vcpu_get_sme_z_reg(hv_vcpu_t vcpu,
-                                                hv_sme_z_reg_t reg,
-                                                uint8_t *value,
-                                                size_t length)
-{
-    g_assert_not_reached();
-}
-
-static inline hv_return_t hv_vcpu_set_sme_z_reg(hv_vcpu_t vcpu,
-                                                hv_sme_z_reg_t reg,
-                                                const uint8_t *value,
-                                                size_t length)
-{
-    g_assert_not_reached();
-}
-
-static inline hv_return_t hv_vcpu_get_sme_p_reg(hv_vcpu_t vcpu,
-                                                hv_sme_p_reg_t reg,
-                                                uint8_t *value,
-                                                size_t length)
-{
-    g_assert_not_reached();
-}
-
-static inline hv_return_t hv_vcpu_set_sme_p_reg(hv_vcpu_t vcpu,
-                                                hv_sme_p_reg_t reg,
-                                                const uint8_t *value,
-                                                size_t length)
-{
-    g_assert_not_reached();
-}
-
-static inline hv_return_t hv_vcpu_get_sme_za_reg(hv_vcpu_t vcpu,
-                                                 uint8_t *value,
-                                                 size_t length)
-{
-    g_assert_not_reached();
-}
-
-static inline hv_return_t hv_vcpu_set_sme_za_reg(hv_vcpu_t vcpu,
-                                                 const uint8_t *value,
-                                                 size_t length)
-{
-    g_assert_not_reached();
-}
-
-static inline hv_return_t hv_vcpu_get_sme_zt0_reg(hv_vcpu_t vcpu,
-                                                  hv_sme_zt0_uchar64_t *value)
-{
-    g_assert_not_reached();
-}
-
-static inline hv_return_t hv_vcpu_set_sme_zt0_reg(hv_vcpu_t vcpu,
-                                                  const hv_sme_zt0_uchar64_t 
*value)
-{
-    g_assert_not_reached();
-}
diff --git a/target/arm/hvf_arm.h b/target/arm/hvf_arm.h
index 9cb58ad9ab..97b02cb472 100644
--- a/target/arm/hvf_arm.h
+++ b/target/arm/hvf_arm.h
@@ -23,49 +23,4 @@ void hvf_arm_init_debug(void);
 
 void hvf_arm_set_cpu_features_from_host(ARMCPU *cpu);
 
-/*
- * We need access to types from macOS SDK >=15.2, so expose stubs if the
- * headers are not available until we raise our minimum macOS version.
- */
-#ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
-  #if (__MAC_OS_X_VERSION_MAX_ALLOWED >= 150200)
-    #include "system/hvf_int.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();
-        }
-    }
-  #else /* (__MAC_OS_X_VERSION_MAX_ALLOWED >= 150200) */
-      #include "hvf/hvf_sme_stubs.h"
-  #endif /* (__MAC_OS_X_VERSION_MAX_ALLOWED >= 150200) */
-#else /* ifdef __MAC_OS_X_VERSION_MAX_ALLOWED */
-  #include "hvf/hvf_sme_stubs.h"
-#endif /* ifdef __MAC_OS_X_VERSION_MAX_ALLOWED */
-
 #endif
-- 
2.50.1 (Apple Git-155)


Reply via email to