From: "Russell McGuire" <rmcguire@videopresence.com>
To: <linuxppc-embedded@ozlabs.org>
Subject: virt_to_phys() in drivers w/dma - MPC8xxx
Date: Fri, 22 Aug 2008 16:14:28 -0700 [thread overview]
Message-ID: <6FC450394F2147FDB7EC1D1EB168EB8B@absolutdaddy> (raw)
In-Reply-To: <mailman.1.1217383202.19379.linuxppc-embedded@ozlabs.org>
A style / function question. I have been seeing conflicting articles and
examples on what the proper method would be for some of the Freescale MPC
drivers. I am putting together an ATM driver, and 'might' be having some
erratic results due to this function. Not sure yet, but wanted to put this
out there for comments.
In many cases when dealing with TxBD or RxBD pointers a UCC or what not
driver will use the virt_to_phys() call to get what I assume is a physical
address that can be used for dma? Perhaps not in all cases, but a majority.
See ucc_geth.c for an example of the usage. I have also seen some prototype
drivers that use this call to get the physical address to place into the
QE_MURAM for the PRAM initialization.
I then ran across this link:
http://mirror.linux.org.au/linux.conf.au/2005/cdrom-beta-1/linux-mandocs-2.6
.12.6/virt_to_phys.html
Which states:
The returned physical address is the physical (CPU) mapping for the memory
address given. It is only valid to use this function on addresses directly
mapped or allocated via kmalloc. This function does not give bus mappings
for DMA transfers. In almost all conceivable cases a device driver should
not be using this function.
-----------
So shouldn't we be using like dma_alloc_coherent, and then tracking the dma
address separately as a variable, and use it when necessary instead of
calling virt_to_phys()?
Or am I confused on what these are doing?
-Russ
next prev parent reply other threads:[~2008-08-22 23:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1.1217383202.19379.linuxppc-embedded@ozlabs.org>
2008-08-20 23:49 ` ELDK Fedora Core 9 Russell McGuire
2008-08-21 10:10 ` Wolfgang Denk
2008-08-22 23:14 ` Russell McGuire [this message]
2008-08-25 15:33 ` virt_to_phys() in drivers w/dma - MPC8xxx Scott Wood
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=6FC450394F2147FDB7EC1D1EB168EB8B@absolutdaddy \
--to=rmcguire@videopresence.com \
--cc=linuxppc-embedded@ozlabs.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