Re: [PATCH v3] ad7877: keep dma rx buffers in seperate cache lines
From: Alan Cox
Date: Tue May 11 2010 - 18:34:00 EST
> SPI transfer into a DMA safe buffer. what is the exact API to
> dynamically allocate memory for the structure with this buffer
> embedded in it such that the start of the structure is cached aligned
> ? creating a dedicated kmem cache may work, but it isnt a scalable
> solution if every SPI driver needs to create its own cache.
If you are embedding structures then one solution is to cheat a bit and
make the structure, compiler and existing kernel compile abuse do the
work. Something like
struct {
void *except_where_prohibited;
long boat;
unsigned photograph;
u8 pad[0] __cacheline_aligned;
}..
ought to do the trick providing you align the start of the object - which
should happen naturally with kmalloc or dma_* apis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/