aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2011-09-22 04:56:06 -0400
committerAvi Kivity <avi@redhat.com>2011-12-27 04:16:54 -0500
commit505aef8f30a95f7e4abf2c07e54ded1521587ba0 (patch)
tree47b4c515c5782cbb3428437b4c7c820a7956c312 /arch/x86/kvm/mmu.c
parentd01f8d5e02cc79998e3160f7ad545f77891b00e5 (diff)
KVM: MMU: cleanup FNAME(invlpg)
Directly Use mmu_page_zap_pte to zap spte in FNAME(invlpg), also remove the same code between FNAME(invlpg) and FNAME(sync_page) Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index b432a71a1839..d15f908649e7 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1809,7 +1809,7 @@ static void validate_direct_spte(struct kvm_vcpu *vcpu, u64 *sptep,
1809 } 1809 }
1810} 1810}
1811 1811
1812static void mmu_page_zap_pte(struct kvm *kvm, struct kvm_mmu_page *sp, 1812static bool mmu_page_zap_pte(struct kvm *kvm, struct kvm_mmu_page *sp,
1813 u64 *spte) 1813 u64 *spte)
1814{ 1814{
1815 u64 pte; 1815 u64 pte;
@@ -1817,17 +1817,21 @@ static void mmu_page_zap_pte(struct kvm *kvm, struct kvm_mmu_page *sp,
1817 1817
1818 pte = *spte; 1818 pte = *spte;
1819 if (is_shadow_present_pte(pte)) { 1819 if (is_shadow_present_pte(pte)) {
1820 if (is_last_spte(pte, sp->role.level)) 1820 if (is_last_spte(pte, sp->role.level)) {
1821 drop_spte(kvm, spte); 1821 drop_spte(kvm, spte);
1822 else { 1822 if (is_large_pte(pte))
1823 --kvm->stat.lpages;
1824 } else {
1823 child = page_header(pte & PT64_BASE_ADDR_MASK); 1825 child = page_header(pte & PT64_BASE_ADDR_MASK);
1824 drop_parent_pte(child, spte); 1826 drop_parent_pte(child, spte);
1825 } 1827 }
1826 } else if (is_mmio_spte(pte)) 1828 return true;
1829 }
1830
1831 if (is_mmio_spte(pte))
1827 mmu_spte_clear_no_track(spte); 1832 mmu_spte_clear_no_track(spte);
1828 1833
1829 if (is_large_pte(pte)) 1834 return false;
1830 --kvm->stat.lpages;
1831} 1835}
1832 1836
1833static void kvm_mmu_page_unlink_children(struct kvm *kvm, 1837static void kvm_mmu_page_unlink_children(struct kvm *kvm,