[PATCH] platforms/powernv: Fix update of NVLink DMA mask

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE3860d

2 messages, 2 authors, 2016-01-12 · open the first message on its own page

[PATCH] platforms/powernv: Fix update of NVLink DMA mask

From: Alistair Popple <hidden>
Date: 2016-01-08 00:40:14

The emulated NVLink PCI devices share the same IODA2 TCE tables but
only support a single TVT (instead of the normal two for PCI
devices). This requires the kernel to manually replace windows with
either the bypass or non-bypass window depending on what the driver
has requested.

Unfortunately an incorrect optimisation was made in
pnv_pci_ioda_dma_set_mask() which caused updating of some NPU device
PEs to be skipped in certain configurations due to an incorrect
assumption that a NULL peer PE in the array indicated there were no
more peers present. This patch fixes the problem by ensuring all peer
PEs are updated.

Signed-off-by: Alistair Popple <redacted>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 323e1e5..458133f 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1612,7 +1612,10 @@ static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
 
 	/* Update peer npu devices */
 	if (pe->flags & PNV_IODA_PE_PEER)
-		for (i = 0; pe->peers[i]; i++) {
+		for (i = 0; i < PNV_IODA_MAX_PEER_PES; i++) {
+			if (!pe->peers[i])
+				continue;
+
 			linked_npu_dev = pe->peers[i]->pdev;
 			if (dma_get_mask(&linked_npu_dev->dev) != dma_mask)
 				dma_set_mask(&linked_npu_dev->dev, dma_mask);
-- 
2.1.4

Re: platforms/powernv: Fix update of NVLink DMA mask

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-01-12 12:32:50

On Fri, 2016-08-01 at 00:35:09 UTC, Alistair Popple wrote:
The emulated NVLink PCI devices share the same IODA2 TCE tables but
only support a single TVT (instead of the normal two for PCI
devices). This requires the kernel to manually replace windows with
either the bypass or non-bypass window depending on what the driver
has requested.

Unfortunately an incorrect optimisation was made in
pnv_pci_ioda_dma_set_mask() which caused updating of some NPU device
PEs to be skipped in certain configurations due to an incorrect
assumption that a NULL peer PE in the array indicated there were no
more peers present. This patch fixes the problem by ensuring all peer
PEs are updated.

Signed-off-by: Alistair Popple <redacted>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/419dbd5e1ff0e45a6e1d28c1f7

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help