Hi,

Dave reports a 2.6.28 regression here:
https://bugs.gentoo.org/show_bug.cgi?id=253149

X (server v1.5.3) no longer starts, it aborts with a mmap() error.


This is because X tries to use sysfs pci legacy_mem to map the VGA frame buffer if it is available, and this became available in 2.6.28 for ppc, but the mmap() fails with -ENXIO.

(Arguably, xserver should fallback on the old /proc approach when mmap fails, we're working on that too)

The memory map for the system is:
Found UniNorth PCI host bridge at 0x00000000f0000000. Firmware bus number: 0->0
PCI host bridge /p...@f0000000  ranges:
  MEM 0x00000000f1000000..0x00000000f1ffffff -> 0x00000000f1000000
   IO 0x00000000f0000000..0x00000000f07fffff -> 0x0000000000000000
  MEM 0x0000000090000000..0x00000000afffffff -> 0x0000000090000000
Found UniNorth PCI host bridge at 0x00000000f2000000. Firmware bus number: 0->0
PCI host bridge /p...@f2000000 (primary) ranges:
  MEM 0x00000000f3000000..0x00000000f3ffffff -> 0x00000000f3000000
   IO 0x00000000f2000000..0x00000000f27fffff -> 0x0000000000000000
  MEM 0x0000000080000000..0x000000008fffffff -> 0x0000000080000000
Found UniNorth PCI host bridge at 0x00000000f4000000. Firmware bus number: 0->0
PCI host bridge /p...@f4000000  ranges:
  MEM 0x00000000f5000000..0x00000000f5ffffff -> 0x00000000f5000000
   IO 0x00000000f4000000..0x00000000f47fffff -> 0x0000000000000000

Full dmesg here:
https://bugs.gentoo.org/attachment.cgi?id=178141&action=view


strace excerpt from X:
open("/sys/class/pci_bus/0000:00/legacy_mem", O_RDWR) = 9
mmap(NULL, 131072, PROT_READ|PROT_WRITE, MAP_SHARED, 9, 0xa0000) = -1 ENXIO (No such device or address)


Confirmed with printk debugging, the code that produces the -ENXIO condition can be found in arch/powerpc/kernel/pci-common.c pci_mmap_legacy_page_range()

                if ((offset + size) > hose->isa_mem_size)
                        return -ENXIO;

In this case, hose->isa_mem_size=0 (and offset=655360, size=65536)

As far as I can see, isa_mem_size only ever gets set if a PCI memory space is addressed to address 0, which it is not on this system (only IO regions get mapped there).

Is this a bug, or is mmap doing the correct thing by failing here?

Given the comment in pci-bridge.h:
        /* Some machines have a special region to forward the ISA
         * "memory" cycles such as VGA memory regions. Left to 0
         * if unsupported
         */

Should this check instead be:
 if (hose->isa_mem_size && ((offset + size) > hose->isa_mem_size))  ?

cheers
Daniel
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to