|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/time: use public interface TSC mode definitions
commit 6c707d4573f5df2b60503dfeedc10b33cebd60d1
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Feb 6 16:04:43 2023 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Feb 6 16:04:43 2023 +0100
x86/time: use public interface TSC mode definitions
Now that they're properly represented in the public interface, let's do
away with our private #define-s.
No functional change intended.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/domain.c | 3 ++-
xen/arch/x86/include/asm/time.h | 14 --------------
xen/arch/x86/time.c | 17 +++++++++--------
3 files changed, 11 insertions(+), 23 deletions(-)
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d7a8237f01..a3c88cd729 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -36,6 +36,7 @@
#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>
@@ -844,7 +845,7 @@ int arch_domain_create(struct domain *d,
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;
diff --git a/xen/arch/x86/include/asm/time.h b/xen/arch/x86/include/asm/time.h
index dc2e636916..0d7989a1fe 100644
--- a/xen/arch/x86/include/asm/time.h
+++ b/xen/arch/x86/include/asm/time.h
@@ -4,20 +4,6 @@
#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;
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 7bee4f784f..782b11c8a9 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -2545,13 +2545,13 @@ void tsc_get_info(struct domain *d, uint32_t *tsc_mode,
{
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;
@@ -2588,8 +2588,8 @@ int tsc_set_info(struct domain *d,
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);
@@ -2601,12 +2601,12 @@ int tsc_set_info(struct domain *d,
* 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;
}
@@ -2674,7 +2674,8 @@ static void cf_check dump_softtsc(unsigned char key)
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);
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |