aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-12-20 07:54:04 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 10:35:41 -0500
commit4c07b0a4b6df45fd8c6d07d838b4faf65eed2ba4 (patch)
tree81480994994292d8f7e5c1128becd1052651f6d1
parent3f0852e0aca9de2d2f8bc756630a82352cbfde68 (diff)
KVM: Remove ifdefs from mmu notifier initialization
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--virt/kvm/kvm_main.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 92f5c98b6c4d..c10d117c4317 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -341,6 +341,20 @@ static const struct mmu_notifier_ops kvm_mmu_notifier_ops = {
341 .change_pte = kvm_mmu_notifier_change_pte, 341 .change_pte = kvm_mmu_notifier_change_pte,
342 .release = kvm_mmu_notifier_release, 342 .release = kvm_mmu_notifier_release,
343}; 343};
344
345static int kvm_init_mmu_notifier(struct kvm *kvm)
346{
347 kvm->mmu_notifier.ops = &kvm_mmu_notifier_ops;
348 return mmu_notifier_register(&kvm->mmu_notifier, current->mm);
349}
350
351#else /* !(CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER) */
352
353static int kvm_init_mmu_notifier(struct kvm *kvm)
354{
355 return 0;
356}
357
344#endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */ 358#endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */
345 359
346static struct kvm *kvm_create_vm(void) 360static struct kvm *kvm_create_vm(void)
@@ -373,11 +387,7 @@ static struct kvm *kvm_create_vm(void)
373 (struct kvm_coalesced_mmio_ring *)page_address(page); 387 (struct kvm_coalesced_mmio_ring *)page_address(page);
374#endif 388#endif
375 389
376#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER) 390 r = kvm_init_mmu_notifier(kvm);
377 kvm->mmu_notifier.ops = &kvm_mmu_notifier_ops;
378 r = mmu_notifier_register(&kvm->mmu_notifier, current->mm);
379#endif
380
381 if (r) { 391 if (r) {
382#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET 392#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
383 put_page(page); 393 put_page(page);