|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 11/31] xen/x86: Calculate Raw featureset
Calculate and expose the raw featureset to userspace. This is for
informational purposes; the difference between the raw and the host
featuresets are the features Xen has specifically chosen not to use.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Tim Deegan <tim@xxxxxxx>
CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
---
xen/arch/x86/cpuid.c | 36 +++++++++++++++++++++++++++++++++++-
xen/arch/x86/sysctl.c | 4 ++++
xen/include/asm-x86/cpuid.h | 1 +
xen/include/public/sysctl.h | 1 +
4 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 1a8b0ff..e4da820 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -7,12 +7,46 @@
#include "cpuid/cpuid-private.h"
uint32_t __read_mostly host_featureset[XEN_NR_FEATURESET_ENTRIES];
+uint32_t __read_mostly raw_featureset[XEN_NR_FEATURESET_ENTRIES];
uint32_t __read_mostly pv_featureset[XEN_NR_FEATURESET_ENTRIES];
uint32_t __read_mostly hvm_featureset[XEN_NR_FEATURESET_ENTRIES];
void __init calculate_featuresets(void)
{
- unsigned int i;
+ unsigned int i, max, tmp;
+
+ /* Raw featureset. */
+ max = cpuid_eax(0);
+
+ if ( max >= 1 )
+ cpuid(0x1, &tmp, &tmp,
+ &raw_featureset[XEN_FEATURESET_1c],
+ &raw_featureset[XEN_FEATURESET_1d]);
+ if ( max >= 7 )
+ cpuid_count(0x7, 0, &tmp,
+ &raw_featureset[XEN_FEATURESET_7b0],
+ &raw_featureset[XEN_FEATURESET_7c0],
+ &tmp);
+ if ( max >= 0xd )
+ cpuid_count(0xd, 1,
+ &raw_featureset[XEN_FEATURESET_Da1],
+ &tmp, &tmp, &tmp);
+
+ max = cpuid_eax(0x80000000);
+ if ( max >= 0x80000001 )
+ cpuid(0x80000001, &tmp, &tmp,
+ &raw_featureset[XEN_FEATURESET_e1c],
+ &raw_featureset[XEN_FEATURESET_e1d]);
+ if ( max >= 0x80000007 )
+ cpuid(0x80000007, &tmp, &tmp, &tmp,
+ &raw_featureset[XEN_FEATURESET_e7d]);
+ if ( max >= 0x80000008 )
+ cpuid(0x80000008, &tmp,
+ &raw_featureset[XEN_FEATURESET_e8b],
+ &tmp, &tmp);
+
+ for ( i = 0; i < ARRAY_SIZE(raw_featureset); ++i )
+ raw_featureset[i] ^= inverted_features[i];
/* Host featureset. */
memcpy(host_featureset, boot_cpu_data.x86_capability,
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index 0ba0f5e..50b2fd4 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -223,6 +223,10 @@ long arch_do_sysctl(
featureset = hvm_featureset;
break;
+ case XEN_SYSCTL_featureset_raw:
+ featureset = raw_featureset;
+ break;
+
default:
featureset = NULL;
break;
diff --git a/xen/include/asm-x86/cpuid.h b/xen/include/asm-x86/cpuid.h
index b6498b9..6b61400 100644
--- a/xen/include/asm-x86/cpuid.h
+++ b/xen/include/asm-x86/cpuid.h
@@ -6,6 +6,7 @@
#include <public/sysctl.h>
extern uint32_t host_featureset[XEN_NR_FEATURESET_ENTRIES];
+extern uint32_t raw_featureset[XEN_NR_FEATURESET_ENTRIES];
extern uint32_t pv_featureset[XEN_NR_FEATURESET_ENTRIES];
extern uint32_t hvm_featureset[XEN_NR_FEATURESET_ENTRIES];
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 8728950..3119b7b 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -775,6 +775,7 @@ struct xen_sysctl_featureset {
#define XEN_SYSCTL_featureset_host 0
#define XEN_SYSCTL_featureset_pv 1
#define XEN_SYSCTL_featureset_hvm 2
+#define XEN_SYSCTL_featureset_raw 3
uint32_t index; /* IN: Which featureset to query? */
uint32_t nr_features; /* IN/OUT: Number of entries in/written to
* 'features', or the maximum number of features if
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |