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>
This commit is contained in:
@@ -931,3 +931,16 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)
|
||||
apic_clear_irr(vector, apic);
|
||||
return vector;
|
||||
}
|
||||
|
||||
void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
struct kvm_lapic *apic = vcpu->apic;
|
||||
|
||||
apic->base_address = vcpu->apic_base &
|
||||
MSR_IA32_APICBASE_BASE;
|
||||
apic_set_reg(apic, APIC_LVR, APIC_VERSION);
|
||||
apic_update_ppr(apic);
|
||||
hrtimer_cancel(&apic->timer.dev);
|
||||
update_divide_count(apic);
|
||||
start_apic_timer(apic);
|
||||
}
|
||||
|
Reference in New Issue
Block a user