linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Remi Machet <rmachet@slac.stanford.edu>
Cc: Scott Wood <scottwood@freescale.com>,
	Linux PPC <linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH] dma: add new dma_mapping_ops API sync_page
Date: Fri, 10 Oct 2008 14:46:02 +1100	[thread overview]
Message-ID: <1223610362.8157.139.camel@pasglop> (raw)
In-Reply-To: <1223314733.21869.38.camel@pcds-ts102.slac.stanford.edu>


> > A virtual address will typically be needed to perform the flush; why 
> > pass the bus address?

> Because it is a sync API. You want to make sure that a physical memory
> area is in sync with the caches, not the virtual address. This
> distinction can become important in the event where the page is mapped
> multiple times in the memory and the architecture does not take care of
> synchronizing the multiple mapping, the dma_mapping_ops code should be
> able to synchronize the multiple mapping. In most case it would be easy
> of course to go from virtual address to the page address, but not if the
> page is in high memory ...

Well, not really. IE, you are right that a dma_addr_t or a struct page
is the way to go but for the wrong reasons :-)

All mappings should be coherent. The powerpc architecture is pretty
strict with that. The only known violation is the instruction cache on
44x but that's irrelevant to your problem.

Thus, -any- virtual address will do.

However, you may not have a virtual address. You may get into a
situation where the page isn't in the linear mapping and needs to be
kmap'ed for the sync to happen.

Now, using PCI_DRAM_OFFSET in bus_to_page() is incorrect here with
Becky's new set of changes. You need to get the offset properly using
the accessor she provides (I don't have the name off the top of my
head).

Cheers,
Ben.

  reply	other threads:[~2008-10-10  3:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-01 22:03 [PATCH] dma: add new dma_mapping_ops API sync_page Remi Machet
2008-10-03 16:33 ` Remi Machet
2008-10-06 16:30   ` Scott Wood
2008-10-06 17:38     ` Remi Machet
2008-10-10  3:46       ` Benjamin Herrenschmidt [this message]
2008-10-10 16:16         ` Remi Machet

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=1223610362.8157.139.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=rmachet@slac.stanford.edu \
    --cc=scottwood@freescale.com \
    /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).