summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-05-23 19:06:48 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-30 16:24:35 -0400
commit8d6b5cc349643c5e96384a8dbc27afc705bc5bfc (patch)
treec3cb1335c0da0aef85c6a54d286b2bc159fd9460 /drivers/gpu
parent66a2511a366113fa4d42dc500c9df9b348d9f208 (diff)
gpu: nvgpu: Move unify_address_spaces to flags
Use the enabled flags API to handle the unify_address_sapce spaces flag. JIRA NVGPU-84 JIRA NVGPU-12 JIRA NVGPU-30 Change-Id: Id1b59aed4b349d6067615991597d534936cc5ce9 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1488307 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/common/linux/driver_common.c4
-rw-r--r--drivers/gpu/nvgpu/common/mm/vm.c9
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/enabled.h5
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c3
5 files changed, 18 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c
index 0d29223f..80e7698b 100644
--- a/drivers/gpu/nvgpu/common/linux/driver_common.c
+++ b/drivers/gpu/nvgpu/common/linux/driver_common.c
@@ -20,6 +20,7 @@
20#include <nvgpu/nvgpu_common.h> 20#include <nvgpu/nvgpu_common.h>
21#include <nvgpu/soc.h> 21#include <nvgpu/soc.h>
22#include <nvgpu/bug.h> 22#include <nvgpu/bug.h>
23#include <nvgpu/enabled.h>
23 24
24#include "gk20a/gk20a_scale.h" 25#include "gk20a/gk20a_scale.h"
25#include "gk20a/gk20a.h" 26#include "gk20a/gk20a.h"
@@ -133,6 +134,9 @@ static void nvgpu_init_mm_vars(struct gk20a *g)
133 g->mm.disable_bigpage = platform->disable_bigpage; 134 g->mm.disable_bigpage = platform->disable_bigpage;
134 g->mm.vidmem_is_vidmem = platform->vidmem_is_vidmem; 135 g->mm.vidmem_is_vidmem = platform->vidmem_is_vidmem;
135 136
137 __nvgpu_set_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES,
138 platform->unify_address_spaces);
139
136 nvgpu_mutex_init(&g->mm.tlb_lock); 140 nvgpu_mutex_init(&g->mm.tlb_lock);
137 nvgpu_mutex_init(&g->mm.priv_lock); 141 nvgpu_mutex_init(&g->mm.priv_lock);
138} 142}
diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c
index bdc8554c..904284ec 100644
--- a/drivers/gpu/nvgpu/common/mm/vm.c
+++ b/drivers/gpu/nvgpu/common/mm/vm.c
@@ -22,10 +22,10 @@
22#include <nvgpu/list.h> 22#include <nvgpu/list.h>
23#include <nvgpu/rbtree.h> 23#include <nvgpu/rbtree.h>
24#include <nvgpu/semaphore.h> 24#include <nvgpu/semaphore.h>
25#include <nvgpu/enabled.h>
25 26
26#include "gk20a/gk20a.h" 27#include "gk20a/gk20a.h"
27#include "gk20a/mm_gk20a.h" 28#include "gk20a/mm_gk20a.h"
28#include "gk20a/platform_gk20a.h"
29 29
30int vm_aspace_id(struct vm_gk20a *vm) 30int vm_aspace_id(struct vm_gk20a *vm)
31{ 31{
@@ -255,7 +255,6 @@ int nvgpu_init_vm(struct mm_gk20a *mm,
255 u64 user_lp_vma_start, user_lp_vma_limit; 255 u64 user_lp_vma_start, user_lp_vma_limit;
256 u64 kernel_vma_start, kernel_vma_limit; 256 u64 kernel_vma_start, kernel_vma_limit;
257 struct gk20a *g = mm->g; 257 struct gk20a *g = mm->g;
258 struct gk20a_platform *p = gk20a_get_platform(g->dev);
259 258
260 if (WARN_ON(kernel_reserved + low_hole > aperture_size)) 259 if (WARN_ON(kernel_reserved + low_hole > aperture_size))
261 return -ENOMEM; 260 return -ENOMEM;
@@ -275,7 +274,7 @@ int nvgpu_init_vm(struct mm_gk20a *mm,
275 vm->vma[gmmu_page_size_small] = &vm->user; 274 vm->vma[gmmu_page_size_small] = &vm->user;
276 vm->vma[gmmu_page_size_big] = &vm->user; 275 vm->vma[gmmu_page_size_big] = &vm->user;
277 vm->vma[gmmu_page_size_kernel] = &vm->kernel; 276 vm->vma[gmmu_page_size_kernel] = &vm->kernel;
278 if (!p->unify_address_spaces) 277 if (!nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES))
279 vm->vma[gmmu_page_size_big] = &vm->user_lp; 278 vm->vma[gmmu_page_size_big] = &vm->user_lp;
280 279
281 vm->va_start = low_hole; 280 vm->va_start = low_hole;
@@ -293,7 +292,7 @@ int nvgpu_init_vm(struct mm_gk20a *mm,
293 292
294 /* Setup vma limits. */ 293 /* Setup vma limits. */
295 if (kernel_reserved + low_hole < aperture_size) { 294 if (kernel_reserved + low_hole < aperture_size) {
296 if (p->unify_address_spaces) { 295 if (nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES)) {
297 user_vma_start = low_hole; 296 user_vma_start = low_hole;
298 user_vma_limit = vm->va_limit - kernel_reserved; 297 user_vma_limit = vm->va_limit - kernel_reserved;
299 user_lp_vma_start = user_vma_limit; 298 user_lp_vma_start = user_vma_limit;
@@ -346,7 +345,7 @@ int nvgpu_init_vm(struct mm_gk20a *mm,
346 * Determine if big pages are possible in this VM. If a split address 345 * Determine if big pages are possible in this VM. If a split address
347 * space is used then check the user_lp vma instead of the user vma. 346 * space is used then check the user_lp vma instead of the user vma.
348 */ 347 */
349 if (p->unify_address_spaces) 348 if (nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES))
350 vm->big_pages = nvgpu_big_pages_possible(vm, user_vma_start, 349 vm->big_pages = nvgpu_big_pages_possible(vm, user_vma_start,
351 user_vma_limit - user_vma_start); 350 user_vma_limit - user_vma_start);
352 else 351 else
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 786a6693..53d22a7d 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -2432,12 +2432,12 @@ static enum gmmu_pgsz_gk20a __get_pte_size_split_addr(struct vm_gk20a *vm,
2432 */ 2432 */
2433enum gmmu_pgsz_gk20a __get_pte_size(struct vm_gk20a *vm, u64 base, u64 size) 2433enum gmmu_pgsz_gk20a __get_pte_size(struct vm_gk20a *vm, u64 base, u64 size)
2434{ 2434{
2435 struct gk20a_platform *p = gk20a_get_platform(vm->mm->g->dev); 2435 struct gk20a *g = gk20a_from_vm(vm);
2436 2436
2437 if (!vm->big_pages) 2437 if (!vm->big_pages)
2438 return gmmu_page_size_small; 2438 return gmmu_page_size_small;
2439 2439
2440 if (!p->unify_address_spaces) 2440 if (!nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES))
2441 return __get_pte_size_split_addr(vm, base, size); 2441 return __get_pte_size_split_addr(vm, base, size);
2442 2442
2443 if (base) 2443 if (base)
diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h
index 5d30ba12..a0b809ca 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h
@@ -29,6 +29,11 @@ struct gk20a;
29#define NVGPU_DRIVER_IS_DYING 2 29#define NVGPU_DRIVER_IS_DYING 2
30 30
31/* 31/*
32 * MM flags.
33 */
34#define NVGPU_MM_UNIFY_ADDRESS_SPACES 16
35
36/*
32 * Must be greater than the largest bit offset in the above list. 37 * Must be greater than the largest bit offset in the above list.
33 */ 38 */
34#define NVGPU_MAX_ENABLED_BITS 64 39#define NVGPU_MAX_ENABLED_BITS 64
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index a88d9e09..02cc5b47 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -245,6 +245,9 @@ static void vgpu_init_vars(struct gk20a *g, struct gk20a_platform *platform)
245 g->ptimer_src_freq = platform->ptimer_src_freq; 245 g->ptimer_src_freq = platform->ptimer_src_freq;
246 g->can_railgate = platform->can_railgate_init; 246 g->can_railgate = platform->can_railgate_init;
247 g->railgate_delay = platform->railgate_delay_init; 247 g->railgate_delay = platform->railgate_delay_init;
248
249 __nvgpu_set_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES,
250 platform->unify_address_spaces);
248} 251}
249 252
250static int vgpu_init_support(struct platform_device *pdev) 253static int vgpu_init_support(struct platform_device *pdev)