From: "Michael S. Tsirkin" Subject: Userspace PIO access under xen Date: Mon, 25 Jul 2005 14:31:49 +0300 Message-ID: <20050725113149.GT2775@mellanox.co.il> Reply-To: "Michael S. Tsirkin" Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Pratt , Dror Goldenberg Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi! 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 Where does one start looking at fixing this? Thanks, MST --- #include #include #include #include #include #include #include #include #include /* Usage: test0 file offset */ int main(int argc, char** argv) { int fd; if (argc < 3) { fprintf(stderr, "Usage: %s file offset\n", argv[0]); return 2; } fd = open(argv[1], O_RDWR | O_SYNC); if (fd < 0) { perror("open"); return errno; } long o = strtol(argv[2], NULL, 0); long* ptr = mmap(NULL, 0x1000, PROT_READ, MAP_SHARED, fd, o); if ( (! ptr) || (ptr == MAP_FAILED) ) { perror("mmap"); return errno; } printf("%#lx %#lx\n", o, *ptr); return 0; } -- MST