From 973ec72753f8cfabcd50db5a881ea06b92498ae0 Mon Sep 17 00:00:00 2001 From: Pedro Gonnet Date: Tue, 22 Oct 2024 12:07:53 +0200 Subject: [PATCH 1/3] Add `sme`/`sme2` detection to `mach/init.c`. I forgot to add this for `mach` when I did it for `linux` a while back (#262). I could not find `hw.optional.arm.FEAT_SME_*` features for all the `sme`-related bits in `cpuinfo_arm_isa`, but I've added the ones I could find. --- src/arm/mach/init.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/arm/mach/init.c b/src/arm/mach/init.c index 9d83c05a..0bb31b89 100644 --- a/src/arm/mach/init.c +++ b/src/arm/mach/init.c @@ -399,6 +399,31 @@ void cpuinfo_arm_mach_init(void) { cpuinfo_isa.i8mm = true; } + const uint32_t has_feat_sme = get_sys_info_by_name("hw.optional.arm.FEAT_SME"); + if (has_feat_sme != 0) { + cpuinfo_isa.sme = true; + } + + const uint32_t has_feat_sme2 = get_sys_info_by_name("hw.optional.arm.FEAT_SME2"); + if (has_feat_sme2 != 0) { + cpuinfo_isa.sme2 = true; + } + + const uint32_t has_feat_sme2p1 = get_sys_info_by_name("hw.optional.arm.FEAT_SME2p1"); + if (has_feat_sme2p1 != 0) { + cpuinfo_isa.sme2p1 = true; + } + + const uint32_t has_feat_sme_b16b16 = get_sys_info_by_name("hw.optional.arm.FEAT_SME_B16B16"); + if (has_feat_sme_b16b16 != 0) { + cpuinfo_isa.sme_b16b16 = true; + } + + const uint32_t has_feat_sme_f16f16 = get_sys_info_by_name("hw.optional.arm.FEAT_SME_F16F16"); + if (has_feat_sme_f16f16 != 0) { + cpuinfo_isa.sme_f16f16 = true; + } + uint32_t num_clusters = 1; for (uint32_t i = 0; i < mach_topology.cores; i++) { cores[i] = (struct cpuinfo_core){ From f6d058260c06ad6246b4f226895337cb6b7ae11e Mon Sep 17 00:00:00 2001 From: Pedro Gonnet Date: Tue, 22 Oct 2024 12:18:51 +0200 Subject: [PATCH 2/3] Fix formatting. --- src/arm/mach/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arm/mach/init.c b/src/arm/mach/init.c index 0bb31b89..c3fe7605 100644 --- a/src/arm/mach/init.c +++ b/src/arm/mach/init.c @@ -423,7 +423,7 @@ void cpuinfo_arm_mach_init(void) { if (has_feat_sme_f16f16 != 0) { cpuinfo_isa.sme_f16f16 = true; } - + uint32_t num_clusters = 1; for (uint32_t i = 0; i < mach_topology.cores; i++) { cores[i] = (struct cpuinfo_core){ From ff278217bce7da999ad2285fd7e929a1301a30d7 Mon Sep 17 00:00:00 2001 From: Pedro Gonnet Date: Tue, 22 Oct 2024 12:29:59 +0200 Subject: [PATCH 3/3] Remove unrecognized features. --- src/arm/mach/init.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/arm/mach/init.c b/src/arm/mach/init.c index c3fe7605..3fb62414 100644 --- a/src/arm/mach/init.c +++ b/src/arm/mach/init.c @@ -409,21 +409,6 @@ void cpuinfo_arm_mach_init(void) { cpuinfo_isa.sme2 = true; } - const uint32_t has_feat_sme2p1 = get_sys_info_by_name("hw.optional.arm.FEAT_SME2p1"); - if (has_feat_sme2p1 != 0) { - cpuinfo_isa.sme2p1 = true; - } - - const uint32_t has_feat_sme_b16b16 = get_sys_info_by_name("hw.optional.arm.FEAT_SME_B16B16"); - if (has_feat_sme_b16b16 != 0) { - cpuinfo_isa.sme_b16b16 = true; - } - - const uint32_t has_feat_sme_f16f16 = get_sys_info_by_name("hw.optional.arm.FEAT_SME_F16F16"); - if (has_feat_sme_f16f16 != 0) { - cpuinfo_isa.sme_f16f16 = true; - } - uint32_t num_clusters = 1; for (uint32_t i = 0; i < mach_topology.cores; i++) { cores[i] = (struct cpuinfo_core){