* [PATCH v2 0/2] dmaengine: at_hdmac: Regression fix and cleanup
@ 2023-05-23 17:19 Peter Rosin
2023-05-23 17:20 ` [PATCH v2 1/2] dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling Peter Rosin
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Peter Rosin @ 2023-05-23 17:19 UTC (permalink / raw)
To: LKML
Cc: Tudor Ambarus, Ludovic Desroches, stable@vger.kernel.org,
Vinod Koul, dmaengine, linux-arm-kernel
Hi!
I found a regression in DMA handling on one of our SAMA5D3 boards.
While combing through the regressing commit, a found two unrelated
strange things. The first is the actually problematic change. The
second is a number of suspect defines, that I fail to see how they
can ever do any good.
Cheers,
Peter
Changes since v1 [1], after comments from Tudor Ambarus:
Patch 1/2:
- Don't convert to inline functions.
- Cc stable
Patch 2/2:
- Extend the field instead of killing "too big" field values.
- Add Fixes and R-b tags.
- Cc stable
[1] https://lore.kernel.org/lkml/dc4834cb-fadf-17a5-fbc7-cf500db88f20@axentia.se/
Peter Rosin (2):
dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling
dmaengine: at_hdmac: Extend the Flow Controller bitfield to three bits
drivers/dma/at_hdmac.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling
2023-05-23 17:19 [PATCH v2 0/2] dmaengine: at_hdmac: Regression fix and cleanup Peter Rosin
@ 2023-05-23 17:20 ` Peter Rosin
2023-05-23 17:24 ` Tudor Ambarus
2023-05-23 17:20 ` [PATCH v2 2/2] dmaengine: at_hdmac: Extend the Flow Controller bitfield to three bits Peter Rosin
2023-05-24 5:50 ` [PATCH v2 0/2] dmaengine: at_hdmac: Regression fix and cleanup Vinod Koul
2 siblings, 1 reply; 5+ messages in thread
From: Peter Rosin @ 2023-05-23 17:20 UTC (permalink / raw)
To: LKML
Cc: Tudor Ambarus, Ludovic Desroches, stable@vger.kernel.org,
Vinod Koul, dmaengine, linux-arm-kernel
The MSB part of the peripheral IDs need to go into the ATC_SRC_PER_MSB
and ATC_DST_PER_MSB fields. Not the LSB part.
This fixes a severe regression for TSE-850 devices (compatible
axentia,tse850v3) where output to the audio I2S codec (the main
purpose of the device) simply do not work.
Fixes: d8840a7edcf0 ("dmaengine: at_hdmac: Use bitfield access macros")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/dma/at_hdmac.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 8858470246e1..6362013b90df 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -153,8 +153,6 @@
#define ATC_AUTO BIT(31) /* Auto multiple buffer tx enable */
/* Bitfields in CFG */
-#define ATC_PER_MSB(h) ((0x30U & (h)) >> 4) /* Extract most significant bits of a handshaking identifier */
-
#define ATC_SRC_PER GENMASK(3, 0) /* Channel src rq associated with periph handshaking ifc h */
#define ATC_DST_PER GENMASK(7, 4) /* Channel dst rq associated with periph handshaking ifc h */
#define ATC_SRC_REP BIT(8) /* Source Replay Mod */
@@ -181,10 +179,15 @@
#define ATC_DPIP_HOLE GENMASK(15, 0)
#define ATC_DPIP_BOUNDARY GENMASK(25, 16)
-#define ATC_SRC_PER_ID(id) (FIELD_PREP(ATC_SRC_PER_MSB, (id)) | \
- FIELD_PREP(ATC_SRC_PER, (id)))
-#define ATC_DST_PER_ID(id) (FIELD_PREP(ATC_DST_PER_MSB, (id)) | \
- FIELD_PREP(ATC_DST_PER, (id)))
+#define ATC_PER_MSB GENMASK(5, 4) /* Extract MSBs of a handshaking identifier */
+#define ATC_SRC_PER_ID(id) \
+ ({ typeof(id) _id = (id); \
+ FIELD_PREP(ATC_SRC_PER_MSB, FIELD_GET(ATC_PER_MSB, _id)) | \
+ FIELD_PREP(ATC_SRC_PER, _id); })
+#define ATC_DST_PER_ID(id) \
+ ({ typeof(id) _id = (id); \
+ FIELD_PREP(ATC_DST_PER_MSB, FIELD_GET(ATC_PER_MSB, _id)) | \
+ FIELD_PREP(ATC_DST_PER, _id); })
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] dmaengine: at_hdmac: Extend the Flow Controller bitfield to three bits
2023-05-23 17:19 [PATCH v2 0/2] dmaengine: at_hdmac: Regression fix and cleanup Peter Rosin
2023-05-23 17:20 ` [PATCH v2 1/2] dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling Peter Rosin
@ 2023-05-23 17:20 ` Peter Rosin
2023-05-24 5:50 ` [PATCH v2 0/2] dmaengine: at_hdmac: Regression fix and cleanup Vinod Koul
2 siblings, 0 replies; 5+ messages in thread
From: Peter Rosin @ 2023-05-23 17:20 UTC (permalink / raw)
To: LKML
Cc: Tudor Ambarus, Ludovic Desroches, stable@vger.kernel.org,
Vinod Koul, dmaengine, linux-arm-kernel
Some chips have two bits (e.g SAMA5D3), and some have three (e.g.
SAM9G45). A field width of three is compatible as long as valid
values are used for the different chips.
There is no current use of any value needing three bits, so the
fixed bug is relatively benign.
Fixes: d8840a7edcf0 ("dmaengine: at_hdmac: Use bitfield access macros")
Cc: stable@vger.kernel.org
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/dma/at_hdmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 6362013b90df..ee3a219e3a89 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -132,7 +132,7 @@
#define ATC_DST_PIP BIT(12) /* Destination Picture-in-Picture enabled */
#define ATC_SRC_DSCR_DIS BIT(16) /* Src Descriptor fetch disable */
#define ATC_DST_DSCR_DIS BIT(20) /* Dst Descriptor fetch disable */
-#define ATC_FC GENMASK(22, 21) /* Choose Flow Controller */
+#define ATC_FC GENMASK(23, 21) /* Choose Flow Controller */
#define ATC_FC_MEM2MEM 0x0 /* Mem-to-Mem (DMA) */
#define ATC_FC_MEM2PER 0x1 /* Mem-to-Periph (DMA) */
#define ATC_FC_PER2MEM 0x2 /* Periph-to-Mem (DMA) */
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling
2023-05-23 17:20 ` [PATCH v2 1/2] dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling Peter Rosin
@ 2023-05-23 17:24 ` Tudor Ambarus
0 siblings, 0 replies; 5+ messages in thread
From: Tudor Ambarus @ 2023-05-23 17:24 UTC (permalink / raw)
To: Peter Rosin, LKML
Cc: Vinod Koul, stable@vger.kernel.org, Ludovic Desroches, dmaengine,
linux-arm-kernel
On 5/23/23 18:20, Peter Rosin wrote:
> The MSB part of the peripheral IDs need to go into the ATC_SRC_PER_MSB
> and ATC_DST_PER_MSB fields. Not the LSB part.
>
> This fixes a severe regression for TSE-850 devices (compatible
> axentia,tse850v3) where output to the audio I2S codec (the main
> purpose of the device) simply do not work.
>
> Fixes: d8840a7edcf0 ("dmaengine: at_hdmac: Use bitfield access macros")
> Cc: stable@vger.kernel.org
> Signed-off-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> ---
> drivers/dma/at_hdmac.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 8858470246e1..6362013b90df 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -153,8 +153,6 @@
> #define ATC_AUTO BIT(31) /* Auto multiple buffer tx enable */
>
> /* Bitfields in CFG */
> -#define ATC_PER_MSB(h) ((0x30U & (h)) >> 4) /* Extract most significant bits of a handshaking identifier */
> -
> #define ATC_SRC_PER GENMASK(3, 0) /* Channel src rq associated with periph handshaking ifc h */
> #define ATC_DST_PER GENMASK(7, 4) /* Channel dst rq associated with periph handshaking ifc h */
> #define ATC_SRC_REP BIT(8) /* Source Replay Mod */
> @@ -181,10 +179,15 @@
> #define ATC_DPIP_HOLE GENMASK(15, 0)
> #define ATC_DPIP_BOUNDARY GENMASK(25, 16)
>
> -#define ATC_SRC_PER_ID(id) (FIELD_PREP(ATC_SRC_PER_MSB, (id)) | \
> - FIELD_PREP(ATC_SRC_PER, (id)))
> -#define ATC_DST_PER_ID(id) (FIELD_PREP(ATC_DST_PER_MSB, (id)) | \
> - FIELD_PREP(ATC_DST_PER, (id)))
> +#define ATC_PER_MSB GENMASK(5, 4) /* Extract MSBs of a handshaking identifier */
> +#define ATC_SRC_PER_ID(id) \
> + ({ typeof(id) _id = (id); \
> + FIELD_PREP(ATC_SRC_PER_MSB, FIELD_GET(ATC_PER_MSB, _id)) | \
> + FIELD_PREP(ATC_SRC_PER, _id); })
> +#define ATC_DST_PER_ID(id) \
> + ({ typeof(id) _id = (id); \
> + FIELD_PREP(ATC_DST_PER_MSB, FIELD_GET(ATC_PER_MSB, _id)) | \
> + FIELD_PREP(ATC_DST_PER, _id); })
>
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/2] dmaengine: at_hdmac: Regression fix and cleanup
2023-05-23 17:19 [PATCH v2 0/2] dmaengine: at_hdmac: Regression fix and cleanup Peter Rosin
2023-05-23 17:20 ` [PATCH v2 1/2] dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling Peter Rosin
2023-05-23 17:20 ` [PATCH v2 2/2] dmaengine: at_hdmac: Extend the Flow Controller bitfield to three bits Peter Rosin
@ 2023-05-24 5:50 ` Vinod Koul
2 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2023-05-24 5:50 UTC (permalink / raw)
To: Peter Rosin
Cc: Tudor Ambarus, stable@vger.kernel.org, LKML, Ludovic Desroches,
dmaengine, linux-arm-kernel
On 23-05-23, 19:19, Peter Rosin wrote:
> Hi!
>
> I found a regression in DMA handling on one of our SAMA5D3 boards.
>
> While combing through the regressing commit, a found two unrelated
> strange things. The first is the actually problematic change. The
> second is a number of suspect defines, that I fail to see how they
> can ever do any good.
Applied, thanks
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-24 5:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-23 17:19 [PATCH v2 0/2] dmaengine: at_hdmac: Regression fix and cleanup Peter Rosin
2023-05-23 17:20 ` [PATCH v2 1/2] dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling Peter Rosin
2023-05-23 17:24 ` Tudor Ambarus
2023-05-23 17:20 ` [PATCH v2 2/2] dmaengine: at_hdmac: Extend the Flow Controller bitfield to three bits Peter Rosin
2023-05-24 5:50 ` [PATCH v2 0/2] dmaengine: at_hdmac: Regression fix and cleanup Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).