From: Dave Airlie <airl...@redhat.com>

gk20a is an ARM only GPU, so we can just do the correct thing on
ARM but fail on other architectures. The other option was to use
SWIOTLB as the define, which means phys_to_page exists, but
this seems clearer.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
index fc419bb..c4b8704 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
@@ -139,10 +139,16 @@ gk20a_instobj_cpu_map_dma(struct nvkm_memory *memory)
        struct page *pages[npages];
        int i;

+       /* we shouldn't see a gk20a on anything but arm/arm64 anyways */
+#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
        /* phys_to_page does not exist on all platforms... */
        pages[0] = pfn_to_page(dma_to_phys(dev, node->handle) >> PAGE_SHIFT);
        for (i = 1; i < npages; i++)
                pages[i] = pages[0] + i;
+#else
+       BUG();
+       return NULL;
+#endif

        return vmap(pages, npages, VM_MAP, pgprot_writecombine(PAGE_KERNEL));
 }
-- 
2.5.0

Reply via email to