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] 1GB Page Table Support for HVM Guest 3/3

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] 1GB Page Table Support for HVM Guest 3/3
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 05 Apr 2010 23:20:40 -0700
Delivery-date: Mon, 05 Apr 2010 23:22:48 -0700
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 1270534175 -3600
# Node ID 44bef2b4a075c416596504fe827ac7858a2f790d
# Parent  1ea7b73b30618ad4712a4475a1a40b72f78d7441
1GB Page Table Support for HVM Guest 3/3

This patch adds a new field in hvm to indicate 1gb is supported by
CPU.  In addition, users can turn 1GB feature on/off using a Xen
option ("hap_1gb", default is off). Per Tim's suggestion, I also add
an assertion check in shadow/common.c file to prevent affecting shadow
code.

Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>
Acked-by: Dongxiao Xu <dongxiao.xu@xxxxxxxxx>
Acked-by: Tim Deegan <tim.deegan@xxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c      |    2 ++
 xen/arch/x86/hvm/vmx/vmx.c      |    2 ++
 xen/arch/x86/mm/p2m.c           |   10 +++++++---
 xen/arch/x86/mm/shadow/common.c |    5 +++++
 xen/include/asm-x86/hvm/hvm.h   |    4 ++++
 5 files changed, 20 insertions(+), 3 deletions(-)

diff -r 1ea7b73b3061 -r 44bef2b4a075 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Tue Apr 06 07:07:37 2010 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Tue Apr 06 07:09:35 2010 +0100
@@ -884,6 +884,8 @@ void start_svm(struct cpuinfo_x86 *c)
                          cpuid_edx(0x8000000A) : 0);
 
     svm_function_table.hap_supported = cpu_has_svm_npt;
+    svm_function_table.hap_1gb_pgtb = 
+        (CONFIG_PAGING_LEVELS == 4)? !!(cpuid_edx(0x80000001) & 0x04000000):0;
 
     hvm_enable(&svm_function_table);
 }
diff -r 1ea7b73b3061 -r 44bef2b4a075 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Tue Apr 06 07:07:37 2010 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Tue Apr 06 07:09:35 2010 +0100
@@ -1445,6 +1445,8 @@ void start_vmx(void)
 
     if ( cpu_has_vmx_ept )
         vmx_function_table.hap_supported = 1;
+    
+    vmx_function_table.hap_1gb_pgtb = 0;
 
     setup_vmcs_dump();
 
diff -r 1ea7b73b3061 -r 44bef2b4a075 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Tue Apr 06 07:07:37 2010 +0100
+++ b/xen/arch/x86/mm/p2m.c     Tue Apr 06 07:09:35 2010 +0100
@@ -38,6 +38,10 @@
 /* Debugging and auditing of the P2M code? */
 #define P2M_AUDIT     0
 #define P2M_DEBUGGING 0
+
+/* turn on/off 1GB host page table support for hap */
+static int opt_hap_1gb = 0;
+boolean_param("hap_1gb", opt_hap_1gb);
 
 /* Printouts */
 #define P2M_PRINTK(_f, _a...)                                \
@@ -1736,9 +1740,9 @@ int set_p2m_entry(struct domain *d, unsi
     while ( todo )
     {
         if ( is_hvm_domain(d) && paging_mode_hap(d) )
-            order = ( (((gfn | mfn_x(mfn) | todo) & ((1ul << 18) - 1)) == 0) ) 
?
-                18 :
-            (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? 9 : 0;
+            order = ( (((gfn | mfn_x(mfn) | todo) & ((1ul << 18) - 1)) == 0) &&
+                      hvm_funcs.hap_1gb_pgtb && opt_hap_1gb ) ? 18 :
+                (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? 9 : 0;
         else
             order = 0;
 
diff -r 1ea7b73b3061 -r 44bef2b4a075 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Tue Apr 06 07:07:37 2010 +0100
+++ b/xen/arch/x86/mm/shadow/common.c   Tue Apr 06 07:09:35 2010 +0100
@@ -3452,6 +3452,11 @@ static void sh_unshadow_for_p2m_change(s
 {
     struct domain *d = v->domain;
 
+    /* The following assertion is to make sure we don't step on 1GB host
+     * page support of HVM guest. */
+    ASSERT(!(level > 2 && (l1e_get_flags(*p) & _PAGE_PRESENT) &&
+             (l1e_get_flags(*p) & _PAGE_PSE)));
+
     /* If we're removing an MFN from the p2m, remove it from the shadows too */
     if ( level == 1 )
     {
diff -r 1ea7b73b3061 -r 44bef2b4a075 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Tue Apr 06 07:07:37 2010 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h     Tue Apr 06 07:09:35 2010 +0100
@@ -68,6 +68,10 @@ struct hvm_function_table {
 
     /* Support Hardware-Assisted Paging? */
     int hap_supported;
+
+    /* Support 1GB Harware-Assisted Paging? */
+    int hap_1gb_pgtb;
+
 
     /*
      * Initialise/destroy HVM domain/vcpu resources

_______________________________________________
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] 1GB Page Table Support for HVM Guest 3/3, Xen patchbot-unstable <=