gpu: nvgpu: update pd clear condition to address IOMMU prefetch issue

IOMMU fault is observed with 64KB PAGE_SIZE. This is due to IOMMU
prefetching stale/invalid pd entries. IOMMU can prefetch more
than 4K worth of entries.

Clear pd when NVGPU_PD_CACHE_SIZE is more than 4K.

Bug 200719161

Change-Id: Iac2a9bcfbcfaa36840da1fa85594520a6fd4eaaf
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2521912
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@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: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2021-04-28 22:39:17 +05:30
committed by mobile promotions
parent c041ad5b4b
commit 44c4611fda
2 changed files with 5 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2017-2021, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -449,7 +449,7 @@ static void nvgpu_pd_cache_do_free(struct gk20a *g,
* fill them with zero.
*/
if ((nvgpu_iommuable(g)) &&
(NVGPU_PD_CACHE_SIZE > PAGE_SIZE) &&
(NVGPU_PD_CACHE_SIZE > NVGPU_CPU_SMALL_PAGE_SIZE) &&
(pd->mem->cpu_va != NULL)) {
(void)memset(((u8 *)pd->mem->cpu_va + pd->mem_offs), 0,
pd->pd_size);

View File

@@ -36,7 +36,9 @@
* PAGE_SIZE is OS specific and can vary across OSes. Depending on the OS it maybe
* defined to 4K or 64K.
*/
#define NVGPU_CPU_PAGE_SIZE PAGE_SIZE
#define NVGPU_CPU_PAGE_SIZE PAGE_SIZE
#define NVGPU_CPU_SMALL_PAGE_SIZE 4096U
/**
* @file