aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xen/arch/x86/hvm/i8254.c2
-rw-r--r--xen/arch/x86/hvm/save.c6
-rw-r--r--xen/arch/x86/hvm/vpt.c2
-rw-r--r--xen/include/asm-x86/hvm/domain.h3
-rw-r--r--xen/include/asm-x86/hvm/vpt.h2
-rw-r--r--xen/include/public/arch-x86/hvm/save.h2
6 files changed, 10 insertions, 7 deletions
diff --git a/xen/arch/x86/hvm/i8254.c b/xen/arch/x86/hvm/i8254.c
index 2babc2e93d..2d206889ba 100644
--- a/xen/arch/x86/hvm/i8254.c
+++ b/xen/arch/x86/hvm/i8254.c
@@ -481,8 +481,6 @@ void pit_init(struct vcpu *v, unsigned long cpu_khz)
register_portio_handler(v->domain, PIT_BASE, 4, handle_pit_io);
register_portio_handler(v->domain, 0x61, 1, handle_speaker_io);
- ticks_per_sec(v) = cpu_khz * (int64_t)1000;
-
pit_reset(v->domain);
}
diff --git a/xen/arch/x86/hvm/save.c b/xen/arch/x86/hvm/save.c
index 6d93340c8b..235be64a96 100644
--- a/xen/arch/x86/hvm/save.c
+++ b/xen/arch/x86/hvm/save.c
@@ -32,7 +32,8 @@ void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
cpuid(1, &eax, &ebx, &ecx, &edx);
hdr->cpuid = eax;
- hdr->pad0 = 0;
+ /* Save guest's preferred TSC. */
+ hdr->gtsc_khz = d->arch.hvm_domain.gtsc_khz;
}
int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
@@ -59,6 +60,9 @@ int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
gdprintk(XENLOG_WARNING, "HVM restore: saved CPUID (%#"PRIx32") "
"does not match host (%#"PRIx32").\n", hdr->cpuid, eax);
+ /* Restore guest's preferred TSC frequency. */
+ d->arch.hvm_domain.gtsc_khz = hdr->gtsc_khz;
+
/* VGA state is not saved/restored, so we nobble the cache. */
d->arch.hvm_domain.stdvga.cache = 0;
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 929d4cf57d..071ef14517 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -32,6 +32,8 @@ void hvm_init_guest_time(struct domain *d)
spin_lock_init(&pl->pl_time_lock);
pl->stime_offset = -(u64)get_s_time();
pl->last_guest_time = 0;
+
+ d->arch.hvm_domain.gtsc_khz = cpu_khz;
}
u64 hvm_get_guest_time(struct vcpu *v)
diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index 0d4aa16028..dc05b5aafe 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -44,7 +44,8 @@ struct hvm_domain {
struct hvm_ioreq_page ioreq;
struct hvm_ioreq_page buf_ioreq;
- s64 tsc_frequency;
+ uint32_t gtsc_khz; /* kHz */
+ uint32_t pad0;
struct pl_time pl_time;
struct hvm_io_handler io_handler;
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
index a3384aee9d..9f559ea81e 100644
--- a/xen/include/asm-x86/hvm/vpt.h
+++ b/xen/include/asm-x86/hvm/vpt.h
@@ -136,8 +136,6 @@ struct pl_time { /* platform time */
spinlock_t pl_time_lock;
};
-#define ticks_per_sec(v) (v->domain->arch.hvm_domain.tsc_frequency)
-
void pt_save_timer(struct vcpu *v);
void pt_restore_timer(struct vcpu *v);
void pt_update_irq(struct vcpu *v);
diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h
index d3692d6a86..fd81420439 100644
--- a/xen/include/public/arch-x86/hvm/save.h
+++ b/xen/include/public/arch-x86/hvm/save.h
@@ -38,7 +38,7 @@ struct hvm_save_header {
uint32_t version; /* File format version */
uint64_t changeset; /* Version of Xen that saved this file */
uint32_t cpuid; /* CPUID[0x01][%eax] on the saving machine */
- uint32_t pad0;
+ uint32_t gtsc_khz; /* Guest's TSC frequency in kHz */
};
DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header);