kvm_main.c (2efd61a608b0039911924d2e5d7028eb37496e85) | kvm_main.c (982ed0de4753ed6e71dbd40f82a5a066baf133ed) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Kernel-based Virtual Machine driver for Linux 4 * 5 * This module enables machines with Intel VT-x extensions to run virtual 6 * machines without emulation or binary translation. 7 * 8 * Copyright (C) 2006 Qumranet, Inc. --- 45 unchanged lines hidden (view full) --- 54#include <linux/suspend.h> 55 56#include <asm/processor.h> 57#include <asm/ioctl.h> 58#include <linux/uaccess.h> 59 60#include "coalesced_mmio.h" 61#include "async_pf.h" | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Kernel-based Virtual Machine driver for Linux 4 * 5 * This module enables machines with Intel VT-x extensions to run virtual 6 * machines without emulation or binary translation. 7 * 8 * Copyright (C) 2006 Qumranet, Inc. --- 45 unchanged lines hidden (view full) --- 54#include <linux/suspend.h> 55 56#include <asm/processor.h> 57#include <asm/ioctl.h> 58#include <linux/uaccess.h> 59 60#include "coalesced_mmio.h" 61#include "async_pf.h" |
62#include "mmu_lock.h" | 62#include "kvm_mm.h" |
63#include "vfio.h" 64 65#define CREATE_TRACE_POINTS 66#include <trace/events/kvm.h> 67 68#include <linux/kvm_dirty_ring.h> 69 70/* Worst case buffer size needed for holding an integer. */ --- 635 unchanged lines hidden (view full) --- 706 * adjustments will be imbalanced. 707 * 708 * Pairs with the decrement in range_end(). 709 */ 710 spin_lock(&kvm->mn_invalidate_lock); 711 kvm->mn_active_invalidate_count++; 712 spin_unlock(&kvm->mn_invalidate_lock); 713 | 63#include "vfio.h" 64 65#define CREATE_TRACE_POINTS 66#include <trace/events/kvm.h> 67 68#include <linux/kvm_dirty_ring.h> 69 70/* Worst case buffer size needed for holding an integer. */ --- 635 unchanged lines hidden (view full) --- 706 * adjustments will be imbalanced. 707 * 708 * Pairs with the decrement in range_end(). 709 */ 710 spin_lock(&kvm->mn_invalidate_lock); 711 kvm->mn_active_invalidate_count++; 712 spin_unlock(&kvm->mn_invalidate_lock); 713 |
714 gfn_to_pfn_cache_invalidate_start(kvm, range->start, range->end, 715 hva_range.may_block); 716 |
|
714 __kvm_handle_hva_range(kvm, &hva_range); 715 716 return 0; 717} 718 719void kvm_dec_notifier_count(struct kvm *kvm, unsigned long start, 720 unsigned long end) 721{ --- 344 unchanged lines hidden (view full) --- 1066 mutex_init(&kvm->lock); 1067 mutex_init(&kvm->irq_lock); 1068 mutex_init(&kvm->slots_lock); 1069 mutex_init(&kvm->slots_arch_lock); 1070 spin_lock_init(&kvm->mn_invalidate_lock); 1071 rcuwait_init(&kvm->mn_memslots_update_rcuwait); 1072 xa_init(&kvm->vcpu_array); 1073 | 717 __kvm_handle_hva_range(kvm, &hva_range); 718 719 return 0; 720} 721 722void kvm_dec_notifier_count(struct kvm *kvm, unsigned long start, 723 unsigned long end) 724{ --- 344 unchanged lines hidden (view full) --- 1069 mutex_init(&kvm->lock); 1070 mutex_init(&kvm->irq_lock); 1071 mutex_init(&kvm->slots_lock); 1072 mutex_init(&kvm->slots_arch_lock); 1073 spin_lock_init(&kvm->mn_invalidate_lock); 1074 rcuwait_init(&kvm->mn_memslots_update_rcuwait); 1075 xa_init(&kvm->vcpu_array); 1076 |
1077 INIT_LIST_HEAD(&kvm->gpc_list); 1078 spin_lock_init(&kvm->gpc_lock); 1079 |
|
1074 INIT_LIST_HEAD(&kvm->devices); 1075 1076 BUILD_BUG_ON(KVM_MEM_SLOTS_NUM > SHRT_MAX); 1077 1078 if (init_srcu_struct(&kvm->srcu)) 1079 goto out_err_no_srcu; 1080 if (init_srcu_struct(&kvm->irq_srcu)) 1081 goto out_err_no_irq_srcu; --- 1452 unchanged lines hidden (view full) --- 2534 * @write_fault: whether we should get a writable host page 2535 * @writable: whether it allows to map a writable host page for !@write_fault 2536 * 2537 * The function will map a writable host page for these two cases: 2538 * 1): @write_fault = true 2539 * 2): @write_fault = false && @writable, @writable will tell the caller 2540 * whether the mapping is writable. 2541 */ | 1080 INIT_LIST_HEAD(&kvm->devices); 1081 1082 BUILD_BUG_ON(KVM_MEM_SLOTS_NUM > SHRT_MAX); 1083 1084 if (init_srcu_struct(&kvm->srcu)) 1085 goto out_err_no_srcu; 1086 if (init_srcu_struct(&kvm->irq_srcu)) 1087 goto out_err_no_irq_srcu; --- 1452 unchanged lines hidden (view full) --- 2540 * @write_fault: whether we should get a writable host page 2541 * @writable: whether it allows to map a writable host page for !@write_fault 2542 * 2543 * The function will map a writable host page for these two cases: 2544 * 1): @write_fault = true 2545 * 2): @write_fault = false && @writable, @writable will tell the caller 2546 * whether the mapping is writable. 2547 */ |
2542static kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async, 2543 bool write_fault, bool *writable) | 2548kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async, 2549 bool write_fault, bool *writable) |
2544{ 2545 struct vm_area_struct *vma; 2546 kvm_pfn_t pfn = 0; 2547 int npages, r; 2548 2549 /* we can do it either atomically or asynchronously, not both */ 2550 BUG_ON(atomic && async); 2551 --- 3281 unchanged lines hidden --- | 2550{ 2551 struct vm_area_struct *vma; 2552 kvm_pfn_t pfn = 0; 2553 int npages, r; 2554 2555 /* we can do it either atomically or asynchronously, not both */ 2556 BUG_ON(atomic && async); 2557 --- 3281 unchanged lines hidden --- |