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: Sat, 17 Mar 2007 07:57:03 +0000 Message-ID: References: <63c711180703161736v49c25721kb06c648f316fb292@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1750934929==" Return-path: In-Reply-To: <63c711180703161736v49c25721kb06c648f316fb292@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. --===============1750934929== Content-type: multipart/alternative; boundary="B_3256963024_2506222" > 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_3256963024_2506222 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit You want to mmap() the dma_handle, not the CPU pointer. -- Keir On 17/3/07 00:36, "Haw-Yuan Yang" wrote: > In driver I have an IOCTL option IO_DMA_ALLOC to allocate the DMA buffer by > using pci_alloc_consistent() and return the allocated physical address to user > space. > > In user space testing program: > > 1. Call IOCTL IO_DMA_ALLOC to allocate a 64Kbyte DMA buffer. The physical > address of the allocated buffer is 0x03bb0000. > 2. Open /dev/mem and call > mmap(0,64*1024,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0x03bb0000) ; > > the return of mmap is -1. --B_3256963024_2506222 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 You w= ant to mmap() the dma_handle, not the CPU pointer.

 -- Keir

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

In driver I have an IOCTL option IO_DMA_ALLOC to alloca= te the DMA buffer by using pci_alloc_consistent() and return the allocated p= hysical address to user space.
 
In user space testing program:
 
1. Call IOCTL IO_DMA_ALLOC to allocate a 64Kbyte DMA buffer. The physical a= ddress of the allocated buffer is 0x03bb0000.
2. Open /dev/mem and call mmap(0,64*1024,PROT_READ|PROT_WRITE,MAP_SHARED,fd= ,0x03bb0000) ;  
 
the return of mmap is -1.

--B_3256963024_2506222-- --===============1750934929== 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 --===============1750934929==--