Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Arjan Koers <4kgluc2fa5qp@list.nospam.xutrox.com>
To: linux-crypto@vger.kernel.org
Subject: Re: [PATCH] The VIA Hardware RNG driver is for the CPU, not Chipset
Date: Mon, 11 May 2009 02:12:17 +0200	[thread overview]
Message-ID: <4A076D61.1040608@list.nospam.xutrox.com> (raw)
In-Reply-To: <20090510062844.GD12152@prithivi.gnumonks.org>

Harald Welte wrote:
> This is a cosmetic change, fixing the MODULE_DESCRIPTION() of via-rng.c

Coincidentally, I was trying to make my RNG work for x86_64 today and I
was wondering about this. How can multiple RNGs in current dual-processor
setups and in the future multicore Nano be handled?


The MSR wizardry in via_rng_init doesn't seem to work on my Nano. I'm
simply skipping it with the patch below, because my RNG is enabled
by default. I don't know the proper way to initialize it because of
lacking documentation. Would you happen to know a better way of doing
this?

diff -u linux-2.6.30-rc5.orig/drivers/char/hw_random/Kconfig linux-2.6.30-rc5/drivers/char/hw_random/Kconfig
--- linux-2.6.30-rc5.orig/drivers/char/hw_random/Kconfig	2009-04-23 20:13:55.000000000 +0000
+++ linux-2.6.30-rc5/drivers/char/hw_random/Kconfig	2009-05-10 09:59:59.000000000 +0000
@@ -88,7 +88,7 @@

 config HW_RANDOM_VIA
 	tristate "VIA HW Random Number Generator support"
-	depends on HW_RANDOM && X86_32
+	depends on HW_RANDOM && X86
 	default HW_RANDOM
 	---help---
 	  This driver provides kernel-side support for the Random Number
diff -u linux-2.6.30-rc5.orig/drivers/char/hw_random/via-rng.c linux-2.6.30-rc5/drivers/char/hw_random/via-rng.c
--- linux-2.6.30-rc5.orig/drivers/char/hw_random/via-rng.c	2009-03-23 23:12:14.000000000 +0000
+++ linux-2.6.30-rc5/drivers/char/hw_random/via-rng.c	2009-05-10 15:33:23.000000000 +0000
@@ -132,6 +132,17 @@
 	struct cpuinfo_x86 *c = &cpu_data(0);
 	u32 lo, hi, old_lo;

+	/* Nano */
+	if ((c->x86 == 6) && (c->x86_model >= 0xf)) {
+		if (!cpu_has_xstore_enabled) {
+			printk(KERN_ERR PFX
+			       "don't know how to enable VIA Nano RNG,"
+			       " aborting\n");
+			return -ENODEV;
+		}
+		return 0;
+	}
+
 	/* Control the RNG via MSR.  Tread lightly and pay very close
 	 * close attention to values written, as the reserved fields
 	 * are documented to be "undefined and unpredictable"; but it


  reply	other threads:[~2009-05-11  0:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-10  6:28 [PATCH] The VIA Hardware RNG driver is for the CPU, not Chipset Harald Welte
2009-05-11  0:12 ` Arjan Koers [this message]
2009-05-11  2:58   ` Harald Welte
2009-05-11 11:22     ` Arjan Koers
2009-05-11 17:46       ` Harald Welte
2009-05-11  4:06   ` Harald Welte
2009-05-11 11:24     ` Arjan Koers
2009-05-11 23:07     ` Herbert Xu
2009-05-15  5:57 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A076D61.1040608@list.nospam.xutrox.com \
    --to=4kgluc2fa5qp@list.nospam.xutrox.com \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox