summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2017-06-05 10:40:44 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-06 14:05:03 -0400
commit80197d2c9daa8e2320cc0b15741904eb3c1b9ba7 (patch)
treef6c5d33058f59df536860b4b1209950a63dda5be /drivers/gpu/nvgpu/common
parent26487b82df0c6604cc40fd6480f7ad7ed4e3efb0 (diff)
gpu: nvgpu: split vidmem_is_vidmem
As the vidmem_is_vidmem flag has got two separate meanings in one bit, split it in two bits into the enabled() API: Add NVGPU_MM_HONORS_APERTURE bit, which is the same as vidmem_is_vidmem with its original meaning, and use it to test which aperture bits to write to hardware. Add NVGPU_MM_UNIFIED_MEMORY bit, which has the opposite meaning: that the GPU shares the SoC memory. When this flag is false, the GPU has its own local video memory. Jira NVGPU-86 Change-Id: I2d0bed3b1ede5a712be99323d3035b154bb23c3a Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/1496080 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/dma.c5
-rw-r--r--drivers/gpu/nvgpu/common/linux/driver_common.c6
-rw-r--r--drivers/gpu/nvgpu/common/linux/nvgpu_mem.c6
-rw-r--r--drivers/gpu/nvgpu/common/linux/pci.c8
4 files changed, 15 insertions, 10 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)
69int nvgpu_dma_alloc_flags(struct gk20a *g, unsigned long flags, size_t size, 70int 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,
251int nvgpu_dma_alloc_map_flags(struct vm_gk20a *vm, unsigned long flags, 252int 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,