Messages in this thread | ![/](/images/icornerl.gif) | | Date | Thu, 1 Feb 2024 12:52:20 +0000 | From | Will Deacon <> | Subject | Re: [PATCH v2 3/3] swiotlb: Honour dma_alloc_coherent() alignment in swiotlb_alloc() |
| |
On Wed, Jan 31, 2024 at 04:03:38PM +0000, Robin Murphy wrote: > On 31/01/2024 12:25 pm, Will Deacon wrote: > > core-api/dma-api-howto.rst states the following properties of > > dma_alloc_coherent(): > > > > | The CPU virtual address and the DMA address are both guaranteed to > > | be aligned to the smallest PAGE_SIZE order which is greater than or > > | equal to the requested size. > > > > However, swiotlb_alloc() passes zero for the 'alloc_align_mask' > > parameter of swiotlb_find_slots() and so this property is not upheld. > > Instead, allocations larger than a page are aligned to PAGE_SIZE, > > > > Calculate the mask corresponding to the page order suitable for holding > > the allocation and pass that to swiotlb_find_slots(). > > I guess this goes back to at least e81e99bacc9f ("swiotlb: Support aligned > swiotlb buffers") when the explicit argument was added - not sure what we do > about 5.15 LTS though (unless the answer is to not care...)
Thanks. I'll add the Fixes: tag but, to be honest, if we backport the first patch then I'm not hugely fussed about this one in -stable kernels simply because I spotted it my inspection rather than an real failure.
> As before, though, how much of patch #1 is needed if this comes first?
See my reply over there, but I think we need all of this.
Will
| ![\](/images/icornerr.gif) |