spi: pxa2xx: Set controller->max_transfer_size in dma mode
Subsystems (3)
PATCH 1/1 spi: pxa2xx: Set controller->max_transfer_size in dma mode
In DMA mode we have a maximum transfer size, past that the driver falls back to PIO (see the check at the top of pxa2xx_spi_transfer_one). Falling back to PIO for big transfers defeats the point of a dma engine, hence set the max transfer size to inform spi clients that they need to do something smarter.
This was uncovered by the drm_mipi_dbi spi panel code, which does large spi transfers, but stopped splitting them after:
commit e143364b4c1774f68e923a5a0bb0fca28ac25888
Author: Noralf Trønnes <[email protected]> Date: Fri Jul 19 17:59:10 2019 +0200
drm/tinydrm: Remove tinydrm_spi_max_transfer_size()
After this commit the code relied on the spi core to split transfers into max dma-able blocks, which also papered over the PIO fallback issue.
Fix this by setting the overall max transfer size to the DMA limit, but only when the controller runs in DMA mode.
--- drivers/spi/spi-pxa2xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-pxa2xx.c +1 -0
@@ -1707,6 +1707,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) }else { controller->can_dma = pxa2xx_spi_can_dma; controller->max_dma_len =MAX_DMA_LEN ; + controller->max_transfer_size =MAX_DMA_LEN ; } }
Signature · 6 lines
2.23.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Den 16.10.2019 21.57, skrev Daniel Vetter:
Quoted 42 lines
In DMA mode we have a maximum transfer size, past that the driver falls back to PIO (see the check at the top of
pxa2xx_spi_transfer_one). Falling back to PIO for big transfers defeats the point of a dma engine, hence set the max transfer size to inform spi clients that they need to do something smarter.This was uncovered by the
drm_mipi_dbispi panel code, which does large spi transfers, but stopped splitting them after:commit
e143364b4c1774f68e923a5a0bb0fca28ac25888Author: Noralf Trønnes <[email protected]> Date: Fri Jul 19 17:59:10 2019 +0200drm/tinydrm: Remove
tinydrm_spi_max_transfer_size()After this commit the code relied on the spi core to split transfers into max dma-able blocks, which also papered over the PIO fallback issue.
Fix this by setting the overall max transfer size to the DMA limit, but only when the controller runs in DMA mode.
Fixes e143364b4c17 ("drm/tinydrm: Remove tinydrm_spi_max_transfer_size()")Cc Sam Ravnborg <[email protected]>Cc Noralf Trønnes <[email protected]>Cc Andy Shevchenko <[email protected]>Reported-and-tested-by Andy Shevchenko <[email protected]>Cc Daniel Mack <[email protected]>Cc Haojian Zhuang <[email protected]>Cc Robert Jarzmik <[email protected]>Cc Mark Brown <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/spi/spi-pxa2xx.c | 1 + 1 file changed, 1 insertion(+)drivers/spi/spi-pxa2xx.c +0
-0
drivers/spi/spi-pxa2xx.c static int pxa2xx_spi_probe(struct platform_device *pdev) · line 1710
Quoted 4 lines
drivers/spi/spi-pxa2xx.c +1
-0@@ -1707,6 +1707,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) }else { controller->can_dma = pxa2xx_spi_can_dma; controller->max_dma_len =MAX_DMA_LEN ; + controller->max_transfer_size =MAX_DMA_LEN ;
As Andy mentioned, ->max_transfer_size is a callback:
struct spi_controller {
/*
* on some hardware transfer / message size may be constrained
* the limit may depend on device transfer settings
*/
size_t (*max_transfer_size)(struct spi_device *spi);(I looked at its users and they all return a static or probe time value so not sure why it's a callback.)
Noralf.
drivers/spi/spi-pxa2xx.c static int pxa2xx_spi_probe(struct platform_device *pdev) · line 1713
Quoted 4 lines
drivers/spi/spi-pxa2xx.c +0
-0} }
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerQuoted 11 lines · Noralf Trønnes
As Andy mentioned, ->max_transfer_size is a callback:
struct spi_controller { /* * on some hardware transfer / message size may be constrained * the limit may depend on device transfer settings */ size_t (*max_transfer_size)(struct spi_device *spi);(I looked at its users and they all return a static or probe time value so not sure why it's a callback.)
Huh, I wonder why we did that... I can't find any clear record, and like you say nothing is using it so we should probably fix it - however that's best done separately to this :/ Sorry for the confusion, I didn't register what Andy was saying as being pointing out the current state of the code.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 spi: pxa2xx: Set controller->max_transfer_size in dma mode
In reply to Daniel VetterIn DMA mode we have a maximum transfer size, past that the driver falls back to PIO (see the check at the top of pxa2xx_spi_transfer_one). Falling back to PIO for big transfers defeats the point of a dma engine, hence set the max transfer size to inform spi clients that they need to do something smarter.
This was uncovered by the drm_mipi_dbi spi panel code, which does large spi transfers, but stopped splitting them after:
commit e143364b4c1774f68e923a5a0bb0fca28ac25888
Author: Noralf Trønnes <[email protected]> Date: Fri Jul 19 17:59:10 2019 +0200
drm/tinydrm: Remove tinydrm_spi_max_transfer_size()
After this commit the code relied on the spi core to split transfers into max dma-able blocks, which also papered over the PIO fallback issue.
Fix this by setting the overall max transfer size to the DMA limit, but only when the controller runs in DMA mode.
--
v2: Brown paper bag edition, it needs to be a function ...
--- drivers/spi/spi-pxa2xx.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/spi/spi-pxa2xx.c +7 -0
@@ -1602,6 +1602,11 @@ static int pxa2xx_spi_fw_translate_cs(struct spi_controller *controller,return cs; } +static size_t pxa2xx_spi_max_dma_transfer_size (struct spi_device *spi) +{ +return MAX_DMA_LEN ; +} +static int pxa2xx_spi_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -1707,6 +1712,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) }else { controller->can_dma = pxa2xx_spi_can_dma; controller->max_dma_len =MAX_DMA_LEN ; + controller->max_transfer_size = + pxa2xx_spi_max_dma_transfer_size; } }
Signature · 7 lines
2.23.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 13 lines · Daniel Vetter
In DMA mode we have a maximum transfer size, past that the driver falls back to PIO (see the check at the top of
pxa2xx_spi_transfer_one). Falling back to PIO for big transfers defeats the point of a dma engine, hence set the max transfer size to inform spi clients that they need to do something smarter.This was uncovered by the
drm_mipi_dbispi panel code, which does large spi transfers, but stopped splitting them after:commit
e143364b4c1774f68e923a5a0bb0fca28ac25888Author: Noralf Trønnes <[email protected]> Date: Fri Jul 19 17:59:10 2019 +0200
Quoted 8 lines
drm/tinydrm: Remove
tinydrm_spi_max_transfer_size()After this commit the code relied on the spi core to split transfers into max dma-able blocks, which also papered over the PIO fallback issue.
Fix this by setting the overall max transfer size to the DMA limit, but only when the controller runs in DMA mode.
Thank you, Daniel!
Quoted 46 lines
Fixes e143364b4c17 ("drm/tinydrm: Remove tinydrm_spi_max_transfer_size()")Cc Sam Ravnborg <[email protected]>Cc Noralf Trønnes <[email protected]>Cc Andy Shevchenko <[email protected]>Reported-and-tested-by Andy Shevchenko <[email protected]>Cc Daniel Mack <[email protected]>Cc Haojian Zhuang <[email protected]>Cc Robert Jarzmik <[email protected]>Cc Mark Brown <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--
v2: Brown paper bag edition, it needs to be a function ...--- drivers/spi/spi-pxa2xx.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/spi/spi-pxa2xx.c +7
-0@@ -1602,6 +1602,11 @@ static int pxa2xx_spi_fw_translate_cs(struct spi_controller *controller,return cs; } +static size_t pxa2xx_spi_max_dma_transfer_size (struct spi_device *spi) +{ +return MAX_DMA_LEN ; +} +static int pxa2xx_spi_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;@@ -1707,6 +1712,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) }else { controller->can_dma = pxa2xx_spi_can_dma; controller->max_dma_len =MAX_DMA_LEN ; + controller->max_transfer_size = + pxa2xx_spi_max_dma_transfer_size; } }Signature · 1 line
2.23.0
Signature · 8 lines
With Best Regards, Andy Shevchenko _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 16 lines · Andy Shevchenko
Quoted 15 lines · Daniel Vetter
In DMA mode we have a maximum transfer size, past that the driver falls back to PIO (see the check at the top of
pxa2xx_spi_transfer_one). Falling back to PIO for big transfers defeats the point of a dma engine, hence set the max transfer size to inform spi clients that they need to do something smarter.This was uncovered by the
drm_mipi_dbispi panel code, which does large spi transfers, but stopped splitting them after:commit
e143364b4c1774f68e923a5a0bb0fca28ac25888Author: Noralf Trønnes <[email protected]> Date: Fri Jul 19 17:59:10 2019 +0200drm/tinydrm: Remove
tinydrm_spi_max_transfer_size()
Quoted 8 lines
Quoted 6 lines
After this commit the code relied on the spi core to split transfers into max dma-able blocks, which also papered over the PIO fallback issue.
Fix this by setting the overall max transfer size to the DMA limit, but only when the controller runs in DMA mode.
Thank you, Daniel!
Mark, can be this applied?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Mark Brown
maintainerQuoted 1 line · Andy Shevchenko
Mark, can be this applied?
b2662a164f9dc48d
Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. If there have been review comments then people may be waiting for those to be addressed.
Sending content free pings adds to the mail volume (if they are seen at all) which is often the problem and since they can't be reviewed directly if something has gone wrong you'll have to resend the patches anyway, so sending again is generally a better approach though there are some other maintainers who like them - if in doubt look at how patches for the subsystem are normally handled.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel