[Skiboot] [PATCH 15/61] hdat/spira: Define ibm, primary-topology-index property per chip

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Mon Jul 19 23:19:26 AEST 2021


From: Haren Myneni <haren at linux.ibm.com>

HDAT provides Topology ID table and the primary topology location on
P10. This primary location points to primary topology entry in ID table
which contains the primary topology index and this index is used to
define the paste base address per chip.

This patch reads Topology ID table and the primary topology location
from hdata and retrieves the primary topology index in the ID table.

Make this primaty topology index value available with
ibm,primary-topology-index property per chip. VAS reads this property
to setup paste base address for each chip.

Signed-off-by: Haren Myneni <haren at linux.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/chip.c    |  3 +++
 hdata/spira.c  | 12 ++++++++++++
 hdata/spira.h  |  5 ++++-
 include/chip.h |  3 +++
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/core/chip.c b/core/chip.c
index a4ba3249e..2d95b2e05 100644
--- a/core/chip.c
+++ b/core/chip.c
@@ -133,6 +133,9 @@ static void init_chip(struct dt_node *dn)
 	if (lc)
 		chip->loc_code = strdup(lc);
 
+	chip->primary_topology = dt_prop_get_u32_def(dn,
+		"ibm,primary-topology-index", 0xffffffff);
+
 	prlog(PR_INFO, "CHIP: Initialised chip %d from %s\n", id, dn->name);
 	chips[id] = chip;
 }
diff --git a/hdata/spira.c b/hdata/spira.c
index 85c2fe71c..2fd3da108 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -688,6 +688,18 @@ static bool add_xscom_sppcrd(uint64_t xscom_base)
 					be32_to_cpu(cinfo->sw_xstop_fir_scom),
 					fir_bit);
 		}
+
+		if (proc_gen >= proc_gen_p10) {
+			uint8_t primary_loc = cinfo->primary_topology_loc;
+
+			if (primary_loc >= CHIP_MAX_TOPOLOGY_ENTRIES) {
+				prerror("XSCOM: Invalid primary topology index %d\n",
+					primary_loc);
+				continue;
+			}
+			dt_add_property_cells(np, "ibm,primary-topology-index",
+					cinfo->topology_id_table[primary_loc]);
+		}
 	}
 
 	return i > 0;
diff --git a/hdata/spira.h b/hdata/spira.h
index 7c5341f94..7da1154d7 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -1092,7 +1092,10 @@ struct sppcrd_chip_info {
 	/* From latest version (possibly 0x21 and later) */
 	__be32 sw_xstop_fir_scom;
 	uint8_t sw_xstop_fir_bitpos;
-	uint8_t	reserved_1[3];
+	/* Latest version for P10 */
+#define	CHIP_MAX_TOPOLOGY_ENTRIES	32
+	uint8_t topology_id_table[CHIP_MAX_TOPOLOGY_ENTRIES];
+	uint8_t	primary_topology_loc;	/* Index in topology_id_table */
 } __packed;
 
 /* Idata index 1 : Chip TOD */
diff --git a/include/chip.h b/include/chip.h
index 8bc48ba29..bbfc65e3a 100644
--- a/include/chip.h
+++ b/include/chip.h
@@ -277,6 +277,9 @@ struct proc_chip {
 
 	/* Used during OCC init */
 	bool			ex_present;
+
+	/* Used by hw/vas.c on p10 */
+	uint32_t		primary_topology;
 };
 
 extern uint32_t pir_to_chip_id(uint32_t pir);
-- 
2.31.1



More information about the Skiboot mailing list