aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/mmu.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-01-05 19:36:44 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2007-01-06 02:55:25 -0500
commit815af8d42ee3f844c0ceaf2104bd9c6a0bb1e26c (patch)
treecbb21a8efea0fb3fbd94689546b2f97e11dbf9d9 /drivers/kvm/mmu.c
parent374cbac0333ddf5cf1c6637efaf7f3adcc67fd75 (diff)
[PATCH] KVM: MMU: Let the walker extract the target page gfn from the pte
This fixes a problem where set_pte_common() looked for shadowed pages based on the page directory gfn (a huge page) instead of the actual gfn being mapped. Signed-off-by: Avi Kivity <avi@qumranet.com> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/kvm/mmu.c')
-rw-r--r--drivers/kvm/mmu.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index ba813f49f8aa..ceae25bfd4b5 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -752,7 +752,8 @@ static inline void set_pte_common(struct kvm_vcpu *vcpu,
752 u64 *shadow_pte, 752 u64 *shadow_pte,
753 gpa_t gaddr, 753 gpa_t gaddr,
754 int dirty, 754 int dirty,
755 u64 access_bits) 755 u64 access_bits,
756 gfn_t gfn)
756{ 757{
757 hpa_t paddr; 758 hpa_t paddr;
758 759
@@ -779,10 +780,10 @@ static inline void set_pte_common(struct kvm_vcpu *vcpu,
779 if (access_bits & PT_WRITABLE_MASK) { 780 if (access_bits & PT_WRITABLE_MASK) {
780 struct kvm_mmu_page *shadow; 781 struct kvm_mmu_page *shadow;
781 782
782 shadow = kvm_mmu_lookup_page(vcpu, gaddr >> PAGE_SHIFT); 783 shadow = kvm_mmu_lookup_page(vcpu, gfn);
783 if (shadow) { 784 if (shadow) {
784 pgprintk("%s: found shadow page for %lx, marking ro\n", 785 pgprintk("%s: found shadow page for %lx, marking ro\n",
785 __FUNCTION__, (gfn_t)(gaddr >> PAGE_SHIFT)); 786 __FUNCTION__, gfn);
786 access_bits &= ~PT_WRITABLE_MASK; 787 access_bits &= ~PT_WRITABLE_MASK;
787 *shadow_pte &= ~PT_WRITABLE_MASK; 788 *shadow_pte &= ~PT_WRITABLE_MASK;
788 } 789 }