aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorSheng Yang <sheng.yang@intel.com>2008-01-27 16:10:22 -0500
committerAvi Kivity <avi@qumranet.com>2008-04-27 05:00:21 -0400
commit7837699fa6d7adf81f26ab73a5f6897ea1ab9d6a (patch)
tree37a89d5c10869a9ada59df75b49d685708661434 /arch/x86/kvm/x86.c
parent4fcaa98267efc4d39ded9b0bc33c6b4a2f62fecd (diff)
KVM: In kernel PIT model
The patch moves the PIT model from userspace to kernel, and increases the timer accuracy greatly. [marcelo: make last_injected_time per-guest] Signed-off-by: Sheng Yang <sheng.yang@intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Tested-and-Acked-by: Alex Davis <alex14641@yahoo.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index bf78d6522d3d..c33a4578132c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -17,6 +17,7 @@
17#include <linux/kvm_host.h> 17#include <linux/kvm_host.h>
18#include "irq.h" 18#include "irq.h"
19#include "mmu.h" 19#include "mmu.h"
20#include "i8254.h"
20 21
21#include <linux/clocksource.h> 22#include <linux/clocksource.h>
22#include <linux/kvm.h> 23#include <linux/kvm.h>
@@ -818,6 +819,7 @@ int kvm_dev_ioctl_check_extension(long ext)
818 case KVM_CAP_SET_TSS_ADDR: 819 case KVM_CAP_SET_TSS_ADDR:
819 case KVM_CAP_EXT_CPUID: 820 case KVM_CAP_EXT_CPUID:
820 case KVM_CAP_CLOCKSOURCE: 821 case KVM_CAP_CLOCKSOURCE:
822 case KVM_CAP_PIT:
821 r = 1; 823 r = 1;
822 break; 824 break;
823 case KVM_CAP_VAPIC: 825 case KVM_CAP_VAPIC:
@@ -1594,6 +1596,12 @@ long kvm_arch_vm_ioctl(struct file *filp,
1594 } else 1596 } else
1595 goto out; 1597 goto out;
1596 break; 1598 break;
1599 case KVM_CREATE_PIT:
1600 r = -ENOMEM;
1601 kvm->arch.vpit = kvm_create_pit(kvm);
1602 if (kvm->arch.vpit)
1603 r = 0;
1604 break;
1597 case KVM_IRQ_LINE: { 1605 case KVM_IRQ_LINE: {
1598 struct kvm_irq_level irq_event; 1606 struct kvm_irq_level irq_event;
1599 1607
@@ -3372,6 +3380,7 @@ static void kvm_free_vcpus(struct kvm *kvm)
3372 3380
3373void kvm_arch_destroy_vm(struct kvm *kvm) 3381void kvm_arch_destroy_vm(struct kvm *kvm)
3374{ 3382{
3383 kvm_free_pit(kvm);
3375 kfree(kvm->arch.vpic); 3384 kfree(kvm->arch.vpic);
3376 kfree(kvm->arch.vioapic); 3385 kfree(kvm->arch.vioapic);
3377 kvm_free_vcpus(kvm); 3386 kvm_free_vcpus(kvm);