[PATCH 07/38] MIPS: SGI-IP27: choose the node address layout at runtime
From: Imre Kaloz
Date: Thu Oct 01 2026 - 12:27:45 EST
A Bedrock node owns twice the address space a Hub node does, putting
the nasid one bit higher. Take the shift and the node size from the
generation detected at boot; head.S runs before that and keeps Hub's
values.
Signed-off-by: Imre Kaloz <kaloz@xxxxxxxxxx>
---
arch/mips/include/asm/sn/addrs.h | 12 +++++++++++-
arch/mips/include/asm/sn/sn0/addrs.h | 8 ++++----
arch/mips/include/asm/sn/sn1/addrs.h | 22 ++++++++++++++++++++++
3 files changed, 37 insertions(+), 5 deletions(-)
create mode 100644 arch/mips/include/asm/sn/sn1/addrs.h
diff --git a/arch/mips/include/asm/sn/addrs.h b/arch/mips/include/asm/sn/addrs.h
index 51161fd5130b..499615abd501 100644
--- a/arch/mips/include/asm/sn/addrs.h
+++ b/arch/mips/include/asm/sn/addrs.h
@@ -20,7 +20,6 @@
#if defined(CONFIG_SGI_IP27)
#include <asm/sn/sn0/addrs.h>
-#elif defined(CONFIG_SGI_IP35)
#include <asm/sn/sn1/addrs.h>
#endif
@@ -39,6 +38,17 @@
extern bool system_is_ip35;
+#define NASID_SHFT (system_is_ip35 ? SN1_NASID_SHFT : \
+ SN0_NASID_SHFT)
+#define NODE_SIZE_BITS (system_is_ip35 ? SN1_NODE_SIZE_BITS : \
+ SN0_NODE_SIZE_BITS)
+
+#else /* __ASSEMBLER__ */
+
+/* The entry paths run before prom_init() reads the hub's part number. */
+#define NASID_SHFT SN0_NASID_SHFT
+#define NODE_SIZE_BITS SN0_NODE_SIZE_BITS
+
#endif /* __ASSEMBLER__ */
diff --git a/arch/mips/include/asm/sn/sn0/addrs.h b/arch/mips/include/asm/sn/sn0/addrs.h
index a28158a91ecf..f1a161913ae4 100644
--- a/arch/mips/include/asm/sn/sn0/addrs.h
+++ b/arch/mips/include/asm/sn/sn0/addrs.h
@@ -50,12 +50,12 @@
#ifdef CONFIG_SGI_SN_N_MODE
-#define NODE_SIZE_BITS 31
+#define SN0_NODE_SIZE_BITS 31
#define BWIN_SIZE_BITS 28
#define NASID_BITS 9
#define NASID_BITMASK (0x1ffLL)
-#define NASID_SHFT 31
+#define SN0_NASID_SHFT 31
#define NASID_META_BITS 5
#define NASID_LOCAL_BITS 4
@@ -64,12 +64,12 @@
#else /* !defined(CONFIG_SGI_SN_N_MODE), assume that M-mode is desired */
-#define NODE_SIZE_BITS 32
+#define SN0_NODE_SIZE_BITS 32
#define BWIN_SIZE_BITS 29
#define NASID_BITMASK (0xffLL)
#define NASID_BITS 8
-#define NASID_SHFT 32
+#define SN0_NASID_SHFT 32
#define NASID_META_BITS 4
#define NASID_LOCAL_BITS 4
diff --git a/arch/mips/include/asm/sn/sn1/addrs.h b/arch/mips/include/asm/sn/sn1/addrs.h
new file mode 100644
index 000000000000..58878a5b4710
--- /dev/null
+++ b/arch/mips/include/asm/sn/sn1/addrs.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * SN1 (Bedrock) address space layout.
+ *
+ * Copyright (C) 2026 Imre Kaloz <kaloz@xxxxxxxxxx>
+ */
+#ifndef _ASM_SN_SN1_ADDRS_H
+#define _ASM_SN_SN1_ADDRS_H
+
+#ifdef CONFIG_SGI_SN_N_MODE
+
+#define SN1_NODE_SIZE_BITS 32
+#define SN1_NASID_SHFT 32
+
+#else /* !defined(CONFIG_SGI_SN_N_MODE), assume that M-mode is desired */
+
+#define SN1_NODE_SIZE_BITS 33
+#define SN1_NASID_SHFT 33
+
+#endif /* !defined(CONFIG_SGI_SN_N_MODE) */
+
+#endif /* _ASM_SN_SN1_ADDRS_H */
--
2.47.3