From: "Christian König" <christian.koenig@amd.com>
To: "Timur Kristóf" <timur.kristof@gmail.com>,
amd-gfx@lists.freedesktop.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Alexandre Demers" <alexandre.f.demers@gmail.com>,
"Rodrigo Siqueira" <siqueira@igalia.com>,
"Leo Liu" <Leo.Liu@amd.com>
Subject: Re: [PATCH 05/12] drm/amdgpu/vce: Clear VCPU BO, don't unmap/unreserve (v4)
Date: Mon, 10 Nov 2025 15:16:20 +0100 [thread overview]
Message-ID: <75dd7b72-99db-4886-b7e8-87aba18d182e@amd.com> (raw)
In-Reply-To: <20251107155745.8334-6-timur.kristof@gmail.com>
On 11/7/25 16:57, Timur Kristóf wrote:
> The VCPU BO doesn't only contain the VCE firmware but also other
> ranges that the VCE uses for its stack and data. Let's initialize
> this to zero to avoid having garbage in the VCPU BO.
>
> Additionally, don't unmap/unreserve the VCPU BO.
> The VCPU BO needs to stay at the same location before and after
> sleep/resume because the FW code is not relocatable once it's
> started.
>
> Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 23 +++--------------------
> 1 file changed, 3 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> index c4e9d1862108..3a986e3589a5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> @@ -314,40 +314,23 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev)
> */
> int amdgpu_vce_resume(struct amdgpu_device *adev)
> {
> - void *cpu_addr;
> const struct common_firmware_header *hdr;
> unsigned int offset;
> - int r, idx;
> + int idx;
>
> if (adev->vce.vcpu_bo == NULL)
> return -EINVAL;
>
> - r = amdgpu_bo_reserve(adev->vce.vcpu_bo, false);
> - if (r) {
> - dev_err(adev->dev, "(%d) failed to reserve VCE bo\n", r);
> - return r;
> - }
> -
> - r = amdgpu_bo_kmap(adev->vce.vcpu_bo, &cpu_addr);
> - if (r) {
> - amdgpu_bo_unreserve(adev->vce.vcpu_bo);
> - dev_err(adev->dev, "(%d) VCE map failed\n", r);
> - return r;
> - }
> -
> hdr = (const struct common_firmware_header *)adev->vce.fw->data;
> offset = le32_to_cpu(hdr->ucode_array_offset_bytes);
>
> if (drm_dev_enter(adev_to_drm(adev), &idx)) {
> - memcpy_toio(cpu_addr, adev->vce.fw->data + offset,
> + memset_io(adev->vce.cpu_addr, 0, amdgpu_bo_size(adev->vce.vcpu_bo));
> + memcpy_toio(adev->vce.cpu_addr, adev->vce.fw->data + offset,
> adev->vce.fw->size - offset);
> drm_dev_exit(idx);
> }
>
> - amdgpu_bo_kunmap(adev->vce.vcpu_bo);
> -
> - amdgpu_bo_unreserve(adev->vce.vcpu_bo);
> -
> return 0;
> }
>
next prev parent reply other threads:[~2025-11-10 14:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 15:57 [PATCH 00/12] drm/amdgpu: Support VCE1 IP block (v4) Timur Kristóf
2025-11-07 15:57 ` [PATCH 01/12] drm/amdgpu/gmc6: Place gart at low address range Timur Kristóf
2025-11-07 15:57 ` [PATCH 02/12] drm/amdgpu/gart: Add helper to bind VRAM pages (v2) Timur Kristóf
2025-11-07 15:57 ` [PATCH 03/12] drm/amdgpu/ttm: Use GART helper to map " Timur Kristóf
2025-11-07 15:57 ` [PATCH 04/12] drm/amdgpu/vce: Move firmware load to amdgpu_vce_early_init Timur Kristóf
2025-11-07 15:57 ` [PATCH 05/12] drm/amdgpu/vce: Clear VCPU BO, don't unmap/unreserve (v4) Timur Kristóf
2025-11-10 14:16 ` Christian König [this message]
2025-11-07 15:57 ` [PATCH 06/12] drm/amdgpu/vce1: Clean up register definitions Timur Kristóf
2025-11-07 15:57 ` [PATCH 07/12] drm/amdgpu/vce1: Load VCE1 firmware Timur Kristóf
2025-11-07 15:57 ` [PATCH 08/12] drm/amdgpu/vce1: Implement VCE1 IP block (v2) Timur Kristóf
2025-11-07 15:57 ` [PATCH 09/12] drm/amdgpu/vce1: Ensure VCPU BO is in lower 32-bit address space (v3) Timur Kristóf
2025-11-07 15:57 ` [PATCH 10/12] drm/amd/pm/si: Hook up VCE1 to SI DPM Timur Kristóf
2025-11-07 15:57 ` [PATCH 11/12] drm/amdgpu/vce1: Enable VCE1 on Tahiti, Pitcairn, Cape Verde GPUs Timur Kristóf
2025-11-07 15:57 ` [PATCH 12/12] drm/amdgpu/vce1: Workaround PLL timeout on FirePro W9000 Timur Kristóf
2025-11-10 19:22 ` [PATCH 00/12] drm/amdgpu: Support VCE1 IP block (v4) 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=75dd7b72-99db-4886-b7e8-87aba18d182e@amd.com \
--to=christian.koenig@amd.com \
--cc=Leo.Liu@amd.com \
--cc=alexander.deucher@amd.com \
--cc=alexandre.f.demers@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=siqueira@igalia.com \
--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