diff options
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 2d6ca7968d65..e7644b90667e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -70,7 +70,7 @@ module_param(msi2intx, bool, 0); | |||
70 | DEFINE_SPINLOCK(kvm_lock); | 70 | DEFINE_SPINLOCK(kvm_lock); |
71 | LIST_HEAD(vm_list); | 71 | LIST_HEAD(vm_list); |
72 | 72 | ||
73 | static cpumask_t cpus_hardware_enabled; | 73 | static cpumask_var_t cpus_hardware_enabled; |
74 | 74 | ||
75 | struct kmem_cache *kvm_vcpu_cache; | 75 | struct kmem_cache *kvm_vcpu_cache; |
76 | EXPORT_SYMBOL_GPL(kvm_vcpu_cache); | 76 | EXPORT_SYMBOL_GPL(kvm_vcpu_cache); |
@@ -1965,9 +1965,9 @@ static void hardware_enable(void *junk) | |||
1965 | { | 1965 | { |
1966 | int cpu = raw_smp_processor_id(); | 1966 | int cpu = raw_smp_processor_id(); |
1967 | 1967 | ||
1968 | if (cpu_isset(cpu, cpus_hardware_enabled)) | 1968 | if (cpumask_test_cpu(cpu, cpus_hardware_enabled)) |
1969 | return; | 1969 | return; |
1970 | cpu_set(cpu, cpus_hardware_enabled); | 1970 | cpumask_set_cpu(cpu, cpus_hardware_enabled); |
1971 | kvm_arch_hardware_enable(NULL); | 1971 | kvm_arch_hardware_enable(NULL); |
1972 | } | 1972 | } |
1973 | 1973 | ||
@@ -1975,9 +1975,9 @@ static void hardware_disable(void *junk) | |||
1975 | { | 1975 | { |
1976 | int cpu = raw_smp_processor_id(); | 1976 | int cpu = raw_smp_processor_id(); |
1977 | 1977 | ||
1978 | if (!cpu_isset(cpu, cpus_hardware_enabled)) | 1978 | if (!cpumask_test_cpu(cpu, cpus_hardware_enabled)) |
1979 | return; | 1979 | return; |
1980 | cpu_clear(cpu, cpus_hardware_enabled); | 1980 | cpumask_clear_cpu(cpu, cpus_hardware_enabled); |
1981 | kvm_arch_hardware_disable(NULL); | 1981 | kvm_arch_hardware_disable(NULL); |
1982 | } | 1982 | } |
1983 | 1983 | ||
@@ -2211,9 +2211,14 @@ int kvm_init(void *opaque, unsigned int vcpu_size, | |||
2211 | 2211 | ||
2212 | bad_pfn = page_to_pfn(bad_page); | 2212 | bad_pfn = page_to_pfn(bad_page); |
2213 | 2213 | ||
2214 | if (!alloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) { | ||
2215 | r = -ENOMEM; | ||
2216 | goto out_free_0; | ||
2217 | } | ||
2218 | |||
2214 | r = kvm_arch_hardware_setup(); | 2219 | r = kvm_arch_hardware_setup(); |
2215 | if (r < 0) | 2220 | if (r < 0) |
2216 | goto out_free_0; | 2221 | goto out_free_0a; |
2217 | 2222 | ||
2218 | for_each_online_cpu(cpu) { | 2223 | for_each_online_cpu(cpu) { |
2219 | smp_call_function_single(cpu, | 2224 | smp_call_function_single(cpu, |
@@ -2277,6 +2282,8 @@ out_free_2: | |||
2277 | on_each_cpu(hardware_disable, NULL, 1); | 2282 | on_each_cpu(hardware_disable, NULL, 1); |
2278 | out_free_1: | 2283 | out_free_1: |
2279 | kvm_arch_hardware_unsetup(); | 2284 | kvm_arch_hardware_unsetup(); |
2285 | out_free_0a: | ||
2286 | free_cpumask_var(cpus_hardware_enabled); | ||
2280 | out_free_0: | 2287 | out_free_0: |
2281 | __free_page(bad_page); | 2288 | __free_page(bad_page); |
2282 | out: | 2289 | out: |
@@ -2300,6 +2307,7 @@ void kvm_exit(void) | |||
2300 | kvm_arch_hardware_unsetup(); | 2307 | kvm_arch_hardware_unsetup(); |
2301 | kvm_arch_exit(); | 2308 | kvm_arch_exit(); |
2302 | kvm_exit_debug(); | 2309 | kvm_exit_debug(); |
2310 | free_cpumask_var(cpus_hardware_enabled); | ||
2303 | __free_page(bad_page); | 2311 | __free_page(bad_page); |
2304 | } | 2312 | } |
2305 | EXPORT_SYMBOL_GPL(kvm_exit); | 2313 | EXPORT_SYMBOL_GPL(kvm_exit); |