All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Bob Zhou <bobzhou2@amd.com>,
	amd-gfx@lists.freedesktop.org, Hawking.Zhang@amd.com,
	Alexander.Deucher@amd.com, Mukul.Joshi@amd.com,
	Felix.Kuehling@amd.com, Philip.Yang@amd.com
Subject: Re: [PATCH] drm/amdgpu: keep the address of cleared PDEs with translate further
Date: Thu, 26 Nov 2026 11:35:04 +0100	[thread overview]
Message-ID: <44e5f985-0125-4aea-8b3d-71efa13fa375@amd.com> (raw)
In-Reply-To: <20261126101946.2651048-1-bobzhou2@amd.com>

On 11/26/26 11:19, Bob Zhou wrote:
> Commit 37a0bad677a7 ("drm/amdgpu: Update PTE flags with TF enabled")
> made gmc_v9_0_get_vm_pde() set bit 12 in the address of an invalid PDB0
> entry, because with translate further consecutive invalid entries which
> read as 0 are considered a fault.
> 
> amdgpu_vm_pt_clear_flags() drops that address and amdgpu_vm_pt_clear()
> writes 0 instead. Return both the address and the flags to the caller
> and write the address again.
> 
> Fixes: 6250a8342784 ("drm/amdgpu: fix cleared PDE/PTE flag generation")
> Signed-off-by: Bob Zhou <bobzhou2@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 36 ++++++++++-------------
>  1 file changed, 16 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> index a6d389c08524f..8f1e0bc7d65ae 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> @@ -346,31 +346,26 @@ static void amdgpu_vm_pt_next_dfs(struct amdgpu_device *adev,
>  	     amdgpu_vm_pt_continue_dfs((start), (entry));			\
>  	     (entry) = (cursor).entry, amdgpu_vm_pt_next_dfs((adev), &(cursor)))
>  
> -/* Return the flags used for cleared PDEs/PTES */
> -static uint64_t amdgpu_vm_pt_clear_flags(struct amdgpu_device *adev,
> -					struct amdgpu_vm *vm,
> -					unsigned int level)
> +/* Set @addr and @flags for cleared PDEs/PTEs */
> +static void amdgpu_vm_pt_clear_flags(struct amdgpu_device *adev,
> +				     struct amdgpu_vm *vm,
> +				     unsigned int level, uint64_t *addr,
> +				     uint64_t *flags)
>  {
> -	uint64_t flags;
> -
>  	if (adev->asic_type < CHIP_VEGA10)
> -		return 0;
> +		return;
>  
>  	if (level != AMDGPU_VM_PTB) {
> -		uint64_t value = 0;
> -
> -		flags = AMDGPU_PDE_PTE_FLAG(adev);
> +		*flags |= AMDGPU_PDE_PTE_FLAG(adev);
>  		if (vm->is_npa)
> -			flags |= adev->gmc.noretry_flags;
> -		amdgpu_gmc_get_vm_pde(adev, level, &value, &flags);
> +			*flags |= adev->gmc.noretry_flags;
> +		amdgpu_gmc_get_vm_pde(adev, level, addr, flags);
>  	} else if (vm->is_npa) {
> -		flags = adev->gmc.noretry_flags;
> +		*flags |= adev->gmc.noretry_flags;
>  	} else {
>  		/* Workaround for fault priority problem on GMC9 */
> -		flags = AMDGPU_PTE_EXECUTABLE | adev->gmc.init_pte_flags;
> +		*flags |= AMDGPU_PTE_EXECUTABLE | adev->gmc.init_pte_flags;
>  	}
> -
> -	return flags;
>  }
>  
>  /**
> @@ -395,7 +390,7 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>  	struct amdgpu_bo *ancestor = &vmbo->bo;
>  	struct amdgpu_bo *bo = &vmbo->bo;
>  	unsigned int entries;
> -	uint64_t flags;
> +	uint64_t value = 0, flags = 0;
>  	int r, idx;
>  
>  	/* Figure out our place in the hierarchy */
> @@ -430,8 +425,9 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>  	if (r)
>  		goto exit;
>  
> -	flags = amdgpu_vm_pt_clear_flags(adev, vm, level);
> -	r = vm->update_funcs->update(&params, vmbo, 0, 0, entries, 0, flags);
> +	amdgpu_vm_pt_clear_flags(adev, vm, level, &value, &flags);
> +	r = vm->update_funcs->update(&params, vmbo, 0, 0, entries, value,
> +				     flags);
>  	if (r)
>  		goto exit;
>  
> @@ -724,7 +720,7 @@ static void amdgpu_vm_pte_update_flags(struct amdgpu_vm_update_params *params,
>  
>  	} else if (!(flags & AMDGPU_PTE_VALID) &&
>  		   !(flags & AMDGPU_PTE_PRT_FLAG(params->adev))) {
> -		flags |= amdgpu_vm_pt_clear_flags(adev, params->vm, level);
> +		amdgpu_vm_pt_clear_flags(adev, params->vm, level, &addr, &flags);
>  	}
>  
>  	/*


  reply	other threads:[~2026-11-26 10:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 10:19 [PATCH] drm/amdgpu: keep the address of cleared PDEs with translate further Bob Zhou
2026-11-26 10:35 ` Christian König [this message]
2026-11-26 10:40 ` sashiko-bot
  -- strict thread matches above, loose matches on Subject: below --
2026-11-26  7:32 Bob Zhou
2026-11-26  7:52 ` sashiko-bot
2026-11-26  9:45 ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44e5f985-0125-4aea-8b3d-71efa13fa375@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Mukul.Joshi@amd.com \
    --cc=Philip.Yang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bobzhou2@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.