Re: [PATCH v3 3/3] spi: spi-qcom-qspi: Add DMA mode support
From: Mark Brown
Date: Mon Apr 17 2023 - 12:39:15 EST
On Mon, Apr 17, 2023 at 09:27:16PM +0530, Vijaya Krishna Nivarthi wrote:
> However, Like Doug pointed, dma_alignment is not being used by core.
The core will use kmalloc() for any new buffers it allocates, this is
guaranteed to satisfy DMA constraints.
> Is it up to the SPI consumers to read this and ensure they are providing
> dmaable buffers of required alignment?
If they're doing anything fun for allocation. Or they can just use
kmalloc() themselves.
> The dma_addresses coming from core are aligned for larger sized buffers but
> for small ones like 1 and 3 bytes they are not aligned.
In theory even buffers that small should be DMA safe, in practice that
rarely matters since it's vanishingly rare that it's sensible to DMA
such tiny buffers rather than PIOing them so drivers will tend to never
actually try to do so and I'd expect bugs. It is likely worth checking
that DMA makes sense for this hardware.
> I have not checked the spi-nor driver, but is it the consumer driver's job
> to ensure required alignment in all cases?
Yes.
Attachment:
signature.asc
Description: PGP signature