diff options
author | Yang Zhang <yang.z.zhang@Intel.com> | 2013-08-05 04:07:13 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-08-07 09:57:39 -0400 |
commit | 7a1638ce4220d52e53d4114e34e4529161a3449c (patch) | |
tree | dc22f449b34f91acb0c35920a13ab53c8ccc82b7 /arch/x86/kvm/mmu.c | |
parent | 37406aaaeebc36632efc3f493363da9644e57ef1 (diff) |
nEPT: Redefine EPT-specific link_shadow_page()
Since nEPT doesn't support A/D bit, so we should not set those bit
when build shadow page table.
Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r-- | arch/x86/kvm/mmu.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 2988df5c1e3e..68d0f086de6c 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2047,12 +2047,18 @@ static void shadow_walk_next(struct kvm_shadow_walk_iterator *iterator) | |||
2047 | return __shadow_walk_next(iterator, *iterator->sptep); | 2047 | return __shadow_walk_next(iterator, *iterator->sptep); |
2048 | } | 2048 | } |
2049 | 2049 | ||
2050 | static void link_shadow_page(u64 *sptep, struct kvm_mmu_page *sp) | 2050 | static void link_shadow_page(u64 *sptep, struct kvm_mmu_page *sp, bool accessed) |
2051 | { | 2051 | { |
2052 | u64 spte; | 2052 | u64 spte; |
2053 | 2053 | ||
2054 | BUILD_BUG_ON(VMX_EPT_READABLE_MASK != PT_PRESENT_MASK || | ||
2055 | VMX_EPT_WRITABLE_MASK != PT_WRITABLE_MASK); | ||
2056 | |||
2054 | spte = __pa(sp->spt) | PT_PRESENT_MASK | PT_WRITABLE_MASK | | 2057 | spte = __pa(sp->spt) | PT_PRESENT_MASK | PT_WRITABLE_MASK | |
2055 | shadow_user_mask | shadow_x_mask | shadow_accessed_mask; | 2058 | shadow_user_mask | shadow_x_mask; |
2059 | |||
2060 | if (accessed) | ||
2061 | spte |= shadow_accessed_mask; | ||
2056 | 2062 | ||
2057 | mmu_spte_set(sptep, spte); | 2063 | mmu_spte_set(sptep, spte); |
2058 | } | 2064 | } |
@@ -2677,7 +2683,7 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write, | |||
2677 | iterator.level - 1, | 2683 | iterator.level - 1, |
2678 | 1, ACC_ALL, iterator.sptep); | 2684 | 1, ACC_ALL, iterator.sptep); |
2679 | 2685 | ||
2680 | link_shadow_page(iterator.sptep, sp); | 2686 | link_shadow_page(iterator.sptep, sp, true); |
2681 | } | 2687 | } |
2682 | } | 2688 | } |
2683 | return emulate; | 2689 | return emulate; |