lkml.org 
[lkml]   [2018]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: block: DMA alignment of IO buffer allocated from slab
From
Date
On Mon, 2018-09-24 at 13:41 -0700, Matthew Wilcox wrote:
> On Mon, Sep 24, 2018 at 12:56:18PM -0700, Bart Van Assche wrote:
> > On Mon, 2018-09-24 at 11:57 -0700, Matthew Wilcox wrote:
> > > You're not supposed to use kmalloc memory for DMA. This is why we have
> > > dma_alloc_coherent() and friends.
> >
> > Are you claiming that all drivers that use DMA should use coherent DMA only? If
> > coherent DMA is the only DMA style that should be used, why do the following
> > function pointers exist in struct dma_map_ops?
>
> Good job snipping the part of my reply which addressed this. Go read
> DMA-API.txt yourself. Carefully.

The snipped part did not contradict your claim that "You're not supposed to use
kmalloc memory for DMA." In the DMA-API.txt document however there are multiple
explicit statements that support allocating memory for DMA with kmalloc(). Here
is one example from the DMA-API.txt section about dma_map_single():

Not all memory regions in a machine can be mapped by this API.
Further, contiguous kernel virtual space may not be contiguous as
physical memory. Since this API does not provide any scatter/gather
capability, it will fail if the user tries to map a non-physically
contiguous piece of memory. For this reason, memory to be mapped by
this API should be obtained from sources which guarantee it to be
physically contiguous (like kmalloc).

Bart.

\
 
 \ /
  Last update: 2018-09-24 22:54    [W:0.093 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site