mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Falkowski, Maciej" <maciej.falkowski@linux.intel.com>
To: Lizhi Hou <lizhi.hou@amd.com>,
	ogabbay@kernel.org, quic_jhugo@quicinc.com,
	dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, max.zhen@amd.com,
	sonal.santan@amd.com, mario.limonciello@amd.com
Subject: Re: [PATCH V1] accel/amdxdna: Fix tail-pointer polling in mailbox_get_msg()
Date: Fri, 5 Dec 2025 17:41:30 +0100	[thread overview]
Message-ID: <c16fb0e0-1f30-422e-9785-78ac0b8c4783@linux.intel.com> (raw)
In-Reply-To: <20251204181603.793824-1-lizhi.hou@amd.com>

Reviewed-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>

On 12/4/2025 7:16 PM, Lizhi Hou wrote:
> In mailbox_get_msg(), mailbox_reg_read_non_zero() is called to poll for a
> non-zero tail pointer. This assumed that a zero value indicates an error.
> However, certain corner cases legitimately produce a zero tail pointer.
> To handle these cases, remove mailbox_reg_read_non_zero(). The zero tail
> pointer will be treated as a valid rewind event.
>
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> ---
>   drivers/accel/amdxdna/amdxdna_mailbox.c | 19 +------------------
>   1 file changed, 1 insertion(+), 18 deletions(-)
>
> diff --git a/drivers/accel/amdxdna/amdxdna_mailbox.c b/drivers/accel/amdxdna/amdxdna_mailbox.c
> index 858df97cd3fb..a60a85ce564c 100644
> --- a/drivers/accel/amdxdna/amdxdna_mailbox.c
> +++ b/drivers/accel/amdxdna/amdxdna_mailbox.c
> @@ -112,22 +112,6 @@ static u32 mailbox_reg_read(struct mailbox_channel *mb_chann, u32 mbox_reg)
>   	return readl(ringbuf_addr);
>   }
>   
> -static int mailbox_reg_read_non_zero(struct mailbox_channel *mb_chann, u32 mbox_reg, u32 *val)
> -{
> -	struct xdna_mailbox_res *mb_res = &mb_chann->mb->res;
> -	void __iomem *ringbuf_addr = mb_res->mbox_base + mbox_reg;
> -	int ret, value;
> -
> -	/* Poll till value is not zero */
> -	ret = readx_poll_timeout(readl, ringbuf_addr, value,
> -				 value, 1 /* us */, 100);
> -	if (ret < 0)
> -		return ret;
> -
> -	*val = value;
> -	return 0;
> -}
> -
>   static inline void
>   mailbox_set_headptr(struct mailbox_channel *mb_chann, u32 headptr_val)
>   {
> @@ -286,8 +270,7 @@ static int mailbox_get_msg(struct mailbox_channel *mb_chann)
>   	u32 start_addr;
>   	int ret;
>   
> -	if (mailbox_reg_read_non_zero(mb_chann, mb_chann->res[CHAN_RES_I2X].mb_tail_ptr_reg, &tail))
> -		return -EINVAL;
> +	tail = mailbox_get_tailptr(mb_chann, CHAN_RES_I2X);
>   	head = mb_chann->i2x_head;
>   	ringbuf_size = mailbox_get_ringbuf_size(mb_chann, CHAN_RES_I2X);
>   	start_addr = mb_chann->res[CHAN_RES_I2X].rb_start_addr;

  reply	other threads:[~2025-12-05 16:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04 18:16 Lizhi Hou
2025-12-05 16:41 ` Falkowski, Maciej [this message]
2025-12-08 16:34   ` Lizhi Hou

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=c16fb0e0-1f30-422e-9785-78ac0b8c4783@linux.intel.com \
    --to=maciej.falkowski@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.hou@amd.com \
    --cc=mario.limonciello@amd.com \
    --cc=max.zhen@amd.com \
    --cc=ogabbay@kernel.org \
    --cc=quic_jhugo@quicinc.com \
    --cc=sonal.santan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®