* [PATCH] dmaengine: switchtec-dma: fix FIELD_GET misuse when programming SE threshold
@ 2026-03-17 8:32 David Carlier
2026-03-27 17:00 ` Logan Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: David Carlier @ 2026-03-17 8:32 UTC (permalink / raw)
To: Kelvin Cao, Logan Gunthorpe, Vinod Koul; +Cc: dmaengine, David Carlier
FIELD_GET(SE_THRESH_MASK, thresh) extracts bits [31:23] from thresh and
right-shifts them, which is the inverse of the intended operation. Since
thresh is derived from se_buf_len / 2 (at most 255), bits [31:23] are
always zero, so the SE threshold is never actually programmed into the
register.
Use FIELD_PREP() instead to correctly left-shift thresh into bits [31:23]
of the valid_en_se register, consistent with the FIELD_PREP usage for
the perf tuner config just above.
Fixes: 30eba9df76ad ("dmaengine: switchtec-dma: Implement hardware initialization and cleanup")
Signed-off-by: David Carlier <devnexen@gmail.com>
---
drivers/dma/switchtec_dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/switchtec_dma.c b/drivers/dma/switchtec_dma.c
index 3ef928640615..71d9868ce613 100644
--- a/drivers/dma/switchtec_dma.c
+++ b/drivers/dma/switchtec_dma.c
@@ -1099,7 +1099,7 @@ static int switchtec_dma_chan_init(struct switchtec_dma_dev *swdma_dev,
dev_dbg(&pdev->dev, "Channel %d: SE buffer count %d\n", i, se_buf_len);
thresh = se_buf_len / 2;
- valid_en_se |= FIELD_GET(SE_THRESH_MASK, thresh);
+ valid_en_se |= FIELD_PREP(SE_THRESH_MASK, thresh);
writel(valid_en_se, &swdma_chan->mmio_chan_fw->valid_en_se);
/* request irqs */
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] dmaengine: switchtec-dma: fix FIELD_GET misuse when programming SE threshold
2026-03-17 8:32 [PATCH] dmaengine: switchtec-dma: fix FIELD_GET misuse when programming SE threshold David Carlier
@ 2026-03-27 17:00 ` Logan Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Logan Gunthorpe @ 2026-03-27 17:00 UTC (permalink / raw)
To: David Carlier, Kelvin Cao, Vinod Koul; +Cc: dmaengine
On 2026-03-17 2:32 a.m., David Carlier wrote:
> FIELD_GET(SE_THRESH_MASK, thresh) extracts bits [31:23] from thresh and
> right-shifts them, which is the inverse of the intended operation. Since
> thresh is derived from se_buf_len / 2 (at most 255), bits [31:23] are
> always zero, so the SE threshold is never actually programmed into the
> register.
>
> Use FIELD_PREP() instead to correctly left-shift thresh into bits [31:23]
> of the valid_en_se register, consistent with the FIELD_PREP usage for
> the perf tuner config just above.
>
> Fixes: 30eba9df76ad ("dmaengine: switchtec-dma: Implement hardware initialization and cleanup")
> Signed-off-by: David Carlier <devnexen@gmail.com>
Sorry for the delay for me to look at this, I just got back from vacation.
Butt yes this looks correct.
Thanks for the quick catch on that mistake!
Review-by: Logan Gunthorpe <logang@deltatee.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-27 17:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 8:32 [PATCH] dmaengine: switchtec-dma: fix FIELD_GET misuse when programming SE threshold David Carlier
2026-03-27 17:00 ` Logan Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox