Skip to content

Commit

Permalink
npu2: Rework NPU data structures for OpenCAPI
Browse files Browse the repository at this point in the history
Unlike NVLink, OpenCAPI registers a separate PHB for each device, in order
to allow us to force Linux to use the correct MMIO windows for each NPU
link. This requires some reworking of NPU data structures to account for
the fact that a PHB could correspond to either an NPU (NVLink) or a single
link (OpenCAPI).

At some later point, we may want to rework the NVLink code to present a
separate PHB per device in order to simplify this. For now, we split
NVLink-specific device data into a separate struct in order to make it
clear which fields are NVLink-only.

Additionally, add helper functions to correctly translate between
OpenCAPI/NVLink PHBs and the underlying structures, and various fields
for OpenCAPI data that we're going to need later on.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Reza Arbab <arbab@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
ajdlinux authored and stewartsmith committed Mar 2, 2018
1 parent 399151e commit 11b4629
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 84 deletions.
6 changes: 3 additions & 3 deletions hw/npu2-hw-procedures.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ static int64_t npu_dev_procedure_read(struct npu2_dev *dev, uint32_t offset,

if (size != 4) {
/* Short config reads are not supported */
prlog(PR_ERR, "NPU%d: Short read of procedure register\n", dev->npu->phb.opal_id);
prlog(PR_ERR, "NPU%d: Short read of procedure register\n", npu2_dev_to_phb(dev)->opal_id);
return OPAL_PARAMETER;
}

Expand All @@ -812,7 +812,7 @@ static int64_t npu_dev_procedure_read(struct npu2_dev *dev, uint32_t offset,

default:
prlog(PR_ERR, "NPU%d: Invalid vendor specific offset 0x%08x\n",
dev->npu->phb.opal_id, offset);
npu2_dev_to_phb(dev)->opal_id, offset);
rc = OPAL_PARAMETER;
}

Expand All @@ -828,7 +828,7 @@ static int64_t npu_dev_procedure_write(struct npu2_dev *dev, uint32_t offset,
if (size != 4) {
/* Short config writes are not supported */
prlog(PR_ERR, "NPU%d: Short read of procedure register\n",
dev->npu->phb.opal_id);
npu2_dev_to_phb(dev)->opal_id);
return OPAL_PARAMETER;
}

Expand Down

0 comments on commit 11b4629

Please sign in to comment.