Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwrng: via_rng - Support VIA Nano hardware RNG

The VIA Nano CPU supports the same XSTORE instruction based RNG,
but it lacks the MSR present in earlier CPUs.

Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Harald Welte and committed by
Herbert Xu
858576bd 608d1cd5

+13
+13
drivers/char/hw_random/via-rng.c
··· 132 132 struct cpuinfo_x86 *c = &cpu_data(0); 133 133 u32 lo, hi, old_lo; 134 134 135 + /* VIA Nano CPUs don't have the MSR_VIA_RNG anymore. The RNG 136 + * is always enabled if CPUID rng_en is set. There is no 137 + * RNG configuration like it used to be the case in this 138 + * register */ 139 + if ((c->x86 == 6) && (c->x86_model >= 0x0f)) { 140 + if (!cpu_has_xstore_enabled) { 141 + printk(KERN_ERR PFX "can't enable hardware RNG " 142 + "if XSTORE is not enabled\n"); 143 + return -ENODEV; 144 + } 145 + return 0; 146 + } 147 + 135 148 /* Control the RNG via MSR. Tread lightly and pay very close 136 149 * close attention to values written, as the reserved fields 137 150 * are documented to be "undefined and unpredictable"; but it