diff options
author | Nicolin Chen <nicolinc@nvidia.com> | 2018-08-30 17:34:52 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-04 19:16:55 -0400 |
commit | bd47d00ce736a421a3b4376ad996fdc877ccf0ca (patch) | |
tree | da3e014b79a8beac25dec722ed36cdcd0c32c140 | |
parent | 471be337187477e57f8ab08d04d22f19700c3ade (diff) |
gpu: nvgpu: Add a macro of totalram_size_in_mb
There are two (would be more) places calculating the ram size in MB from
page numbers, so this patch just simply adds a macro for simplification.
Bug 2327574
Bug 2284925
Change-Id: Ie5dc387d547e1b8ce98946f0637dc17a6897e5a6
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1810333
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/driver_common.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_linux.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c | 3 |
3 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/driver_common.c b/drivers/gpu/nvgpu/os/linux/driver_common.c index b81cc90c..4d345aaa 100644 --- a/drivers/gpu/nvgpu/os/linux/driver_common.c +++ b/drivers/gpu/nvgpu/os/linux/driver_common.c | |||
@@ -98,8 +98,7 @@ static void nvgpu_init_gr_vars(struct gk20a *g) | |||
98 | gk20a_init_gr(g); | 98 | gk20a_init_gr(g); |
99 | 99 | ||
100 | nvgpu_log_info(g, "total ram pages : %lu", totalram_pages); | 100 | nvgpu_log_info(g, "total ram pages : %lu", totalram_pages); |
101 | g->gr.max_comptag_mem = totalram_pages | 101 | g->gr.max_comptag_mem = totalram_size_in_mb; |
102 | >> (10 - (PAGE_SHIFT - 10)); | ||
103 | 102 | ||
104 | /* Deduct the part taken by the running system */ | 103 | /* Deduct the part taken by the running system */ |
105 | if (platform->comptag_mem_deduct && | 104 | if (platform->comptag_mem_deduct && |
diff --git a/drivers/gpu/nvgpu/os/linux/os_linux.h b/drivers/gpu/nvgpu/os/linux/os_linux.h index 13c20a81..5f35db09 100644 --- a/drivers/gpu/nvgpu/os/linux/os_linux.h +++ b/drivers/gpu/nvgpu/os/linux/os_linux.h | |||
@@ -165,4 +165,6 @@ static inline struct device *dev_from_gk20a(struct gk20a *g) | |||
165 | 165 | ||
166 | #define INTERFACE_NAME "nvhost%s-gpu" | 166 | #define INTERFACE_NAME "nvhost%s-gpu" |
167 | 167 | ||
168 | #define totalram_size_in_mb (totalram_pages >> (10 - (PAGE_SHIFT - 10))) | ||
169 | |||
168 | #endif | 170 | #endif |
diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c index 83191316..33c067c6 100644 --- a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c +++ b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c | |||
@@ -439,8 +439,7 @@ int vgpu_probe(struct platform_device *pdev) | |||
439 | gk20a_init_gr(gk20a); | 439 | gk20a_init_gr(gk20a); |
440 | 440 | ||
441 | nvgpu_log_info(gk20a, "total ram pages : %lu", totalram_pages); | 441 | nvgpu_log_info(gk20a, "total ram pages : %lu", totalram_pages); |
442 | gk20a->gr.max_comptag_mem = totalram_pages | 442 | gk20a->gr.max_comptag_mem = totalram_size_in_mb; |
443 | >> (10 - (PAGE_SHIFT - 10)); | ||
444 | 443 | ||
445 | nvgpu_ref_init(&gk20a->refcount); | 444 | nvgpu_ref_init(&gk20a->refcount); |
446 | 445 | ||