[Skiboot] [PATCH 1/2] hw/npu.c: Add ibm, npu-index property to npu device tree
Alistair Popple
alistair at popple.id.au
Fri Apr 22 13:35:25 AEST 2016
The PHB slot location code ueses the ibm,phb-index property to find
slot location names. As the NPU is implemented as a different PHB type
it means the phb-index property overlaps with the other PHBs in the
system.
This patch changes the existing usage of phb-index to npu-index which
allows the phb-index property to be assigned a unique value which can
then be matched by the PHB slot location code.
Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
hw/npu.c | 8 +++++---
platforms/astbmc/garrison.c | 4 ++++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/hw/npu.c b/hw/npu.c
index a3898b1..a61dd20 100644
--- a/hw/npu.c
+++ b/hw/npu.c
@@ -1235,7 +1235,7 @@ static void assign_mmio_bars(uint32_t gcid, uint32_t xscom,
static void npu_probe_phb(struct dt_node *dn)
{
struct dt_node *np;
- uint32_t gcid, index, xscom;
+ uint32_t gcid, index, phb_index, xscom;
uint64_t at_bar[2], mm_win[2], val;
uint32_t links = 0;
char *path;
@@ -1244,6 +1244,7 @@ static void npu_probe_phb(struct dt_node *dn)
path = dt_get_path(dn);
gcid = dt_get_chip_id(dn);
index = dt_prop_get_u32(dn, "ibm,npu-index");
+ phb_index = dt_prop_get_u32(dn, "ibm,phb-index");
dt_for_each_compatible(dn, np, "ibm,npu-link")
links++;
@@ -1283,7 +1284,8 @@ static void npu_probe_phb(struct dt_node *dn)
dt_add_property_strings(np, "device_type", "pciex");
dt_add_property(np, "reg", at_bar, sizeof(at_bar));
- dt_add_property_cells(np, "ibm,phb-index", index);
+ dt_add_property_cells(np, "ibm,phb-index", phb_index);
+ dt_add_property_cells(np, "ibm,npu-index", index);
dt_add_property_cells(np, "ibm,chip-id", gcid);
dt_add_property_cells(np, "ibm,xscom-base", xscom);
dt_add_property_cells(np, "ibm,npcq", dn->phandle);
@@ -1764,7 +1766,7 @@ static void npu_create_phb(struct dt_node *dn)
/* Populate PHB */
p = pmem;
- p->index = dt_prop_get_u32(dn, "ibm,phb-index");
+ p->index = dt_prop_get_u32(dn, "ibm,npu-index");
p->chip_id = dt_prop_get_u32(dn, "ibm,chip-id");
p->xscom_base = dt_prop_get_u32(dn, "ibm,xscom-base");
p->total_devices = links;
diff --git a/platforms/astbmc/garrison.c b/platforms/astbmc/garrison.c
index 57e41d7..bf4bb69 100644
--- a/platforms/astbmc/garrison.c
+++ b/platforms/astbmc/garrison.c
@@ -65,6 +65,10 @@ static void dt_create_npu(void)
npu = dt_new(xscom, namebuf);
dt_add_property_cells(npu, "reg", NPU_BASE, NPU_SIZE);
dt_add_property_strings(npu, "compatible", "ibm,power8-npu");
+
+ /* Use the first available PHB index which is 4 given
+ * there are three normal PHBs. */
+ dt_add_property_cells(npu, "ibm,phb-index", 4);
dt_add_property_cells(npu, "ibm,npu-index", 0);
dt_add_property_cells(npu, "ibm,npu-links", 4);
--
2.1.4
More information about the Skiboot
mailing list