Commit 2cbd1883 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'kvm-updates/2.6.33' of git://git.kernel.org/pub/scm/virt/kvm/kvm

* 'kvm-updates/2.6.33' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: PIT: control word is write-only
  kvmclock: count total_sleep_time when updating guest clock
  Export the symbol of getboottime and mmonotonic_to_bootbased
parents 5993fe31 ee73f656
...@@ -467,6 +467,9 @@ static int pit_ioport_read(struct kvm_io_device *this, ...@@ -467,6 +467,9 @@ static int pit_ioport_read(struct kvm_io_device *this,
return -EOPNOTSUPP; return -EOPNOTSUPP;
addr &= KVM_PIT_CHANNEL_MASK; addr &= KVM_PIT_CHANNEL_MASK;
if (addr == 3)
return 0;
s = &pit_state->channels[addr]; s = &pit_state->channels[addr];
mutex_lock(&pit_state->lock); mutex_lock(&pit_state->lock);
......
...@@ -670,7 +670,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock) ...@@ -670,7 +670,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
{ {
static int version; static int version;
struct pvclock_wall_clock wc; struct pvclock_wall_clock wc;
struct timespec now, sys, boot; struct timespec boot;
if (!wall_clock) if (!wall_clock)
return; return;
...@@ -685,9 +685,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock) ...@@ -685,9 +685,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
* wall clock specified here. guest system time equals host * wall clock specified here. guest system time equals host
* system time for us, thus we must fill in host boot time here. * system time for us, thus we must fill in host boot time here.
*/ */
now = current_kernel_time(); getboottime(&boot);
ktime_get_ts(&sys);
boot = ns_to_timespec(timespec_to_ns(&now) - timespec_to_ns(&sys));
wc.sec = boot.tv_sec; wc.sec = boot.tv_sec;
wc.nsec = boot.tv_nsec; wc.nsec = boot.tv_nsec;
...@@ -762,6 +760,7 @@ static void kvm_write_guest_time(struct kvm_vcpu *v) ...@@ -762,6 +760,7 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
local_irq_save(flags); local_irq_save(flags);
kvm_get_msr(v, MSR_IA32_TSC, &vcpu->hv_clock.tsc_timestamp); kvm_get_msr(v, MSR_IA32_TSC, &vcpu->hv_clock.tsc_timestamp);
ktime_get_ts(&ts); ktime_get_ts(&ts);
monotonic_to_bootbased(&ts);
local_irq_restore(flags); local_irq_restore(flags);
/* With all the info we got, fill in the values */ /* With all the info we got, fill in the values */
......
...@@ -880,6 +880,7 @@ void getboottime(struct timespec *ts) ...@@ -880,6 +880,7 @@ void getboottime(struct timespec *ts)
set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec); set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec);
} }
EXPORT_SYMBOL_GPL(getboottime);
/** /**
* monotonic_to_bootbased - Convert the monotonic time to boot based. * monotonic_to_bootbased - Convert the monotonic time to boot based.
...@@ -889,6 +890,7 @@ void monotonic_to_bootbased(struct timespec *ts) ...@@ -889,6 +890,7 @@ void monotonic_to_bootbased(struct timespec *ts)
{ {
*ts = timespec_add_safe(*ts, total_sleep_time); *ts = timespec_add_safe(*ts, total_sleep_time);
} }
EXPORT_SYMBOL_GPL(monotonic_to_bootbased);
unsigned long get_seconds(void) unsigned long get_seconds(void)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment