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 3/7] drm/amdgpu/vce1: Correct firmware offset mask
Date: Mon, 20 Apr 2026 14:23:18 +0200 [thread overview]
Message-ID: <14b58bb8-e1bf-4b9d-9957-dbdc32144278@amd.com> (raw)
In-Reply-To: <20260420121044.155030-4-timur.kristof@gmail.com>
On 4/20/26 14:10, Timur Kristóf wrote:
> It's 0x0fffffff and not 0x7fffffff.
>
> Fixes: d4a640d4b9f3 ("drm/amdgpu/vce1: Implement VCE1 IP block (v2)")
> Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
> ---
> drivers/gpu/drm/amd/amdgpu/vce_v1_0.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v1_0.c
> index 2fe931366985a..ce993b57b0e9f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vce_v1_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vce_v1_0.c
> @@ -313,17 +313,17 @@ static int vce_v1_0_mc_resume(struct amdgpu_device *adev)
>
> offset = adev->vce.gpu_addr + AMDGPU_VCE_FIRMWARE_OFFSET;
> size = VCE_V1_0_FW_SIZE;
> - WREG32(mmVCE_VCPU_CACHE_OFFSET0, offset & 0x7fffffff);
> + WREG32(mmVCE_VCPU_CACHE_OFFSET0, offset & 0x0fffffff);
> WREG32(mmVCE_VCPU_CACHE_SIZE0, size);
>
> offset += size;
> size = VCE_V1_0_STACK_SIZE;
> - WREG32(mmVCE_VCPU_CACHE_OFFSET1, offset & 0x7fffffff);
> + WREG32(mmVCE_VCPU_CACHE_OFFSET1, offset & 0x0fffffff);
> WREG32(mmVCE_VCPU_CACHE_SIZE1, size);
>
> offset += size;
> size = VCE_V1_0_DATA_SIZE;
> - WREG32(mmVCE_VCPU_CACHE_OFFSET2, offset & 0x7fffffff);
> + WREG32(mmVCE_VCPU_CACHE_OFFSET2, offset & 0x0fffffff);
We actually have that as VCE_VCPU_CACHE_OFFSET*__OFFSET_MASK in the headers, would probably be a good idea to use that one instead.
Additional to that limiting the value actually doesn't make much sense, that just hides the problem when we really get an offset which is to large.
We should probably rather have a WARN_ON(offset & ~VCE_VCPU_CACHE_OFFSET2__OFFSET_MASK) directly above the register write.
Apart from that the patch looks good to me.
Regards,
Christian.
> WREG32(mmVCE_VCPU_CACHE_SIZE2, size);
>
> WREG32_P(mmVCE_LMI_CTRL2, 0x0, ~0x100);
> @@ -531,7 +531,7 @@ static int vce_v1_0_early_init(struct amdgpu_ip_block *ip_block)
> static int vce_v1_0_ensure_vcpu_bo_32bit_addr(struct amdgpu_device *adev)
> {
> u64 bo_size = amdgpu_bo_size(adev->vce.vcpu_bo);
> - u64 max_vcpu_bo_addr = 0xffffffff - bo_size;
> + u64 max_vcpu_bo_addr = 0x0fffffff - bo_size;
> u64 num_pages = ALIGN(bo_size, AMDGPU_GPU_PAGE_SIZE) / AMDGPU_GPU_PAGE_SIZE;
> u64 pa = amdgpu_gmc_vram_pa(adev, adev->vce.vcpu_bo);
> u64 flags = AMDGPU_PTE_READABLE | AMDGPU_PTE_WRITEABLE | AMDGPU_PTE_VALID;
next prev parent reply other threads:[~2026-04-20 12:23 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
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 [this message]
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=14b58bb8-e1bf-4b9d-9957-dbdc32144278@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