[PATCH] drm/amdgpu: Restore uncache behaviour on GFX12
Felix Kuehling
felix.kuehling at amd.com
Tue Jul 9 17:52:22 UTC 2024
On 2024-07-08 17:41, David Belanger wrote:
> Always use MTYPE_UC if UNCACHED flag is specified.
>
> This makes kernarg region uncached and it restores
> usermode cache disable debug flag functionality.
>
> Do not set MTYPE_UC for COHERENT flag, on GFX12 coherence is handled by
> shader code.
>
> Signed-off-by: David Belanger <david.belanger at amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 21 ++-------------------
> drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 8 +-------
> 2 files changed, 3 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> index fd3ac483760e..542225eb13b5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> @@ -498,9 +498,6 @@ static void gmc_v12_0_get_vm_pte(struct amdgpu_device *adev,
> uint64_t *flags)
> {
> struct amdgpu_bo *bo = mapping->bo_va->base.bo;
> - struct amdgpu_device *bo_adev;
> - bool coherent, is_system;
> -
>
> *flags &= ~AMDGPU_PTE_EXECUTABLE;
> *flags |= mapping->flags & AMDGPU_PTE_EXECUTABLE;
> @@ -516,25 +513,11 @@ static void gmc_v12_0_get_vm_pte(struct amdgpu_device *adev,
> *flags &= ~AMDGPU_PTE_VALID;
> }
>
> - if (!bo)
> - return;
> -
> - if (bo->flags & (AMDGPU_GEM_CREATE_COHERENT |
> - AMDGPU_GEM_CREATE_UNCACHED))
> - *flags = AMDGPU_PTE_MTYPE_GFX12(*flags, MTYPE_UC);
> -
> - bo_adev = amdgpu_ttm_adev(bo->tbo.bdev);
> - coherent = bo->flags & AMDGPU_GEM_CREATE_COHERENT;
> - is_system = (bo->tbo.resource->mem_type == TTM_PL_TT) ||
> - (bo->tbo.resource->mem_type == AMDGPU_PL_PREEMPT);
> -
> if (bo && bo->flags & AMDGPU_GEM_CREATE_GFX12_DCC)
> *flags |= AMDGPU_PTE_DCC;
>
> - /* WA for HW bug */
> - if (is_system || ((bo_adev != adev) && coherent))
> - *flags = AMDGPU_PTE_MTYPE_GFX12(*flags, MTYPE_NC);
> -
> + if (bo && bo->flags & AMDGPU_GEM_CREATE_UNCACHED)
> + *flags = AMDGPU_PTE_MTYPE_GFX12(*flags, MTYPE_UC);
> }
>
> static unsigned gmc_v12_0_get_vbios_fb_size(struct amdgpu_device *adev)
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index bd9c2921e0dc..7b671aefab01 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -1248,13 +1248,7 @@ svm_range_get_pte_flags(struct kfd_node *node,
> break;
> case IP_VERSION(12, 0, 0):
> case IP_VERSION(12, 0, 1):
> - if (domain == SVM_RANGE_VRAM_DOMAIN) {
> - if (bo_node != node)
> - mapping_flags |= AMDGPU_VM_MTYPE_NC;
> - } else {
> - mapping_flags |= coherent ?
> - AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC;
> - }
> + mapping_flags |= AMDGPU_VM_MTYPE_NC;
> break;
> default:
> mapping_flags |= coherent ?
More information about the amd-gfx
mailing list