From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ed White Subject: [PATCH v7 04/15] x86/HVM: Hardware alternate p2m support detection. Date: Wed, 22 Jul 2015 16:01:10 -0700 Message-ID: <1437606081-6964-5-git-send-email-edmund.h.white@intel.com> References: <1437606081-6964-1-git-send-email-edmund.h.white@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1437606081-6964-1-git-send-email-edmund.h.white@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ravi Sahita , Wei Liu , Jun Nakajima , George Dunlap , Ian Jackson , Tim Deegan , Ed White , Jan Beulich , Andrew Cooper , tlengyel@novetta.com, Daniel De Graaf List-Id: xen-devel@lists.xenproject.org As implemented here, only supported on platforms with VMX HAP. By default this functionality is force-disabled, it can be enabled by specifying altp2m=1 on the Xen command line. Signed-off-by: Ed White Reviewed-by: Andrew Cooper --- Changes since v6: no changes docs/misc/xen-command-line.markdown | 7 +++++++ xen/arch/x86/hvm/hvm.c | 7 +++++++ xen/arch/x86/hvm/vmx/vmx.c | 1 + xen/include/asm-x86/hvm/hvm.h | 9 +++++++++ 4 files changed, 24 insertions(+) diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index 70d7ab8..7bdcfff 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -140,6 +140,13 @@ mode during S3 resume. Permit Xen to use superpages when performing memory management. +### altp2m (Intel) +> `= ` + +> Default: `false` + +Permit multiple copies of host p2m. + ### apic > `= bigsmp | default` diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index c07e3ef..eafaf9d 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -96,6 +96,10 @@ bool_t opt_hvm_fep; boolean_param("hvm_fep", opt_hvm_fep); #endif +/* Xen command-line option to enable altp2m */ +static bool_t __initdata opt_altp2m_enabled = 0; +boolean_param("altp2m", opt_altp2m_enabled); + static int cpu_callback( struct notifier_block *nfb, unsigned long action, void *hcpu) { @@ -162,6 +166,9 @@ static int __init hvm_enable(void) if ( !fns->pvh_supported ) printk(XENLOG_INFO "HVM: PVH mode not supported on this platform\n"); + if ( !opt_altp2m_enabled ) + hvm_funcs.altp2m_supported = 0; + /* * Allow direct access to the PC debug ports 0x80 and 0xed (they are * often used for I/O delays, but the vmexits simply slow things down). diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index d3183a8..4f8b0e0 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1847,6 +1847,7 @@ const struct hvm_function_table * __init start_vmx(void) if ( cpu_has_vmx_ept && (cpu_has_vmx_pat || opt_force_ept) ) { vmx_function_table.hap_supported = 1; + vmx_function_table.altp2m_supported = 1; vmx_function_table.hap_capabilities = 0; diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index 82f1b32..3a94f8c 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -94,6 +94,9 @@ struct hvm_function_table { /* Necessary hardware support for PVH mode? */ int pvh_supported; + /* Necessary hardware support for alternate p2m's? */ + bool_t altp2m_supported; + /* Indicate HAP capabilities. */ int hap_capabilities; @@ -530,6 +533,12 @@ static inline bool_t hvm_is_singlestep_supported(void) hvm_funcs.is_singlestep_supported()); } +/* returns true if hardware supports alternate p2m's */ +static inline bool_t hvm_altp2m_supported(void) +{ + return hvm_funcs.altp2m_supported; +} + #ifndef NDEBUG /* Permit use of the Forced Emulation Prefix in HVM guests */ extern bool_t opt_hvm_fep; -- 1.9.1