• Nick Kossifidis's avatar
    riscv: try to allocate crashkern region from 32bit addressible memory · decf89f8
    Nick Kossifidis authored
    When allocating crash kernel region without explicitly specifying its
    base address/size, memblock_phys_alloc_range will attempt to allocate
    memory top to bottom (memblock.bottom_up is false), so the crash
    kernel region will end up in highmem on 64bit systems. This way
    swiotlb can't work on the crash kernel, since there won't be any
    32bit addressible memory available for the bounce buffers.
    
    Try to allocate 32bit addressible memory if available, for the
    crash kernel by restricting the top search address to be less
    than SZ_4G. If that fails fallback to the previous behavior.
    
    I tested this on HiFive Unmatched where the pci-e controller needs
    swiotlb to work, with this patch it's possible to access the pci-e
    controller on crash kernel and mount the rootfs from the nvme.
    Signed-off-by: default avatarNick Kossifidis <mick@ics.forth.gr>
    Fixes: e53d2818 ("RISC-V: Add kdump support")
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
    decf89f8
init.c 24.1 KB