aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorTang Chen <tangchen@cn.fujitsu.com>2014-09-24 03:57:54 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2014-09-24 08:08:00 -0400
commit4256f43f9fab91e1c17b5846a240cf4b66a768a8 (patch)
treeb88c0d65ef1d6b14e82ed31a1e8ae4d0e63507b4 /arch/x86/kvm
parentfe71557afbec641fee73711e40602bed37f6f33b (diff)
kvm: x86: Add request bit to reload APIC access page address
Currently, the APIC access page is pinned by KVM for the entire life of the guest. We want to make it migratable in order to make memory hot-unplug available for machines that run KVM. This patch prepares to handle this in generic code, through a new request bit (that will be set by the MMU notifier) and a new hook that is called whenever the request bit is processed. Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/x86.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 142569e6f8f9..c1412f5d93db 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6026,6 +6026,18 @@ static void kvm_vcpu_flush_tlb(struct kvm_vcpu *vcpu)
6026 kvm_x86_ops->tlb_flush(vcpu); 6026 kvm_x86_ops->tlb_flush(vcpu);
6027} 6027}
6028 6028
6029void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu)
6030{
6031 if (!kvm_x86_ops->set_apic_access_page_addr)
6032 return;
6033
6034 vcpu->kvm->arch.apic_access_page = gfn_to_page(vcpu->kvm,
6035 APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT);
6036 kvm_x86_ops->set_apic_access_page_addr(vcpu,
6037 page_to_phys(vcpu->kvm->arch.apic_access_page));
6038}
6039EXPORT_SYMBOL_GPL(kvm_vcpu_reload_apic_access_page);
6040
6029void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm, 6041void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
6030 unsigned long address) 6042 unsigned long address)
6031{ 6043{
@@ -6091,6 +6103,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
6091 kvm_deliver_pmi(vcpu); 6103 kvm_deliver_pmi(vcpu);
6092 if (kvm_check_request(KVM_REQ_SCAN_IOAPIC, vcpu)) 6104 if (kvm_check_request(KVM_REQ_SCAN_IOAPIC, vcpu))
6093 vcpu_scan_ioapic(vcpu); 6105 vcpu_scan_ioapic(vcpu);
6106 if (kvm_check_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu))
6107 kvm_vcpu_reload_apic_access_page(vcpu);
6094 } 6108 }
6095 6109
6096 if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) { 6110 if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {