diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2016-05-20 02:12:23 -0400 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-06-08 15:05:05 -0400 |
commit | d215bc1107a8a032d18e515e55d5e29c7192f15e (patch) | |
tree | 2873d7d453cd727d7ee865b9f73408be3ec92539 /drivers/gpu/nvgpu/gk20a | |
parent | 2219f38727ffa17291e15c1898bd3e65f43d09fd (diff) |
gpu: nvgpu: detect vidmem configuration from HW
Read video memory size from hardware during initialization for devices
that support it.
JIRA DNVGPU-14
Change-Id: If190f2d89f7148520ee274ca674f972987c8056d
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/1157215
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 15 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index c7d12f86..6622dad0 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -524,6 +524,7 @@ struct gpu_ops { | |||
524 | u64 (*get_iova_addr)(struct gk20a *g, struct scatterlist *sgl, | 524 | u64 (*get_iova_addr)(struct gk20a *g, struct scatterlist *sgl, |
525 | u32 flags); | 525 | u32 flags); |
526 | int (*bar1_bind)(struct gk20a *g, u64 bar1_iova); | 526 | int (*bar1_bind)(struct gk20a *g, u64 bar1_iova); |
527 | size_t (*get_vidmem_size)(struct gk20a *g); | ||
527 | } mm; | 528 | } mm; |
528 | struct { | 529 | struct { |
529 | int (*init_therm_setup_hw)(struct gk20a *g); | 530 | int (*init_therm_setup_hw)(struct gk20a *g); |
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 6505015f..60c1b7ea 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -613,6 +613,20 @@ static void gk20a_init_pramin(struct mm_gk20a *mm) | |||
613 | mm->force_pramin = GK20A_FORCE_PRAMIN_DEFAULT; | 613 | mm->force_pramin = GK20A_FORCE_PRAMIN_DEFAULT; |
614 | } | 614 | } |
615 | 615 | ||
616 | static int gk20a_init_vidmem(struct mm_gk20a *mm) | ||
617 | { | ||
618 | struct gk20a *g = mm->g; | ||
619 | size_t size = g->ops.mm.get_vidmem_size ? | ||
620 | g->ops.mm.get_vidmem_size(g) : 0; | ||
621 | |||
622 | if (!size) | ||
623 | return 0; | ||
624 | |||
625 | mm->vidmem_size = size; | ||
626 | |||
627 | return 0; | ||
628 | } | ||
629 | |||
616 | int gk20a_init_mm_setup_sw(struct gk20a *g) | 630 | int gk20a_init_mm_setup_sw(struct gk20a *g) |
617 | { | 631 | { |
618 | struct mm_gk20a *mm = &g->mm; | 632 | struct mm_gk20a *mm = &g->mm; |
@@ -637,6 +651,7 @@ int gk20a_init_mm_setup_sw(struct gk20a *g) | |||
637 | (int)(mm->channel.kernel_size >> 20)); | 651 | (int)(mm->channel.kernel_size >> 20)); |
638 | 652 | ||
639 | gk20a_init_pramin(mm); | 653 | gk20a_init_pramin(mm); |
654 | gk20a_init_vidmem(mm); | ||
640 | 655 | ||
641 | err = gk20a_alloc_sysmem_flush(g); | 656 | err = gk20a_alloc_sysmem_flush(g); |
642 | if (err) | 657 | if (err) |
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index e83e1111..590ede71 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h | |||
@@ -372,6 +372,8 @@ struct mm_gk20a { | |||
372 | #else | 372 | #else |
373 | bool force_pramin; /* via debugfs */ | 373 | bool force_pramin; /* via debugfs */ |
374 | #endif | 374 | #endif |
375 | |||
376 | size_t vidmem_size; | ||
375 | }; | 377 | }; |
376 | 378 | ||
377 | int gk20a_mm_init(struct mm_gk20a *mm); | 379 | int gk20a_mm_init(struct mm_gk20a *mm); |