From: sashiko-bot@kernel.org
To: ukrainer8 <kolomiiec@gmail.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/radeon: retry UVD v1 init on failure after resume
Date: Thu, 15 Oct 2026 08:11:10 +0000 [thread overview]
Message-ID: <sashiko-outbox-172448@kernel.org> (raw)
In-Reply-To: <20261013175753.37344-1-kolomiiec@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/radeon: system hang due to unclocked UVD register access on clock setup failure
--
commit 9840a4a45eacb2033c0f3f3ceb29f75910196145
Author: ukrainer8 <kolomiiec@gmail.com>
Subject: drm/radeon: retry UVD v1 init on failure after resume
This commit introduces a retry loop for UVD v1 initialization during resume,
as the ring test can sometimes fail due to racing with hardware. On failure,
it stops UVD, waits 20ms, and retries the initialization steps up to 3 times.
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1867
Link: https://bugs.launchpad.net/bugs/1865130
> --- a/drivers/gpu/drm/radeon/uvd_v1_0.c
> +++ b/drivers/gpu/drm/radeon/uvd_v1_0.c
> @@ -158,24 +158,45 @@ int uvd_v1_0_init(struct radeon_device *rdev)
> {
> struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX];
> uint32_t tmp;
> - int r;
> + int r, retry;
> +
> + /* after resume the first ring test can race with the hardware; retry */
> + for (retry = 0; retry < 3; retry++) {
> + /* raise clocks while booting up the VCPU */
> + if (rdev->family < CHIP_RV740)
> + r = radeon_set_uvd_clocks(rdev, 10000, 10000);
> + else
> + r = radeon_set_uvd_clocks(rdev, 53300, 40000);
> + if (r)
> + drm_warn(&rdev->ddev, "radeon: raising UVD clocks failed (%d), attempt %d\n",
> + r, retry + 1);
[ ... ]
> + if (!r)
> + break;
>
> - ring->ready = true;
> - r = radeon_ring_test(rdev, R600_RING_TYPE_UVD_INDEX, ring);
> - if (r) {
> - ring->ready = false;
> - goto done;
> + uvd_v1_0_stop(rdev);
^^^^^^^^^^^^^^^^^^^
[Severity: High]
Is it safe to call uvd_v1_0_stop() when radeon_set_uvd_clocks() fails?
If clock setup fails, r is non-zero, and the loop bypasses the break
condition to unconditionally call uvd_v1_0_stop().
This function performs MMIO writes to UVD registers like UVD_RBC_RB_CNTL:
drivers/gpu/drm/radeon/uvd_v1_0.c:uvd_v1_0_stop() {
/* force RBC into idle state */
WREG32(UVD_RBC_RB_CNTL, 0x11010101);
...
}
Accessing these registers when the UVD IP block is unclocked can cause a PCI
bus master abort and lead to a hard system hang. Should there be a check to
ensure clocks are successfully raised before attempting to stop the hardware?
> + if (retry < 2)
> + mdelay(20);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261013175753.37344-1-kolomiiec@gmail.com?part=1
next prev parent reply other threads:[~2026-10-15 8:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 17:57 [PATCH] drm/radeon: retry UVD v1 init on failure after resume ukrainer8
2026-10-15 8:11 ` sashiko-bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-10-13 17:39 ukrainer8
2026-10-12 19:43 О К
2026-10-13 13:57 ` 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=sashiko-outbox-172448@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kolomiiec@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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.