[PATCH 2/5] sparc64: Add the M7 capabilities carried in the hwcap-list

From: Stian Halseth

Date: Tue Sep 29 2026 - 09:46:09 EST


A SPARC M7's machine description names four capabilities the kernel does
not know, so they never reach AT_HWCAP:

vis3b pause-nsec mwait sparc5

Add them. hwcaps[] is indexed by bit position and only ever appended to,
so the four names take indices 28 to 31, in the order the machine
description lists them. That fixes their bit values.

Read from /dev/mdesc on a SPARC T7-1, where all 256 cpu nodes carry an
identical hwcap-list.

Closes: https://github.com/sparclinux/issues/issues/17
Signed-off-by: Stian Halseth <stian@xxxxxx>
---
arch/sparc/include/asm/elf_64.h | 8 ++++++++
arch/sparc/kernel/setup_64.c | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
index 694ed081cf8d9..714ca79c88d7e 100644
--- a/arch/sparc/include/asm/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
@@ -99,6 +99,14 @@
#define HWCAP_SPARC_CRYPTO 0x04000000 /* CRYPTO insns available */
#define HWCAP_SPARC_ADI 0x08000000 /* ADI available */

+/* Linux has only AT_HWCAP, so these continue the single word. They are
+ * ABI: a bit once assigned cannot be moved.
+ */
+#define HWCAP_SPARC_VIS3B 0x10000000 /* VIS3B insns available */
+#define HWCAP_SPARC_PAUSE_NSEC 0x20000000 /* PAUSE has nanosecond granularity */
+#define HWCAP_SPARC_MWAIT 0x40000000 /* MWAIT available */
+#define HWCAP_SPARC_SPARC5 0x80000000 /* SPARC5 insns available */
+
#define CORE_DUMP_USE_REGSET

/*
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 8ed65ad0e6081..d819ce65d1d44 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -387,7 +387,7 @@ static const char *hwcaps[] = {
"mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",
"ASIBlkInit", "fmaf", "vis3", "hpc", "random", "trans", "fjfmau",
"ima", "cspare", "pause", "cbcond", NULL /*reserved for crypto */,
- "adp",
+ "adp", "vis3b", "pause-nsec", "mwait", "sparc5",
};

static const char *crypto_hwcaps[] = {
--
2.43.0