mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-05 07:35:31 +00:00
HV: timer: keep TSC frequency in KHz
This patch represents TSC freqeuency in KHz using a 32-bit unsigned integer.
The conversion macros between ticks and us/ms are changed to inline functions to
enforce the types of the input parameters. Note that us_to_ticks accepts only
uint32_t (~4K us at most) and never overflows.
Results of some unit tests on the conversion functions:
calibrate_tsc, tsc_khz=1881600
64us -> ticks: 120422
64us -> ticks -> us: 63
511us -> ticks: 961497
511us -> ticks -> us: 510
1280000 ticks -> us: 680
1280000 ticks -> us -> ticks: 1279488
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -497,12 +497,12 @@ static void bsp_boot_post(void)
|
||||
pr_acrnlog("HV version %d.%d-rc%d-%s-%s %s build by %s, start time %lluus",
|
||||
HV_MAJOR_VERSION, HV_MINOR_VERSION, HV_RC_VERSION,
|
||||
HV_BUILD_TIME, HV_BUILD_VERSION, HV_BUILD_TYPE,
|
||||
HV_BUILD_USER, TICKS_TO_US(start_tsc));
|
||||
HV_BUILD_USER, ticks_to_us(start_tsc));
|
||||
else
|
||||
pr_acrnlog("HV version %d.%d-%s-%s %s build by %s, start time %lluus",
|
||||
HV_MAJOR_VERSION, HV_MINOR_VERSION,
|
||||
HV_BUILD_TIME, HV_BUILD_VERSION, HV_BUILD_TYPE,
|
||||
HV_BUILD_USER, TICKS_TO_US(start_tsc));
|
||||
HV_BUILD_USER, ticks_to_us(start_tsc));
|
||||
|
||||
pr_acrnlog("API version %d.%d",
|
||||
HV_API_MAJOR_VERSION, HV_API_MINOR_VERSION);
|
||||
|
||||
Reference in New Issue
Block a user