From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Eric Camachat <eric.camachat@gmail.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: virtual, physical and bus address on Dom0
Date: Fri, 17 Feb 2012 14:08:22 -0500 [thread overview]
Message-ID: <20120217190822.GB20584@phenom.dumpdata.com> (raw)
In-Reply-To: <CACeEFf42Wa38-6YJ+xYhs216QJK2yurCVKrn5=Ni0zZR9wM_mQ@mail.gmail.com>
On Fri, Feb 17, 2012 at 10:20:21AM -0800, Eric Camachat wrote:
> Consider the code:
>
> dma_addr_t dma_addr, dma_addr2;
> phys_addr_t phys_addr;
> cpu_addr = pci_alloc_consistent(pdev, size, &dma_addr);
> phys_addr = virt_to_phys(cpu_addr);
> dma_addr2 = virt_to_bus(cpu_addr);
>
> In Dom0 the outputs are:
>
> dma_addr: 0xbc800000
You should use the dma_addr.
> phys_addr: 0x5b000000
> dma_addr2: 0x5b000000
>
> Why the addresses are different in dma_addr and dma_addr2?
B/c you are doing a bit shift on the cpu_addr - both virt_to_phys
and virt_to_bus do exactly the same thing.
> Which one is the correct value I should use in DMA operations?
The one that pci_alloc_coherent gives you.
>
> Eric
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
prev parent reply other threads:[~2012-02-17 19:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-17 18:20 virtual, physical and bus address on Dom0 Eric Camachat
2012-02-17 19:08 ` Konrad Rzeszutek Wilk [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=20120217190822.GB20584@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=eric.camachat@gmail.com \
--cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.