• N
    powerpc/powernv/pci-ioda: fix 32-bit TCE table init in kdump kernel · bb005455
    Nishanth Aravamudan 提交于
    When attempting to kdump with the 4.2 kernel, we see for each PCI
    device:
    
     pci 0003:01     : [PE# 000] Assign DMA32 space
     pci 0003:01     : [PE# 000] Setting up 32-bit TCE table at 0..80000000
     pci 0003:01     : [PE# 000] Failed to create 32-bit TCE table, err -22
     PCI: Domain 0004 has 8 available 32-bit DMA segments
     PCI: 4 PE# for a total weight of 70
     pci 0004:01     : [PE# 002] Assign DMA32 space
     pci 0004:01     : [PE# 002] Setting up 32-bit TCE table at 0..80000000
     pci 0004:01     : [PE# 002] Failed to create 32-bit TCE table, err -22
     pci 0004:0d     : [PE# 005] Assign DMA32 space
     pci 0004:0d     : [PE# 005] Setting up 32-bit TCE table at 0..80000000
     pci 0004:0d     : [PE# 005] Failed to create 32-bit TCE table, err -22
     pci 0004:0e     : [PE# 006] Assign DMA32 space
     pci 0004:0e     : [PE# 006] Setting up 32-bit TCE table at 0..80000000
     pci 0004:0e     : [PE# 006] Failed to create 32-bit TCE table, err -22
     pci 0004:10     : [PE# 008] Assign DMA32 space
     pci 0004:10     : [PE# 008] Setting up 32-bit TCE table at 0..80000000
     pci 0004:10     : [PE# 008] Failed to create 32-bit TCE table, err -22
    
    and eventually the kdump kernel fails to boot as none of the PCI devices
    (including the disk controller) are successfully initialized.
    
    The EINVAL response is because the DMA window (the 2GB base window) is
    larger than the kdump kernel's reserved memory (crashkernel=, in this
    case specified to be 1024M). The check in question,
    
     if ((window_size > memory_hotplug_max()) || !is_power_of_2(window_size))
    
    is a valid sanity check for pnv_pci_ioda2_table_alloc_pages(), so adjust
    the caller to pass in a smaller window size if our maximum memory value
    is smaller than the DMA window.
    
    After this change, the PCI devices successfully set up the 32-bit TCE
    table and kdump succeeds.
    
    The problem was seen on a Firestone machine originally.
    
    Fixes: aca6913f ("powerpc/powernv/ioda2: Introduce helpers to allocate TCE pages")
    Cc: stable@vger.kernel.org # 4.2
    Signed-off-by: NNishanth Aravamudan <nacc@linux.vnet.ibm.com>
    Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
    [mpe: Coding style pedantry, use u64, change the indentation]
    Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
    bb005455
pci-ioda.c 85.5 KB