Message ID | f968723251a632e47047cd20fd5e06fc8c018c1d.1544597914.git-series.andrew.donnellan@au1.ibm.com |
---|---|
State | Superseded |
Headers | show |
Series | Support OpenCAPI and NVLink devices on same NPU on Witherspoon | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | master/apply_patch Successfully applied |
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot | success | Test snowpatch/job/snowpatch-skiboot on branch master |
Le 12/12/2018 à 07:58, Andrew Donnellan a écrit : > 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@au1.ibm.com> It looks safe enough Reviewed-by: Frederic Barrat <fbarrat@linux.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 >
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
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@au1.ibm.com> --- hw/npu2.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)