diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/fb/fb_gv100.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/fb/fb_gv100.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/fb/fb_gv100.c b/drivers/gpu/nvgpu/common/fb/fb_gv100.c index 848d6efb..4cae5312 100644 --- a/drivers/gpu/nvgpu/common/fb/fb_gv100.c +++ b/drivers/gpu/nvgpu/common/fb/fb_gv100.c | |||
@@ -281,3 +281,18 @@ int gv100_fb_enable_nvlink(struct gk20a *g) | |||
281 | 281 | ||
282 | return 0; | 282 | return 0; |
283 | } | 283 | } |
284 | |||
285 | size_t gv100_fb_get_vidmem_size(struct gk20a *g) | ||
286 | { | ||
287 | u32 range = gk20a_readl(g, fb_mmu_local_memory_range_r()); | ||
288 | u32 mag = fb_mmu_local_memory_range_lower_mag_v(range); | ||
289 | u32 scale = fb_mmu_local_memory_range_lower_scale_v(range); | ||
290 | u32 ecc = fb_mmu_local_memory_range_ecc_mode_v(range); | ||
291 | size_t bytes = ((size_t)mag << scale) * SZ_1M; | ||
292 | |||
293 | if (ecc) { | ||
294 | bytes = bytes / 16U * 15U; | ||
295 | } | ||
296 | |||
297 | return bytes; | ||
298 | } | ||