• Youling Tang's avatar
    MIPS: kexec: Add crashkernel=YM handling · 26262396
    Youling Tang authored
    When the kernel crashkernel parameter is specified with just a size,
    we are supposed to allocate a region from RAM to store the crashkernel.
    However, MIPS merely reserves physical address zero with no checking
    that there is even RAM there.
    
    Fix this by lifting similar code from x86, importing it to MIPS with the
    MIPS specific parameters added. In the absence of any platform specific
    information, we allocate the crashkernel region from the first 512MB of
    physical memory (limited to CKSEG0 or KSEG0 address range).
    
    When X is not specified, crash_base defaults to 0 (crashkernel=YM@XM).
    
    E.g. without this patch:
    
    The environment as follows:
    [    0.000000] MIPS: machine is loongson,loongson64c-4core-ls7a
    ...
    [    0.000000] Kernel command line: root=/dev/sda2 crashkernel=96M ...
    
    The warning as follows:
    [    0.000000] Invalid memory region reserved for crash kernel
    
    And the iomem as follows:
    00200000-0effffff : System RAM
      00200000-00b47f87 : Kernel code
      00b47f88-00dfffff : Kernel data
      00e60000-01f73c7f : Kernel bss
    1a000000-1bffffff : pci@1a000000
    ...
    
    With this patch:
    
    After increasing crash_base <= 0 handling.
    
    And the iomem as follows:
    00200000-0effffff : System RAM
      00200000-00b47f87 : Kernel code
      00b47f88-00dfffff : Kernel data
      00e60000-01f73c7f : Kernel bss
      04000000-09ffffff : Crash kernel
    1a000000-1bffffff : pci@1a000000
    ...
    Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
    Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
    26262396
setup.c 21.6 KB