hv: implement cpu dead and cpu idle for riscv

implement arch_cpu_dead and arch_cpu_do_idle for riscv, arch_cpu_dead and
arch_cpu_do_idle will be called by common module.

Tracked-On: #8812
Signed-off-by: Haicheng Li <haicheng.li@outlook.com>
Signed-off-by: Xue Bosheng <bosheng.xue@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Haicheng Li
2025-09-02 10:35:25 +08:00
committed by acrnsi-robot
parent 4875a4a919
commit fb82f3b931
2 changed files with 14 additions and 8 deletions

View File

@@ -15,6 +15,7 @@
#include <delay.h>
#include <asm/sbi.h>
#include <asm/pgtable.h>
#include <schedule.h>
/*
* This array contains the hart IDs for each physial cpu.
@@ -114,3 +115,16 @@ void arch_start_pcpu(uint16_t pcpu_id)
pr_fatal("Failed to start cpu%hu by SBI HSM", pcpu_id);
}
}
void arch_cpu_do_idle(void)
{
asm volatile ("wfi"::);
}
/**
* FIXME: This is a temp solution for now. The formal solution should clear up and put pcpu into a low power state.
*/
void arch_cpu_dead(void)
{
while (true) {};
}

View File

@@ -108,14 +108,6 @@ struct stack_frame {
/* Define CPU stack alignment */
#define CPU_STACK_ALIGN 16UL
/**
* FIXME: This is a temp solution for now. The formal solution should clear up and put pcpu into a low power state.
*/
static inline void cpu_dead(void)
{
while (true) {};
}
/* In ACRN, struct per_cpu_region is a critical data structure
* containing key per-CPU data frequently accessed via get_cpu_var().
* We use the tp register to store the current logical pCPU ID to