diff options
Diffstat (limited to 'arch/powerpc/platforms/powernv/npu-dma.c')
-rw-r--r-- | arch/powerpc/platforms/powernv/npu-dma.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c index abeaa533b976..b711dc3262a3 100644 --- a/arch/powerpc/platforms/powernv/npu-dma.c +++ b/arch/powerpc/platforms/powernv/npu-dma.c | |||
@@ -385,7 +385,8 @@ static void pnv_npu_peers_take_ownership(struct iommu_table_group *table_group) | |||
385 | for (i = 0; i < npucomp->pe_num; ++i) { | 385 | for (i = 0; i < npucomp->pe_num; ++i) { |
386 | struct pnv_ioda_pe *pe = npucomp->pe[i]; | 386 | struct pnv_ioda_pe *pe = npucomp->pe[i]; |
387 | 387 | ||
388 | if (!pe->table_group.ops->take_ownership) | 388 | if (!pe->table_group.ops || |
389 | !pe->table_group.ops->take_ownership) | ||
389 | continue; | 390 | continue; |
390 | pe->table_group.ops->take_ownership(&pe->table_group); | 391 | pe->table_group.ops->take_ownership(&pe->table_group); |
391 | } | 392 | } |
@@ -401,7 +402,8 @@ static void pnv_npu_peers_release_ownership( | |||
401 | for (i = 0; i < npucomp->pe_num; ++i) { | 402 | for (i = 0; i < npucomp->pe_num; ++i) { |
402 | struct pnv_ioda_pe *pe = npucomp->pe[i]; | 403 | struct pnv_ioda_pe *pe = npucomp->pe[i]; |
403 | 404 | ||
404 | if (!pe->table_group.ops->release_ownership) | 405 | if (!pe->table_group.ops || |
406 | !pe->table_group.ops->release_ownership) | ||
405 | continue; | 407 | continue; |
406 | pe->table_group.ops->release_ownership(&pe->table_group); | 408 | pe->table_group.ops->release_ownership(&pe->table_group); |
407 | } | 409 | } |
@@ -623,6 +625,11 @@ int pnv_npu2_map_lpar_dev(struct pci_dev *gpdev, unsigned int lparid, | |||
623 | return -ENODEV; | 625 | return -ENODEV; |
624 | 626 | ||
625 | hose = pci_bus_to_host(npdev->bus); | 627 | hose = pci_bus_to_host(npdev->bus); |
628 | if (hose->npu == NULL) { | ||
629 | dev_info_once(&npdev->dev, "Nvlink1 does not support contexts"); | ||
630 | return 0; | ||
631 | } | ||
632 | |||
626 | nphb = hose->private_data; | 633 | nphb = hose->private_data; |
627 | 634 | ||
628 | dev_dbg(&gpdev->dev, "Map LPAR opalid=%llu lparid=%u\n", | 635 | 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) | |||
670 | return -ENODEV; | 677 | return -ENODEV; |
671 | 678 | ||
672 | hose = pci_bus_to_host(npdev->bus); | 679 | hose = pci_bus_to_host(npdev->bus); |
680 | if (hose->npu == NULL) { | ||
681 | dev_info_once(&npdev->dev, "Nvlink1 does not support contexts"); | ||
682 | return 0; | ||
683 | } | ||
684 | |||
673 | nphb = hose->private_data; | 685 | nphb = hose->private_data; |
674 | 686 | ||
675 | dev_dbg(&gpdev->dev, "destroy context opalid=%llu\n", | 687 | dev_dbg(&gpdev->dev, "destroy context opalid=%llu\n", |