WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86 p2m: Apply correct 4GB NPT limit chec

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86 p2m: Apply correct 4GB NPT limit check in two places.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 Jan 2009 08:35:15 -0800
Delivery-date: Fri, 16 Jan 2009 08:35:36 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1232024071 0
# Node ID 40d9d9ff435afee74431102e4e1ac6c7542649bd
# Parent  d84504432e611beb407ff4de29ab29a59187a3ea
x86 p2m: Apply correct 4GB NPT limit check in two places.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/mm/p2m.c |   61 ++++++++++++++++++++++++--------------------------
 1 files changed, 30 insertions(+), 31 deletions(-)

diff -r d84504432e61 -r 40d9d9ff435a xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Thu Jan 15 12:41:44 2009 +0000
+++ b/xen/arch/x86/mm/p2m.c     Thu Jan 15 12:54:31 2009 +0000
@@ -1890,6 +1890,30 @@ guest_physmap_remove_page(struct domain 
     p2m_unlock(d->arch.p2m);
 }
 
+#if CONFIG_PAGING_LEVELS == 3
+static int gfn_check_limit(
+    struct domain *d, unsigned long gfn, unsigned int order)
+{
+    /*
+     * 32bit AMD nested paging does not support over 4GB guest due to 
+     * hardware translation limit. This limitation is checked by comparing
+     * gfn with 0xfffffUL.
+     */
+    if ( !paging_mode_hap(d) || ((gfn + (1ul << order)) <= 0x100000UL) ||
+         (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) )
+        return 0;
+
+    if ( !test_and_set_bool(d->arch.hvm_domain.svm.npt_4gb_warning) )
+        dprintk(XENLOG_WARNING, "Dom%d failed to populate memory beyond"
+                " 4GB: specify 'hap=0' domain config option.\n",
+                d->domain_id);
+
+    return -EINVAL;
+}
+#else
+#define gfn_check_limit(d, g, o) 0
+#endif
+
 int
 guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
                                       unsigned int order)
@@ -1903,21 +1927,9 @@ guest_physmap_mark_populate_on_demand(st
 
     BUG_ON(!paging_mode_translate(d));
 
-#if CONFIG_PAGING_LEVELS == 3
-    /*
-     * 32bit PAE nested paging does not support over 4GB guest due to 
-     * hardware translation limit. This limitation is checked by comparing
-     * gfn with 0xfffffUL.
-     */
-    if ( paging_mode_hap(d) && (gfn > 0xfffffUL) )
-    {
-        if ( !test_and_set_bool(d->arch.hvm_domain.svm.npt_4gb_warning) )
-            dprintk(XENLOG_WARNING, "Dom%d failed to populate memory beyond"
-                    " 4GB: specify 'hap=0' domain config option.\n",
-                    d->domain_id);
-        return -EINVAL;
-    }
-#endif
+    rc = gfn_check_limit(d, gfn, order);
+    if ( rc != 0 )
+        return rc;
 
     p2m_lock(p2md);
     audit_p2m(d);
@@ -1987,22 +1999,9 @@ guest_physmap_add_entry(struct domain *d
         return 0;
     }
 
-#if CONFIG_PAGING_LEVELS == 3
-    /*
-     * 32bit AMD nested paging does not support over 4GB guest due to 
-     * hardware translation limit. This limitation is checked by comparing
-     * gfn with 0xfffffUL.
-     */
-    if ( paging_mode_hap(d) && (gfn > 0xfffffUL) &&
-         (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) )
-    {
-        if ( !test_and_set_bool(d->arch.hvm_domain.svm.npt_4gb_warning) )
-            dprintk(XENLOG_WARNING, "Dom%d failed to populate memory beyond"
-                    " 4GB: specify 'hap=0' domain config option.\n",
-                    d->domain_id);
-        return -EINVAL;
-    }
-#endif
+    rc = gfn_check_limit(d, gfn, order);
+    if ( rc != 0 )
+        return rc;
 
     p2m_lock(d->arch.p2m);
     audit_p2m(d);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86 p2m: Apply correct 4GB NPT limit check in two places., Xen patchbot-unstable <=