hv:Change phys_cpu_num to static

-- change phys_cpu_num to static
-- add get_pcpu_nums() and is_pcpu_active() APIs
-- replace phys_cpu_num with get_pcpu_nums() except cpu.c

Tracked-On: #1842
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Mingqiang Chi
2018-12-26 13:54:05 +08:00
committed by wenlingz
parent 59e2de4805
commit 682824de6d
16 changed files with 57 additions and 35 deletions

View File

@@ -462,6 +462,8 @@ static inline void clac(void)
asm volatile ("clac" : : : "memory");
}
uint16_t get_pcpu_nums(void);
bool is_pcpu_active(uint16_t pcpu_id);
#else /* ASSEMBLER defined */
#endif /* ASSEMBLER defined */

View File

@@ -270,6 +270,10 @@ int32_t vlapic_create(struct acrn_vcpu *vcpu);
* @pre vcpu != NULL
*/
void vlapic_free(struct acrn_vcpu *vcpu);
/**
* @pre vlapic->vm != NULL
* @pre vlapic->vcpu->vcpu_id < CONFIG_MAX_VCPUS_PER_VM
*/
void vlapic_init(struct acrn_vlapic *vlapic);
void vlapic_reset(struct acrn_vlapic *vlapic);
void vlapic_restore(struct acrn_vlapic *vlapic, const struct lapic_regs *regs);

View File

@@ -50,7 +50,7 @@
#define DEFAULT_DEST_MODE IOAPIC_RTE_DESTLOG
#define DEFAULT_DELIVERY_MODE IOAPIC_RTE_DELLOPRI
#define ALL_CPUS_MASK ((1UL << (uint64_t)phys_cpu_num) - 1UL)
#define ALL_CPUS_MASK ((1UL << (uint64_t)get_pcpu_nums()) - 1UL)
#define IRQ_ALLOC_BITMAP_SIZE INT_DIV_ROUNDUP(NR_IRQS, 64U)

View File

@@ -56,7 +56,6 @@ struct per_cpu_region {
} __aligned(PAGE_SIZE); /* per_cpu_region size aligned with PAGE_SIZE */
extern struct per_cpu_region per_cpu_data[];
extern uint16_t phys_cpu_num;
extern uint64_t pcpu_active_bitmap;
/*
* get percpu data for pcpu_id.