diff options
author | Milton Miller <miltonm@us.ibm.com> | 2016-09-02 14:39:57 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-09-02 15:27:39 +1000 |
commit | 8f67ee3b7fa573885c2bda34c7934418e12287db (patch) | |
tree | 9292fd01b830d325702381e73db8bce11fda98dd /hw | |
parent | 863ac3c5d2f8a5ea5d471167f3da5cb07aab72fc (diff) | |
download | skiboot-8f67ee3b7fa573885c2bda34c7934418e12287db.zip skiboot-8f67ee3b7fa573885c2bda34c7934418e12287db.tar.gz skiboot-8f67ee3b7fa573885c2bda34c7934418e12287db.tar.bz2 |
hw/npu: program NPU BUID reg properly
The NPU BUID register was incorrectly programmed resulting in npu
interrupt level 0 causing a PB_CENT_CRESP_ADDR_ERROR checkstop,
and irqs from npus in odd chips being aliased to and processed
as the interrupts from the corresponding npu on the even chips.
The documentation for the BUID register is confusing, describing
required values of some bits and bits of differing meaning within
contained within one field.
This patch seperates the per-irq-level irq enable mask from the
documented buid base field, leaving the buid base as the part that
is directly compared. It documents the buid as the boundary of a
block of 16 sources (in the form of a 4 bit shift), and documents
that some bits are sourced from another register and are always
compared to that register, so they are not required to be set in
the base and mask fields.
Fixes: cc61799 Nvlink: Add NPU PHB functions
Signed-off-by: Milton Miller <miltonm@us.ibm.com>
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/npu.c | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -1614,14 +1614,20 @@ static void npu_create_devices(struct dt_node *dn, struct npu *p) struct npu_dev *dev; struct dt_node *npu_dn, *link; uint32_t npu_phandle, index = 0; - uint64_t buid; + uint64_t buid_reg; uint64_t lsisrcid; + uint64_t buid; + + + /* The bits in the LSI ID Base register are always compared and + * can be set to 0 in the buid base and mask fields. The + * buid (bus unit id) is the full irq minus the last 4 bits. */ + lsisrcid = GETFIELD(NPU_LSI_SRC_ID_BASE, NPU_LSI_SRC_ID_BASE); + buid = p8_chip_irq_block_base(p->chip_id, P8_IRQ_BLOCK_MISC) >> 4; - lsisrcid = GETFIELD(NPU_LSI_SRC_ID_BASE, - in_be64(p->at_regs + NPU_LSI_SOURCE_ID)); - buid = SETFIELD(NP_BUID_BASE, 0ull, - (p8_chip_irq_block_base(p->chip_id, P8_IRQ_BLOCK_MISC) | lsisrcid)); - buid |= NP_BUID_ENABLE; + buid_reg = SETFIELD(NP_IRQ_LEVELS, NP_BUID_ENABLE, ~0); + buid_reg = SETFIELD(NP_BUID_MASK, buid_reg, ~lsisrcid); + buid_reg = SETFIELD(NP_BUID_BASE, buid_reg, (buid & ~lsisrcid)); /* Get the npu node which has the links which we expand here * into pci like devices attached to our emulated phb. */ @@ -1661,7 +1667,7 @@ static void npu_create_devices(struct dt_node *dn, struct npu *p) dev->lane_mask = dt_prop_get_u32(link, "ibm,npu-lane-mask"); /* Setup BUID/ISRN */ - xscom_write(p->chip_id, dev->xscom + NX_NP_BUID, buid); + xscom_write(p->chip_id, dev->xscom + NX_NP_BUID, buid_reg); /* Setup emulated config space */ for (j = 0; j < NPU_DEV_CFG_MAX; j++) |