diff options
Diffstat (limited to 'drivers/kvm/mmu.c')
-rw-r--r-- | drivers/kvm/mmu.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index 62a74151f847..f8a2137c64a2 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
@@ -85,7 +85,8 @@ static int dbg = 1; | |||
85 | #define PT_PAGE_SIZE_MASK (1ULL << 7) | 85 | #define PT_PAGE_SIZE_MASK (1ULL << 7) |
86 | #define PT_PAT_MASK (1ULL << 7) | 86 | #define PT_PAT_MASK (1ULL << 7) |
87 | #define PT_GLOBAL_MASK (1ULL << 8) | 87 | #define PT_GLOBAL_MASK (1ULL << 8) |
88 | #define PT64_NX_MASK (1ULL << 63) | 88 | #define PT64_NX_SHIFT 63 |
89 | #define PT64_NX_MASK (1ULL << PT64_NX_SHIFT) | ||
89 | 90 | ||
90 | #define PT_PAT_SHIFT 7 | 91 | #define PT_PAT_SHIFT 7 |
91 | #define PT_DIR_PAT_SHIFT 12 | 92 | #define PT_DIR_PAT_SHIFT 12 |
@@ -153,6 +154,11 @@ static int dbg = 1; | |||
153 | 154 | ||
154 | #define RMAP_EXT 4 | 155 | #define RMAP_EXT 4 |
155 | 156 | ||
157 | #define ACC_EXEC_MASK 1 | ||
158 | #define ACC_WRITE_MASK PT_WRITABLE_MASK | ||
159 | #define ACC_USER_MASK PT_USER_MASK | ||
160 | #define ACC_ALL (ACC_EXEC_MASK | ACC_WRITE_MASK | ACC_USER_MASK) | ||
161 | |||
156 | struct kvm_rmap_desc { | 162 | struct kvm_rmap_desc { |
157 | u64 *shadow_ptes[RMAP_EXT]; | 163 | u64 *shadow_ptes[RMAP_EXT]; |
158 | struct kvm_rmap_desc *more; | 164 | struct kvm_rmap_desc *more; |
@@ -921,7 +927,7 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, struct page *page) | |||
921 | >> PAGE_SHIFT; | 927 | >> PAGE_SHIFT; |
922 | new_table = kvm_mmu_get_page(vcpu, pseudo_gfn, | 928 | new_table = kvm_mmu_get_page(vcpu, pseudo_gfn, |
923 | v, level - 1, | 929 | v, level - 1, |
924 | 1, 3, &table[index]); | 930 | 1, ACC_ALL, &table[index]); |
925 | if (!new_table) { | 931 | if (!new_table) { |
926 | pgprintk("nonpaging_map: ENOMEM\n"); | 932 | pgprintk("nonpaging_map: ENOMEM\n"); |
927 | kvm_release_page_clean(page); | 933 | kvm_release_page_clean(page); |
@@ -988,7 +994,7 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu) | |||
988 | 994 | ||
989 | ASSERT(!VALID_PAGE(root)); | 995 | ASSERT(!VALID_PAGE(root)); |
990 | sp = kvm_mmu_get_page(vcpu, root_gfn, 0, | 996 | sp = kvm_mmu_get_page(vcpu, root_gfn, 0, |
991 | PT64_ROOT_LEVEL, 0, 0, NULL); | 997 | PT64_ROOT_LEVEL, 0, ACC_ALL, NULL); |
992 | root = __pa(sp->spt); | 998 | root = __pa(sp->spt); |
993 | ++sp->root_count; | 999 | ++sp->root_count; |
994 | vcpu->mmu.root_hpa = root; | 1000 | vcpu->mmu.root_hpa = root; |
@@ -1009,7 +1015,7 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu) | |||
1009 | root_gfn = 0; | 1015 | root_gfn = 0; |
1010 | sp = kvm_mmu_get_page(vcpu, root_gfn, i << 30, | 1016 | sp = kvm_mmu_get_page(vcpu, root_gfn, i << 30, |
1011 | PT32_ROOT_LEVEL, !is_paging(vcpu), | 1017 | PT32_ROOT_LEVEL, !is_paging(vcpu), |
1012 | 0, NULL); | 1018 | ACC_ALL, NULL); |
1013 | root = __pa(sp->spt); | 1019 | root = __pa(sp->spt); |
1014 | ++sp->root_count; | 1020 | ++sp->root_count; |
1015 | vcpu->mmu.pae_root[i] = root | PT_PRESENT_MASK; | 1021 | vcpu->mmu.pae_root[i] = root | PT_PRESENT_MASK; |