[xen master] x86/pagewalk: Remove opt_allow_superpage check from guest_can_use_l2_superpages()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[xen master] x86/pagewalk: Remove opt_allow_superpage check from guest_can_use_l2_superpages()

patchbot
commit 28d9a9a2d41759b9e5163037b759ac557aea767c
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Mon Jul 24 17:28:25 2017 +0100
Commit:     Andrew Cooper <[hidden email]>
CommitDate: Tue Jul 25 18:48:37 2017 +0100

    x86/pagewalk: Remove opt_allow_superpage check from guest_can_use_l2_superpages()
   
    The purpose of guest_walk_tables() is to match the behaviour of real hardware.
   
    A PV guest can have 2M superpages in its pagetables, via the M2P (and for dom0
    via the initial P2M), even if the guest isn't permitted to create arbitrary 2M
    superpage mappings.
   
    guest_can_use_l2_superpages() checking opt_allow_superpage is a piece of PV
    guest policy enforcement, rather than its intended purpose of meaning "would
    hardware tolerate finding an L2 superpage with these control settings?"
   
    Signed-off-by: Andrew Cooper <[hidden email]>
    Reviewed-by: Tim Deegan <[hidden email]>
    Reviewed-by: Wei Liu <[hidden email]>
---
 xen/include/asm-x86/guest_pt.h | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/xen/include/asm-x86/guest_pt.h b/xen/include/asm-x86/guest_pt.h
index 72126d5..08031c8 100644
--- a/xen/include/asm-x86/guest_pt.h
+++ b/xen/include/asm-x86/guest_pt.h
@@ -205,15 +205,17 @@ static inline guest_l4e_t guest_l4e_from_gfn(gfn_t gfn, u32 flags)
 static inline bool guest_can_use_l2_superpages(const struct vcpu *v)
 {
     /*
+     * PV guests use Xen's paging settings.  Being 4-level, 2M
+     * superpages are unconditionally supported.
+     *
      * The L2 _PAGE_PSE bit must be honoured in HVM guests, whenever
      * CR4.PSE is set or the guest is in PAE or long mode.
      * It's also used in the dummy PT for vcpus with CR0.PG cleared.
      */
-    return (is_pv_vcpu(v)
-            ? opt_allow_superpage
-            : (GUEST_PAGING_LEVELS != 2
-               || !hvm_paging_enabled(v)
-               || (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE)));
+    return (is_pv_vcpu(v) ||
+            GUEST_PAGING_LEVELS != 2 ||
+            !hvm_paging_enabled(v) ||
+            (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE));
 }
 
 static inline bool guest_can_use_l3_superpages(const struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog
Loading...