aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2008-12-21 12:27:36 -0500
committerAvi Kivity <avi@redhat.com>2009-03-24 05:02:51 -0400
commit2f0b3d60b2c43aef7cd10169c425c052169c622a (patch)
tree4a2afc6eee48522e380f69fc4c28abde314d3edb /arch/x86
parenta770f6f28b1a9287189f3dc8333eb694d9a2f0ab (diff)
KVM: MMU: Segregate mmu pages created with different cr4.pge settings
Don't allow a vcpu with cr4.pge cleared to use a shadow page created with cr4.pge set; this might cause a cr3 switch not to sync ptes that have the global bit set (the global bit has no effect if !cr4.pge). This can only occur on smp with different cr4.pge settings for different vcpus (since a cr4 change will resync the shadow ptes), but there's no cost to being correct here. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/kvm_host.h1
-rw-r--r--arch/x86/kvm/x86.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 28f875f28f58..c2a01d0513f5 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -183,6 +183,7 @@ union kvm_mmu_page_role {
183 unsigned metaphysical:1; 183 unsigned metaphysical:1;
184 unsigned access:3; 184 unsigned access:3;
185 unsigned invalid:1; 185 unsigned invalid:1;
186 unsigned cr4_pge:1;
186 }; 187 };
187}; 188};
188 189
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2477e87b2f84..873602b5edfd 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -364,6 +364,7 @@ void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
364 } 364 }
365 kvm_x86_ops->set_cr4(vcpu, cr4); 365 kvm_x86_ops->set_cr4(vcpu, cr4);
366 vcpu->arch.cr4 = cr4; 366 vcpu->arch.cr4 = cr4;
367 vcpu->arch.mmu.base_role.cr4_pge = !!(cr4 & X86_CR4_PGE);
367 kvm_mmu_sync_global(vcpu); 368 kvm_mmu_sync_global(vcpu);
368 kvm_mmu_reset_context(vcpu); 369 kvm_mmu_reset_context(vcpu);
369} 370}