aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYang, Wei <wei.y.yang@intel.com>2011-06-14 12:44:48 +0100
committerYang, Wei <wei.y.yang@intel.com>2011-06-14 12:44:48 +0100
commit30090ad8567c97578099fb2aaec29a6a7c9f90a6 (patch)
tree560b46395c1991719674d77519df7141bc7ef3cb /tools
parent70c3da08fb4a7d158ebed65fb57ed741668b6a20 (diff)
downloadxen-30090ad8567c97578099fb2aaec29a6a7c9f90a6.tar.gz
xen-30090ad8567c97578099fb2aaec29a6a7c9f90a6.tar.bz2
xen-30090ad8567c97578099fb2aaec29a6a7c9f90a6.zip
x86/hvm: Make DRNG feature visible in CPUID
This patch exposes DRNG feature to HVM guests. The RDRAND instruction can provide software with sequences of random numbers generated from white noise. Signed-off-by: Yang, Wei <wei.y.yang@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/libxc/xc_cpufeature.h1
-rw-r--r--tools/libxc/xc_cpuid_x86.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/tools/libxc/xc_cpufeature.h b/tools/libxc/xc_cpufeature.h
index a110e6ef01..b1941f9956 100644
--- a/tools/libxc/xc_cpufeature.h
+++ b/tools/libxc/xc_cpufeature.h
@@ -87,6 +87,7 @@
#define X86_FEATURE_XSAVE 26 /* XSAVE/XRSTOR/XSETBV/XGETBV */
#define X86_FEATURE_AVX 28 /* Advanced Vector Extensions */
#define X86_FEATURE_F16C 29 /* Half-precision convert instruction */
+#define X86_FEATURE_RDRAND 30 /* Digital Random Number Generator */
#define X86_FEATURE_HYPERVISOR 31 /* Running under some hypervisor */
/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001 */
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index aae6882653..287b1e7789 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -314,6 +314,7 @@ static void xc_cpuid_hvm_policy(
bitmaskof(X86_FEATURE_POPCNT) |
bitmaskof(X86_FEATURE_AES) |
bitmaskof(X86_FEATURE_F16C) |
+ bitmaskof(X86_FEATURE_RDRAND) |
((xfeature_mask != 0) ?
(bitmaskof(X86_FEATURE_AVX) |
bitmaskof(X86_FEATURE_XSAVE)) : 0));