pci issue - wrong detection of pci ressources

Christian Ehrhardt ehrhardt at linux.vnet.ibm.com
Mon Apr 21 06:36:07 EST 2008


Johan Borkhuis wrote:
> Hello Christian,
> 
> Christian Ehrhardt wrote:
>> Hi,
>> I tried to use a radeon r200 based graphic card on a sequoia ppc 
>> (440epx) board. I wondered about the initialization of radeonfb that 
>> failed with
>>     __ioremap(): phys addr 0x0 is RAM lr c029cf80
>>     radeonfb (0000:00:0a.0): cannot map MMIO
>>     radeonfb: probe of 0000:00:0a.0 failed with error -5
>>
[...]
> 
> I came across a similar problem, which (ultimately) was caused by a lack 
> of memory reserved for PCI. I moved from 2.6.14(ppc) to 2.6.20(powerpc), 
> and suddenly some cards stopped working: the BAR registers were not 
> initialized, so it was not possible to access the cards.
> Have a look at the boot-time messages, especially the early messages, as 
> the PCI subsystem is started very early in the boot process. You could 
> also try switching on PCI-debugging, and have a look at the debug 
> messages, or add some extra debugging info to the pci-initialization code.

Yes you're right. Early at the pci initialization are errors of the allocation for pi ressources.
And that are exactly the ressources failing later, so that pci initialization seem to be the reason for my problem.
Was there any simple solution (e.g. just somehow increase memory reserved for pci) when you came across that issue Johan ?

With DEBUG in pci-common.c enabled (bad kernel) and a extension showing which functions alloc fails (put a %s for __func__):
PCI host bridge /plb/pci at 1ec000000 (primary) ranges:
 MEM 0x0000000180000000..0x000000018fffffff -> 0x0000000080000000
  IO 0x00000001e8000000..0x00000001e80fffff -> 0x0000000000000000
4xx PCI DMA offset set to 0x00000000
PCI: Probing PCI hardware
PCI: Hiding 4xx host bridge resources 0000:00:00.0
Try to map irq for 0000:00:00.0...
 -> got one, spec 2 cells (0x00000003 0x00000008...) on /interrupt-controller2
 -> mapped to linux irq 16
Try to map irq for 0000:00:0a.0...
 -> got one, spec 2 cells (0x00000003 0x00000008...) on /interrupt-controller2
 -> mapped to linux irq 16
Try to map irq for 0000:00:0a.1...
PCI: PHB (bus 0) bridge rsrc 0: 0000000000000000-00000000000fffff [0x100], parent c0363060 (PCI IO)
PCI: PHB (bus 0) bridge rsrc 1: 0000000180000000-000000018fffffff [0x200], parent c0363038 (PCI mem)
PCI: Assigning unassigned resouces...
PCI: pci_assign_resource - Failed to allocate mem resource #6:20000 at 190000000 for 0000:00:0a.0
PCI: pci_assign_resource - Failed to allocate mem resource #2:10000 at 190000000 for 0000:00:0a.0
PCI: pci_assign_resource - Failed to allocate mem resource #1:10000 at 190000000 for 0000:00:0a.1

-- 

Grüsse / regards, 
Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization


########


To be complete for the case we might need it I answer all the other questions:

Benjamin Herrenschmidt wrote:
> On Fri, 2008-04-18 at 14:07 +0200, Christian Ehrhardt wrote:
>> => Region 2 is not detected with our kernel, this later break things
>> like radeonfb initialization.
> 
> I'll need some information here:
> 
> - Your device-tree (is that the base sequoia one ?)

DTS File is the normal sequoia.dts file in arch/powerpc/boot/dts with the latest change being:
user:        Stefan Roese <sr at denx.de>
date:        Fri Feb 15 21:35:30 2008 -0600
summary:     [POWERPC] 4xx: Remove "i2c" and "xxmii-interface" device_types from dts

> - Enable DEBUG in arch/powerpc/kernel/pci-common.c and pci_32.c
> - Send me the resulting dmesg log

done - full dmesg attached

> - Also include the output of /proc/iomem

/proc/iomem - bad kernel
root at sequoia:~# cat /proc/iomem
e0000300-e000038f : ehci_hcd
180000000-18fffffff : /plb/pci at 1ec000000
  180000000-187ffffff : 0000:00:0a.0
  188000000-18fffffff : 0000:00:0a.1
1ef600300-1ef600307 : serial
1ef600400-1ef600407 : serial
1ef600500-1ef600507 : serial
1ef600600-1ef600607 : serial
1fc000000-1ffffffff : 1fc000000.nor_flash

/proc/iomem - good kernel
root at sequoia:~# cat /proc/iomem
80000000-8fffffff : PCI host bridge
  80000000-8000ffff : 0000:00:0a.1
  80020000-8003ffff : 0000:00:0a.0
  87ff0000-87ffffff : 0000:00:0a.0
    87ff0000-87ffffff : radeonfb mmio
  88000000-8fffffff : 0000:00:0a.0
    88000000-8fffffff : radeonfb framebuffer
d0000000-d0001fff : ndfc-nand.0
e0000100-e000017f : musbhsfc_udc.0
  e0000100-e000017f : musbhsfc_udc
e0000300-e00003ff : ppc-soc-ehci.0
e0000400-e00004ff : ppc-soc-ohci.0
fc000000-ffffffff : physmap-flash.0
  fc000000-ffffffff : physmap-flash.0
 

> Actually, there's a bug in radeonfb:
> 
> In radeonfb.h, try changing
> 
> 	unsigned long		mmio_base_phys;
> 	unsigned long		fb_base_phys;
> 
> To
> 
> 	resource_size_t		mmio_base_phys;
> 	resource_size_t		fb_base_phys;

This did not fix the issue, as we have seen that it is caused earlier in pci initialization.
But that fix corrects the code if it is useful in my case or not ;-)

########

Sergei Shtylyov wrote:
> Christian Ehrhardt wrote:
> 
[...]
>> Bad kernel:
>> 00:0a.0 VGA compatible controller: ATI Technologies Inc RV280 [Radeon 
>> 9200 PRO] (rev 01) (prog-if 00 [VGA])
>>        Subsystem: PC Partner Limited Unknown device 0250
>>        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
>> ParErr- Stepping- SERR- FastB2B-
>>        Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium 
>> >TAbort- <TAbort- <MAbort- >SERR- <PERR-
>>        Latency: 128 (2000ns min)
>>        Interrupt: pin A routed to IRQ 16
>>        Region 0: Memory at 180000000 (32-bit, prefetchable) [size=128M]
> 
>    That's beyond 4 GB, seems correct. That should be the address 
> assigned by bootloader? BTW, what's your bootloader, U-Boot?

Yes a modified u-boot

> 
>>        Region 1: I/O ports at 1000 [size=256]
>>        Region 2: Memory at <ignored> (32-bit, non-prefetchable)
> 
>    Hm... what could this mean? Could you post the result of 'lspci -x'?

lspci -xvvv (bad kernel)
00:0a.0 VGA compatible controller: ATI Technologies Inc RV280 [Radeon 9200 PRO] (rev 01) (prog-if 00 [VGA])
        Subsystem: PC Partner Limited Unknown device 0250
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 128 (2000ns min)
        Interrupt: pin A routed to IRQ 16
        Region 0: Memory at 180000000 (32-bit, prefetchable) [size=128M]
        Region 1: I/O ports at 1000 [size=256]
        Region 2: Memory at <ignored> (32-bit, non-prefetchable)
        Capabilities: [50] Power Management version 2
                Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-
00: 02 10 60 59 07 00 90 02 01 00 00 03 00 80 80 00
10: 08 00 00 80 01 10 00 00 00 00 00 88 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 4b 17 50 02
30: 00 00 00 00 50 00 00 00 00 00 00 00 43 01 08 00

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pci_resource_alocation_fails.dmesg.txt
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20080420/576dab62/attachment.txt>


More information about the Linuxppc-dev mailing list