Re: PCI DMA to small buffers on cache-incoherent arch

William Jhun
2002-06-10T18:31:46Z

On Mon, Jun 10, 2002 at 11:07:40AM -0700, William Jhun wrote:
> Perhaps provide macros in asm/pci.h that will:
>
> - Take a buffer size and add an appropriate amount (one cache line for
> alignment and the remainder to fill out the last cache line) to be
> used for kmalloc(), etc, eg:

Err, I should say any case where the buffer may not be cache-aligned
(this would enable the use of DMA to stack...). For allocation routines
that give a cache-aligned buffer, this is obviously not needed (but
would just add one cacheline to the size).

>
> #define DMA_SIZE_ROUNDUP(size) \
> ((size + 2*SMP_CACHE_BYTES - 1) & ~(SMP_CACHE_BYTES - 1))
>