From d3c218ebe3e05e8e5b010fa72745eaf0f0071540 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Sun, 8 Feb 2009 14:27:21 +0000 Subject: [PATCH] --- yaml --- r: 131223 b: refs/heads/master c: 5b11abfdb572bf9284e596dd198ac2aaf95b6616 h: refs/heads/master i: 131221: a06e7a5e016be7433136dee0a40d13e580adebb8 131219: 5e733365059463c59de6641136b299f06ee88cdb 131215: 6541e11f72a7874ebb34b86882d04f8670ce5a9c v: v3 --- [refs] | 2 +- trunk/arch/powerpc/kernel/pci-common.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index cde837cf399d..9f44c452dbbb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d87bf76679bd37593ae4a3133f5da9395a4963ac +refs/heads/master: 5b11abfdb572bf9284e596dd198ac2aaf95b6616 diff --git a/trunk/arch/powerpc/kernel/pci-common.c b/trunk/arch/powerpc/kernel/pci-common.c index 19b12d2cbb4b..0f4181272311 100644 --- a/trunk/arch/powerpc/kernel/pci-common.c +++ b/trunk/arch/powerpc/kernel/pci-common.c @@ -561,8 +561,21 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus, (unsigned long long)(offset + size - 1)); if (mmap_state == pci_mmap_mem) { - if ((offset + size) > hose->isa_mem_size) - return -ENXIO; + /* Hack alert ! + * + * Because X is lame and can fail starting if it gets an error trying + * to mmap legacy_mem (instead of just moving on without legacy memory + * access) we fake it here by giving it anonymous memory, effectively + * behaving just like /dev/zero + */ + if ((offset + size) > hose->isa_mem_size) { + printk(KERN_DEBUG + "Process %s (pid:%d) mapped non-existing PCI legacy memory for 0%04x:%02x\n", + current->comm, current->pid, pci_domain_nr(bus), bus->number); + if (vma->vm_flags & VM_SHARED) + return shmem_zero_setup(vma); + return 0; + } offset += hose->isa_mem_phys; } else { unsigned long io_offset = (unsigned long)hose->io_base_virt - _IO_BASE;