diff options
author | Fei Li <fei1.li@intel.com> | 2022-08-04 08:59:03 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2022-08-04 12:11:59 +0300 |
commit | 81a71f51b89e84f39df2a3b1daf4274ae6b7b194 (patch) | |
tree | 5a4ce493c1ea3f7f848b01eb46ea9c9eebd26b40 /arch/x86/include/asm/acrn.h | |
parent | 9de1f9c8ca5100a02a2e271bdbde36202e251b4b (diff) | |
download | linux-81a71f51b89e84f39df2a3b1daf4274ae6b7b194.tar.xz |
x86/acrn: Set up timekeeping
ACRN Hypervisor reports timing information via CPUID leaf 0x40000010.
Get the TSC and CPU frequency via CPUID leaf 0x40000010 and set the
kernel values accordingly.
Signed-off-by: Fei Li <fei1.li@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Conghui <conghui.chen@intel.com>
Link: https://lore.kernel.org/r/20220804055903.365211-1-fei1.li@intel.com
Diffstat (limited to 'arch/x86/include/asm/acrn.h')
-rw-r--r-- | arch/x86/include/asm/acrn.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/x86/include/asm/acrn.h b/arch/x86/include/asm/acrn.h index e003a01b7c67..1dd14381bcb6 100644 --- a/arch/x86/include/asm/acrn.h +++ b/arch/x86/include/asm/acrn.h @@ -10,6 +10,15 @@ /* Bit 0 indicates whether guest VM is privileged */ #define ACRN_FEATURE_PRIVILEGED_VM BIT(0) +/* + * Timing Information. + * This leaf returns the current TSC frequency in kHz. + * + * EAX: (Virtual) TSC frequency in kHz. + * EBX, ECX, EDX: RESERVED (reserved fields are set to zero). + */ +#define ACRN_CPUID_TIMING_INFO 0x40000010 + void acrn_setup_intr_handler(void (*handler)(void)); void acrn_remove_intr_handler(void); @@ -21,6 +30,11 @@ static inline u32 acrn_cpuid_base(void) return 0; } +static inline unsigned long acrn_get_tsc_khz(void) +{ + return cpuid_eax(ACRN_CPUID_TIMING_INFO); +} + /* * Hypercalls for ACRN * |