Skip to content

Commit 600aa8e

Browse files
jsun26intelacrnsi
authored andcommitted
HV: change param type of init_pcpu_pre
When initialize secondary pcpu, pass INVALID_CPU_ID as param of init_pcpu_pre() looks weird, so change the param type to bool to represent whether the pcpu is a BSP or AP. Tracked-On: #3420 Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent e352553 commit 600aa8e

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

hypervisor/arch/x86/cpu.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ uint64_t get_active_pcpu_bitmap(void)
9494
return pcpu_active_bitmap;
9595
}
9696

97-
void init_pcpu_pre(uint16_t pcpu_id_args)
97+
void init_pcpu_pre(bool is_bsp)
9898
{
99-
uint16_t pcpu_id = pcpu_id_args;
99+
uint16_t pcpu_id;
100100
int32_t ret;
101101

102-
if (pcpu_id == BOOT_CPU_ID) {
102+
if (is_bsp) {
103+
pcpu_id = BOOT_CPU_ID;
103104
start_tsc = rdtsc();
104105

105106
/* Clear BSS */

hypervisor/arch/x86/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void init_primary_pcpu(void)
8282
{
8383
uint64_t rsp;
8484

85-
init_pcpu_pre(BOOT_CPU_ID);
85+
init_pcpu_pre(true);
8686

8787
/* Switch to run-time stack */
8888
rsp = (uint64_t)(&get_cpu_var(stack)[CONFIG_STACK_SIZE - 1]);
@@ -94,7 +94,7 @@ void init_secondary_pcpu(void)
9494
{
9595
uint16_t pcpu_id;
9696

97-
init_pcpu_pre(INVALID_CPU_ID);
97+
init_pcpu_pre(false);
9898

9999
pcpu_id = get_pcpu_id();
100100

hypervisor/include/arch/x86/cpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ void cpu_do_idle(void);
265265
void cpu_dead(void);
266266
void trampoline_start16(void);
267267
void load_pcpu_state_data(void);
268-
void init_pcpu_pre(uint16_t pcpu_id_args);
268+
void init_pcpu_pre(bool is_bsp);
269269
void init_pcpu_post(uint16_t pcpu_id);
270270
bool start_pcpus(uint64_t mask);
271271
void wait_pcpus_offline(uint64_t mask);

0 commit comments

Comments
 (0)