From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Danijel Slivka <danijel.slivka@amd.com>,
amd-gfx@lists.freedesktop.org, nikola.prica@amd.com
Subject: Re: [PATCH] drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts
Date: Mon, 24 Jun 2024 13:54:40 +0200 [thread overview]
Message-ID: <143bb050-b698-4673-b280-b07bdb97aa44@gmail.com> (raw)
In-Reply-To: <20240624100649.14971-1-danijel.slivka@amd.com>
Am 24.06.24 um 12:06 schrieb Danijel Slivka:
> Why:
> Setting IH_RB_WPTR register to 0 will not clear the RB_OVERFLOW bit
> if RB_ENABLE is not set.
>
> How to fix:
> Set WPTR_OVERFLOW_CLEAR bit after RB_ENABLE bit is set.
> The RB_ENABLE bit is required to be set, together with
> WPTR_OVERFLOW_ENABLE bit so that setting WPTR_OVERFLOW_CLEAR bit
> would clear the RB_OVERFLOW.
>
> Signed-off-by: Danijel Slivka <danijel.slivka@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/ih_v6_0.c | 34 ++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/ih_v6_0.c b/drivers/gpu/drm/amd/amdgpu/ih_v6_0.c
> index 3cb64c8f7175..cbc70016f479 100644
> --- a/drivers/gpu/drm/amd/amdgpu/ih_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/ih_v6_0.c
> @@ -135,6 +135,40 @@ static int ih_v6_0_toggle_ring_interrupts(struct amdgpu_device *adev,
>
> tmp = RREG32(ih_regs->ih_rb_cntl);
> tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, RB_ENABLE, (enable ? 1 : 0));
> +
> + if (enable) {
> + /* Unset the CLEAR_OVERFLOW bit to make sure the next step
> + * is switching the bit from 0 to 1
> + */
> + tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
> + if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
> + if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp))
> + return -ETIMEDOUT;
> + } else {
> + WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
> + }
> +
> + /* Clear RB_OVERFLOW bit */
> + tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
> + if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
> + if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp))
> + return -ETIMEDOUT;
> + } else {
> + WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
> + }
> +
> + /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
> + * can be detected.
> + */
> + tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
> + if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {
> + if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp))
> + return -ETIMEDOUT;
> + } else {
> + WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
> + }
The last write can be merged with the one below to eventually enable the
interrupt. So this chunk here can be dropped.
With that fixed feel free to add Reviewed-by: Christian König
<christian.koenig@amd.com>
Regards,
Christian.
> + }
> +
> /* enable_intr field is only valid in ring0 */
> if (ih == &adev->irq.ih)
> tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, ENABLE_INTR, (enable ? 1 : 0));
prev parent reply other threads:[~2024-06-24 11:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 10:06 [PATCH] drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts Danijel Slivka
2024-06-24 11:54 ` Christian König [this message]
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=143bb050-b698-4673-b280-b07bdb97aa44@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=danijel.slivka@amd.com \
--cc=nikola.prica@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.