[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v5 04/23] x86/mm: move {un, }adjust_guest_l*e to pv/mm.h



Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/arch/x86/mm.c    | 57 -----------------------------------------------
 xen/arch/x86/pv/mm.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 57 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 504a0a2a6a..b05648e4e7 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1175,63 +1175,6 @@ get_page_from_l4e(
     return rc;
 }
 
-static l1_pgentry_t adjust_guest_l1e(l1_pgentry_t l1e, const struct domain *d)
-{
-    if ( likely(l1e_get_flags(l1e) & _PAGE_PRESENT) &&
-         likely(!is_pv_32bit_domain(d)) )
-    {
-        /* _PAGE_GUEST_KERNEL page cannot have the Global bit set. */
-        if ( (l1e_get_flags(l1e) & (_PAGE_GUEST_KERNEL | _PAGE_GLOBAL)) ==
-             (_PAGE_GUEST_KERNEL | _PAGE_GLOBAL) )
-            gdprintk(XENLOG_WARNING, "Global bit is set in kernel page %lx\n",
-                     l1e_get_pfn(l1e));
-
-        if ( !(l1e_get_flags(l1e) & _PAGE_USER) )
-            l1e_add_flags(l1e, (_PAGE_GUEST_KERNEL | _PAGE_USER));
-
-        if ( !(l1e_get_flags(l1e) & _PAGE_GUEST_KERNEL) )
-            l1e_add_flags(l1e, (_PAGE_GLOBAL | _PAGE_USER));
-    }
-
-    return l1e;
-}
-
-static l2_pgentry_t adjust_guest_l2e(l2_pgentry_t l2e, const struct domain *d)
-{
-    if ( likely(l2e_get_flags(l2e) & _PAGE_PRESENT) &&
-         likely(!is_pv_32bit_domain(d)) )
-        l2e_add_flags(l2e, _PAGE_USER);
-
-    return l2e;
-}
-
-static l3_pgentry_t adjust_guest_l3e(l3_pgentry_t l3e, const struct domain *d)
-{
-    if ( likely(l3e_get_flags(l3e) & _PAGE_PRESENT) )
-        l3e_add_flags(l3e, (likely(!is_pv_32bit_domain(d))
-                            ? _PAGE_USER : _PAGE_USER | _PAGE_RW));
-
-    return l3e;
-}
-
-static l3_pgentry_t unadjust_guest_l3e(l3_pgentry_t l3e, const struct domain 
*d)
-{
-    if ( unlikely(is_pv_32bit_domain(d)) &&
-         likely(l3e_get_flags(l3e) & _PAGE_PRESENT) )
-        l3e_remove_flags(l3e, _PAGE_USER | _PAGE_RW | _PAGE_ACCESSED);
-
-    return l3e;
-}
-
-static l4_pgentry_t adjust_guest_l4e(l4_pgentry_t l4e, const struct domain *d)
-{
-    if ( likely(l4e_get_flags(l4e) & _PAGE_PRESENT) &&
-         likely(!is_pv_32bit_domain(d)) )
-        l4e_add_flags(l4e, _PAGE_USER);
-
-    return l4e;
-}
-
 void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
 {
     unsigned long     pfn = l1e_get_pfn(l1e);
diff --git a/xen/arch/x86/pv/mm.h b/xen/arch/x86/pv/mm.h
index 2563d280a5..6602e6ce07 100644
--- a/xen/arch/x86/pv/mm.h
+++ b/xen/arch/x86/pv/mm.h
@@ -83,4 +83,66 @@ static inline bool update_intpte(intpte_t *p, intpte_t old, 
intpte_t new,
                   _t ## e_get_intpte(_o), _t ## e_get_intpte(_n),   \
                   (_m), (_v), (_ad))
 
+static inline l1_pgentry_t adjust_guest_l1e(l1_pgentry_t l1e,
+                                            const struct domain *d)
+{
+    if ( likely(l1e_get_flags(l1e) & _PAGE_PRESENT) &&
+         likely(!is_pv_32bit_domain(d)) )
+    {
+        /* _PAGE_GUEST_KERNEL page cannot have the Global bit set. */
+        if ( (l1e_get_flags(l1e) & (_PAGE_GUEST_KERNEL | _PAGE_GLOBAL)) ==
+             (_PAGE_GUEST_KERNEL | _PAGE_GLOBAL) )
+            gdprintk(XENLOG_WARNING, "Global bit is set in kernel page %lx\n",
+                     l1e_get_pfn(l1e));
+
+        if ( !(l1e_get_flags(l1e) & _PAGE_USER) )
+            l1e_add_flags(l1e, (_PAGE_GUEST_KERNEL | _PAGE_USER));
+
+        if ( !(l1e_get_flags(l1e) & _PAGE_GUEST_KERNEL) )
+            l1e_add_flags(l1e, (_PAGE_GLOBAL | _PAGE_USER));
+    }
+
+    return l1e;
+}
+
+static inline l2_pgentry_t adjust_guest_l2e(l2_pgentry_t l2e,
+                                            const struct domain *d)
+{
+    if ( likely(l2e_get_flags(l2e) & _PAGE_PRESENT) &&
+         likely(!is_pv_32bit_domain(d)) )
+        l2e_add_flags(l2e, _PAGE_USER);
+
+    return l2e;
+}
+
+static inline l3_pgentry_t adjust_guest_l3e(l3_pgentry_t l3e,
+                                            const struct domain *d)
+{
+    if ( likely(l3e_get_flags(l3e) & _PAGE_PRESENT) )
+        l3e_add_flags(l3e, (likely(!is_pv_32bit_domain(d))
+                            ? _PAGE_USER : _PAGE_USER | _PAGE_RW));
+
+    return l3e;
+}
+
+static inline l3_pgentry_t unadjust_guest_l3e(l3_pgentry_t l3e,
+                                              const struct domain *d)
+{
+    if ( unlikely(is_pv_32bit_domain(d)) &&
+         likely(l3e_get_flags(l3e) & _PAGE_PRESENT) )
+        l3e_remove_flags(l3e, _PAGE_USER | _PAGE_RW | _PAGE_ACCESSED);
+
+    return l3e;
+}
+
+static inline l4_pgentry_t adjust_guest_l4e(l4_pgentry_t l4e,
+                                            const struct domain *d)
+{
+    if ( likely(l4e_get_flags(l4e) & _PAGE_PRESENT) &&
+         likely(!is_pv_32bit_domain(d)) )
+        l4e_add_flags(l4e, _PAGE_USER);
+
+    return l4e;
+}
+
 #endif /* __PV_MM_H__ */
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.