AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "Timur Kristóf" <timur.kristof@gmail.com>,
	amd-gfx@lists.freedesktop.org, alexander.deucher@amd.com
Subject: Re: [PATCH 2/7] drm/amdgpu/vce: Align VCPU BO to nearest power of two
Date: Mon, 20 Apr 2026 15:52:03 +0200	[thread overview]
Message-ID: <33cb52f5-14b3-44a5-b075-db6cd3ce4547@amd.com> (raw)
In-Reply-To: <20260420121044.155030-3-timur.kristof@gmail.com>

On 4/20/26 14:10, Timur Kristóf wrote:
> VCE accesses memory, including its firmware, through a BAR.
> It works slightly differently on each generation.
> In case of VCE1, the start address of this BAR is zero
> and we can't change it due to the firmware validation mechanism.
> 
> Align the VCE VCPU BO to the nearest power of two after the
> byte size of the BO in order to prevent it from crossing the
> boundaries of its BAR.
> 
> Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)")
> Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> index efdebd9c0a1f3..0658f13f0bdf7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> @@ -218,7 +218,8 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
>  	if (!adev->vce.fw)
>  		return -ENOENT;
>  
> -	r = amdgpu_bo_create_kernel(adev, size, PAGE_SIZE,
> +	r = amdgpu_bo_create_kernel(adev, size,
> +				    roundup_pow_of_two(size),
>  				    AMDGPU_GEM_DOMAIN_VRAM |
>  				    AMDGPU_GEM_DOMAIN_GTT,

I don't think that this is a good idea. The VRAM BO should never cross a BAR boundary.

What could be is that the GTT BO does that, but approach that is only available on VCE4 anyway.

I think we should rather restrict falling back to GTT to VCE4 only.

Regards,
Christian.

>  				    &adev->vce.vcpu_bo,


  reply	other threads:[~2026-04-20 13:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 12:10 [PATCH 0/7] VCE1 fixes Timur Kristóf
2026-04-20 12:10 ` [PATCH 1/7] drm/amdgpu: Add alignment to amdgpu_gtt_mgr_alloc_entries() Timur Kristóf
2026-04-20 12:16   ` Christian König
2026-04-20 12:10 ` [PATCH 2/7] drm/amdgpu/vce: Align VCPU BO to nearest power of two Timur Kristóf
2026-04-20 13:52   ` Christian König [this message]
2026-04-20 12:10 ` [PATCH 3/7] drm/amdgpu/vce1: Correct firmware offset mask Timur Kristóf
2026-04-20 12:23   ` Christian König
2026-04-20 13:49     ` Timur Kristóf
2026-04-20 12:10 ` [PATCH 4/7] drm/amdgpu/vce1: Remove superfluous address check Timur Kristóf
2026-04-20 12:23   ` Christian König
2026-04-20 12:10 ` [PATCH 5/7] drm/amdgpu/vce1: Check if VRAM address is lower than GART Timur Kristóf
2026-04-20 12:25   ` Christian König
2026-04-20 12:10 ` [PATCH 6/7] drm/amdgpu/vce1: Don't repeat GTT MGR node allocation Timur Kristóf
2026-04-20 12:25   ` Christian König
2026-04-20 12:10 ` [PATCH 7/7] drm/amdgpu/vce1: Align VCPU BO GART address to nearest power of two Timur Kristóf
2026-04-20 12:27   ` 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=33cb52f5-14b3-44a5-b075-db6cd3ce4547@amd.com \
    --to=christian.koenig@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=timur.kristof@gmail.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