aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2021-08-04 12:50:56 +0530
committerVasant Hegde <hegdevasant@linux.vnet.ibm.com>2021-08-06 12:21:54 +0530
commite813a0c09dc08aea7144425e1d4ee6c9134e9f47 (patch)
treeade061281b32f874a42e5ad4c8ea502a14800764 /hw
parenta2d4d7f9e14a387371815828e4d46a9943453969 (diff)
downloadskiboot-e813a0c09dc08aea7144425e1d4ee6c9134e9f47.zip
skiboot-e813a0c09dc08aea7144425e1d4ee6c9134e9f47.tar.gz
skiboot-e813a0c09dc08aea7144425e1d4ee6c9134e9f47.tar.bz2
phys/P10: Use topology index to get phys mapping
This fixes multipchip rainier boot issue. for Rainer: chip0: ibm,primary-topology-index = < 0x0>; chip1: ibm,primary-topology-index = < 0x4>; chip2: ibm,primary-topology-index = < 0x8>; chip3: ibm,primary-topology-index = < 0xc>; for Denali: node0: chip0: ibm,primary-topology-index = < 0x0>; chip1: ibm,primary-topology-index = < 0x1>; chip2: ibm,primary-topology-index = < 0x2>; chip3: ibm,primary-topology-index = < 0x3>; node1: chip0: ibm,primary-topology-index = < 0x4>; chip1: ibm,primary-topology-index = < 0x5>; chip2: ibm,primary-topology-index = < 0x6>; chip3: ibm,primary-topology-index = < 0x7>; Note that bmc_create_node() gets called very early in the boot process. Hence we have to traverse through HDAT ntuple to get right topology index. May be we can optimize pcid_to_topology_idx() function as its pretty much duplicate of pcid_to_chip_id(). But for now lets keep it as separate function. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Ryan Grimm <grimm@linux.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/phys-map.c18
-rw-r--r--hw/test/phys-map-test.c7
2 files changed, 22 insertions, 3 deletions
diff --git a/hw/phys-map.c b/hw/phys-map.c
index 2c4d8e4..194e495 100644
--- a/hw/phys-map.c
+++ b/hw/phys-map.c
@@ -277,7 +277,7 @@ static inline bool phys_map_entry_null(const struct phys_map_entry *e)
/* This crashes skiboot on error as any bad calls here are almost
* certainly a developer error
*/
-void phys_map_get(uint64_t gcid, enum phys_map_type type,
+void __phys_map_get(uint64_t topology_idx, uint64_t gcid, enum phys_map_type type,
int index, uint64_t *addr, uint64_t *size) {
const struct phys_map_entry *e;
uint64_t a;
@@ -302,7 +302,7 @@ void phys_map_get(uint64_t gcid, enum phys_map_type type,
break;
}
a = e->addr;
- a += gcid << phys_map->chip_select_shift;
+ a += topology_idx << (phys_map->chip_select_shift);
if (addr)
*addr = a;
@@ -322,6 +322,20 @@ error:
assert(0);
}
+void phys_map_get(uint64_t gcid, enum phys_map_type type,
+ int index, uint64_t *addr, uint64_t *size)
+{
+ struct proc_chip *chip;
+ uint64_t topology_idx = gcid;
+
+ if (proc_gen >= proc_gen_p10) {
+ chip = get_chip(gcid);
+ topology_idx = chip->primary_topology;
+ }
+
+ return __phys_map_get(topology_idx, gcid, type, index, addr, size);
+}
+
void phys_map_init(unsigned long pvr)
{
const char *name = "unused";
diff --git a/hw/test/phys-map-test.c b/hw/test/phys-map-test.c
index 2aabdb8..aa5b733 100644
--- a/hw/test/phys-map-test.c
+++ b/hw/test/phys-map-test.c
@@ -79,6 +79,11 @@ static inline bool map_call_entry_null(const struct map_call_entry *t)
/* Pick a chip ID, any ID. */
#define FAKE_CHIP_ID 8
+struct proc_chip *get_chip(uint32_t chip_id __unused)
+{
+ return NULL;
+}
+
static void check_map_call(void)
{
uint64_t start, size, end;
@@ -98,7 +103,7 @@ static void check_map_call(void)
/* Loop over table entries ... */
for (e = phys_map->table; !phys_map_entry_null(e); e++) {
- phys_map_get(FAKE_CHIP_ID, e->type, e->index, &start, &size);
+ __phys_map_get(FAKE_CHIP_ID, FAKE_CHIP_ID, e->type, e->index, &start, &size);
/* Check for alignment */
if ((e->type != SYSTEM_MEM) && (e->type != RESV)) {