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: Tue, 27 May 2003 19:07:49 +0900 (JST)
Cc: wgowcher@yahoo.com, linux-mips@linux-mips.org
In-reply-to: <20030527091740.GA23296@linux-mips.org>
Organization: TOSHIBA Personal Computer System Corporation
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20030523215935.71373.qmail@web11901.mail.yahoo.com> <20030527091740.GA23296@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
>>>>> On Tue, 27 May 2003 11:17:40 +0200, Ralf Baechle <ralf@linux-mips.org> 
>>>>> said:
ralf> Use the value returned by pci_alloc_consistent in *dma_handle
ralf> instead of trying to do any conversions with of
ralf> pci_alloc_consistent's return value.

How about virt_to_page()?

Currently, many sound drivers (including ALSA) pass a
pci_alloc_consistent's return value to virt_to_page.  While
virt_to_page is defined as below, we can not pass KSEG1 address
(returned by pci_alloc_consistent) to virt_to_page.

#define __pa(x)         ((unsigned long) (x) - PAGE_OFFSET)
#define virt_to_page(kaddr)     (mem_map + (__pa(kaddr) >> PAGE_SHIFT))

Following definition can handle this case properly,

#define virt_to_page(kaddr)     (mem_map + (PHYSADDR(kaddr) >> PAGE_SHIFT))

But as ralf said, PHYSADDR() may be is a bit slower then __pa().

Is it worth to change?  Or should we fix the driver using virt_to_page
with pci_alloc_consistent?

---
Atsushi Nemoto

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