• David S. Miller's avatar
    sparc64: Fix crashes in schizo_pcierr_intr_other(). · 7da89a2a
    David S. Miller authored
    Meelis Roos reports crashes during bootup on a V480 that look like
    this:
    
    ====================
    [   61.300577] PCI: Scanning PBM /pci@9,600000
    [   61.304867] schizo f009b070: PCI host bridge to bus 0003:00
    [   61.310385] pci_bus 0003:00: root bus resource [io  0x7ffe9000000-0x7ffe9ffffff] (bus address [0x0000-0xffffff])
    [   61.320515] pci_bus 0003:00: root bus resource [mem 0x7fb00000000-0x7fbffffffff] (bus address [0x00000000-0xffffffff])
    [   61.331173] pci_bus 0003:00: root bus resource [bus 00]
    [   61.385344] Unable to handle kernel NULL pointer dereference
    [   61.390970] tsk->{mm,active_mm}->context = 0000000000000000
    [   61.396515] tsk->{mm,active_mm}->pgd = fff000b000002000
    [   61.401716]               \|/ ____ \|/
    [   61.401716]               "@'/ .. \`@"
    [   61.401716]               /_| \__/ |_\
    [   61.401716]                  \__U_/
    [   61.416362] swapper/0(0): Oops [#1]
    [   61.419837] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc1-00422-g2cc91884-dirty #24
    [   61.427975] task: fff000b0fd8e9c40 ti: fff000b0fd928000 task.ti: fff000b0fd928000
    [   61.435426] TSTATE: 0000004480e01602 TPC: 00000000004455e4 TNPC: 00000000004455e8 Y: 00000000    Not tainted
    [   61.445230] TPC: <schizo_pcierr_intr+0x104/0x560>
    [   61.449897] g0: 0000000000000000 g1: 0000000000000000 g2: 0000000000a10f78 g3: 000000000000000a
    [   61.458563] g4: fff000b0fd8e9c40 g5: fff000b0fdd82000 g6: fff000b0fd928000 g7: 000000000000000a
    [   61.467229] o0: 000000000000003d o1: 0000000000000000 o2: 0000000000000006 o3: fff000b0ffa5fc7e
    [   61.475894] o4: 0000000000060000 o5: c000000000000000 sp: fff000b0ffa5f3c1 ret_pc: 00000000004455cc
    [   61.484909] RPC: <schizo_pcierr_intr+0xec/0x560>
    [   61.489500] l0: fff000b0fd8e9c40 l1: 0000000000a20800 l2: 0000000000000000 l3: 000000000119a430
    [   61.498164] l4: 0000000001742400 l5: 00000000011cfbe0 l6: 00000000011319c0 l7: fff000b0fd8ea348
    [   61.506830] i0: 0000000000000000 i1: fff000b0fdb34000 i2: 0000000320000000 i3: 0000000000000000
    [   61.515497] i4: 00060002010b003f i5: 0000040004e02000 i6: fff000b0ffa5f481 i7: 00000000004a9920
    [   61.524175] I7: <handle_irq_event_percpu+0x40/0x140>
    [   61.529099] Call Trace:
    [   61.531531]  [00000000004a9920] handle_irq_event_percpu+0x40/0x140
    [   61.537681]  [00000000004a9a58] handle_irq_event+0x38/0x80
    [   61.543145]  [00000000004ac77c] handle_fasteoi_irq+0xbc/0x200
    [   61.548860]  [00000000004a9084] generic_handle_irq+0x24/0x40
    [   61.554500]  [000000000042be0c] handler_irq+0xac/0x100
    ====================
    
    The problem is that pbm->pci_bus->self is NULL.
    
    This code is trying to go through the standard PCI config space
    interfaces to read the PCI controller's PCI_STATUS register.
    
    This doesn't work, because we more often than not do not enumerate
    the PCI controller as a bonafide PCI device during the OF device
    node scan.  Therefore bus->self remains NULL.
    
    Existing common code for PSYCHO and PSYCHO-like PCI controllers
    handles this properly, by doing the config space access directly.
    
    Do the same here, pbm->pci_ops->{read,write}().
    Reported-by: default avatarMeelis Roos <mroos@linux.ee>
    Tested-by: default avatarMeelis Roos <mroos@linux.ee>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    7da89a2a
pci_schizo.c 47.8 KB