diff --git a/hypervisor/arch/x86/timer.c b/hypervisor/arch/x86/timer.c index 5c322cfd5..3b20a3b0d 100644 --- a/hypervisor/arch/x86/timer.c +++ b/hypervisor/arch/x86/timer.c @@ -114,10 +114,6 @@ static int request_timer_irq(uint16_t pcpu_id, { struct dev_handler_node *node = NULL; - if (pcpu_id >= phys_cpu_num) { - return -EINVAL; - } - if (per_cpu(timer_node, pcpu_id) != NULL) { pr_err("CPU%d timer isr already added", pcpu_id); unregister_handler_common(per_cpu(timer_node, pcpu_id)); diff --git a/hypervisor/common/hv_main.c b/hypervisor/common/hv_main.c index d35751222..bc6d2bec3 100644 --- a/hypervisor/common/hv_main.c +++ b/hypervisor/common/hv_main.c @@ -123,12 +123,6 @@ int32_t hv_main(uint16_t pcpu_id) pr_info("%s, Starting common entry point for CPU %hu", __func__, pcpu_id); - if (pcpu_id >= phys_cpu_num) { - pr_err("%s, cpu_id %hu out of range %d\n", - __func__, pcpu_id, phys_cpu_num); - return -EINVAL; - } - if (pcpu_id != get_cpu_id()) { pr_err("%s, cpu_id %hu mismatch\n", __func__, pcpu_id); return -EINVAL; diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index 23a8f0638..821dd9092 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -408,7 +408,10 @@ void stop_cpus(); CPU_RFLAGS_RESTORE(cpu_int_value); \ } -/* Macro to get CPU ID */ +/* + * Macro to get CPU ID + * @pre: the return CPU ID would never equal or large than phys_cpu_num. + */ static inline uint16_t get_cpu_id(void) { uint32_t tsl, tsh, cpu_id; diff --git a/hypervisor/include/debug/trace.h b/hypervisor/include/debug/trace.h index 0a27840ac..447ea5dcf 100644 --- a/hypervisor/include/debug/trace.h +++ b/hypervisor/include/debug/trace.h @@ -78,10 +78,6 @@ struct trace_entry { static inline bool trace_check(uint16_t cpu_id, __unused uint32_t evid) { - if (cpu_id >= phys_cpu_num) { - return false; - } - if (per_cpu(sbuf, cpu_id)[ACRN_TRACE] == NULL) { return false; }