diff options
Diffstat (limited to 'arch/x86/kvm/mmu.h')
-rw-r--r-- | arch/x86/kvm/mmu.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index be66759321a5..7086ca85d3e7 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h | |||
@@ -49,10 +49,17 @@ | |||
49 | #define PFERR_FETCH_MASK (1U << 4) | 49 | #define PFERR_FETCH_MASK (1U << 4) |
50 | 50 | ||
51 | int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]); | 51 | int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]); |
52 | int kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context); | ||
53 | |||
54 | static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) | ||
55 | { | ||
56 | return kvm->arch.n_max_mmu_pages - | ||
57 | kvm->arch.n_used_mmu_pages; | ||
58 | } | ||
52 | 59 | ||
53 | static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) | 60 | static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) |
54 | { | 61 | { |
55 | if (unlikely(vcpu->kvm->arch.n_free_mmu_pages < KVM_MIN_FREE_MMU_PAGES)) | 62 | if (unlikely(kvm_mmu_available_pages(vcpu->kvm)< KVM_MIN_FREE_MMU_PAGES)) |
56 | __kvm_mmu_free_some_pages(vcpu); | 63 | __kvm_mmu_free_some_pages(vcpu); |
57 | } | 64 | } |
58 | 65 | ||