AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Timur Kristóf" <timur.kristof@gmail.com>
To: natalie.vock@gmx.de, honghuan@amd.com, Alexander.Deucher@amd.com,
	Felix.Kuehling@amd.com, Philip.Yang@amd.com, cascardo@igalia.com,
	tvrtko.ursulin@igalia.com, christian.koenig@amd.com
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/9] drm/amdgpu: fix cleared PDE/PTE flag generation
Date: Mon, 28 Sep 2026 15:08:39 -0400	[thread overview]
Message-ID: <P3WG6T-ATwauPO6Yp0bWtQ@gmail.com> (raw)
In-Reply-To: <20260928151041.1857-2-christian.koenig@amd.com>

On 2026. szeptember 28., hétfő 11:10:34 keleti államokbeli nyári idő Christian 
König wrote:
> That was broken since adding the NPA support.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 64 ++++++++++++-----------
>  1 file changed, 33 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c index
> c03327f1242d3..e8f441e018839 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> @@ -346,6 +346,33 @@ 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)
> +{
> +	uint64_t flags;
> +
> +	if (adev->asic_type < CHIP_VEGA10)
> +		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);
> +	} else if (vm->is_npa) {
> +		flags = adev->gmc.noretry_flags;
> +	} else {
> +		/* Workaround for fault priority problem on GMC9 */
> +		flags = AMDGPU_PTE_EXECUTABLE | adev->gmc.init_pte_flags;
> +	}
> +
> +	return flags;
> +}
> +
>  /**
>   * amdgpu_vm_pt_clear - initially clear the PDs/PTs
>   *
> @@ -366,10 +393,9 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev,
> struct amdgpu_vm *vm, struct ttm_operation_ctx ctx = { true, false };
>  	struct amdgpu_vm_update_params params;
>  	struct amdgpu_bo *ancestor = &vmbo->bo;
> -	unsigned int entries;
>  	struct amdgpu_bo *bo = &vmbo->bo;
> -	uint64_t value = 0, flags = 0;
> -	uint64_t addr;
> +	unsigned int entries;
> +	uint64_t flags;
>  	int r, idx;
> 
>  	/* Figure out our place in the hierarchy */
> @@ -404,26 +430,8 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev,
> struct amdgpu_vm *vm, if (r)
>  		goto exit;
> 
> -	addr = 0;
> -
> -	if (adev->asic_type >= CHIP_VEGA10) {
> -		if (level != AMDGPU_VM_PTB) {
> -			if (vm->is_npa)
> -				flags = adev->gmc.noretry_flags;
> -			/* Handle leaf PDEs as PTEs */
> -			flags |= AMDGPU_PDE_PTE_FLAG(adev);
> -			amdgpu_gmc_get_vm_pde(adev, level,
> -					      &value, &flags);
> -		} else if (vm->is_npa) {
> -			flags = adev->gmc.noretry_flags;
> -		} else {
> -			/* Workaround for fault priority problem on 
GMC9 */
> -			flags = AMDGPU_PTE_EXECUTABLE | adev-
>gmc.init_pte_flags;
> -		}
> -	}
> -
> -	r = vm->update_funcs->update(&params, vmbo, addr, 0, entries,
> -				     value, flags);
> +	flags = amdgpu_vm_pt_clear_flags(adev, vm, level);
> +	r = vm->update_funcs->update(&params, vmbo, 0, 0, entries, 0, 
flags);
>  	if (r)
>  		goto exit;
> 
> @@ -712,15 +720,9 @@ static void amdgpu_vm_pte_update_flags(struct
> amdgpu_vm_update_params *params, flags |=
> AMDGPU_PDE_PTE_FLAG(params->adev);
>  		amdgpu_gmc_get_vm_pde(adev, level, &addr, &flags);
> 
> -	} else if (adev->asic_type >= CHIP_VEGA10 &&
> -		   !(flags & AMDGPU_PTE_VALID) &&
> +	} else if (!(flags & AMDGPU_PTE_VALID) &&
>  		   !(flags & AMDGPU_PTE_PRT_FLAG(params->adev))) {
> -
> -		/* Workaround for fault priority problem on GMC9 and 
GFX12,
> -		 * EXECUTABLE for GMC9 fault priority and init_pte_flags
> -		 * (e.g. AMDGPU_PTE_IS_PTE on GFX12)
> -		 */
> -		flags |= AMDGPU_PTE_EXECUTABLE | adev-
>gmc.init_pte_flags;
> +		flags |= amdgpu_vm_pt_clear_flags(adev, params->vm, 
level);
>  	}
> 
>  	/*





  reply	other threads:[~2026-09-28 19:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 15:10 [PATCH 1/9] drm/amdgpu: rework eviction lock handling into critical section v3 Christian König
2026-09-28 15:10 ` [PATCH 2/9] drm/amdgpu: fix cleared PDE/PTE flag generation Christian König
2026-09-28 19:08   ` Timur Kristóf [this message]
2026-09-30  9:02     ` Christian König
2026-09-30 14:44       ` Kuehling, Felix
2026-09-30 14:59         ` Christian König
2026-09-30 16:12           ` Kuehling, Felix
2026-10-01  6:24             ` Christian König
2026-10-01 13:36             ` Mukul Joshi
2026-10-01 13:49               ` Joshi, Mukul
2026-09-28 15:10 ` [PATCH 3/9] drm/amdgpu: allocate and fill dummy PDs/PTs Christian König
2026-09-28 19:02   ` Timur Kristóf
2026-09-28 15:10 ` [PATCH 4/9] drm/amdgpu: add amdgpu_vm_pt_leaves() v2 Christian König
2026-09-28 19:07   ` Timur Kristóf
2026-09-28 15:10 ` [PATCH 5/9] drm/amdgpu: drop immediate updates from amdgpu_vm_update_range Christian König
2026-09-28 15:10 ` [PATCH 6/9] drm/amdgpu: drop immediate updates from amdgpu_vm_update_pdes Christian König
2026-09-28 19:09   ` Timur Kristóf
2026-09-28 15:10 ` [PATCH 7/9] drm/amdgpu: split amdgpu_vm_update_range v3 Christian König
2026-09-30 16:30   ` Kuehling, Felix
2026-09-28 15:10 ` [PATCH 8/9] drm/amdgpu: fix the HMM range handling for KFD SVM v2 Christian König
2026-09-30 16:44   ` Kuehling, Felix
2026-10-01 20:30     ` Olivier Kaloudoff
2026-09-28 15:10 ` [PATCH 9/9] drm/amdgpu: use range unmap in amdgpu_vm_clear_freed Christian König
2026-09-28 19:08 ` [PATCH 1/9] drm/amdgpu: rework eviction lock handling into critical section v3 Timur Kristóf
2026-09-29 14:07 ` Huang, Honglei

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=P3WG6T-ATwauPO6Yp0bWtQ@gmail.com \
    --to=timur.kristof@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Philip.Yang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=cascardo@igalia.com \
    --cc=christian.koenig@amd.com \
    --cc=honghuan@amd.com \
    --cc=natalie.vock@gmx.de \
    --cc=tvrtko.ursulin@igalia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox