acrn-hypervisor/hypervisor/lib
Junjie Mao e75cca64c8 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>
2018-07-03 10:18:06 +08:00
..
crypto license: Replace license text with SPDX tag 2018-06-01 10:43:06 +08:00
div.c HV:treewide:Update return type of function ffs64 and ffz64 2018-07-02 15:11:22 +08:00
mdelay.c license: Replace license text with SPDX tag 2018-06-01 10:43:06 +08:00
memory.c HV:treewide:Update return type of function ffs64 and ffz64 2018-07-02 15:11:22 +08:00
spinlock.c fix parted of "missing for discarded return value" 2018-06-19 16:21:45 +08:00
sprintf.c HV: treewide: convert suffix ULL to UL 2018-06-29 00:50:01 +08:00
string.c HV: coding style cleanup in string.c 2018-07-03 09:41:01 +08:00
udelay.c HV: timer: keep TSC frequency in KHz 2018-07-03 10:18:06 +08:00