Skip to content

riscv: KEXEC_TYPE_MULTIKERNEL Image loader, placement in the grant, no purgatory #26

Description

@congwang-mk

Part of the RISC-V port.

arch/riscv/kernel/kexec_image.c already loads the Image format at any 2 MB-aligned physical address (kernel VA is fixed, PA is free, kernel_map.va_pa_offset computed at runtime). machine_kexec_file.c always loads purgatory and jumps through it.

  • Add KEXEC_TYPE_MULTIKERNEL handling: place Image and instance DTB inside the grant (instance->memory_regions), never in the running kernel's memory; skip purgatory (kexec_load_purgatory(), riscv_kernel_entry symbol patching).
  • image->start = Image load address (_start is offset 0); image->arch.fdt_addr = instance DTB. These feed the fence.i stub.
  • Never call machine_kexec()/riscv_kexec_relocate paths; the current kernel keeps running.
  • No PoC cleaning needed (harts are coherent), but execute fence after writing the image/DTB/ctrl block so the stores are ordered before HART_START.
  • Regenerate the DTB /memory nodes on every exec, not at load (the grant can change between load and exec; see the x86 "grant shortfall" fix).

Metadata

Metadata

Assignees

No one assigned

    Labels

    riscvriscv port

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions