aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2008-12-30 12:55:06 -0500
committerAvi Kivity <avi@redhat.com>2009-03-24 05:02:55 -0400
commit52d939a0bf44081bc9f69b4fbdc9e7f416df27c7 (patch)
tree27a14385847f5585cdccaf5e5c18074595642970 /arch/x86/kvm/x86.c
parent61a6bd672bda3b9468bf5895c1be085c4e481138 (diff)
KVM: PIT: provide an option to disable interrupt reinjection
Certain clocks (such as TSC) in older 2.6 guests overaccount for lost ticks, causing severe time drift. Interrupt reinjection magnifies the problem. Provide an option to disable it. [avi: allow room for expansion in case we want to disable reinjection of other timers] Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c3fbe8c55c13..a1f14611f4b9 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -993,6 +993,7 @@ int kvm_dev_ioctl_check_extension(long ext)
993 case KVM_CAP_NOP_IO_DELAY: 993 case KVM_CAP_NOP_IO_DELAY:
994 case KVM_CAP_MP_STATE: 994 case KVM_CAP_MP_STATE:
995 case KVM_CAP_SYNC_MMU: 995 case KVM_CAP_SYNC_MMU:
996 case KVM_CAP_REINJECT_CONTROL:
996 r = 1; 997 r = 1;
997 break; 998 break;
998 case KVM_CAP_COALESCED_MMIO: 999 case KVM_CAP_COALESCED_MMIO:
@@ -1728,6 +1729,15 @@ static int kvm_vm_ioctl_set_pit(struct kvm *kvm, struct kvm_pit_state *ps)
1728 return r; 1729 return r;
1729} 1730}
1730 1731
1732static int kvm_vm_ioctl_reinject(struct kvm *kvm,
1733 struct kvm_reinject_control *control)
1734{
1735 if (!kvm->arch.vpit)
1736 return -ENXIO;
1737 kvm->arch.vpit->pit_state.pit_timer.reinject = control->pit_reinject;
1738 return 0;
1739}
1740
1731/* 1741/*
1732 * Get (and clear) the dirty memory log for a memory slot. 1742 * Get (and clear) the dirty memory log for a memory slot.
1733 */ 1743 */
@@ -1925,6 +1935,17 @@ long kvm_arch_vm_ioctl(struct file *filp,
1925 r = 0; 1935 r = 0;
1926 break; 1936 break;
1927 } 1937 }
1938 case KVM_REINJECT_CONTROL: {
1939 struct kvm_reinject_control control;
1940 r = -EFAULT;
1941 if (copy_from_user(&control, argp, sizeof(control)))
1942 goto out;
1943 r = kvm_vm_ioctl_reinject(kvm, &control);
1944 if (r)
1945 goto out;
1946 r = 0;
1947 break;
1948 }
1928 default: 1949 default:
1929 ; 1950 ;
1930 } 1951 }