[PATCH v5 2/3] dma: replace zone_dma_bits by zone_dma_limit

2024-08-01 Thread Baruch Siach via Linuxppc-dev
From: Catalin Marinas Hardware DMA limit might not be power of 2. When RAM range starts above 0, say 4GB, DMA limit of 30 bits should end at 5GB. A single high bit can not encode this limit. Use plain address for DMA zone limit. Since DMA zone can now potentially span beyond 4GB physical limit

[PATCH v5 1/3] dma: improve DMA zone selection

2024-08-01 Thread Baruch Siach via Linuxppc-dev
When device DMA limit does not fit in DMA32 zone it should use DMA zone, even when DMA zone is stricter than needed. Same goes for devices that can't allocate from the entire normal zone. Limit to DMA32 in that case. Reported-by: Catalin Marinas Reviewed-by: Catalin Marinas Signed-off-by: Baruc

[PATCH v5 3/3] arm64: support DMA zone above 4GB

2024-08-01 Thread Baruch Siach via Linuxppc-dev
From: Catalin Marinas Commit 791ab8b2e3db ("arm64: Ignore any DMA offsets in the max_zone_phys() calculation") made arm64 DMA/DMA32 zones span the entire RAM when RAM starts above 32-bits. This breaks hardware with DMA area that start above 32-bits. But the commit log says that "we haven't notice

[PATCH v5 0/3] dma: support DMA zone starting above 4GB

2024-08-01 Thread Baruch Siach via Linuxppc-dev
DMA zones code assumes that DMA lower limit is zero. When there is no RAM below 4GB, arm64 platform code sets DMA/DMA32 zone limits to cover the entire RAM[0]. My target platform has RAM starting at 32GB. Devices with 30-bit DMA mask are mapped to 1GB at the bottom of RAM, between 32GB - 33GB.