Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753466Ab1FTJpn (ORCPT ); Mon, 20 Jun 2011 05:45:43 -0400 Received: from mx1.melware.net ([78.47.171.162]:35946 "EHLO mx1.melware.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753353Ab1FTJpl (ORCPT ); Mon, 20 Jun 2011 05:45:41 -0400 Date: Mon, 20 Jun 2011 11:45:39 +0200 (CEST) From: Armin Schindler To: Linux Kernel Mailinglist Subject: Map PCI resource to user space problem. Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) Organization: Cytronics & Melware MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1365 Lines: 30 Hello, when I try to map PCI resource of size < PAGE_SIZE to user space with e.g. remap_pfn_range() the mapping seems to be created, but the access to the PCI device just doesn't work (read returns 0xff). The same happens when using sysfs. The device has # ls -al /sys/bus/pci/devices/0000\:02\:09.0/resource* -rw------- 1 root root 512 Jun 20 11:33 /sys/bus/pci/devices/0000:02:09.0/resource0 -rw------- 1 root root 256 Jun 20 11:33 /sys/bus/pci/devices/0000:02:09.0/resource1 -rw------- 1 root root 8388608 Jun 20 11:33 /sys/bus/pci/devices/0000:02:09.0/resource2 -rw------- 1 root root 262144 Jun 20 11:33 /sys/bus/pci/devices/0000:02:09.0/resource3 and when I mmap() resource0, a valid address is returned, but reading the area always returns 0xff. Since a kernel driver can access resource0 here without problems when using ioremap(), I'm not sure what is wrong with the sysfs entry for user space (or using remap_pfn_range() in own mmap function). The only hint I have so far is the size, which is smaller than PAGE_SIZE. What would be the correct way to map this area to user space? Thanks, Armin -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/