[PATCH] drm/amdkfd: Correct the GFX12 memory type setting

Alex Deucher alexdeucher at gmail.com
Fri May 17 15:51:38 UTC 2024


On Fri, May 17, 2024 at 3:07 AM Shane Xiao <shane.xiao at amd.com> wrote:
>
> This patch fixes the GFX12 memory type to NC. Since
> the Memory type can be overwritten by the previous
> operations, the GFX12 MTYPE bits need to be clear
> before setting to NC.
>
> Signed-off-by: longlyao <Longlong.Yao at amd.com>
> Signed-off-by: Shane Xiao <shane.xiao at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> index e2c6ec3cc4f3..6246d1dc0d30 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
> @@ -534,7 +534,8 @@ static void gmc_v12_0_get_vm_pte(struct amdgpu_device *adev,
>
>         /* WA for HW bug */
>         if (is_system || ((bo_adev != adev) && coherent))
> -               *flags |= AMDGPU_PTE_MTYPE_GFX12(MTYPE_NC);
> +               *flags |= (*flags & ~AMDGPU_PTE_MTYPE_GFX12_MASK) |
> +                       AMDGPU_PTE_MTYPE_GFX12(MTYPE_NC);

Maybe we should make the AMDGPU_PTE_MTYPE_GFX12() macro clear the
current field before setting the new one?  That would align with the
similar register field macros.

Alex

>
>  }
>
> --
> 2.25.1
>


More information about the amd-gfx mailing list