From: Paul Mackerras <paulus@samba.org>
To: Dan Malek <dan@embeddededge.com>
Cc: David Gibson <david@gibson.dropbear.id.au>,
linuxppc-embedded@lists.linuxppc.org
Subject: Re: First cut at large page support on 40x
Date: Thu, 13 Jun 2002 09:49:47 +1000 (EST) [thread overview]
Message-ID: <15623.56859.381319.347724@argo.ozlabs.ibm.com> (raw)
In-Reply-To: <3D06E702.4000709@embeddededge.com>
Dan Malek writes:
> Oh, cool down and just think about this for a moment. All of this was
> done to support noncoherent caches where we allocate some VM space to
> remap pages with different cache attributes. Everything that does
> DMA expects to use virt_to_* functions to find the physical address.
Well no. Drivers shouldn't need to use virt_to_* at all.
> Of course we know the physical address, but functions using the standard
> pci_consistent_* don't know them. To support PCI on noncoherent cache
> processors you have to be able to find the physical address from the
> virtual one, and just an arithmetic operation on the virtual address
> won't work on these processors. It's just the way these functions are
> designed to work in Linux. It's obviously the only way to make it work
> with the way the higher level functions are designed.
Using the pci_* functions as a model, you have two ways to do things.
The first is to use pci_alloc_consistent. It internally gets some
pages of lowmem and, if necessary, maps them cache-inhibited somewhere
and returns both the virtual and bus addresses to the driver. The
driver gives the bus address to the device and uses the virtual
address itself and everyone is happy.
The second is to use pci_map_single/pci_unmap_single and friends. The
*_single variants work on lowmem, the *_page variants work on any page
of memory. You do a pci_map_* and get back a bus address that you
give to the device. It does its DMA, you call pci_unmap_* and then
you can access the buffer again. With this variant the buffer doesn't
need to be remapped cache-inhibited. Since the buffer is either
lowmem or specified by its struct page *, working out its physical
address is trivial. In no case do we need to go chasing through page
tables to find it.
Paul.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
prev parent reply other threads:[~2002-06-12 23:49 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-31 4:21 First cut at large page support on 40x David Gibson
2002-05-31 4:31 ` David Gibson
2002-06-04 0:43 ` Dan Malek
2002-06-04 3:59 ` David Gibson
2002-06-04 17:42 ` Dan Malek
2002-06-05 0:10 ` David Gibson
2002-06-05 17:25 ` Dan Malek
2002-06-06 1:35 ` David Gibson
2002-06-06 4:57 ` Dan Malek
2002-06-05 22:29 ` Paul Mackerras
2002-06-06 4:48 ` Dan Malek
2002-06-06 5:44 ` Paul Mackerras
2002-06-06 7:58 ` Dan Malek
2002-06-06 8:17 ` David Gibson
2002-06-12 3:52 ` David Gibson
2002-06-12 6:15 ` Dan Malek
2002-06-12 6:43 ` David Gibson
2002-06-12 15:19 ` Tom Rini
2002-06-12 23:23 ` Dan Malek
2002-06-12 23:42 ` Paul Mackerras
2002-06-13 0:28 ` Dan Malek
2002-06-13 1:01 ` Paul Mackerras
2002-06-13 4:16 ` Dan Malek
2002-06-13 5:12 ` David Gibson
2002-06-13 7:26 ` Dan Malek
2002-06-13 1:38 ` Paul Mackerras
2002-06-13 4:47 ` Dan Malek
2002-06-13 18:13 ` Armin
2002-06-14 0:33 ` David Gibson
2002-06-12 23:49 ` Paul Mackerras [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15623.56859.381319.347724@argo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=dan@embeddededge.com \
--cc=david@gibson.dropbear.id.au \
--cc=linuxppc-embedded@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).