From: Wei Huang <wei.huang2@amd.com>
To: "'xen-devel@lists.xensource.com'" <xen-devel@lists.xensource.com>,
Keir Fraser <keir.fraser@eu.citrix.com>,
"Xu, Dongxiao" <dongxiao.xu@intel.com>
Subject: [PATCH][4/4] Enable 1GB for Xen HVM host page
Date: Mon, 22 Feb 2010 11:19:28 -0600 [thread overview]
Message-ID: <4B82BCA0.1040500@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 263 bytes --]
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).
Signed-off-by: Wei Huang <wei.huang2@amd.com>
Acked-by: Dongxiao Xu <dongxiao.xu@intel.com>
[-- Attachment #2: 4-xen-hap-new-option.patch --]
[-- Type: text/x-patch, Size: 2580 bytes --]
# HG changeset patch
# User huangwei@huangwei.amd.com
# Date 1266853456 21600
# Node ID 6849ef364858d422c5cb86e3ce49d63cbc897579
# Parent 72075d4fc39e8cd11a06bff4eb66521ab8fe952b
add option to turn on and off 1GB
diff -r 72075d4fc39e -r 6849ef364858 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c Mon Feb 22 09:44:13 2010 -0600
+++ b/xen/arch/x86/hvm/svm/svm.c Mon Feb 22 09:44:16 2010 -0600
@@ -883,6 +883,8 @@
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 72075d4fc39e -r 6849ef364858 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Mon Feb 22 09:44:13 2010 -0600
+++ b/xen/arch/x86/hvm/vmx/vmx.c Mon Feb 22 09:44:16 2010 -0600
@@ -1443,6 +1443,8 @@
if ( cpu_has_vmx_ept )
vmx_function_table.hap_supported = 1;
+
+ vmx_function_table.hap_1gb_pgtb = 0;
setup_vmcs_dump();
diff -r 72075d4fc39e -r 6849ef364858 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c Mon Feb 22 09:44:13 2010 -0600
+++ b/xen/arch/x86/mm/p2m.c Mon Feb 22 09:44:16 2010 -0600
@@ -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...) \
@@ -1735,9 +1739,9 @@
while ( todo )
{
if ( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled )
- 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 72075d4fc39e -r 6849ef364858 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h Mon Feb 22 09:44:13 2010 -0600
+++ b/xen/include/asm-x86/hvm/hvm.h Mon Feb 22 09:44:16 2010 -0600
@@ -68,6 +68,10 @@
/* Support Hardware-Assisted Paging? */
int hap_supported;
+
+ /* Support 1GB Harware-Assisted Paging? */
+ int hap_1gb_pgtb;
+
/*
* Initialise/destroy HVM domain/vcpu resources
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2010-02-22 17:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B82BCA0.1040500@amd.com \
--to=wei.huang2@amd.com \
--cc=dongxiao.xu@intel.com \
--cc=keir.fraser@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).