aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/kvm_mmu.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/include/asm/kvm_mmu.h')
-rw-r--r--arch/arm/include/asm/kvm_mmu.h31
1 files changed, 27 insertions, 4 deletions
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index 3f688b458143..acb0d5712716 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -37,6 +37,11 @@
37 */ 37 */
38#define TRAMPOLINE_VA UL(CONFIG_VECTORS_BASE) 38#define TRAMPOLINE_VA UL(CONFIG_VECTORS_BASE)
39 39
40/*
41 * KVM_MMU_CACHE_MIN_PAGES is the number of stage2 page table translation levels.
42 */
43#define KVM_MMU_CACHE_MIN_PAGES 2
44
40#ifndef __ASSEMBLY__ 45#ifndef __ASSEMBLY__
41 46
42#include <asm/cacheflush.h> 47#include <asm/cacheflush.h>
@@ -50,7 +55,7 @@ void free_hyp_pgds(void);
50int kvm_alloc_stage2_pgd(struct kvm *kvm); 55int kvm_alloc_stage2_pgd(struct kvm *kvm);
51void kvm_free_stage2_pgd(struct kvm *kvm); 56void kvm_free_stage2_pgd(struct kvm *kvm);
52int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa, 57int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa,
53 phys_addr_t pa, unsigned long size); 58 phys_addr_t pa, unsigned long size, bool writable);
54 59
55int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run); 60int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run);
56 61
@@ -83,6 +88,11 @@ static inline void kvm_clean_pgd(pgd_t *pgd)
83 clean_dcache_area(pgd, PTRS_PER_S2_PGD * sizeof(pgd_t)); 88 clean_dcache_area(pgd, PTRS_PER_S2_PGD * sizeof(pgd_t));
84} 89}
85 90
91static inline void kvm_clean_pmd(pmd_t *pmd)
92{
93 clean_dcache_area(pmd, PTRS_PER_PMD * sizeof(pmd_t));
94}
95
86static inline void kvm_clean_pmd_entry(pmd_t *pmd) 96static inline void kvm_clean_pmd_entry(pmd_t *pmd)
87{ 97{
88 clean_pmd_entry(pmd); 98 clean_pmd_entry(pmd);
@@ -123,10 +133,23 @@ static inline bool kvm_page_empty(void *ptr)
123} 133}
124 134
125 135
126#define kvm_pte_table_empty(ptep) kvm_page_empty(ptep) 136#define kvm_pte_table_empty(kvm, ptep) kvm_page_empty(ptep)
127#define kvm_pmd_table_empty(pmdp) kvm_page_empty(pmdp) 137#define kvm_pmd_table_empty(kvm, pmdp) kvm_page_empty(pmdp)
128#define kvm_pud_table_empty(pudp) (0) 138#define kvm_pud_table_empty(kvm, pudp) (0)
139
140#define KVM_PREALLOC_LEVEL 0
129 141
142static inline int kvm_prealloc_hwpgd(struct kvm *kvm, pgd_t *pgd)
143{
144 return 0;
145}
146
147static inline void kvm_free_hwpgd(struct kvm *kvm) { }
148
149static inline void *kvm_get_hwpgd(struct kvm *kvm)
150{
151 return kvm->arch.pgd;
152}
130 153
131struct kvm; 154struct kvm;
132 155