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] Userspace PIO access under xen

To: Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] Userspace PIO access under xen
From: "Michael S. Tsirkin" <mst@xxxxxxxxxxxxxx>
Date: Mon, 25 Jul 2005 16:23:27 +0300
Cc: Dror Goldenberg <gdror@xxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 25 Jul 2005 13:19:22 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <A95E2296287EAD4EB592B5DEEFCE0E9D28276B@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
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: <A95E2296287EAD4EB592B5DEEFCE0E9D28276B@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Reply-to: "Michael S. Tsirkin" <mst@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
Quoting r. Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>:
> Subject: RE: [Xen-devel] Userspace PIO access under xen
> 
>  
> 
> > The following simple program (below) mmaps PCI I/O memory 
> > into userspace. This works fine under linux, but not in Xen dom0.
> > 
> > Linux:
> > 
> > # ./test1 /sys/bus/pci/devices/0000\:07\:00.0/resource0 0 0 0
> > 
> > Xen dom0:
> > 
> > # ./test1 /sys/bus/pci/devices/0000\:07\:00.0/resource0 0 0 0xf000eef3
> 
> 
> Interesting -- I didn't know you could use /sys/bus/pci/devices/ for
> mapping memory.
> 
> Change pci_mmap_page_range in arch/xen/arch/pci/i386.c to use
> io_remap_pfn_range
> 
> I'll check something in.
> 
> Ian
> 

OK, the following seems to work. Thanks!

---

Make pci_mmap_page_range use io_remap_pfn_range.
This fixes mmap for resources under /sys/bus/pci/devices/

Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxxxxxx>

Index: linux-2.6.12-xen0/arch/i386/pci/i386.c
===================================================================
--- linux-2.6.12-xen0/arch/i386/pci/i386.c
+++ linux-2.6.12-xen0/arch/i386/pci/i386.c
@@ -295,7 +295,7 @@ int pci_mmap_page_range(struct pci_dev *
        /* Write-combine setting is ignored, it is changed via the mtrr
         * interfaces on this platform.
         */
-       if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
+       if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
                             vma->vm_end - vma->vm_start,
                             vma->vm_page_prot))
                return -EAGAIN;

-- 
MST

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