Commit 415ba3c1 authored by Alistair Popple's avatar Alistair Popple Committed by Michael Ellerman

powerpc/powernv/npu-dma.c: Fix opal_npu_destroy_context() call

opal_npu_destroy_context() should be called with the NPU PHB, not the
PCIe PHB.

Fixes: 1ab66d1f ("powerpc/powernv: Introduce address translation services for Nvlink2")
Signed-off-by: default avatarAlistair Popple <alistair@popple.id.au>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent fe06fe86
...@@ -714,7 +714,7 @@ static void pnv_npu2_release_context(struct kref *kref) ...@@ -714,7 +714,7 @@ static void pnv_npu2_release_context(struct kref *kref)
void pnv_npu2_destroy_context(struct npu_context *npu_context, void pnv_npu2_destroy_context(struct npu_context *npu_context,
struct pci_dev *gpdev) struct pci_dev *gpdev)
{ {
struct pnv_phb *nphb, *phb; struct pnv_phb *nphb;
struct npu *npu; struct npu *npu;
struct pci_dev *npdev = pnv_pci_get_npu_dev(gpdev, 0); struct pci_dev *npdev = pnv_pci_get_npu_dev(gpdev, 0);
struct device_node *nvlink_dn; struct device_node *nvlink_dn;
...@@ -728,13 +728,12 @@ void pnv_npu2_destroy_context(struct npu_context *npu_context, ...@@ -728,13 +728,12 @@ void pnv_npu2_destroy_context(struct npu_context *npu_context,
nphb = pci_bus_to_host(npdev->bus)->private_data; nphb = pci_bus_to_host(npdev->bus)->private_data;
npu = &nphb->npu; npu = &nphb->npu;
phb = pci_bus_to_host(gpdev->bus)->private_data;
nvlink_dn = of_parse_phandle(npdev->dev.of_node, "ibm,nvlink", 0); nvlink_dn = of_parse_phandle(npdev->dev.of_node, "ibm,nvlink", 0);
if (WARN_ON(of_property_read_u32(nvlink_dn, "ibm,npu-link-index", if (WARN_ON(of_property_read_u32(nvlink_dn, "ibm,npu-link-index",
&nvlink_index))) &nvlink_index)))
return; return;
npu_context->npdev[npu->index][nvlink_index] = NULL; npu_context->npdev[npu->index][nvlink_index] = NULL;
opal_npu_destroy_context(phb->opal_id, npu_context->mm->context.id, opal_npu_destroy_context(nphb->opal_id, npu_context->mm->context.id,
PCI_DEVID(gpdev->bus->number, gpdev->devfn)); PCI_DEVID(gpdev->bus->number, gpdev->devfn));
kref_put(&npu_context->kref, pnv_npu2_release_context); kref_put(&npu_context->kref, pnv_npu2_release_context);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment