diff options
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/dma.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/driver_common.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/pci.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 7 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/fifo_gp10b.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/enabled.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c | 4 |
11 files changed, 33 insertions, 25 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c index 53f3a35e..5fee878a 100644 --- a/drivers/gpu/nvgpu/common/linux/dma.c +++ b/drivers/gpu/nvgpu/common/linux/dma.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <nvgpu/lock.h> | 21 | #include <nvgpu/lock.h> |
22 | #include <nvgpu/bug.h> | 22 | #include <nvgpu/bug.h> |
23 | #include <nvgpu/gmmu.h> | 23 | #include <nvgpu/gmmu.h> |
24 | #include <nvgpu/enabled.h> | ||
24 | 25 | ||
25 | #include <nvgpu/linux/dma.h> | 26 | #include <nvgpu/linux/dma.h> |
26 | 27 | ||
@@ -69,7 +70,7 @@ int nvgpu_dma_alloc(struct gk20a *g, size_t size, struct nvgpu_mem *mem) | |||
69 | int nvgpu_dma_alloc_flags(struct gk20a *g, unsigned long flags, size_t size, | 70 | int nvgpu_dma_alloc_flags(struct gk20a *g, unsigned long flags, size_t size, |
70 | struct nvgpu_mem *mem) | 71 | struct nvgpu_mem *mem) |
71 | { | 72 | { |
72 | if (g->mm.vidmem_is_vidmem) { | 73 | if (!nvgpu_is_enabled(g, NVGPU_MM_UNIFIED_MEMORY)) { |
73 | /* | 74 | /* |
74 | * Force the no-kernel-mapping flag on because we don't support | 75 | * Force the no-kernel-mapping flag on because we don't support |
75 | * the lack of it for vidmem - the user should not care when | 76 | * the lack of it for vidmem - the user should not care when |
@@ -251,7 +252,7 @@ int nvgpu_dma_alloc_map(struct vm_gk20a *vm, size_t size, | |||
251 | int nvgpu_dma_alloc_map_flags(struct vm_gk20a *vm, unsigned long flags, | 252 | int nvgpu_dma_alloc_map_flags(struct vm_gk20a *vm, unsigned long flags, |
252 | size_t size, struct nvgpu_mem *mem) | 253 | size_t size, struct nvgpu_mem *mem) |
253 | { | 254 | { |
254 | if (vm->mm->vidmem_is_vidmem) { | 255 | if (!nvgpu_is_enabled(gk20a_from_vm(vm), NVGPU_MM_UNIFIED_MEMORY)) { |
255 | /* | 256 | /* |
256 | * Force the no-kernel-mapping flag on because we don't support | 257 | * Force the no-kernel-mapping flag on because we don't support |
257 | * the lack of it for vidmem - the user should not care when | 258 | * the lack of it for vidmem - the user should not care when |
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index f85016d4..bd9a4e77 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c | |||
@@ -133,8 +133,10 @@ static void nvgpu_init_mm_vars(struct gk20a *g) | |||
133 | 133 | ||
134 | g->mm.bypass_smmu = platform->bypass_smmu; | 134 | g->mm.bypass_smmu = platform->bypass_smmu; |
135 | g->mm.disable_bigpage = platform->disable_bigpage; | 135 | g->mm.disable_bigpage = platform->disable_bigpage; |
136 | g->mm.vidmem_is_vidmem = platform->vidmem_is_vidmem; | 136 | __nvgpu_set_enabled(g, NVGPU_MM_HONORS_APERTURE, |
137 | 137 | platform->honors_aperture); | |
138 | __nvgpu_set_enabled(g, NVGPU_MM_UNIFIED_MEMORY, | ||
139 | platform->unified_memory); | ||
138 | __nvgpu_set_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES, | 140 | __nvgpu_set_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES, |
139 | platform->unify_address_spaces); | 141 | platform->unify_address_spaces); |
140 | 142 | ||
diff --git a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c index 58488067..34fd6626 100644 --- a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c +++ b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <nvgpu/page_allocator.h> | 19 | #include <nvgpu/page_allocator.h> |
20 | #include <nvgpu/log.h> | 20 | #include <nvgpu/log.h> |
21 | #include <nvgpu/bug.h> | 21 | #include <nvgpu/bug.h> |
22 | #include <nvgpu/enabled.h> | ||
22 | 23 | ||
23 | #include <nvgpu/linux/dma.h> | 24 | #include <nvgpu/linux/dma.h> |
24 | 25 | ||
@@ -30,8 +31,9 @@ u32 __nvgpu_aperture_mask(struct gk20a *g, enum nvgpu_aperture aperture, | |||
30 | { | 31 | { |
31 | switch (aperture) { | 32 | switch (aperture) { |
32 | case APERTURE_SYSMEM: | 33 | case APERTURE_SYSMEM: |
33 | /* sysmem for dgpus; some igpus consider system memory vidmem */ | 34 | /* some igpus consider system memory vidmem */ |
34 | return g->mm.vidmem_is_vidmem ? sysmem_mask : vidmem_mask; | 35 | return nvgpu_is_enabled(g, NVGPU_MM_HONORS_APERTURE) |
36 | ? sysmem_mask : vidmem_mask; | ||
35 | case APERTURE_VIDMEM: | 37 | case APERTURE_VIDMEM: |
36 | /* for dgpus only */ | 38 | /* for dgpus only */ |
37 | return vidmem_mask; | 39 | return vidmem_mask; |
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c index 0a5095fe..b66a6658 100644 --- a/drivers/gpu/nvgpu/common/linux/pci.c +++ b/drivers/gpu/nvgpu/common/linux/pci.c | |||
@@ -86,7 +86,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { | |||
86 | 86 | ||
87 | .ch_wdt_timeout_ms = 7000, | 87 | .ch_wdt_timeout_ms = 7000, |
88 | 88 | ||
89 | .vidmem_is_vidmem = true, | 89 | .honors_aperture = true, |
90 | .vbios_min_version = 0x86063000, | 90 | .vbios_min_version = 0x86063000, |
91 | .hardcode_sw_threshold = true, | 91 | .hardcode_sw_threshold = true, |
92 | .ina3221_dcb_index = 0, | 92 | .ina3221_dcb_index = 0, |
@@ -121,7 +121,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { | |||
121 | 121 | ||
122 | .ch_wdt_timeout_ms = 7000, | 122 | .ch_wdt_timeout_ms = 7000, |
123 | 123 | ||
124 | .vidmem_is_vidmem = true, | 124 | .honors_aperture = true, |
125 | .vbios_min_version = 0x86062d00, | 125 | .vbios_min_version = 0x86062d00, |
126 | .hardcode_sw_threshold = true, | 126 | .hardcode_sw_threshold = true, |
127 | .ina3221_dcb_index = 0, | 127 | .ina3221_dcb_index = 0, |
@@ -156,7 +156,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { | |||
156 | 156 | ||
157 | .ch_wdt_timeout_ms = 7000, | 157 | .ch_wdt_timeout_ms = 7000, |
158 | 158 | ||
159 | .vidmem_is_vidmem = true, | 159 | .honors_aperture = true, |
160 | .vbios_min_version = 0x86063000, | 160 | .vbios_min_version = 0x86063000, |
161 | .hardcode_sw_threshold = true, | 161 | .hardcode_sw_threshold = true, |
162 | .ina3221_dcb_index = 0, | 162 | .ina3221_dcb_index = 0, |
@@ -191,7 +191,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { | |||
191 | 191 | ||
192 | .ch_wdt_timeout_ms = 7000, | 192 | .ch_wdt_timeout_ms = 7000, |
193 | 193 | ||
194 | .vidmem_is_vidmem = true, | 194 | .honors_aperture = true, |
195 | .vbios_min_version = 0x86065600, | 195 | .vbios_min_version = 0x86065600, |
196 | .hardcode_sw_threshold = false, | 196 | .hardcode_sw_threshold = false, |
197 | .ina3221_dcb_index = 1, | 197 | .ina3221_dcb_index = 1, |
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 08e2e9cc..ec020d5f 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -665,7 +665,8 @@ int gk20a_init_mm_setup_sw(struct gk20a *g) | |||
665 | * this requires fixed allocations in vidmem which must be | 665 | * this requires fixed allocations in vidmem which must be |
666 | * allocated before all other buffers | 666 | * allocated before all other buffers |
667 | */ | 667 | */ |
668 | if (g->ops.pmu.alloc_blob_space && g->mm.vidmem_is_vidmem) { | 668 | if (g->ops.pmu.alloc_blob_space |
669 | && !nvgpu_is_enabled(g, NVGPU_MM_UNIFIED_MEMORY)) { | ||
669 | err = g->ops.pmu.alloc_blob_space(g, 0, &g->acr.ucode_blob); | 670 | err = g->ops.pmu.alloc_blob_space(g, 0, &g->acr.ucode_blob); |
670 | if (err) | 671 | if (err) |
671 | return err; | 672 | return err; |
@@ -1234,10 +1235,12 @@ enum nvgpu_aperture gk20a_dmabuf_aperture(struct gk20a *g, | |||
1234 | struct dma_buf *dmabuf) | 1235 | struct dma_buf *dmabuf) |
1235 | { | 1236 | { |
1236 | struct gk20a *buf_owner = gk20a_vidmem_buf_owner(dmabuf); | 1237 | struct gk20a *buf_owner = gk20a_vidmem_buf_owner(dmabuf); |
1238 | bool unified_memory = nvgpu_is_enabled(g, NVGPU_MM_UNIFIED_MEMORY); | ||
1239 | |||
1237 | if (buf_owner == NULL) { | 1240 | if (buf_owner == NULL) { |
1238 | /* Not nvgpu-allocated, assume system memory */ | 1241 | /* Not nvgpu-allocated, assume system memory */ |
1239 | return APERTURE_SYSMEM; | 1242 | return APERTURE_SYSMEM; |
1240 | } else if (WARN_ON(buf_owner == g && !g->mm.vidmem_is_vidmem)) { | 1243 | } else if (WARN_ON(buf_owner == g && unified_memory)) { |
1241 | /* Looks like our video memory, but this gpu doesn't support | 1244 | /* Looks like our video memory, but this gpu doesn't support |
1242 | * it. Warn about a bug and bail out */ | 1245 | * it. Warn about a bug and bail out */ |
1243 | nvgpu_warn(g, | 1246 | nvgpu_warn(g, |
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index 5d90cbf6..94342818 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h | |||
@@ -256,8 +256,6 @@ struct mm_gk20a { | |||
256 | bool disable_bigpage; | 256 | bool disable_bigpage; |
257 | #endif | 257 | #endif |
258 | bool has_physical_mode; | 258 | bool has_physical_mode; |
259 | /* false if vidmem aperture actually points to sysmem */ | ||
260 | bool vidmem_is_vidmem; | ||
261 | 259 | ||
262 | struct nvgpu_mem sysmem_flush; | 260 | struct nvgpu_mem sysmem_flush; |
263 | 261 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index 452b868d..9499f91a 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h | |||
@@ -215,8 +215,10 @@ struct gk20a_platform { | |||
215 | /* soc name for finding firmware files */ | 215 | /* soc name for finding firmware files */ |
216 | const char *soc_name; | 216 | const char *soc_name; |
217 | 217 | ||
218 | /* if vidmem aperture actually points to vidmem*/ | 218 | /* false if vidmem aperture actually points to sysmem */ |
219 | bool vidmem_is_vidmem; | 219 | bool honors_aperture; |
220 | /* unified or split memory with separate vidmem? */ | ||
221 | bool unified_memory; | ||
220 | 222 | ||
221 | /* minimum supported VBIOS version */ | 223 | /* minimum supported VBIOS version */ |
222 | u32 vbios_min_version; | 224 | u32 vbios_min_version; |
diff --git a/drivers/gpu/nvgpu/gp10b/fifo_gp10b.c b/drivers/gpu/nvgpu/gp10b/fifo_gp10b.c index 386318e7..cfc2eb8d 100644 --- a/drivers/gpu/nvgpu/gp10b/fifo_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/fifo_gp10b.c | |||
@@ -68,8 +68,8 @@ int channel_gp10b_commit_userd(struct channel_gk20a *c) | |||
68 | 68 | ||
69 | nvgpu_mem_wr32(g, &c->inst_block, | 69 | nvgpu_mem_wr32(g, &c->inst_block, |
70 | ram_in_ramfc_w() + ram_fc_userd_w(), | 70 | ram_in_ramfc_w() + ram_fc_userd_w(), |
71 | (g->mm.vidmem_is_vidmem ? | 71 | nvgpu_aperture_mask(g, &g->fifo.userd, |
72 | pbdma_userd_target_sys_mem_ncoh_f() : | 72 | pbdma_userd_target_sys_mem_ncoh_f(), |
73 | pbdma_userd_target_vid_mem_f()) | | 73 | pbdma_userd_target_vid_mem_f()) | |
74 | pbdma_userd_addr_f(addr_lo)); | 74 | pbdma_userd_addr_f(addr_lo)); |
75 | 75 | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h index a0b809ca..78dea193 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h +++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h | |||
@@ -32,6 +32,10 @@ struct gk20a; | |||
32 | * MM flags. | 32 | * MM flags. |
33 | */ | 33 | */ |
34 | #define NVGPU_MM_UNIFY_ADDRESS_SPACES 16 | 34 | #define NVGPU_MM_UNIFY_ADDRESS_SPACES 16 |
35 | /* false if vidmem aperture actually points to sysmem */ | ||
36 | #define NVGPU_MM_HONORS_APERTURE 17 | ||
37 | /* unified or split memory with separate vidmem? */ | ||
38 | #define NVGPU_MM_UNIFIED_MEMORY 18 | ||
35 | 39 | ||
36 | /* | 40 | /* |
37 | * Must be greater than the largest bit offset in the above list. | 41 | * Must be greater than the largest bit offset in the above list. |
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c index 96312a00..8a83f7d0 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | |||
@@ -934,8 +934,6 @@ static int gk20a_tegra_probe(struct device *dev) | |||
934 | if (tegra_get_chip_id() == TEGRA132) | 934 | if (tegra_get_chip_id() == TEGRA132) |
935 | platform->soc_name = "tegra13x"; | 935 | platform->soc_name = "tegra13x"; |
936 | 936 | ||
937 | platform->g->mm.vidmem_is_vidmem = platform->vidmem_is_vidmem; | ||
938 | |||
939 | gk20a_tegra_get_clocks(dev); | 937 | gk20a_tegra_get_clocks(dev); |
940 | nvgpu_linux_init_clk_support(platform->g); | 938 | nvgpu_linux_init_clk_support(platform->g); |
941 | gk20a_tegra_init_secure_alloc(platform->g); | 939 | gk20a_tegra_init_secure_alloc(platform->g); |
@@ -1051,7 +1049,7 @@ struct gk20a_platform gk20a_tegra_platform = { | |||
1051 | 1049 | ||
1052 | .soc_name = "tegra12x", | 1050 | .soc_name = "tegra12x", |
1053 | 1051 | ||
1054 | .vidmem_is_vidmem = false, | 1052 | .unified_memory = true, |
1055 | }; | 1053 | }; |
1056 | 1054 | ||
1057 | struct gk20a_platform gm20b_tegra_platform = { | 1055 | struct gk20a_platform gm20b_tegra_platform = { |
@@ -1123,5 +1121,5 @@ struct gk20a_platform gm20b_tegra_platform = { | |||
1123 | 1121 | ||
1124 | .soc_name = "tegra21x", | 1122 | .soc_name = "tegra21x", |
1125 | 1123 | ||
1126 | .vidmem_is_vidmem = false, | 1124 | .unified_memory = true, |
1127 | }; | 1125 | }; |
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c index b7cbf56e..8b530fac 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c | |||
@@ -161,8 +161,6 @@ static int gp10b_tegra_probe(struct device *dev) | |||
161 | platform->g->gr.t18x.ctx_vars.force_preemption_gfxp = false; | 161 | platform->g->gr.t18x.ctx_vars.force_preemption_gfxp = false; |
162 | platform->g->gr.t18x.ctx_vars.force_preemption_cilp = false; | 162 | platform->g->gr.t18x.ctx_vars.force_preemption_cilp = false; |
163 | 163 | ||
164 | platform->g->mm.vidmem_is_vidmem = platform->vidmem_is_vidmem; | ||
165 | |||
166 | gp10b_tegra_get_clocks(dev); | 164 | gp10b_tegra_get_clocks(dev); |
167 | nvgpu_linux_init_clk_support(platform->g); | 165 | nvgpu_linux_init_clk_support(platform->g); |
168 | gk20a_tegra_init_secure_alloc(platform->g); | 166 | gk20a_tegra_init_secure_alloc(platform->g); |
@@ -436,7 +434,7 @@ struct gk20a_platform gp10b_tegra_platform = { | |||
436 | 434 | ||
437 | .soc_name = "tegra18x", | 435 | .soc_name = "tegra18x", |
438 | 436 | ||
439 | .vidmem_is_vidmem = false, | 437 | .unified_memory = true, |
440 | }; | 438 | }; |
441 | 439 | ||
442 | 440 | ||