]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
powerpc/powernv: Fix update of NVLink DMA mask
authorAlistair Popple <alistair@popple.id.au>
Fri, 8 Jan 2016 00:35:09 +0000 (11:35 +1100)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 29 Feb 2016 15:55:10 +0000 (08:55 -0700)
BugLink: http://bugs.launchpad.net/bugs/1522415
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.

Fixes: 5d2aa710e697 ("powerpc/powernv: Add support for Nvlink NPUs")
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 419dbd5e1ff0e45a6e1d28c1f7b74d121d2a56e7)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
arch/powerpc/platforms/powernv/pci-ioda.c

index 840ea255dc6f01731b03d8b06bcf4b1a21cbdf13..c27f6c80e1b1d62fcfc130ac5528887a6ffd6849 100644 (file)
@@ -1620,7 +1620,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);