From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: Physical address mapping to user space in dom0 problem Date: Sun, 18 Mar 2007 08:59:13 +0000 Message-ID: References: <63c711180703171452m3ade426ej937673758407724a@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1338873153==" Return-path: In-Reply-To: <63c711180703171452m3ade426ej937673758407724a@mail.gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Haw-Yuan Yang , Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --===============1338873153== Content-type: multipart/alternative; boundary="B_3257053153_4010603" > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3257053153_4010603 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit On 17/3/07 21:52, "Haw-Yuan Yang" 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 --B_3257053153_4010603 Content-type: text/html; charset="US-ASCII" Content-transfer-encoding: quoted-printable Re: [Xen-devel] Physical address mapping to user space in dom0 probl= em


On 17/3/07 21:52, "Haw-Yuan Yang" <hawyuan@gmail.com> wrote= :

I knew that pci_alloc_consistent() will return both ker= nel virtual address and physical address. If I pass the physical address (dm= a_handler) to mmap, it return -1. However if I pass the kernel virtual addre= ss 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_p= hys(cpu-ptr-returned-by-pci-alloc-consistent)). This would be a neater inter= face to userspace for your device anyway, imo.

 -- Keir
--B_3257053153_4010603-- --===============1338873153== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1338873153==--