WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Kieran Mansley <kmansley@xxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Getting a bus address for granted page in dom0
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1162824954.4614.15.camel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AccCX5NQ0bidsW5SEdurgAAX8io7RQ==
Thread-topic: [Xen-devel] Getting a bus address for granted page in dom0
User-agent: Microsoft-Entourage/11.2.5.060620
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

<Prev in Thread] Current Thread [Next in Thread>