linux-mips
[Top] [All Lists]

Re: pci_alloc_consistent usage

To: ralf@linux-mips.org
Subject: Re: pci_alloc_consistent usage
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Wed, 28 May 2003 10:30:46 +0900 (JST)
Cc: hch@infradead.org, anemo@mba.ocn.ne.jp, wgowcher@yahoo.com, linux-mips@linux-mips.org
In-reply-to: <20030527114551.GC24905@linux-mips.org> <20030527112237.GA24905@linux-mips.org>
Organization: TOSHIBA Personal Computer System Corporation
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20030527112237.GA24905@linux-mips.org> <20030527123329.A7750@infradead.org> <20030527114551.GC24905@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
>>>>> On Tue, 27 May 2003 13:22:37 +0200, Ralf Baechle <ralf@linux-mips.org> 
>>>>> said:
ralf> While it's officially documented I still don't like it.  A
ralf> double conversion such as page_address(virt_to_page(ptr)) would
ralf> accidently turn a pointer of an uncached mapping into one to a
ralf> cached area for the same object - that will almost certainly not
ralf> work as expected on a non-coherent machine.

Yes, it's dangerous, I agree.

ralf> Whatever - virt_to_page should then be considered a a legacy API
ralf> which we have to try to support as well as possible in the hope
ralf> it's going to fade away ...

I hope so.  For now we can do something like:

     buf = pci_alloc_consistent(dev, size, &dmabuf);
#if defined(__mips__) && defined(CONFIG_NONCOHERENT_IO)
     page = virt_to_page(CAC_ADDR(buf));
#else
     page = virt_to_page(buf);
#endif

Ugly but I do not want to add extra overhead to virt_to_page itself...

---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>