All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Timur Kristóf" <timur.kristof@gmail.com>
To: amd-gfx@lists.freedesktop.org,
	Felix Kuehling <Felix.Kuehling@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Alex Deucher <alexdeucher@gmail.com>,
	christian.koenig@amd.com, Philip Yang <yangp@amd.com>,
	Donet Tom <donettom@linux.ibm.com>
Cc: David.YatSin@amd.com, Kent.Russell@amd.com,
	Ritesh Harjani <ritesh.list@gmail.com>,
	Vaidyanathan Srinivasan <svaidy@linux.ibm.com>,
	donettom@linux.ibm.com
Subject: Re: [PATCH v3] drm/amdgpu: Fix incorrect VRAM GART mappings on non-4K page size systems
Date: Wed, 27 May 2026 16:34:33 +0200	[thread overview]
Message-ID: <10065023.eNJFYEL58v@timur-max> (raw)
In-Reply-To: <20260527131931.1133797-1-donettom@linux.ibm.com>

On 2026. május 27., szerda 15:19:31 közép-európai nyári idő Donet Tom wrote:
> When mapping VRAM pages into the GART page table,
> amdgpu_gart_map_vram_range() assumes that the system page size is the
> same as the GPU page size.
> 
> On systems with non-4K page sizes, multiple GPU pages can exist within
> a single CPU page. As a result, the mappings are created incorrectly
> because fewer page table entries are programmed than required.
> 
> Fix this by programming the mappings correctly for non-4K page size
> systems.
> 
> Fixes: 237d623ae659 ("drm/amdgpu/gart: Add helper to bind VRAM pages (v2)")
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Donet Tom <donettom@linux.ibm.com>
> ---

Thank you! The fix looks good to me.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>


> v2 -> v3
> - Addressed Christian's review comments and added the Reviewed-by tag.
> 
> v2 -
> https://lore.kernel.org/all/20260527111750.1084088-1-donettom@linux.ibm.com
> / v1 -
> https://lore.kernel.org/all/20260522112838.1311531-1-donettom@linux.ibm.com
> / ---
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c index b6f849d51c2e..c4c21dbbbdbf
> 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
> @@ -394,7 +394,8 @@ void amdgpu_gart_map_vram_range(struct amdgpu_device
> *adev, uint64_t pa, uint64_t start_page, uint64_t num_pages,
>  				uint64_t flags, void *dst)
>  {
> -	u32 i, idx;
> +	u32 i, j, t, idx;
> +	u64 page_base;
> 
>  	/* The SYSTEM flag indicates the pages aren't in VRAM. */
>  	WARN_ON_ONCE(flags & AMDGPU_PTE_SYSTEM);
> @@ -402,9 +403,12 @@ void amdgpu_gart_map_vram_range(struct amdgpu_device
> *adev, uint64_t pa, if (!drm_dev_enter(adev_to_drm(adev), &idx))
>  		return;
> 
> -	for (i = 0; i < num_pages; ++i) {
> -		amdgpu_gmc_set_pte_pde(adev, dst,
> -			start_page + i, pa + AMDGPU_GPU_PAGE_SIZE * 
i, flags);
> +	page_base = pa;
> +	for (i = 0, t = 0; i < num_pages; i++) {
> +		for (j = 0; j < AMDGPU_GPU_PAGES_IN_CPU_PAGE; j++, t++) 
{
> +			amdgpu_gmc_set_pte_pde(adev, dst, start_page 
+ t, page_base, flags);
> +			page_base += AMDGPU_GPU_PAGE_SIZE;
> +		}
>  	}
> 
>  	drm_dev_exit(idx);





  reply	other threads:[~2026-05-27 14:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 13:19 [PATCH v3] drm/amdgpu: Fix incorrect VRAM GART mappings on non-4K page size systems Donet Tom
2026-05-27 14:34 ` Timur Kristóf [this message]
2026-05-27 22:23   ` Alex Deucher

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=10065023.eNJFYEL58v@timur-max \
    --to=timur.kristof@gmail.com \
    --cc=David.YatSin@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Kent.Russell@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=donettom@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=svaidy@linux.ibm.com \
    --cc=yangp@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.