diff options
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/mm_vgpu.c | 25 |
2 files changed, 18 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c index ea4fde79..ed65756a 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c | |||
@@ -59,6 +59,7 @@ struct gk20a_platform vgpu_tegra_platform = { | |||
59 | .enable_aelpg = false, | 59 | .enable_aelpg = false, |
60 | 60 | ||
61 | .probe = gk20a_tegra_probe, | 61 | .probe = gk20a_tegra_probe, |
62 | .default_big_page_size = SZ_128K, | ||
62 | 63 | ||
63 | .virtual_dev = true, | 64 | .virtual_dev = true, |
64 | }; | 65 | }; |
diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c index c1624ec8..adec4d31 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c | |||
@@ -17,10 +17,6 @@ | |||
17 | #include "vgpu/vgpu.h" | 17 | #include "vgpu/vgpu.h" |
18 | #include "gk20a/semaphore_gk20a.h" | 18 | #include "gk20a/semaphore_gk20a.h" |
19 | 19 | ||
20 | /* note: keep the page sizes sorted lowest to highest here */ | ||
21 | static const u32 gmmu_page_sizes[gmmu_nr_page_sizes] = { SZ_4K, SZ_128K }; | ||
22 | static const u32 gmmu_page_shifts[gmmu_nr_page_sizes] = { 12, 17 }; | ||
23 | |||
24 | static int vgpu_init_mm_setup_sw(struct gk20a *g) | 20 | static int vgpu_init_mm_setup_sw(struct gk20a *g) |
25 | { | 21 | { |
26 | struct mm_gk20a *mm = &g->mm; | 22 | struct mm_gk20a *mm = &g->mm; |
@@ -239,10 +235,18 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, | |||
239 | u64 vma_size; | 235 | u64 vma_size; |
240 | u32 num_pages, low_hole_pages; | 236 | u32 num_pages, low_hole_pages; |
241 | char name[32]; | 237 | char name[32]; |
242 | int err; | 238 | int err, i; |
239 | |||
240 | /* note: keep the page sizes sorted lowest to highest here */ | ||
241 | u32 gmmu_page_sizes[gmmu_nr_page_sizes] = { | ||
242 | SZ_4K, | ||
243 | big_page_size ? big_page_size : platform->default_big_page_size | ||
244 | }; | ||
243 | 245 | ||
244 | gk20a_dbg_fn(""); | 246 | gk20a_dbg_fn(""); |
245 | 247 | ||
248 | big_page_size = gmmu_page_sizes[gmmu_page_size_big]; | ||
249 | |||
246 | vm = kzalloc(sizeof(*vm), GFP_KERNEL); | 250 | vm = kzalloc(sizeof(*vm), GFP_KERNEL); |
247 | if (!vm) | 251 | if (!vm) |
248 | return -ENOMEM; | 252 | return -ENOMEM; |
@@ -252,6 +256,9 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, | |||
252 | vm->mm = mm; | 256 | vm->mm = mm; |
253 | vm->as_share = as_share; | 257 | vm->as_share = as_share; |
254 | 258 | ||
259 | for (i = 0; i < gmmu_nr_page_sizes; i++) | ||
260 | vm->gmmu_page_sizes[i] = gmmu_page_sizes[i]; | ||
261 | |||
255 | vm->big_pages = true; | 262 | vm->big_pages = true; |
256 | 263 | ||
257 | vm->va_start = big_page_size << 10; /* create a one pde hole */ | 264 | vm->va_start = big_page_size << 10; /* create a one pde hole */ |
@@ -273,11 +280,12 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, | |||
273 | 280 | ||
274 | snprintf(name, sizeof(name), "gk20a_as_%d-%dKB", as_share->id, | 281 | snprintf(name, sizeof(name), "gk20a_as_%d-%dKB", as_share->id, |
275 | gmmu_page_sizes[gmmu_page_size_small]>>10); | 282 | gmmu_page_sizes[gmmu_page_size_small]>>10); |
276 | num_pages = (u32)(vma_size >> gmmu_page_shifts[gmmu_page_size_small]); | 283 | num_pages = (u32)(vma_size >> |
284 | ilog2(gmmu_page_sizes[gmmu_page_size_small])); | ||
277 | 285 | ||
278 | /* num_pages above is without regard to the low-side hole. */ | 286 | /* num_pages above is without regard to the low-side hole. */ |
279 | low_hole_pages = (vm->va_start >> | 287 | low_hole_pages = (vm->va_start >> |
280 | gmmu_page_shifts[gmmu_page_size_small]); | 288 | ilog2(gmmu_page_sizes[gmmu_page_size_small])); |
281 | 289 | ||
282 | gk20a_allocator_init(&vm->vma[gmmu_page_size_small], name, | 290 | gk20a_allocator_init(&vm->vma[gmmu_page_size_small], name, |
283 | low_hole_pages, /* start */ | 291 | low_hole_pages, /* start */ |
@@ -287,7 +295,8 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, | |||
287 | snprintf(name, sizeof(name), "gk20a_as_%d-%dKB", as_share->id, | 295 | snprintf(name, sizeof(name), "gk20a_as_%d-%dKB", as_share->id, |
288 | gmmu_page_sizes[gmmu_page_size_big]>>10); | 296 | gmmu_page_sizes[gmmu_page_size_big]>>10); |
289 | 297 | ||
290 | num_pages = (u32)(vma_size >> gmmu_page_shifts[gmmu_page_size_big]); | 298 | num_pages = (u32)(vma_size >> |
299 | ilog2(gmmu_page_sizes[gmmu_page_size_big])); | ||
291 | gk20a_allocator_init(&vm->vma[gmmu_page_size_big], name, | 300 | gk20a_allocator_init(&vm->vma[gmmu_page_size_big], name, |
292 | num_pages, /* start */ | 301 | num_pages, /* start */ |
293 | num_pages, /* length */ | 302 | num_pages, /* length */ |