Yang, Wei Y
2011-Jun-13 13:53 UTC
[Xen-devel] [PATCH] Enable DRNG feature support for HVM guests
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> --- tools/libxc/xc_cpufeature.h | 1 + tools/libxc/xc_cpuid_x86.c | 1 + xen/include/asm-x86/cpufeature.h | 1 + 3 files changed, 3 insertions(+) diff -r 782bc7b2661a tools/libxc/xc_cpufeature.h --- a/tools/libxc/xc_cpufeature.h Fri Jun 10 13:51:39 2011 +0100 +++ b/tools/libxc/xc_cpufeature.h Mon Jun 13 16:04:44 2011 +0800 @@ -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 -r 782bc7b2661a tools/libxc/xc_cpuid_x86.c --- a/tools/libxc/xc_cpuid_x86.c Fri Jun 10 13:51:39 2011 +0100 +++ b/tools/libxc/xc_cpuid_x86.c Mon Jun 13 16:04:44 2011 +0800 @@ -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)); diff -r 782bc7b2661a xen/include/asm-x86/cpufeature.h --- a/xen/include/asm-x86/cpufeature.h Fri Jun 10 13:51:39 2011 +0100 +++ b/xen/include/asm-x86/cpufeature.h Mon Jun 13 16:04:44 2011 +0800 @@ -106,6 +106,7 @@ #define X86_FEATURE_OSXSAVE (4*32+27) /* OSXSAVE */ #define X86_FEATURE_AVX (4*32+28) /* Advanced Vector Extensions */ #define X86_FEATURE_F16C (4*32+29) /* Half-precision convert instruction */ +#define X86_FEATURE_RDRAND (4*32+30) /* Digital Random Number Generator */ #define X86_FEATURE_HYPERVISOR (4*32+31) /* Running under some hypervisor */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel