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 10:45:17 +0100 [thread overview]
Message-ID: <a1bb8bee-2c1e-4623-ab31-0bfbdf700b8b@amd.com> (raw)
In-Reply-To: <20261126073232.2108102-1-bobzhou2@amd.com>
On 11/26/26 08:32, 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.
^^ we should probably stop doing such hacks.
>
> amdgpu_vm_pt_clear_flags() drops that address and amdgpu_vm_pt_clear()
> writes 0 instead.Hand the address back to the caller and write it again.
>
> Fixes: 6250a8342784 ("drm/amdgpu: fix cleared PDE/PTE flag generation")
> Signed-off-by: Bob Zhou <bobzhou2@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 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..6aabd9f5291c2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> @@ -349,7 +349,7 @@ static void amdgpu_vm_pt_next_dfs(struct amdgpu_device *adev,
> /* 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)
> + unsigned int level, uint64_t *addr)
If we need multiple return values please make amdgpu_vm_pt_clear_flags() return void and give flags as parameter.
Apart from that looks good to me.
Thanks a lot for figuring that out,
Christian.
> {
> uint64_t flags;
>
> @@ -357,12 +357,10 @@ static uint64_t amdgpu_vm_pt_clear_flags(struct amdgpu_device *adev,
> return 0;
>
> if (level != AMDGPU_VM_PTB) {
> - uint64_t value = 0;
> -
> flags = AMDGPU_PDE_PTE_FLAG(adev);
> if (vm->is_npa)
> flags |= adev->gmc.noretry_flags;
> - amdgpu_gmc_get_vm_pde(adev, level, &value, &flags);
> + amdgpu_gmc_get_vm_pde(adev, level, addr, &flags);
> } else if (vm->is_npa) {
> flags = adev->gmc.noretry_flags;
> } else {
> @@ -395,7 +393,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;
> int r, idx;
>
> /* Figure out our place in the hierarchy */
> @@ -430,8 +428,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(¶ms, vmbo, 0, 0, entries, 0, flags);
> + flags = amdgpu_vm_pt_clear_flags(adev, vm, level, &value);
> + r = vm->update_funcs->update(¶ms, vmbo, 0, 0, entries, value,
> + flags);
> if (r)
> goto exit;
>
> @@ -724,7 +723,8 @@ 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);
> + flags |= amdgpu_vm_pt_clear_flags(adev, params->vm, level,
> + &addr);
> }
>
> /*
next prev parent reply other threads:[~2026-11-26 9:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 7:32 [PATCH] drm/amdgpu: keep the address of cleared PDEs with translate further Bob Zhou
2026-11-26 7:52 ` sashiko-bot
2026-11-26 9:45 ` Christian König [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-11-26 10:19 Bob Zhou
2026-11-26 10:35 ` Christian König
2026-11-26 10:40 ` sashiko-bot
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=a1bb8bee-2c1e-4623-ab31-0bfbdf700b8b@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.