• Cédric Le Goater's avatar
    powerpc/xive: Skip ioremap() of ESB pages for LSI interrupts · b67a95f2
    Cédric Le Goater authored
    The PCI INTx interrupts and other LSI interrupts are handled differently
    under a sPAPR platform. When the interrupt source characteristics are
    queried, the hypervisor returns an H_INT_ESB flag to inform the OS
    that it should be using the H_INT_ESB hcall for interrupt management
    and not loads and stores on the interrupt ESB pages.
    
    A default -1 value is returned for the addresses of the ESB pages. The
    driver ignores this condition today and performs a bogus IO mapping.
    Recent changes and the DEBUG_VM configuration option make the bug
    visible with :
    
      kernel BUG at arch/powerpc/include/asm/book3s/64/pgtable.h:612!
      Oops: Exception in kernel mode, sig: 5 [#1]
      LE PAGE_SIZE=64K MMU=Radix MMU=Hash SMP NR_CPUS=1024 NUMA pSeries
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.0-0.rc6.git0.1.fc32.ppc64le #1
      NIP:  c000000000f63294 LR: c000000000f62e44 CTR: 0000000000000000
      REGS: c0000000fa45f0d0 TRAP: 0700   Not tainted  (5.4.0-0.rc6.git0.1.fc32.ppc64le)
      ...
      NIP ioremap_page_range+0x4c4/0x6e0
      LR  ioremap_page_range+0x74/0x6e0
      Call Trace:
        ioremap_page_range+0x74/0x6e0 (unreliable)
        do_ioremap+0x8c/0x120
        __ioremap_caller+0x128/0x140
        ioremap+0x30/0x50
        xive_spapr_populate_irq_data+0x170/0x260
        xive_irq_domain_map+0x8c/0x170
        irq_domain_associate+0xb4/0x2d0
        irq_create_mapping+0x1e0/0x3b0
        irq_create_fwspec_mapping+0x27c/0x3e0
        irq_create_of_mapping+0x98/0xb0
        of_irq_parse_and_map_pci+0x168/0x230
        pcibios_setup_device+0x88/0x250
        pcibios_setup_bus_devices+0x54/0x100
        __of_scan_bus+0x160/0x310
        pcibios_scan_phb+0x330/0x390
        pcibios_init+0x8c/0x128
        do_one_initcall+0x60/0x2c0
        kernel_init_freeable+0x290/0x378
        kernel_init+0x2c/0x148
        ret_from_kernel_thread+0x5c/0x80
    
    Fixes: bed81ee1 ("powerpc/xive: introduce H_INT_ESB hcall")
    Cc: stable@vger.kernel.org # v4.14+
    Signed-off-by: default avatarCédric Le Goater <clg@kaod.org>
    Tested-by: default avatarDaniel Axtens <dja@axtens.net>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20191203163642.2428-1-clg@kaod.org
    b67a95f2
spapr.c 18.5 KB