|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 5/5] x86/time: pv_soft_rdtsc() is PV-only
Omit the function when PV=n, by moving it to the sole file using it, thus
allowing it to become static as well.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- a/xen/arch/x86/include/asm/time.h
+++ b/xen/arch/x86/include/asm/time.h
@@ -37,8 +37,6 @@ uint64_t cf_check acpi_pm_tick_to_ns(uin
uint64_t tsc_ticks2ns(uint64_t ticks);
-struct cpu_user_regs;
-uint64_t pv_soft_rdtsc(const struct vcpu *v, const struct cpu_user_regs *regs);
uint64_t gtime_to_gtsc(const struct domain *d, uint64_t time);
uint64_t gtsc_to_gtime(const struct domain *d, uint64_t tsc);
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -874,6 +874,20 @@ static uint64_t guest_efer(const struct
return val;
}
+static uint64_t soft_rdtsc(
+ const struct vcpu *v, const struct cpu_user_regs *regs)
+{
+ s_time_t old, new, now = get_s_time();
+ struct domain *d = v->domain;
+
+ do {
+ old = d->arch.vtsc_last;
+ new = now > d->arch.vtsc_last ? now : old + 1;
+ } while ( cmpxchg(&d->arch.vtsc_last, old, new) != old );
+
+ return gtime_to_gtsc(d, new);
+}
+
static int cf_check read_msr(
unsigned int reg, uint64_t *val, struct x86_emulate_ctxt *ctxt)
{
@@ -920,7 +934,7 @@ static int cf_check read_msr(
return X86EMUL_OKAY;
case MSR_IA32_TSC:
- *val = currd->arch.vtsc ? pv_soft_rdtsc(curr, ctxt->regs) : rdtsc();
+ *val = currd->arch.vtsc ? soft_rdtsc(curr, ctxt->regs) : rdtsc();
return X86EMUL_OKAY;
case MSR_EFER:
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -2848,19 +2848,6 @@ uint64_t gtsc_to_gtime(const struct doma
}
#endif /* CONFIG_HVM */
-uint64_t pv_soft_rdtsc(const struct vcpu *v, const struct cpu_user_regs *regs)
-{
- s_time_t old, new, now = get_s_time();
- struct domain *d = v->domain;
-
- do {
- old = d->arch.vtsc_last;
- new = now > d->arch.vtsc_last ? now : old + 1;
- } while ( cmpxchg(&d->arch.vtsc_last, old, new) != old );
-
- return gtime_to_gtsc(d, new);
-}
-
bool clocksource_is_tsc(void)
{
return plt_src.read_counter == READ_TSC_POISON;
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |