From cecb0666f6f46139040fb85f0e3613e3ebe107c2 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Tue, 22 Jun 2021 10:58:00 -0700 Subject: [PATCH] gpu: nvgpu: pd_cache: always zero partial on free After a partial cache is freed, it is possible to be re-used next time. So always zero the partial on free. Jira GVSCI-10977 Signed-off-by: Richard Zhao Change-Id: I7779169793e32d396db187d6e6e072d6f194e91e Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2548471 Reviewed-by: Sachin Nikam Reviewed-by: svcacv Reviewed-by: Alex Waterman Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: svc_kernel_abi Reviewed-by: Dinesh T Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/mm/gmmu/pd_cache.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/nvgpu/common/mm/gmmu/pd_cache.c b/drivers/gpu/nvgpu/common/mm/gmmu/pd_cache.c index ff41343ff..4a7b15eaa 100644 --- a/drivers/gpu/nvgpu/common/mm/gmmu/pd_cache.c +++ b/drivers/gpu/nvgpu/common/mm/gmmu/pd_cache.c @@ -441,16 +441,9 @@ static void nvgpu_pd_cache_do_free(struct gk20a *g, * Partially full still. If it was already on the partial list * this just re-adds it. * - * Since the memory used for the entries is still mapped, if - * igpu make sure the entries are invalidated so that the hw - * doesn't acccidentally try to prefetch non-existent fb memory. - * - * As IOMMU prefetching of invalid pd entries cause the IOMMU fault, - * fill them with zero. + * Zero the memory for reusing. */ - if ((nvgpu_iommuable(g)) && - (NVGPU_PD_CACHE_SIZE > NVGPU_CPU_SMALL_PAGE_SIZE) && - (pd->mem->cpu_va != NULL)) { + if (pd->mem->cpu_va != NULL) { (void)memset(((u8 *)pd->mem->cpu_va + pd->mem_offs), 0, pd->pd_size); }