From 6dde9e67d91419d1e671a520571a2be9bde93999 Mon Sep 17 00:00:00 2001 From: David Nieto Date: Thu, 4 Jan 2018 11:09:57 -0800 Subject: gpu: nvgpu: allocate from coherent pool Maps memory coherently on devices that are connected to a coherent bus. (1) Add code to be able to get the platform device node. (2) Create a new flag to mark if the device is connected to a coherent bus (3) Map memory coherently on coherent devices. bug 2040331 Change-Id: Ide83a9261acdbbc6e9fef4fc5f38d6f9d0e5ab5b Signed-off-by: David Nieto Reviewed-on: https://git-master.nvidia.com/r/1633985 Reviewed-by: svc-mobile-coverity Reviewed-by: Alex Waterman GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/gpu/nvgpu/common/linux/pci.c') diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c index 23604633..7c853b14 100644 --- a/drivers/gpu/nvgpu/common/linux/pci.c +++ b/drivers/gpu/nvgpu/common/linux/pci.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include "gk20a/gk20a.h" #include "clk/clk.h" @@ -525,6 +527,7 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, struct gk20a *g; int err; char nodefmt[64]; + struct device_node *np; /* make sure driver_data is a sane index */ if (pent->driver_data >= sizeof(nvgpu_pci_device) / @@ -632,6 +635,11 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, g->mm.has_physical_mode = false; + np = nvgpu_get_node(g); + + if (of_dma_is_coherent(np)) + __nvgpu_set_enabled(g, NVGPU_DMA_COHERENT, true); + return 0; } -- cgit v1.2.2