Re: Pass user defines for Barebox build

2023-11-28 Thread Ahmad Fatoum
Hello Lior, On 27.11.23 08:02, Lior Weintraub wrote: > Hi guys, > > Is there a formal way to pass user compilation flags into Barebox build? There isn't. Both barebox and Linux have been broken in the past by distros setting CFLAGS that force hardening options that require kernel/libc

Re: [PATCH 1/2] net: macb: fix dma_alloc for rx_buffer

2023-11-28 Thread Steffen Trumtrar
On 2023-11-28 at 17:56 +01, Lucas Stach wrote: Am Dienstag, dem 28.11.2023 um 17:29 +0100 schrieb Steffen Trumtrar: rx_buffer gets dma_alloc'ed but is never dma_map'ed and therefor not flushed before it is initially used. Map the rx_buffer when the macb is initialized and unmap it on

Re: [PATCH 2/2] net: macb: convert to volatile accesses

2023-11-28 Thread Ahmad Fatoum
Hello Steffen, On 28.11.23 17:29, Steffen Trumtrar wrote: > + writel(ctrl, >tx_ring[tx_head].ctrl); > + writel((ulong)packet, >tx_ring[tx_head].addr); > dma_sync_single_for_device(macb->dev, (unsigned long)packet, length, > DMA_TO_DEVICE); For this buffer dma_map_single is

Re: [PATCH 1/2] net: macb: fix dma_alloc for rx_buffer

2023-11-28 Thread Ahmad Fatoum
Hello Steffen, On 28.11.23 17:29, Steffen Trumtrar wrote: > rx_buffer gets dma_alloc'ed but is never dma_map'ed and therefor not > flushed before it is initially used. > > Map the rx_buffer when the macb is initialized and unmap it on ether_halt. > > While at it, cleanup the dma_alloc_coherent

[PATCH 2/4] dma: add DMA API debugging support

2023-11-28 Thread Ahmad Fatoum
For DMA_FROM_DEVICE, calling dma_sync_single_for_cpu before arch_sync_dma_for_device has been called is wrong: - Memory region is dirty in CPU cache - Device writes packet into region - CPU cache lines are written back - Buffer memory is corrupted In order to spot such issues, let's add

[PATCH 4/4] mci: stm32_sdmmc2: correct usage of DMA API

2023-11-28 Thread Ahmad Fatoum
The new CONFIG_DMA_API_DEBUG option correctly detects that dma_sync_single_for_device is called without dma_map_single. In the particular case of the STM32 SDMMC2 driver, this shouldn't lead to errors as dma_sync_single_for_cpu is only called after successful DMA, not before. In other cases

[PATCH 1/4] dma: factor out dma map generic implementations into file

2023-11-28 Thread Ahmad Fatoum
In preparation for adding optional debugging code for the DMA mapping API, move the definition out of the header file into a source file. Signed-off-by: Ahmad Fatoum --- drivers/dma/Makefile | 1 + drivers/dma/map.c| 32 +++ include/dma.h| 61

[PATCH 3/4] mci: core: remove broken, unneeded write bounce buffer

2023-11-28 Thread Ahmad Fatoum
mci_block_write uses a 512-byte long bounce buffer if the src argument is not 4-byte aligned. This can never happen as src is the address of a block cache chunk, which is always aligned for DMA, which is always a multiple of 4 bytes. Furthermore, the bounce buffer is just a single sector and the

[PATCH 0/4] dma: catch mistakes with CONFIG_DMA_API_DEBUG

2023-11-28 Thread Ahmad Fatoum
://lore.barebox.org/barebox/20231128-v2023-08-0-topic-macb-v1-0-9faff73bc...@pengutronix.de/T/#t Ahmad Fatoum (4): dma: factor out dma map generic implementations into file dma: add DMA API debugging support mci: core: remove broken, unneeded write bounce buffer mci: stm32_sdmmc2: correct usage of DMA API

[PATCH] ARM: dma: define DMA_ALIGNMENT instead of defining dma_alloc

2023-11-28 Thread Ahmad Fatoum
There's a suitable fallback dma_alloc implementation already in dma.h, which we can use as soon as we define DMA_ALIGNMENT. Reviewed-by: Marco Felsch Signed-off-by: Ahmad Fatoum --- arch/arm/include/asm/dma.h | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git

Re: [PATCH 1/2] net: macb: fix dma_alloc for rx_buffer

2023-11-28 Thread Lucas Stach
Am Dienstag, dem 28.11.2023 um 17:29 +0100 schrieb Steffen Trumtrar: > rx_buffer gets dma_alloc'ed but is never dma_map'ed and therefor not > flushed before it is initially used. > > Map the rx_buffer when the macb is initialized and unmap it on ether_halt. > > While at it, cleanup the

[PATCH 1/2] net: macb: fix dma_alloc for rx_buffer

2023-11-28 Thread Steffen Trumtrar
rx_buffer gets dma_alloc'ed but is never dma_map'ed and therefor not flushed before it is initially used. Map the rx_buffer when the macb is initialized and unmap it on ether_halt. While at it, cleanup the dma_alloc_coherent rx_ring/tx_ring, too. Signed-off-by: Steffen Trumtrar ---

[PATCH 0/2] net: macb: fix dma usage

2023-11-28 Thread Steffen Trumtrar
drivers/net/macb.c | 90 ++ 1 file changed, 50 insertions(+), 40 deletions(-) --- base-commit: 5f200dd534c848dfa5d948334b6373f0310b8f73 change-id: 20231128-v2023-08-0-topic-macb-0c13ed91179d Best regards, -- Steffen Trumtrar

[PATCH 2/2] net: macb: convert to volatile accesses

2023-11-28 Thread Steffen Trumtrar
Instead of directly reading from memory addresses and inserting sw barriers to be sure that the compiler will not move loads/stores behind this point, just use proper volatile writel/readl accesses. Signed-off-by: Steffen Trumtrar --- drivers/net/macb.c | 53

[PATCH] commands: regulator: add option to list provider devices

2023-11-28 Thread Ahmad Fatoum
Especially on SCMI boards, it isn't immediately clear if e.g. reg11 is supplied by a directly accessed regulator or by the secure world. Give the regulator command a -D option to list devices that the regulator is associated with as well. Signed-off-by: Ahmad Fatoum --- commands/regulator.c