diff options
author | David Nieto <dmartineznie@nvidia.com> | 2018-01-04 14:09:57 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-01-08 17:38:06 -0500 |
commit | 6dde9e67d91419d1e671a520571a2be9bde93999 (patch) | |
tree | 0471b3f8ef26bed5b3adf4c8ddc6c949e8651bf4 /drivers/gpu/nvgpu/common/linux/pci.c | |
parent | 82f253b7c14d7811a54f8187ff82f8d8befae529 (diff) |
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 <dmartineznie@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1633985
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/pci.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/pci.c | 8 |
1 files changed, 8 insertions, 0 deletions
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 @@ | |||
21 | #include <nvgpu/nvgpu_common.h> | 21 | #include <nvgpu/nvgpu_common.h> |
22 | #include <nvgpu/kmem.h> | 22 | #include <nvgpu/kmem.h> |
23 | #include <nvgpu/enabled.h> | 23 | #include <nvgpu/enabled.h> |
24 | #include <linux/of_platform.h> | ||
25 | #include <linux/of_address.h> | ||
24 | 26 | ||
25 | #include "gk20a/gk20a.h" | 27 | #include "gk20a/gk20a.h" |
26 | #include "clk/clk.h" | 28 | #include "clk/clk.h" |
@@ -525,6 +527,7 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
525 | struct gk20a *g; | 527 | struct gk20a *g; |
526 | int err; | 528 | int err; |
527 | char nodefmt[64]; | 529 | char nodefmt[64]; |
530 | struct device_node *np; | ||
528 | 531 | ||
529 | /* make sure driver_data is a sane index */ | 532 | /* make sure driver_data is a sane index */ |
530 | if (pent->driver_data >= sizeof(nvgpu_pci_device) / | 533 | if (pent->driver_data >= sizeof(nvgpu_pci_device) / |
@@ -632,6 +635,11 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
632 | 635 | ||
633 | g->mm.has_physical_mode = false; | 636 | g->mm.has_physical_mode = false; |
634 | 637 | ||
638 | np = nvgpu_get_node(g); | ||
639 | |||
640 | if (of_dma_is_coherent(np)) | ||
641 | __nvgpu_set_enabled(g, NVGPU_DMA_COHERENT, true); | ||
642 | |||
635 | return 0; | 643 | return 0; |
636 | } | 644 | } |
637 | 645 | ||