diff options
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r-- | virt/kvm/kvm_main.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 28510e72618a..5c360347a1e9 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1346,21 +1346,19 @@ unsigned long kvm_vcpu_gfn_to_hva_prot(struct kvm_vcpu *vcpu, gfn_t gfn, bool *w | |||
1346 | static int get_user_page_nowait(unsigned long start, int write, | 1346 | static int get_user_page_nowait(unsigned long start, int write, |
1347 | struct page **page) | 1347 | struct page **page) |
1348 | { | 1348 | { |
1349 | int flags = FOLL_TOUCH | FOLL_NOWAIT | FOLL_HWPOISON | FOLL_GET; | 1349 | int flags = FOLL_NOWAIT | FOLL_HWPOISON; |
1350 | 1350 | ||
1351 | if (write) | 1351 | if (write) |
1352 | flags |= FOLL_WRITE; | 1352 | flags |= FOLL_WRITE; |
1353 | 1353 | ||
1354 | return __get_user_pages(current, current->mm, start, 1, flags, page, | 1354 | return get_user_pages(start, 1, flags, page, NULL); |
1355 | NULL, NULL); | ||
1356 | } | 1355 | } |
1357 | 1356 | ||
1358 | static inline int check_user_page_hwpoison(unsigned long addr) | 1357 | static inline int check_user_page_hwpoison(unsigned long addr) |
1359 | { | 1358 | { |
1360 | int rc, flags = FOLL_TOUCH | FOLL_HWPOISON | FOLL_WRITE; | 1359 | int rc, flags = FOLL_HWPOISON | FOLL_WRITE; |
1361 | 1360 | ||
1362 | rc = __get_user_pages(current, current->mm, addr, 1, | 1361 | rc = get_user_pages(addr, 1, flags, NULL, NULL); |
1363 | flags, NULL, NULL, NULL); | ||
1364 | return rc == -EHWPOISON; | 1362 | return rc == -EHWPOISON; |
1365 | } | 1363 | } |
1366 | 1364 | ||
@@ -3846,7 +3844,12 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, | |||
3846 | * kvm_arch_init makes sure there's at most one caller | 3844 | * kvm_arch_init makes sure there's at most one caller |
3847 | * for architectures that support multiple implementations, | 3845 | * for architectures that support multiple implementations, |
3848 | * like intel and amd on x86. | 3846 | * like intel and amd on x86. |
3847 | * kvm_arch_init must be called before kvm_irqfd_init to avoid creating | ||
3848 | * conflicts in case kvm is already setup for another implementation. | ||
3849 | */ | 3849 | */ |
3850 | r = kvm_irqfd_init(); | ||
3851 | if (r) | ||
3852 | goto out_irqfd; | ||
3850 | 3853 | ||
3851 | if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) { | 3854 | if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) { |
3852 | r = -ENOMEM; | 3855 | r = -ENOMEM; |
@@ -3928,6 +3931,7 @@ out_free_0a: | |||
3928 | free_cpumask_var(cpus_hardware_enabled); | 3931 | free_cpumask_var(cpus_hardware_enabled); |
3929 | out_free_0: | 3932 | out_free_0: |
3930 | kvm_irqfd_exit(); | 3933 | kvm_irqfd_exit(); |
3934 | out_irqfd: | ||
3931 | kvm_arch_exit(); | 3935 | kvm_arch_exit(); |
3932 | out_fail: | 3936 | out_fail: |
3933 | return r; | 3937 | return r; |