diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2015-11-10 13:55:55 +0900 |
---|---|---|
committer | Alexandre Courbot <acourbot@nvidia.com> | 2015-11-10 16:40:37 +0900 |
commit | d5fbab716a0e0f74a759b38c44c2ba115dfee700 (patch) | |
tree | ed84da674a90930900f88f9ebfada7d0f270ae0e | |
parent | cca528f9468bcbf991292456db71ce79ea1ea43b (diff) | |
download | nouveau-d5fbab716a0e0f74a759b38c44c2ba115dfee700.tar.gz |
instmem/gk20a: do not use non-portable dma_to_phys()
dma_to_phys() is not guaranteed to be available on all platforms and
should not be used outside of arch/. Replace it with what it is expected
to do in our case: simply cast the DMA handle to a physical address.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
-rw-r--r-- | drm/nouveau/nvkm/subdev/instmem/gk20a.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drm/nouveau/nvkm/subdev/instmem/gk20a.c b/drm/nouveau/nvkm/subdev/instmem/gk20a.c index 681b25412..ef60a9e4a 100644 --- a/drm/nouveau/nvkm/subdev/instmem/gk20a.c +++ b/drm/nouveau/nvkm/subdev/instmem/gk20a.c @@ -136,13 +136,17 @@ static void __iomem * gk20a_instobj_cpu_map_dma(struct nvkm_memory *memory) { struct gk20a_instobj_dma *node = gk20a_instobj_dma(memory); - struct device *dev = node->base.imem->base.subdev.device->dev; int npages = nvkm_memory_size(memory) >> 12; struct page *pages[npages]; int i; - /* phys_to_page does not exist on all platforms... */ - pages[0] = pfn_to_page(dma_to_phys(dev, node->handle) >> PAGE_SHIFT); + /* + * Ideally we would have a function to translate a handle to a physical + * address, but there is no portable way of doing this. However since we + * always use the DMA API without an IOMMU, we can assume that handles + * are actual physical addresses. + */ + pages[0] = pfn_to_page(((phys_addr_t)node->handle) >> PAGE_SHIFT); for (i = 1; i < npages; i++) pages[i] = pages[0] + i; |