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

Re: [Xen-devel] Physical address mapping to user space in dom0 problem

  • To: "Keir Fraser" <keir@xxxxxxxxxxxxx>
  • 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
  • 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=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Thanks, It works.
Here is what I have in the mmap handler:
if  the physical address is MMIO
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



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