summaryrefslogtreecommitdiffstats
path: root/include/linux/spinlock_up.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2010-11-16 09:13:41 -0800
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-11-16 09:15:39 -0800
commit8c05cd08a7504b855c265263e84af61aabafa329 (patch)
treeb38e0b4173c9ce2f5442911249eaccdd52efe5d3 /include/linux/spinlock_up.h
parente53beacd23d9cb47590da6a7a7f6d417b941a994 (diff)
downloadop-kernel-dev-8c05cd08a7504b855c265263e84af61aabafa329.zip
op-kernel-dev-8c05cd08a7504b855c265263e84af61aabafa329.tar.gz
PCI: fix offset check for sysfs mmapped files
I just loaded 2.6.37-rc2 on my machines, and I noticed that X no longer starts. Running an strace of the X server shows that it's doing this: open("/sys/bus/pci/devices/0000:07:00.0/resource0", O_RDWR) = 10 mmap(NULL, 16777216, PROT_READ|PROT_WRITE, MAP_SHARED, 10, 0) = -1 EINVAL (Invalid argument) This code seems to be asking for a shared read/write mapping of 16MB worth of BAR0 starting at file offset 0, and letting the kernel assign a starting address. Unfortunately, this -EINVAL causes X not to start. Looking into dmesg, there's a complaint like so: process "Xorg" tried to map 0x01000000 bytes at page 0x00000000 on 0000:07:00.0 BAR 0 (start 0x 96000000, size 0x 1000000) ...with the following code in pci_mmap_fits: pci_start = (mmap_api == PCI_MMAP_SYSFS) ? pci_resource_start(pdev, resno) >> PAGE_SHIFT : 0; if (start >= pci_start && start < pci_start + size && start + nr <= pci_start + size) It looks like the logic here is set up such that when the mmap call comes via sysfs, the check in pci_mmap_fits wants vma->vm_pgoff to be between the resource's start and end address, and the end of the vma to be no farther than the end. However, the sysfs PCI resource files always start at offset zero, which means that this test always fails for programs that mmap the sysfs files. Given the comment in the original commit 3b519e4ea618b6943a82931630872907f9ac2c2b, I _think_ the old procfs files require that the file offset be equal to the resource's base address when mmapping. I think what we want here is for pci_start to be 0 when mmap_api == PCI_MMAP_PROCFS. The following patch makes that change, after which the Matrox and Mach64 X drivers work again. Acked-by: Martin Wilck <martin.wilck@ts.fujitsu.com> Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'include/linux/spinlock_up.h')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud