Skip to content

Commit 2cbd188

Browse files
committed
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
2 parents 5993fe3 + ee73f65 commit 2cbd188

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

arch/x86/kvm/i8254.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@ static int pit_ioport_read(struct kvm_io_device *this,
467467
return -EOPNOTSUPP;
468468

469469
addr &= KVM_PIT_CHANNEL_MASK;
470+
if (addr == 3)
471+
return 0;
472+
470473
s = &pit_state->channels[addr];
471474

472475
mutex_lock(&pit_state->lock);

arch/x86/kvm/x86.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
670670
{
671671
static int version;
672672
struct pvclock_wall_clock wc;
673-
struct timespec now, sys, boot;
673+
struct timespec boot;
674674

675675
if (!wall_clock)
676676
return;
@@ -685,9 +685,7 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
685685
* wall clock specified here. guest system time equals host
686686
* system time for us, thus we must fill in host boot time here.
687687
*/
688-
now = current_kernel_time();
689-
ktime_get_ts(&sys);
690-
boot = ns_to_timespec(timespec_to_ns(&now) - timespec_to_ns(&sys));
688+
getboottime(&boot);
691689

692690
wc.sec = boot.tv_sec;
693691
wc.nsec = boot.tv_nsec;
@@ -762,6 +760,7 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
762760
local_irq_save(flags);
763761
kvm_get_msr(v, MSR_IA32_TSC, &vcpu->hv_clock.tsc_timestamp);
764762
ktime_get_ts(&ts);
763+
monotonic_to_bootbased(&ts);
765764
local_irq_restore(flags);
766765

767766
/* With all the info we got, fill in the values */

kernel/time/timekeeping.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,7 @@ void getboottime(struct timespec *ts)
880880

881881
set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec);
882882
}
883+
EXPORT_SYMBOL_GPL(getboottime);
883884

884885
/**
885886
* monotonic_to_bootbased - Convert the monotonic time to boot based.
@@ -889,6 +890,7 @@ void monotonic_to_bootbased(struct timespec *ts)
889890
{
890891
*ts = timespec_add_safe(*ts, total_sleep_time);
891892
}
893+
EXPORT_SYMBOL_GPL(monotonic_to_bootbased);
892894

893895
unsigned long get_seconds(void)
894896
{

0 commit comments

Comments
 (0)