Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751138AbbKJFLG (ORCPT ); Tue, 10 Nov 2015 00:11:06 -0500 Received: from hqemgate14.nvidia.com ([216.228.121.143]:6338 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750896AbbKJFLD (ORCPT ); Tue, 10 Nov 2015 00:11:03 -0500 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 09 Nov 2015 21:00:07 -0800 From: Alexandre Courbot To: Dave Airlie , Ben Skeggs CC: Guenter Roeck , Stephen Rothwell , linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, gnurou@gmail.com, Alexandre Courbot Subject: [PATCH] instmem/gk20a: do not use non-portable dma_to_phys() Date: Tue, 10 Nov 2015 14:10:47 +0900 Message-ID: <1447132247-9767-1-git-send-email-acourbot@nvidia.com> X-Mailer: git-send-email 2.6.2 X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1818 Lines: 43 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 Signed-off-by: Alexandre Courbot --- drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c index fc419bb8eab7..49451645a049 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c @@ -134,13 +134,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; -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/