From: Liang Li <liang.z.li@intel.com>
To: xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, Liang Li <liang.z.li@intel.com>,
ian.jackson@eu.citrix.com, jbeulich@suse.com
Subject: [PATCH] libxc: Expose the MPX cpuid flag to guest
Date: Mon, 11 Jan 2016 16:52:10 +0800 [thread overview]
Message-ID: <1452502330-2630-1-git-send-email-liang.z.li@intel.com> (raw)
If hardware support memory protect externsion, expose this feature
to guest by default. Users don't have to use a 'cpuid= ' option in
config file to turn it on.
Signed-off-by: Liang Li <liang.z.li@intel.com>
---
tools/libxc/xc_cpufeature.h | 1 +
tools/libxc/xc_cpuid_x86.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/tools/libxc/xc_cpufeature.h b/tools/libxc/xc_cpufeature.h
index c3ddc80..cda9305 100644
--- a/tools/libxc/xc_cpufeature.h
+++ b/tools/libxc/xc_cpufeature.h
@@ -137,6 +137,7 @@
#define X86_FEATURE_ERMS 9 /* Enhanced REP MOVSB/STOSB */
#define X86_FEATURE_INVPCID 10 /* Invalidate Process Context ID */
#define X86_FEATURE_RTM 11 /* Restricted Transactional Memory */
+#define X86_FEATURE_MPX 14 /* Memory Protection Extensions */
#define X86_FEATURE_RDSEED 18 /* RDSEED instruction */
#define X86_FEATURE_ADX 19 /* ADCX, ADOX instructions */
#define X86_FEATURE_SMAP 20 /* Supervisor Mode Access Protection */
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 8882c01..4c88db4 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -423,6 +423,8 @@ static void xc_cpuid_hvm_policy(xc_interface *xch,
bitmaskof(X86_FEATURE_ERMS) |
bitmaskof(X86_FEATURE_INVPCID) |
bitmaskof(X86_FEATURE_RTM) |
+ ((info->xfeature_mask != 0) ?
+ bitmaskof(X86_FEATURE_MPX) : 0) |
bitmaskof(X86_FEATURE_RDSEED) |
bitmaskof(X86_FEATURE_ADX) |
bitmaskof(X86_FEATURE_SMAP) |
@@ -538,6 +540,7 @@ static void xc_cpuid_pv_policy(xc_interface *xch,
case 0x00000007:
if ( input[1] == 0 )
+ {
regs[1] &= (bitmaskof(X86_FEATURE_BMI1) |
bitmaskof(X86_FEATURE_HLE) |
bitmaskof(X86_FEATURE_AVX2) |
@@ -547,6 +550,9 @@ static void xc_cpuid_pv_policy(xc_interface *xch,
bitmaskof(X86_FEATURE_RDSEED) |
bitmaskof(X86_FEATURE_ADX) |
bitmaskof(X86_FEATURE_FSGSBASE));
+ if ( info->xfeature_mask == 0 )
+ clear_bit(X86_FEATURE_MPX, regs[1]);
+ }
else
regs[1] = 0;
regs[0] = regs[2] = regs[3] = 0;
--
1.9.1
next reply other threads:[~2016-01-11 8:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 8:52 Liang Li [this message]
2016-01-11 9:05 ` [PATCH] libxc: Expose the MPX cpuid flag to guest Wei Liu
2016-01-11 9:59 ` Andrew Cooper
2016-01-11 10:07 ` Li, Liang Z
2016-02-23 8:57 ` Li, Liang Z
2016-02-29 17:10 ` Doug Goldstein
2016-01-11 16:03 ` Konrad Rzeszutek Wilk
2016-01-20 9:20 ` Li, Liang Z
2016-03-01 18:02 ` Ian Jackson
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=1452502330-2630-1-git-send-email-liang.z.li@intel.com \
--to=liang.z.li@intel.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/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).