# HG changeset patch # User Yang, Wei # Date 1308051888 -3600 # Node ID 864a3dd1d9b4664f1ece44c9eaf390969253b7a8 # Parent 782bc7b2661a3921af21130f34f599f68911f2ce 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 --- 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 */ --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -262,6 +262,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)); --- a/xen/include/asm-x86/cpufeature.h +++ b/xen/include/asm-x86/cpufeature.h @@ -105,6 +105,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 */