diff options
author | Eddie Dong <eddie.dong@intel.com> | 2007-09-06 05:22:56 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:25 -0400 |
commit | 96ad2cc6132479aa0aea485d0838a13fda765bd5 (patch) | |
tree | dc3596b92981332cee0749004b7076a7d52a90b1 /drivers/kvm/lapic.c | |
parent | 6bf9e962d14deb9e460afbbfd83ea2f450325c2d (diff) |
KVM: in-kernel LAPIC save and restore support
This patch adds a new vcpu-based IOCTL to save and restore the local
apic registers for a single vcpu. The kernel only copies the apic page as
a whole, extraction of registers is left to userspace side. On restore, the
APIC timer is restarted from the initial count, this introduces a little
delay, but works fine.
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/lapic.c')
-rw-r--r-- | drivers/kvm/lapic.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c index 4b5c77d8900d..df636bf19798 100644 --- a/drivers/kvm/lapic.c +++ b/drivers/kvm/lapic.c | |||
@@ -931,3 +931,16 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) | |||
931 | apic_clear_irr(vector, apic); | 931 | apic_clear_irr(vector, apic); |
932 | return vector; | 932 | return vector; |
933 | } | 933 | } |
934 | |||
935 | void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu) | ||
936 | { | ||
937 | struct kvm_lapic *apic = vcpu->apic; | ||
938 | |||
939 | apic->base_address = vcpu->apic_base & | ||
940 | MSR_IA32_APICBASE_BASE; | ||
941 | apic_set_reg(apic, APIC_LVR, APIC_VERSION); | ||
942 | apic_update_ppr(apic); | ||
943 | hrtimer_cancel(&apic->timer.dev); | ||
944 | update_divide_count(apic); | ||
945 | start_apic_timer(apic); | ||
946 | } | ||