[Skiboot] [PATCH 12/13] hw/npu2: Always check device type when looping through NPU devices
Andrew Donnellan
andrew.donnellan at au1.ibm.com
Wed Dec 12 17:58:55 AEDT 2018
Fix all the remaining places in the NVLink code where we loop through all
the devices on an NPU and don't check whether it's an NVLink device -
triggering NTL resets, setting up relaxed ordering, and setting up LPAR
mapping.
Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
---
hw/npu2.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/hw/npu2.c b/hw/npu2.c
index 9e60b4e16f29..12e370968914 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -1165,7 +1165,7 @@ static int64_t npu2_hreset(struct pci_slot *slot __unused)
for (i = 0; i < p->total_devices; i++) {
ndev = &p->devices[i];
- if (ndev) {
+ if (ndev && ndev->type == NPU2_DEV_TYPE_NVLINK) {
NPU2DEVINF(ndev, "Resetting device\n");
reset_ntl(ndev);
}
@@ -1189,7 +1189,7 @@ static int64_t npu2_creset(struct pci_slot *slot)
for (i = 0; i < p->total_devices; i++) {
ndev = &p->devices[i];
- if (ndev) {
+ if (ndev && ndev->type == NPU2_DEV_TYPE_NVLINK) {
NPU2DEVINF(ndev, "Resetting device\n");
reset_ntl(ndev);
}
@@ -2016,7 +2016,8 @@ static int opal_npu_map_lpar(uint64_t phb_id, uint64_t bdf, uint64_t lparid,
/* Need to find an NVLink to send the ATSDs for this device over */
for (i = 0; i < p->total_devices; i++) {
- if (p->devices[i].nvlink.gpu_bdfn == bdf) {
+ if (p->devices[i].type == NPU2_DEV_TYPE_NVLINK &&
+ p->devices[i].nvlink.gpu_bdfn == bdf) {
ndev = &p->devices[i];
break;
}
@@ -2200,6 +2201,9 @@ static int npu2_set_relaxed_ordering(uint32_t gcid, int pec, bool enable)
npu = phb_to_npu2_nvlink(phb);
for (int i = 0; i < npu->total_devices; i++) {
ndev = &npu->devices[i];
+ if (ndev->type != NPU2_DEV_TYPE_NVLINK)
+ continue;
+
if (enable)
rc = npu2_enable_relaxed_ordering(ndev, gcid, pec);
else
--
git-series 0.9.1
More information about the Skiboot
mailing list