diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 3c2805e0b..fb0bd6b94 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -301,7 +301,7 @@ void stop_cpus(void) void cpu_do_idle(void) { - __asm __volatile("pause" ::: "memory"); + asm_pause(); } /** @@ -325,7 +325,7 @@ void cpu_dead(void) /* Halt the CPU */ do { - hlt_cpu(); + asm_hlt(); } while (halt != 0); } else { pr_err("pcpu%hu already dead", pcpu_id); diff --git a/hypervisor/arch/x86/guest/vcpu.c b/hypervisor/arch/x86/guest/vcpu.c index c24a0f947..757565599 100644 --- a/hypervisor/arch/x86/guest/vcpu.c +++ b/hypervisor/arch/x86/guest/vcpu.c @@ -578,7 +578,7 @@ void pause_vcpu(struct acrn_vcpu *vcpu, enum vcpu_state new_state) if (vcpu->pcpu_id != pcpu_id) { while (atomic_load32(&vcpu->running) == 1U) - __asm__ __volatile("pause" ::: "memory"); + asm_pause(); } } else { remove_from_cpu_runqueue(&vcpu->sched_obj, vcpu->pcpu_id); diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c index 25d4d8ffa..988397e78 100644 --- a/hypervisor/arch/x86/vtd.c +++ b/hypervisor/arch/x86/vtd.c @@ -256,7 +256,7 @@ static inline void dmar_wait_completion(const struct dmar_drhd_rt *dmar_unit, ui } ASSERT(((rdtsc() - start) < CYCLES_PER_MS), "DMAR OP Timeout!"); - pause_cpu(); + asm_pause(); } } diff --git a/hypervisor/debug/dump.c b/hypervisor/debug/dump.c index 78c671884..c450402ee 100644 --- a/hypervisor/debug/dump.c +++ b/hypervisor/debug/dump.c @@ -247,7 +247,7 @@ void asm_assert(int32_t line, const char *file, const char *txt) show_host_call_trace(rsp, rbp, pcpu_id); dump_guest_context(pcpu_id); do { - pause_cpu(); + asm_pause(); } while (1); } diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index 9cdfa3c7c..662d65928 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -306,12 +306,12 @@ static inline void cpu_msr_write(uint32_t reg, uint64_t msr_val) asm volatile (" wrmsr " : : "c" (reg), "a" ((uint32_t)msr_val), "d" ((uint32_t)(msr_val >> 32U))); } -static inline void pause_cpu(void) +static inline void asm_pause(void) { asm volatile ("pause" ::: "memory"); } -static inline void hlt_cpu(void) +static inline void asm_hlt(void) { asm volatile ("hlt"); } diff --git a/hypervisor/include/debug/logmsg.h b/hypervisor/include/debug/logmsg.h index d98ae6a82..cb45889aa 100644 --- a/hypervisor/include/debug/logmsg.h +++ b/hypervisor/include/debug/logmsg.h @@ -6,6 +6,7 @@ #ifndef LOGMSG_H #define LOGMSG_H +#include /* Logging severity levels */ #define LOG_FATAL 1U @@ -116,6 +117,6 @@ void vprintf(const char *fmt, va_list args); #define panic(...) \ do { pr_fatal("PANIC: %s line: %d\n", __func__, __LINE__); \ pr_fatal(__VA_ARGS__); \ - while (1) { asm volatile ("pause" ::: "memory"); }; } while (0) + while (1) { asm_pause(); }; } while (0) #endif /* LOGMSG_H */