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] Reversing the DMA handle

To: Pete Zaitcev <zaitcev@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Reversing the DMA handle
From: Keir Fraser <keir@xxxxxxxxxxxxx>
Date: Wed, 10 Jan 2007 11:04:01 +0000
Delivery-date: Wed, 10 Jan 2007 03:03:45 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070109171710.b4cf6ec6.zaitcev@xxxxxxxxxx>
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: Acc0pwh9RsGC46CaEduNDgAX8io7RQ==
Thread-topic: [Xen-devel] Reversing the DMA handle
User-agent: Microsoft-Entourage/11.2.5.060620
On 10/1/07 01:17, "Pete Zaitcev" <zaitcev@xxxxxxxxxx> wrote:

> I maintain a component in Linux kernel, called usbmon. It provides for
> snooping of USB traffic, analoguously to tcpdump. Due to pequliarities
> of USB API in Linux, usbmon has to take a DMA address (coming from
> dma_alloc_coherent() typically), find the corresponding PFN and call
> pkmap()/memcpy()/pkunmap().
> 
> My question is: how to find PFN under Xen if DMA address is known,
> on x86_64 and i386?

Use mfn_to_local_pfn() which is safe to call from any context. This will
return a !pfn_valid() value if the given MFN actually belongs to a foreign
domain (e.g., we are issuing a DMA on behalf of another guest via netback or
blkback) or if the MFN is not RAM. Otherwise it will return the local PFN.
Of course you may then want to do further translation if that happens to be
in the swiotlb aperture.

 -- Keir


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

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