Skip to content

riscv: spinwait / M-mode fallback park page (optional) #34

Description

@congwang-mk

Part of the RISC-V port. Only for platforms without SBI HSM (CONFIG_RISCV_BOOT_SPINWAIT) or M-mode Linux (CONFIG_RISCV_M_MODE). Optional; do not build the common path around it.

cpu_ops_spinwait.c spins secondaries inside the kernel image on __cpu_spinwait_stack_pointer[hartid] (indexed by hartid, hartid < NR_CPUS required). That is the x86 hazard: a hart executing an image about to be overwritten.

  • Host-owned MMU-off spin page: satp = 0, poll a per-hart mailbox, wfi, on match fence.i then jr entry with a0 = hartid, a1 = dtb. Twin of the arm64 spin-table item arm64: spin-table fallback park loop for platforms without PSCI #19.
  • Host parks a hart by jumping to the spin page with satp = 0 (same sequence riscv_kexec_relocate uses: set stvec to the physical continuation, write satp).
  • Spawn secondaries via stock spinwait pointing at the host-owned page is not possible (the pointers live in the spawn image); either keep spinwait harts inside the spawn and accept the hazard on halt, or give the spawn a mailbox-based cpu_ops. Decide when a real target appears.

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