]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
powerpc/powernv/npu: Move tlb flush before launching ATSD
authorAlistair Popple <alistair@popple.id.au>
Fri, 11 Aug 2017 06:22:56 +0000 (16:22 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Sep 2017 12:43:15 +0000 (14:43 +0200)
commit bab9f954aaf352127725a9b7920226abdb65b604 upstream.

The nest MMU tlb flush needs to happen before the GPU translation
shootdown is launched to avoid the GPU refilling its tlb with stale
nmmu translations prior to the nmmu flush completing.

Fixes: 1ab66d1fbada ("powerpc/powernv: Introduce address translation services for Nvlink2")
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/platforms/powernv/npu-dma.c

index 4c7b8591f7379931a1d319c8edd5995610ca6d8c..2cb6cbea4b3b377329803a1a825360c60df10835 100644 (file)
@@ -545,6 +545,12 @@ static void mmio_invalidate(struct npu_context *npu_context, int va,
        struct mmio_atsd_reg mmio_atsd_reg[NV_MAX_NPUS];
        unsigned long pid = npu_context->mm->context.id;
 
+       /*
+        * Unfortunately the nest mmu does not support flushing specific
+        * addresses so we have to flush the whole mm.
+        */
+       flush_tlb_mm(npu_context->mm);
+
        /*
         * Loop over all the NPUs this process is active on and launch
         * an invalidate.
@@ -576,12 +582,6 @@ static void mmio_invalidate(struct npu_context *npu_context, int va,
                }
        }
 
-       /*
-        * Unfortunately the nest mmu does not support flushing specific
-        * addresses so we have to flush the whole mm.
-        */
-       flush_tlb_mm(npu_context->mm);
-
        mmio_invalidate_wait(mmio_atsd_reg, flush);
        if (flush)
                /* Wait for the flush to complete */