linux-mips
[Top] [All Lists]

consistent_alloc() for MIPS

To: linux-mips@linux-mips.org
Subject: consistent_alloc() for MIPS
From: Johannes Stezenbach <js@convergence.de>
Date: Tue, 17 Sep 2002 17:31:02 +0200
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4i
Hi,

a co-worker ported consistent_alloc() from ARM to MIPS.
We use it to allocate DMA buffers in unified memory in
a non-PCI system-on-a-chip embedded thingy.

Maybe we could have just used pci_alloc_consistent(), but
consistent_alloc() has the advantage of freeing unused
pages allocated due to __get_free_pages() power-of-two-
number-of-pages semantics.

BTW, it seems that at least for CONFIG_SGI_IP27
pci_alloc_consistent() does not work for non-PCI DMA
buffers (hwdev == NULL). Anyway, the code for pci_alloc_consistent()
looks confusing because it seems to dereference a NULL pointer.

The attached patch works for us, but maybe someone
could comment if
a) it was a good idea to port it from ARM to MIPS
b) we made no gross mistakes (e.g. do we need to flush
   the dcache? Currently it works without. Should we
   ioremap()?)
c) if it is of use to other linux/MIPS users


One other thing:
The comments for dma_cache_wback_inv() in io.h seem
to lack a "memory" in "...makes caches and coherent...".
Also, dma_cache_wback() and dma_cache_wback_inv() seem to
be identical. Is this intentional?


Regards,
Johannes

Attachment: linux-oss-consistent-alloc.patch
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>
  • consistent_alloc() for MIPS, Johannes Stezenbach <=