[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Getting a bus address for granted page in dom0


  • To: Kieran Mansley <kmansley@xxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
  • Date: Tue, 07 Nov 2006 11:26:32 +0000
  • Delivery-date: Tue, 07 Nov 2006 03:26:57 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AccCX5NQ0bidsW5SEdurgAAX8io7RQ==
  • Thread-topic: [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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.