From: Frank Li <Frank.li@oss.nxp.com>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Chen-Yu Tsai <wens@kernel.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: sun6i: bound burst selection before shifting
Date: Thu, 22 Oct 2026 11:26:51 -0500 [thread overview]
Message-ID: <ato5S9rXovXJO6-i@SMW015318> (raw)
In-Reply-To: <20261021-submit-sun6i-dma-burst-limit-v1-v1-1-41a7a476ef66@gmail.com>
On Wed, Oct 21, 2026 at 03:06:33PM -0600, James Hilliard wrote:
> find_burst_size() tests BIT(maxburst) before reducing the client's maximum
> to a supported burst length. DesignWare UARTs request a maximum burst of
> one quarter of their FIFO size, so a 256-byte FIFO supplies 64. Shifting
> an unsigned long by 64 is undefined even on a 64-bit CPU. The fallback
> loop can repeat the same invalid shift.
>
> Limit the search to the highest burst represented in the controller's
> nonzero capability mask before either shift. Larger client limits still
> select the largest supported burst, while smaller limits retain the
> existing power-of-two selection and the zero/default case is unchanged.
>
> Fixes: 7178c3586ab4 ("dmaengine: sun6i: Choose appropriate burst length under maxburst")
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/sun6i-dma.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> index 7704b016aed8..a8b12262b3c3 100644
> --- a/drivers/dma/sun6i-dma.c
> +++ b/drivers/dma/sun6i-dma.c
> @@ -590,6 +590,9 @@ static u32 find_burst_size(const u32 burst_lengths, u32 maxburst)
> if (!maxburst)
> return 1;
>
> + /* maxburst is a transfer limit, not necessarily a valid bit index. */
> + maxburst = min_t(u32, maxburst, fls(burst_lengths) - 1);
> +
> if (BIT(maxburst) & burst_lengths)
> return maxburst;
>
>
> ---
> base-commit: 93f51579e7df248780214094418f205253383cc5
> change-id: 20261021-submit-sun6i-dma-burst-limit-v1-47e32971471e
>
> Best regards,
> --
> James Hilliard <james.hilliard1@gmail.com>
>
prev parent reply other threads:[~2026-10-22 16:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 21:06 James Hilliard
2026-10-22 16:26 ` Frank Li [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=ato5S9rXovXJO6-i@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=james.hilliard1@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=samuel@sholland.org \
--cc=vkoul@kernel.org \
--cc=wens@kernel.org \
/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®