aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-01-13 06:23:56 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 11:01:22 -0500
commit97db56ce6cc2a0766b536cc227a1da20acc5d82f (patch)
tree2c45a5b388f3204012667051b2601cc2c25c4afb
parent75e68e607896c84310dee37c783c45220e56ce8c (diff)
KVM: Initialize the mmu caches only after verifying cpu support
Otherwise we re-initialize the mmu caches, which will fail since the caches are already registered, which will cause us to deinitialize said caches. Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--arch/x86/kvm/x86.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8a90403272e2..77d57ff3d74e 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2187,12 +2187,6 @@ int kvm_arch_init(void *opaque)
2187 int r; 2187 int r;
2188 struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque; 2188 struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque;
2189 2189
2190 r = kvm_mmu_module_init();
2191 if (r)
2192 goto out_fail;
2193
2194 kvm_init_msr_list();
2195
2196 if (kvm_x86_ops) { 2190 if (kvm_x86_ops) {
2197 printk(KERN_ERR "kvm: already loaded the other module\n"); 2191 printk(KERN_ERR "kvm: already loaded the other module\n");
2198 r = -EEXIST; 2192 r = -EEXIST;
@@ -2210,13 +2204,17 @@ int kvm_arch_init(void *opaque)
2210 goto out; 2204 goto out;
2211 } 2205 }
2212 2206
2207 r = kvm_mmu_module_init();
2208 if (r)
2209 goto out;
2210
2211 kvm_init_msr_list();
2212
2213 kvm_x86_ops = ops; 2213 kvm_x86_ops = ops;
2214 kvm_mmu_set_nonpresent_ptes(0ull, 0ull); 2214 kvm_mmu_set_nonpresent_ptes(0ull, 0ull);
2215 return 0; 2215 return 0;
2216 2216
2217out: 2217out:
2218 kvm_mmu_module_exit();
2219out_fail:
2220 return r; 2218 return r;
2221} 2219}
2222 2220