diff options
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r-- | virt/kvm/kvm_main.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 45f09362ee7b..8a1889ccb883 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -3105,13 +3105,21 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, | |||
3105 | int r; | 3105 | int r; |
3106 | int cpu; | 3106 | int cpu; |
3107 | 3107 | ||
3108 | r = kvm_irqfd_init(); | ||
3109 | if (r) | ||
3110 | goto out_irqfd; | ||
3111 | r = kvm_arch_init(opaque); | 3108 | r = kvm_arch_init(opaque); |
3112 | if (r) | 3109 | if (r) |
3113 | goto out_fail; | 3110 | goto out_fail; |
3114 | 3111 | ||
3112 | /* | ||
3113 | * kvm_arch_init makes sure there's at most one caller | ||
3114 | * for architectures that support multiple implementations, | ||
3115 | * like intel and amd on x86. | ||
3116 | * kvm_arch_init must be called before kvm_irqfd_init to avoid creating | ||
3117 | * conflicts in case kvm is already setup for another implementation. | ||
3118 | */ | ||
3119 | r = kvm_irqfd_init(); | ||
3120 | if (r) | ||
3121 | goto out_irqfd; | ||
3122 | |||
3115 | if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) { | 3123 | if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) { |
3116 | r = -ENOMEM; | 3124 | r = -ENOMEM; |
3117 | goto out_free_0; | 3125 | goto out_free_0; |
@@ -3186,10 +3194,10 @@ out_free_1: | |||
3186 | out_free_0a: | 3194 | out_free_0a: |
3187 | free_cpumask_var(cpus_hardware_enabled); | 3195 | free_cpumask_var(cpus_hardware_enabled); |
3188 | out_free_0: | 3196 | out_free_0: |
3189 | kvm_arch_exit(); | ||
3190 | out_fail: | ||
3191 | kvm_irqfd_exit(); | 3197 | kvm_irqfd_exit(); |
3192 | out_irqfd: | 3198 | out_irqfd: |
3199 | kvm_arch_exit(); | ||
3200 | out_fail: | ||
3193 | return r; | 3201 | return r; |
3194 | } | 3202 | } |
3195 | EXPORT_SYMBOL_GPL(kvm_init); | 3203 | EXPORT_SYMBOL_GPL(kvm_init); |