aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2008-12-21 12:36:59 -0500
committerAvi Kivity <avi@redhat.com>2009-03-24 05:02:51 -0400
commite2078318042569682d0496cfd7bd962a766e82b1 (patch)
treed5f6d2d2c25471f61801f8d0a01a0ddf8d257500 /arch
parent2f0b3d60b2c43aef7cd10169c425c052169c622a (diff)
KVM: MMU: Initialize a shadow page's global attribute from cr4.pge
If cr4.pge is cleared, we ought to treat any ptes in the page as non-global. This allows us to remove the check from set_spte(). Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/mmu.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index f15023c11fea..5f03ec324e35 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -797,7 +797,6 @@ static struct kvm_mmu_page *kvm_mmu_alloc_page(struct kvm_vcpu *vcpu,
797 ASSERT(is_empty_shadow_page(sp->spt)); 797 ASSERT(is_empty_shadow_page(sp->spt));
798 bitmap_zero(sp->slot_bitmap, KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS); 798 bitmap_zero(sp->slot_bitmap, KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS);
799 sp->multimapped = 0; 799 sp->multimapped = 0;
800 sp->global = 1;
801 sp->parent_pte = parent_pte; 800 sp->parent_pte = parent_pte;
802 --vcpu->kvm->arch.n_free_mmu_pages; 801 --vcpu->kvm->arch.n_free_mmu_pages;
803 return sp; 802 return sp;
@@ -1241,6 +1240,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
1241 pgprintk("%s: adding gfn %lx role %x\n", __func__, gfn, role.word); 1240 pgprintk("%s: adding gfn %lx role %x\n", __func__, gfn, role.word);
1242 sp->gfn = gfn; 1241 sp->gfn = gfn;
1243 sp->role = role; 1242 sp->role = role;
1243 sp->global = role.cr4_pge;
1244 hlist_add_head(&sp->hash_link, bucket); 1244 hlist_add_head(&sp->hash_link, bucket);
1245 if (!metaphysical) { 1245 if (!metaphysical) {
1246 if (rmap_write_protect(vcpu->kvm, gfn)) 1246 if (rmap_write_protect(vcpu->kvm, gfn))
@@ -1668,8 +1668,6 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
1668 u64 mt_mask = shadow_mt_mask; 1668 u64 mt_mask = shadow_mt_mask;
1669 struct kvm_mmu_page *sp = page_header(__pa(shadow_pte)); 1669 struct kvm_mmu_page *sp = page_header(__pa(shadow_pte));
1670 1670
1671 if (!(vcpu->arch.cr4 & X86_CR4_PGE))
1672 global = 0;
1673 if (!global && sp->global) { 1671 if (!global && sp->global) {
1674 sp->global = 0; 1672 sp->global = 0;
1675 if (sp->unsync) { 1673 if (sp->unsync) {