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] Physical address mapping to user space in dom0 problem

To: "Keir Fraser" <keir@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Physical address mapping to user space in dom0 problem
From: "Haw-Yuan Yang" <hawyuan@xxxxxxxxx>
Date: Sun, 18 Mar 2007 13:11:04 -0700
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sun, 18 Mar 2007 13:09:59 -0700
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=DTYFk4RpJ8G+XsWmF8c5QZsbHF5OnPQBcT0qTNw+g1KtdVka3vzONh5GL43P2H9E6AsKVkybBG7XjUrLG5iaa2e3D6Xq2SXlJ532MALHvTGhB2Lk4FomrSlNzobPoRqRSgEUZqZhJmkgl/ugxatgGHBbHxaYv8lmyB1Q/wVuFIo=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=mw/Uea7KOxgcxIbZrsqdsYaANMJAbIOFQOPDuI2KOZHmb2TuMnG0+R/Keri6Ni8pHmTrvNYc4cmyQNYH5fg5FBTFOoD0MY0sXcFjrAXPAPoO6H+9u4YtjZYgDQaCwwhfDzgwtOHvjrdhsPjmOMid+Vb3qKH2HqjwD2y9OmVagjk=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C222AFE1.4883%keir@xxxxxxxxxxxxx>
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>
References: <63c711180703171452m3ade426ej937673758407724a@xxxxxxxxxxxxxx> <C222AFE1.4883%keir@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thanks, It works.
 
Here is what I have in the mmap handler:
 
if  the physical address is MMIO
    io_remap_pfn_range(MMIO_address)
else
   remap_pfn_range(virt_to_phys(cpu-ptr-returned-by-pci-alloc-consistent)   
 
hyang
 
 
On 3/18/07, Keir Fraser <keir@xxxxxxxxxxxxx> wrote:



On 17/3/07 21:52, "Haw-Yuan Yang" < hawyuan@xxxxxxxxx> wrote:

I knew that pci_alloc_consistent() will return both kernel virtual address and physical address. If I pass the physical address (dma_handler) to mmap, it return -1. However if I pass the kernel virtual address to mmap, I got a pointer point to the worng memory.

Oh, I see the problem. You can only mmap() MMIO regions using /dev/mem when running on Xen. Could your device (which you already implement ioctl() for) also implement mmap() itself? Then you can simply remap_pfn_range(virt_to_phys(cpu-ptr-returned-by-pci-alloc-consistent)). This would be a neater interface to userspace for your device anyway, imo.

 -- Keir

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