Skip to content

Commit 8f39a22

Browse files
lifeixlijinxia
authored andcommitted
hv: cpu: remove unnecessary cpu_id valid check
Remove unnecessary cpu_id valid check if the cpu_id comes from get_cpu_id(). Signed-off-by: Li, Fei1 <fei1.li@intel.com>
1 parent a98113b commit 8f39a22

File tree

4 files changed

+4
-15
lines changed

4 files changed

+4
-15
lines changed

hypervisor/arch/x86/timer.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ static int request_timer_irq(uint16_t pcpu_id,
114114
{
115115
struct dev_handler_node *node = NULL;
116116

117-
if (pcpu_id >= phys_cpu_num) {
118-
return -EINVAL;
119-
}
120-
121117
if (per_cpu(timer_node, pcpu_id) != NULL) {
122118
pr_err("CPU%d timer isr already added", pcpu_id);
123119
unregister_handler_common(per_cpu(timer_node, pcpu_id));

hypervisor/common/hv_main.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ int32_t hv_main(uint16_t pcpu_id)
123123
pr_info("%s, Starting common entry point for CPU %hu",
124124
__func__, pcpu_id);
125125

126-
if (pcpu_id >= phys_cpu_num) {
127-
pr_err("%s, cpu_id %hu out of range %d\n",
128-
__func__, pcpu_id, phys_cpu_num);
129-
return -EINVAL;
130-
}
131-
132126
if (pcpu_id != get_cpu_id()) {
133127
pr_err("%s, cpu_id %hu mismatch\n", __func__, pcpu_id);
134128
return -EINVAL;

hypervisor/include/arch/x86/cpu.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ void stop_cpus();
408408
CPU_RFLAGS_RESTORE(cpu_int_value); \
409409
}
410410

411-
/* Macro to get CPU ID */
411+
/*
412+
* Macro to get CPU ID
413+
* @pre: the return CPU ID would never equal or large than phys_cpu_num.
414+
*/
412415
static inline uint16_t get_cpu_id(void)
413416
{
414417
uint32_t tsl, tsh, cpu_id;

hypervisor/include/debug/trace.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ struct trace_entry {
7878
static inline bool
7979
trace_check(uint16_t cpu_id, __unused uint32_t evid)
8080
{
81-
if (cpu_id >= phys_cpu_num) {
82-
return false;
83-
}
84-
8581
if (per_cpu(sbuf, cpu_id)[ACRN_TRACE] == NULL) {
8682
return false;
8783
}

0 commit comments

Comments
 (0)