powerpc/powernv/npu: Do not attempt NPU2 setup on POWER8NVL NPU
We execute certain NPU2 setup code (such as mapping an LPID to a device
in NPU2) unconditionally if an Nvlink bridge is detected. However this
cannot succeed on POWER8NVL machines and errors appear in dmesg. This is
harmless as skiboot returns an error and the only place we check it is
vfio-pci but that code does not get called on P8+ either.
This adds a check if pnv_npu2_xxx helpers are called on a machine with
NPU2 which initializes pnv_phb::npu in pnv_npu2_init();
pnv_phb::npu==NULL on POWER8/NVL (Naples).
While at this, fix NULL derefencing in pnv_npu_peers_take_ownership/
pnv_npu_peers_release_ownership which occurs when GPUs on mentioned P8s
cause EEH which happens if "vfio-pci" disables devices using
the D3 power state; the vfio-pci's disable_idle_d3 module parameter
controls this and must be set on Naples. The EEH handling clears
the entire pnv_ioda_pe struct in pnv_ioda_free_pe() hence
the NULL derefencing. We cannot recover from that but at least we stop
crashing.
Tested on
- POWER9 pvr=004e1201, Ubuntu 19.04 host, Ubuntu 18.04 vm,
NVIDIA GV100 10de:1db1 driver 418.39
- POWER8 pvr=004c0100, RHEL 7.6 host, Ubuntu 16.10 vm,
NVIDIA P100 10de:15f9 driver 396.47
Fixes: 1b785611e1
("powerpc/powernv/npu: Add release_ownership hook")
Cc: stable@vger.kernel.org # 5.0
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201122073828.15446-1-aik@ozlabs.ru
This commit is contained in:
Родитель
3ba150fb21
Коммит
b1198a8823
|
@ -385,7 +385,8 @@ static void pnv_npu_peers_take_ownership(struct iommu_table_group *table_group)
|
|||
for (i = 0; i < npucomp->pe_num; ++i) {
|
||||
struct pnv_ioda_pe *pe = npucomp->pe[i];
|
||||
|
||||
if (!pe->table_group.ops->take_ownership)
|
||||
if (!pe->table_group.ops ||
|
||||
!pe->table_group.ops->take_ownership)
|
||||
continue;
|
||||
pe->table_group.ops->take_ownership(&pe->table_group);
|
||||
}
|
||||
|
@ -401,7 +402,8 @@ static void pnv_npu_peers_release_ownership(
|
|||
for (i = 0; i < npucomp->pe_num; ++i) {
|
||||
struct pnv_ioda_pe *pe = npucomp->pe[i];
|
||||
|
||||
if (!pe->table_group.ops->release_ownership)
|
||||
if (!pe->table_group.ops ||
|
||||
!pe->table_group.ops->release_ownership)
|
||||
continue;
|
||||
pe->table_group.ops->release_ownership(&pe->table_group);
|
||||
}
|
||||
|
@ -623,6 +625,11 @@ int pnv_npu2_map_lpar_dev(struct pci_dev *gpdev, unsigned int lparid,
|
|||
return -ENODEV;
|
||||
|
||||
hose = pci_bus_to_host(npdev->bus);
|
||||
if (hose->npu == NULL) {
|
||||
dev_info_once(&npdev->dev, "Nvlink1 does not support contexts");
|
||||
return 0;
|
||||
}
|
||||
|
||||
nphb = hose->private_data;
|
||||
|
||||
dev_dbg(&gpdev->dev, "Map LPAR opalid=%llu lparid=%u\n",
|
||||
|
@ -670,6 +677,11 @@ int pnv_npu2_unmap_lpar_dev(struct pci_dev *gpdev)
|
|||
return -ENODEV;
|
||||
|
||||
hose = pci_bus_to_host(npdev->bus);
|
||||
if (hose->npu == NULL) {
|
||||
dev_info_once(&npdev->dev, "Nvlink1 does not support contexts");
|
||||
return 0;
|
||||
}
|
||||
|
||||
nphb = hose->private_data;
|
||||
|
||||
dev_dbg(&gpdev->dev, "destroy context opalid=%llu\n",
|
||||
|
|
Загрузка…
Ссылка в новой задаче