diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/module.c | 21 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/module.h | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/nvhost.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/pci.c | 8 |
5 files changed, 34 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index 4fe38588..5d91da8f 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/pm_runtime.h> | 24 | #include <linux/pm_runtime.h> |
25 | #include <linux/reset.h> | 25 | #include <linux/reset.h> |
26 | #include <linux/platform/tegra/common.h> | 26 | #include <linux/platform/tegra/common.h> |
27 | #include <linux/pci.h> | ||
28 | |||
27 | #include <uapi/linux/nvgpu.h> | 29 | #include <uapi/linux/nvgpu.h> |
28 | #include <dt-bindings/soc/gm20b-fuse.h> | 30 | #include <dt-bindings/soc/gm20b-fuse.h> |
29 | #include <dt-bindings/soc/gp10b-fuse.h> | 31 | #include <dt-bindings/soc/gp10b-fuse.h> |
@@ -70,6 +72,23 @@ | |||
70 | #define CREATE_TRACE_POINTS | 72 | #define CREATE_TRACE_POINTS |
71 | #include <trace/events/gk20a.h> | 73 | #include <trace/events/gk20a.h> |
72 | 74 | ||
75 | |||
76 | struct device_node *nvgpu_get_node(struct gk20a *g) | ||
77 | { | ||
78 | struct device *dev = dev_from_gk20a(g); | ||
79 | |||
80 | if (dev_is_pci(dev)) { | ||
81 | struct pci_bus *bus = to_pci_dev(dev)->bus; | ||
82 | |||
83 | while (!pci_is_root_bus(bus)) | ||
84 | bus = bus->parent; | ||
85 | |||
86 | return bus->bridge->parent->of_node; | ||
87 | } | ||
88 | |||
89 | return dev->of_node; | ||
90 | } | ||
91 | |||
73 | void gk20a_busy_noresume(struct gk20a *g) | 92 | void gk20a_busy_noresume(struct gk20a *g) |
74 | { | 93 | { |
75 | pm_runtime_get_noresume(dev_from_gk20a(g)); | 94 | pm_runtime_get_noresume(dev_from_gk20a(g)); |
@@ -1042,7 +1061,7 @@ static inline void set_gk20a(struct platform_device *pdev, struct gk20a *gk20a) | |||
1042 | 1061 | ||
1043 | static int nvgpu_read_fuse_overrides(struct gk20a *g) | 1062 | static int nvgpu_read_fuse_overrides(struct gk20a *g) |
1044 | { | 1063 | { |
1045 | struct device_node *np = dev_from_gk20a(g)->of_node; | 1064 | struct device_node *np = nvgpu_get_node(g); |
1046 | u32 *fuses; | 1065 | u32 *fuses; |
1047 | int count, i; | 1066 | int count, i; |
1048 | 1067 | ||
diff --git a/drivers/gpu/nvgpu/common/linux/module.h b/drivers/gpu/nvgpu/common/linux/module.h index 90dba804..934c895d 100644 --- a/drivers/gpu/nvgpu/common/linux/module.h +++ b/drivers/gpu/nvgpu/common/linux/module.h | |||
@@ -28,6 +28,7 @@ void gk20a_driver_start_unload(struct gk20a *g); | |||
28 | int nvgpu_quiesce(struct gk20a *g); | 28 | int nvgpu_quiesce(struct gk20a *g); |
29 | int nvgpu_remove(struct device *dev, struct class *class); | 29 | int nvgpu_remove(struct device *dev, struct class *class); |
30 | void nvgpu_free_irq(struct gk20a *g); | 30 | void nvgpu_free_irq(struct gk20a *g); |
31 | struct device_node *nvgpu_get_node(struct gk20a *g); | ||
31 | 32 | ||
32 | extern struct class nvgpu_class; | 33 | extern struct class nvgpu_class; |
33 | 34 | ||
diff --git a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c index 79098eca..e4b4be06 100644 --- a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c +++ b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | |||
@@ -61,6 +61,8 @@ u32 nvgpu_aperture_mask(struct gk20a *g, struct nvgpu_mem *mem, | |||
61 | int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem) | 61 | int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem) |
62 | { | 62 | { |
63 | void *cpu_va; | 63 | void *cpu_va; |
64 | pgprot_t prot = nvgpu_is_enabled(g, NVGPU_DMA_COHERENT) ? PAGE_KERNEL : | ||
65 | pgprot_writecombine(PAGE_KERNEL); | ||
64 | 66 | ||
65 | if (mem->aperture != APERTURE_SYSMEM || g->mm.force_pramin) | 67 | if (mem->aperture != APERTURE_SYSMEM || g->mm.force_pramin) |
66 | return 0; | 68 | return 0; |
@@ -80,7 +82,7 @@ int nvgpu_mem_begin(struct gk20a *g, struct nvgpu_mem *mem) | |||
80 | 82 | ||
81 | cpu_va = vmap(mem->priv.pages, | 83 | cpu_va = vmap(mem->priv.pages, |
82 | PAGE_ALIGN(mem->size) >> PAGE_SHIFT, | 84 | PAGE_ALIGN(mem->size) >> PAGE_SHIFT, |
83 | 0, pgprot_writecombine(PAGE_KERNEL)); | 85 | 0, prot); |
84 | 86 | ||
85 | if (WARN_ON(!cpu_va)) | 87 | if (WARN_ON(!cpu_va)) |
86 | return -ENOMEM; | 88 | return -ENOMEM; |
diff --git a/drivers/gpu/nvgpu/common/linux/nvhost.c b/drivers/gpu/nvgpu/common/linux/nvhost.c index b8e51aac..511cffc4 100644 --- a/drivers/gpu/nvgpu/common/linux/nvhost.c +++ b/drivers/gpu/nvgpu/common/linux/nvhost.c | |||
@@ -24,10 +24,11 @@ | |||
24 | 24 | ||
25 | #include "gk20a/gk20a.h" | 25 | #include "gk20a/gk20a.h" |
26 | #include "os_linux.h" | 26 | #include "os_linux.h" |
27 | #include "module.h" | ||
27 | 28 | ||
28 | int nvgpu_get_nvhost_dev(struct gk20a *g) | 29 | int nvgpu_get_nvhost_dev(struct gk20a *g) |
29 | { | 30 | { |
30 | struct device_node *np = dev_from_gk20a(g)->of_node; | 31 | struct device_node *np = nvgpu_get_node(g); |
31 | struct platform_device *host1x_pdev = NULL; | 32 | struct platform_device *host1x_pdev = NULL; |
32 | const __be32 *host1x_ptr; | 33 | const __be32 *host1x_ptr; |
33 | 34 | ||
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 | ||