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 <rizhao@nvidia.com>
Change-Id: I7779169793e32d396db187d6e6e072d6f194e91e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2548471
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Dinesh T <dt@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Richard Zhao
2021-06-22 10:58:00 -07:00
committed by mobile promotions
parent 61173ed198
commit cecb0666f6

View File

@@ -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);
}