diff --git a/hypervisor/arch/x86/trusty.c b/hypervisor/arch/x86/trusty.c index b1e1a38f1..85a2b1339 100644 --- a/hypervisor/arch/x86/trusty.c +++ b/hypervisor/arch/x86/trusty.c @@ -317,7 +317,7 @@ static bool setup_trusty_info(struct vcpu *vcpu, mem->first_page.startup_param.size_of_this_struct = sizeof(struct trusty_startup_param); mem->first_page.startup_param.mem_size = mem_size; - mem->first_page.startup_param.tsc_per_ms = TIME_MS_DELTA; + mem->first_page.startup_param.tsc_per_ms = CYCLES_PER_MS; mem->first_page.startup_param.trusty_mem_base = TRUSTY_EPT_REBASE_GPA; /* According to trusty boot protocol, it will use RDI as the diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c index a8340d10d..61c90da25 100644 --- a/hypervisor/arch/x86/vtd.c +++ b/hypervisor/arch/x86/vtd.c @@ -105,7 +105,7 @@ #define IOMMU_LOCK(u) spinlock_obtain(&((u)->lock)) #define IOMMU_UNLOCK(u) spinlock_release(&((u)->lock)) -#define DMAR_OP_TIMEOUT TIME_MS_DELTA +#define DMAR_OP_TIMEOUT CYCLES_PER_MS #define DMAR_WAIT_COMPLETION(offset, condition, status) \ do { \ @@ -114,7 +114,7 @@ status = iommu_read32(dmar_uint, offset); \ if (condition) \ break; \ - ASSERT((rdtsc() - start < TIME_MS_DELTA), \ + ASSERT((rdtsc() - start < CYCLES_PER_MS), \ "DMAR OP Timeout!"); \ asm volatile ("pause" ::: "memory"); \ } \ diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c index d089bc84b..b7069c8c1 100644 --- a/hypervisor/debug/console.c +++ b/hypervisor/debug/console.c @@ -231,6 +231,6 @@ void console_setup_timer(void) { /* Start an one-shot timer */ if (add_timer(console_timer_callback, 0, - rdtsc() + TIME_MS_DELTA * CONSOLE_KICK_TIMER_TIMEOUT) < 0) + rdtsc() + CYCLES_PER_MS * CONSOLE_KICK_TIMER_TIMEOUT) < 0) pr_err("Failed to add console kick timer"); } diff --git a/hypervisor/include/lib/rtl.h b/hypervisor/include/lib/rtl.h index 2bba8361c..c39646352 100644 --- a/hypervisor/include/lib/rtl.h +++ b/hypervisor/include/lib/rtl.h @@ -67,7 +67,7 @@ int udiv32(uint32_t dividend, uint32_t divisor, struct udiv_result *res); extern uint64_t tsc_clock_freq; #define US_TO_TICKS(x) ((x)*tsc_clock_freq/1000000UL) -#define TIME_MS_DELTA US_TO_TICKS(1000UL) +#define CYCLES_PER_MS US_TO_TICKS(1000UL) #define TICKS_TO_US(x) ((((x) * (1000000UL >> 8)) / tsc_clock_freq) << 8) #define TICKS_TO_MS(x) (((x) * 1000UL) / tsc_clock_freq) diff --git a/hypervisor/lib/udelay.c b/hypervisor/lib/udelay.c index 1a0576ece..29b66d790 100644 --- a/hypervisor/lib/udelay.c +++ b/hypervisor/lib/udelay.c @@ -36,7 +36,7 @@ void udelay(int loop_count) uint64_t dest_tsc, delta_tsc; /* Calculate number of ticks to wait */ - delta_tsc = TIME_MS_DELTA * loop_count; + delta_tsc = CYCLES_PER_MS * loop_count; dest_tsc = rdtsc() + delta_tsc; /* Loop until time expired */