diff options
author | Avi Kivity <avi@qumranet.com> | 2007-11-21 06:54:47 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:10 -0500 |
commit | da928521b7a095e85f6ac92a6c106bca7e17625f (patch) | |
tree | 4c8fc2b3f056cd1bd7d335958bf384ebc62d8614 /drivers/kvm | |
parent | 5fb07ddb183eb4728f240e09c3305d271ce61d48 (diff) |
KVM: MMU: Move pse36 handling to the guest walker
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm')
-rw-r--r-- | drivers/kvm/mmu.c | 7 | ||||
-rw-r--r-- | drivers/kvm/paging_tmpl.h | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index 346aa65a08d5..a9fed594ac58 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
@@ -218,6 +218,13 @@ static int is_rmap_pte(u64 pte) | |||
218 | && pte != shadow_notrap_nonpresent_pte; | 218 | && pte != shadow_notrap_nonpresent_pte; |
219 | } | 219 | } |
220 | 220 | ||
221 | static gfn_t pse36_gfn_delta(u32 gpte) | ||
222 | { | ||
223 | int shift = 32 - PT32_DIR_PSE36_SHIFT - PAGE_SHIFT; | ||
224 | |||
225 | return (gpte & PT32_DIR_PSE36_MASK) << shift; | ||
226 | } | ||
227 | |||
221 | static void set_shadow_pte(u64 *sptep, u64 spte) | 228 | static void set_shadow_pte(u64 *sptep, u64 spte) |
222 | { | 229 | { |
223 | #ifdef CONFIG_X86_64 | 230 | #ifdef CONFIG_X86_64 |
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index 6f79ae87d0cf..dceb4b9137a4 100644 --- a/drivers/kvm/paging_tmpl.h +++ b/drivers/kvm/paging_tmpl.h | |||
@@ -149,6 +149,8 @@ static int FNAME(walk_addr)(struct guest_walker *walker, | |||
149 | && (PTTYPE == 64 || is_pse(vcpu))) { | 149 | && (PTTYPE == 64 || is_pse(vcpu))) { |
150 | walker->gfn = gpte_to_gfn_pde(pte); | 150 | walker->gfn = gpte_to_gfn_pde(pte); |
151 | walker->gfn += PT_INDEX(addr, PT_PAGE_TABLE_LEVEL); | 151 | walker->gfn += PT_INDEX(addr, PT_PAGE_TABLE_LEVEL); |
152 | if (PTTYPE == 32 && is_cpuid_PSE36()) | ||
153 | walker->gfn += pse36_gfn_delta(pte); | ||
152 | break; | 154 | break; |
153 | } | 155 | } |
154 | 156 | ||
@@ -320,9 +322,6 @@ static void FNAME(set_pde)(struct kvm_vcpu *vcpu, pt_element_t gpde, | |||
320 | 322 | ||
321 | access_bits &= gpde; | 323 | access_bits &= gpde; |
322 | gaddr = (gpa_t)gfn << PAGE_SHIFT; | 324 | gaddr = (gpa_t)gfn << PAGE_SHIFT; |
323 | if (PTTYPE == 32 && is_cpuid_PSE36()) | ||
324 | gaddr |= (gpde & PT32_DIR_PSE36_MASK) << | ||
325 | (32 - PT32_DIR_PSE36_SHIFT); | ||
326 | FNAME(set_pte_common)(vcpu, shadow_pte, gaddr, | 325 | FNAME(set_pte_common)(vcpu, shadow_pte, gaddr, |
327 | gpde, access_bits, user_fault, write_fault, | 326 | gpde, access_bits, user_fault, write_fault, |
328 | ptwrite, walker, gfn); | 327 | ptwrite, walker, gfn); |