#include <xen/wait.h>
#include <xen/guest_access.h>
#include <xen/livepatch.h>
+#include <public/arch-x86/cpuid.h>
#include <public/sysctl.h>
#include <public/hvm/hvm_vcpu.h>
#include <asm/regs.h>
else
ASSERT_UNREACHABLE(); /* Not HVM and not PV? */
- if ( (rc = tsc_set_info(d, TSC_MODE_DEFAULT, 0, 0, 0)) != 0 )
+ if ( (rc = tsc_set_info(d, XEN_CPUID_TSC_MODE_DEFAULT, 0, 0, 0)) != 0 )
{
ASSERT_UNREACHABLE();
goto fail;
#include <asm/msr.h>
-/*
- * PV TSC emulation modes:
- * 0 = guest rdtsc/p executed natively when monotonicity can be guaranteed
- * and emulated otherwise (with frequency scaled if necessary)
- * 1 = guest rdtsc/p always emulated at 1GHz (kernel and user)
- * 2 = guest rdtsc always executed natively (no monotonicity/frequency
- * guarantees); guest rdtscp emulated at native frequency if
- * unsupported by h/w, else executed natively
- * 3 = Removed, was PVRDTSCP.
- */
-#define TSC_MODE_DEFAULT 0
-#define TSC_MODE_ALWAYS_EMULATE 1
-#define TSC_MODE_NEVER_EMULATE 2
-
typedef u64 cycles_t;
extern bool disable_tsc_sync;
{
uint64_t tsc;
- case TSC_MODE_NEVER_EMULATE:
+ case XEN_CPUID_TSC_MODE_NEVER_EMULATE:
*elapsed_nsec = *gtsc_khz = 0;
break;
- case TSC_MODE_DEFAULT:
+ case XEN_CPUID_TSC_MODE_DEFAULT:
if ( d->arch.vtsc )
{
- case TSC_MODE_ALWAYS_EMULATE:
+ case XEN_CPUID_TSC_MODE_ALWAYS_EMULATE:
*elapsed_nsec = get_s_time() - d->arch.vtsc_offset;
*gtsc_khz = d->arch.tsc_khz;
break;
switch ( tsc_mode )
{
- case TSC_MODE_DEFAULT:
- case TSC_MODE_ALWAYS_EMULATE:
+ case XEN_CPUID_TSC_MODE_DEFAULT:
+ case XEN_CPUID_TSC_MODE_ALWAYS_EMULATE:
d->arch.vtsc_offset = get_s_time() - elapsed_nsec;
d->arch.tsc_khz = gtsc_khz ?: cpu_khz;
set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000UL);
* When a guest is created, gtsc_khz is passed in as zero, making
* d->arch.tsc_khz == cpu_khz. Thus no need to check incarnation.
*/
- if ( tsc_mode == TSC_MODE_DEFAULT && host_tsc_is_safe() &&
+ if ( tsc_mode == XEN_CPUID_TSC_MODE_DEFAULT && host_tsc_is_safe() &&
(d->arch.tsc_khz == cpu_khz ||
(is_hvm_domain(d) &&
hvm_get_tsc_scaling_ratio(d->arch.tsc_khz))) )
{
- case TSC_MODE_NEVER_EMULATE:
+ case XEN_CPUID_TSC_MODE_NEVER_EMULATE:
d->arch.vtsc = 0;
break;
}
for_each_domain ( d )
{
- if ( is_hardware_domain(d) && d->arch.tsc_mode == TSC_MODE_DEFAULT )
+ if ( is_hardware_domain(d) &&
+ d->arch.tsc_mode == XEN_CPUID_TSC_MODE_DEFAULT )
continue;
printk("dom%u%s: mode=%d",d->domain_id,
is_hvm_domain(d) ? "(hvm)" : "", d->arch.tsc_mode);