Part of the RISC-V port. Prerequisite for the first spawn boot that reaches userspace.
machine_halt(), machine_power_off() and machine_restart() in arch/riscv/kernel/reset.c end in sbi_srst_reset() (SRST extension) or legacy SBI_EXT_0_1_SHUTDOWN, both of which act on the whole machine. A spawn kernel running the stock path powers off or resets the host.
- Spawn-side override (mirror of
mk_spawn_reboot_init() in arch/x86/multikernel/spawn.c:1732): halt/power-off/restart = every hart calls HART_STOP; the last hart too. Never SRST, never legacy shutdown, never emergency_restart() through SRST.
- Skip
register_platform_power_off(sbi_shutdown) (sbi.c:151) and the sbi_srst_reboot_nb notifier when booted as a spawn.
smp_send_stop() parks other harts in wait_for_interrupt() inside the image (arch/riscv/kernel/smp.c:86), the "hart still executing the image we are about to overwrite" hazard. Route the stop handler to HART_STOP in a spawn.
panic() paths: panic_timeout reboot must also go through the override.
mk_instance_settle_halted() completion = HART_STATUS == STOPPED for every instance hart.
Test: poweroff and reboot inside a spawn leave the host running and every instance hart STOPPED.
Part of the RISC-V port. Prerequisite for the first spawn boot that reaches userspace.
machine_halt(),machine_power_off()andmachine_restart()inarch/riscv/kernel/reset.cend insbi_srst_reset()(SRST extension) or legacySBI_EXT_0_1_SHUTDOWN, both of which act on the whole machine. A spawn kernel running the stock path powers off or resets the host.mk_spawn_reboot_init()inarch/x86/multikernel/spawn.c:1732): halt/power-off/restart = every hart callsHART_STOP; the last hart too. Never SRST, never legacy shutdown, neveremergency_restart()through SRST.register_platform_power_off(sbi_shutdown)(sbi.c:151) and thesbi_srst_reboot_nbnotifier when booted as a spawn.smp_send_stop()parks other harts inwait_for_interrupt()inside the image (arch/riscv/kernel/smp.c:86), the "hart still executing the image we are about to overwrite" hazard. Route the stop handler toHART_STOPin a spawn.panic()paths:panic_timeoutreboot must also go through the override.mk_instance_settle_halted()completion =HART_STATUS == STOPPEDfor every instance hart.Test:
poweroffandrebootinside a spawn leave the host running and every instance hart STOPPED.