diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/dma.c | 13 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c index eff60f5b..46b49930 100644 --- a/drivers/gpu/nvgpu/common/linux/dma.c +++ b/drivers/gpu/nvgpu/common/linux/dma.c | |||
@@ -100,9 +100,11 @@ static void __dma_dbg(struct gk20a *g, size_t size, unsigned long flags, | |||
100 | 100 | ||
101 | __nvgpu_log_dbg(g, gpu_dbg_dma, | 101 | __nvgpu_log_dbg(g, gpu_dbg_dma, |
102 | __func__, __LINE__, | 102 | __func__, __LINE__, |
103 | "DMA %s: [%s] size=%-7zu aligned=%-7zu %s", | 103 | "DMA %s: [%s] size=%-7zu " |
104 | "aligned=%-7zu total=%-10llukB %s", | ||
104 | what, type, | 105 | what, type, |
105 | size, PAGE_ALIGN(size), | 106 | size, PAGE_ALIGN(size), |
107 | g->dma_memory_used >> 10, | ||
106 | flags_str); | 108 | flags_str); |
107 | 109 | ||
108 | if (flags_str) | 110 | if (flags_str) |
@@ -207,6 +209,12 @@ int nvgpu_dma_alloc_flags_sys(struct gk20a *g, unsigned long flags, | |||
207 | int err; | 209 | int err; |
208 | dma_addr_t iova; | 210 | dma_addr_t iova; |
209 | 211 | ||
212 | /* | ||
213 | * Before the debug print so we see this in the total. But during | ||
214 | * cleanup in the fail path this has to be subtracted. | ||
215 | */ | ||
216 | g->dma_memory_used += mem->aligned_size; | ||
217 | |||
210 | dma_dbg_alloc(g, size, flags, "sysmem"); | 218 | dma_dbg_alloc(g, size, flags, "sysmem"); |
211 | 219 | ||
212 | /* | 220 | /* |
@@ -261,6 +269,7 @@ int nvgpu_dma_alloc_flags_sys(struct gk20a *g, unsigned long flags, | |||
261 | return 0; | 269 | return 0; |
262 | 270 | ||
263 | fail_free: | 271 | fail_free: |
272 | g->dma_memory_used -= mem->aligned_size; | ||
264 | dma_free_coherent(d, size, mem->cpu_va, iova); | 273 | dma_free_coherent(d, size, mem->cpu_va, iova); |
265 | mem->cpu_va = NULL; | 274 | mem->cpu_va = NULL; |
266 | mem->priv.sgt = NULL; | 275 | mem->priv.sgt = NULL; |
@@ -452,6 +461,8 @@ static void nvgpu_dma_free_sys(struct gk20a *g, struct nvgpu_mem *mem) | |||
452 | { | 461 | { |
453 | struct device *d = dev_from_gk20a(g); | 462 | struct device *d = dev_from_gk20a(g); |
454 | 463 | ||
464 | g->dma_memory_used -= mem->aligned_size; | ||
465 | |||
455 | dma_dbg_free(g, mem->size, mem->priv.flags, "sysmem"); | 466 | dma_dbg_free(g, mem->size, mem->priv.flags, "sysmem"); |
456 | 467 | ||
457 | if (!(mem->mem_flags & NVGPU_MEM_FLAG_SHADOW_COPY) && | 468 | if (!(mem->mem_flags & NVGPU_MEM_FLAG_SHADOW_COPY) && |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 8ac82428..48b34db7 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -1269,6 +1269,8 @@ struct gk20a { | |||
1269 | /* memory training sequence and mclk switch scripts */ | 1269 | /* memory training sequence and mclk switch scripts */ |
1270 | u32 mem_config_idx; | 1270 | u32 mem_config_idx; |
1271 | 1271 | ||
1272 | u64 dma_memory_used; | ||
1273 | |||
1272 | #if defined(CONFIG_TEGRA_GK20A_NVHOST) && defined(CONFIG_TEGRA_19x_GPU) | 1274 | #if defined(CONFIG_TEGRA_GK20A_NVHOST) && defined(CONFIG_TEGRA_19x_GPU) |
1273 | phys_addr_t syncpt_unit_base; | 1275 | phys_addr_t syncpt_unit_base; |
1274 | size_t syncpt_unit_size; | 1276 | size_t syncpt_unit_size; |