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: Sat, 17 Mar 2007 14:52:29 -0700
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sat, 17 Mar 2007 14:51:26 -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=q8isl5YaeOcQ2V7YCqeN8z4aekvf3nPp7PxXiGcpnsyU064E/7czEyI6vM2DUjHzAu2oaXFK7tYdSnyvMs52BTldRhc2qUSlohlSMmweYNaX7exmoiH/AgL6XrIaNvcjKZTgkE6wfmEXwCWXvxtDUVsSn4TdCGaZRI7ygOizTp4=
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=iKM6lB9HaKjGw1l6Je7H7lH2EVo6dWxedhan1pRRrm0E7UrJ8W3diVRKzEy/Kj/YoRRnPpQnNKyhpaKuj9wZgi524mwnuYemD018LIYGP5UREgEMSpU40l7VxSKoPuydTS78OWtYYDgupS+wbdCRNcanPiFURiKHHJwPF5OaBI8=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C2214FCF.481B%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: <63c711180703161736v49c25721kb06c648f316fb292@xxxxxxxxxxxxxx> <C2214FCF.481B%keir@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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.
 
hyang 

 
On 3/17/07, Keir Fraser <keir@xxxxxxxxxxxxx> wrote:
You want to mmap() the dma_handle, not the CPU pointer.

 -- Keir


On 17/3/07 00:36, "Haw-Yuan Yang" < hawyuan@xxxxxxxxx> 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.


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