Thread (5 messages) read the whole thread 5 messages, 2 authors, 2021-06-11

Re: [PATCH] mci: dw_mmc: set dma mask to work correctly on 64bit platforms

From: Ahmad Fatoum <a.fatoum@pengutronix.de>
Date: 2021-06-11 10:42:03

Hi,

On 11.06.21 12:02, Sascha Hauer wrote:
On Fri, Jun 11, 2021 at 10:23:25AM +0200, Ahmad Fatoum wrote:
quoted
Hello Sascha,

On 10.06.21 15:10, Sascha Hauer wrote:
quoted
The variant we support currently can only do 32bit DMA. Adjust dma mask
accordingly. Also use dma_map_single() rather than dma_sync_single() to
actually get errors when the mapping fails.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

On a StarFive JH7100 (64-bit CPU, 32-bit MMC controller, non-1:1 mapping for
coherent DMA).
quoted
 	host->idmac = dma_alloc_coherent(sizeof(*host->idmac) * DW_MMC_NUM_IDMACS,
-					 DMA_ADDRESS_BROKEN);
+					 &host->idmac_dma);
+	if (!host->idmac)
That works for Linux, but not for barebox: barebox dma_alloc_coherent doesn't have

a dev parameter, so it can't check for dma_mapping_error() internally.
Yeah, I know. I have that on my mental todo list and hoped nobody would
realize.
Tss. tss. ;)
Adding a dev parameter to dma_alloc_coherent() is one thing. With that
we can check for errors. The next step of course would be to allocate
memory in the allowed area, not only to complain.
What you can do for now is checking for dma_mapping_error here and abort
the probe if you exceed the mask.
quoted
dma_alloc_coherent also never returns NULL in barebox, all implementations, except

for kvx, abort if no memory could be allocated.
quoted
+		return PTR_ERR(-ENOMEM);
-ENOMEM is no pointer.
Yes, fixed.

Sascha
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help