|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] Getting a bus address for granted page in dom0
On 6/11/06 14:55, "Kieran Mansley" <kmansley@xxxxxxxxxxxxxx> wrote:
>> I pass a grant from domU to dom0, and map it in to dom0 using
>> xenbus_map_ring_valloc(). This gives me a "struct vm_struct" which
>> isn't terribly useful as most of it isn't filled out, but it does have a
>> virtual address for the page in dom0. I need to pass this page to a PCI
>> device, and so would like to use something like pci_map_single() (or
>> dma_map_page()) to convert this virtual address into a bus address.
>> However, neither of these seem to be working as one might hope: they
>> always return the same value regardless of the address you pass in (at
>> least for the valid addresses that I've tried).
Map_ring_valloc() maps the page into the vmalloc area of the kernel address
space. Thus it has no 'struct page' backing it and none of the DMA macros
will work.
Do you need to map the rings into dom0 addr space at all? If not just do a
GNTMAP_device_map yourself, and this will return a dev_bus_addr that you can
poke into hardware. If you go this route you avoid using the Linux DMA
interfaces altogether.
If you need to be able to use those macros then you need to map the grant
into Linux lowmem. You'll then have a 'struct page' associated with the
virtual address you mapped at, and so long as you update the
physical_to_machine_mapping table you should find the DMA API starts to work
for you.
-- Keir
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|