From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org
Cc: Juergen Gross <jgross@suse.com>,
Olivia Mackall <olivia@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>
Subject: [PATCH v2 07/13] hw_random/via-rng: Stop using 32-bit MSR interfaces
Date: Wed, 19 Aug 2026 12:23:08 +0200 [thread overview]
Message-ID: <20260819102314.1499258-8-jgross@suse.com> (raw)
In-Reply-To: <20260819102314.1499258-1-jgross@suse.com>
The 32-bit MSR interfaces rdmsr() and wrmsr() are planned to be
removed. Use the related 64-bit variants instead.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/char/hw_random/via-rng.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/char/hw_random/via-rng.c b/drivers/char/hw_random/via-rng.c
index a9a0a3b09c8b..b718e78d3c1c 100644
--- a/drivers/char/hw_random/via-rng.c
+++ b/drivers/char/hw_random/via-rng.c
@@ -129,7 +129,8 @@ static int via_rng_data_read(struct hwrng *rng, u32 *data)
static int via_rng_init(struct hwrng *rng)
{
struct cpuinfo_x86 *c = &cpu_data(0);
- u32 lo, hi, old_lo;
+ u32 old_lo;
+ struct msr val;
/* VIA Nano CPUs don't have the MSR_VIA_RNG anymore. The RNG
* is always enabled if CPUID rng_en is set. There is no
@@ -150,32 +151,32 @@ static int via_rng_init(struct hwrng *rng)
* does not say to write them as zero, so I make a guess that
* we restore the values we find in the register.
*/
- rdmsr(MSR_VIA_RNG, lo, hi);
+ rdmsrq(MSR_VIA_RNG, val.q);
- old_lo = lo;
- lo &= ~(0x7f << VIA_STRFILT_CNT_SHIFT);
- lo &= ~VIA_XSTORE_CNT_MASK;
- lo &= ~(VIA_STRFILT_ENABLE | VIA_STRFILT_FAIL | VIA_RAWBITS_ENABLE);
- lo |= VIA_RNG_ENABLE;
- lo |= VIA_NOISESRC1;
+ old_lo = val.l;
+ val.l &= ~(0x7f << VIA_STRFILT_CNT_SHIFT);
+ val.l &= ~VIA_XSTORE_CNT_MASK;
+ val.l &= ~(VIA_STRFILT_ENABLE | VIA_STRFILT_FAIL | VIA_RAWBITS_ENABLE);
+ val.l |= VIA_RNG_ENABLE;
+ val.l |= VIA_NOISESRC1;
/* Enable secondary noise source on CPUs where it is present. */
/* Nehemiah stepping 8 and higher */
if ((c->x86_model == 9) && (c->x86_stepping > 7))
- lo |= VIA_NOISESRC2;
+ val.l |= VIA_NOISESRC2;
/* Esther */
if (c->x86_model >= 10)
- lo |= VIA_NOISESRC2;
+ val.l |= VIA_NOISESRC2;
- if (lo != old_lo)
- wrmsr(MSR_VIA_RNG, lo, hi);
+ if (val.l != old_lo)
+ wrmsrq(MSR_VIA_RNG, val.q);
/* perhaps-unnecessary sanity check; remove after testing if
unneeded */
- rdmsr(MSR_VIA_RNG, lo, hi);
- if ((lo & VIA_RNG_ENABLE) == 0) {
+ rdmsrq(MSR_VIA_RNG, val.q);
+ if ((val.l & VIA_RNG_ENABLE) == 0) {
pr_err(PFX "cannot enable VIA C3 RNG, aborting\n");
return -ENODEV;
}
--
2.55.0
next prev parent reply other threads:[~2026-08-19 10:24 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 10:23 [PATCH v2 00/13] x86/msr: Drop 32-bit MSR interfaces Juergen Gross
2026-08-19 10:23 ` Juergen Gross
2026-08-19 10:23 ` [PATCH v2 01/13] x86/cpu: Fix coding style violation Juergen Gross
2026-08-19 10:23 ` [PATCH v2 02/13] x86/msr: Remove wrmsr_safe() Juergen Gross
2026-08-19 10:23 ` [PATCH v2 03/13] x86/msr: Remove rdmsr_safe() Juergen Gross
2026-08-19 10:23 ` [PATCH v2 04/13] drivers/ata: Stop using 32-bit MSR interfaces Juergen Gross
2026-08-19 13:40 ` David Laight
2026-08-19 15:27 ` Jürgen Groß
2026-08-21 9:12 ` [PATCH v3 " Juergen Gross
2026-08-21 12:14 ` Niklas Cassel
2026-08-19 10:23 ` [PATCH v2 05/13] agp/nvidia: " Juergen Gross
2026-08-19 10:23 ` [PATCH v2 06/13] fbdev/geode: " Juergen Gross
2026-08-19 10:23 ` Juergen Gross [this message]
2026-08-19 10:23 ` [PATCH v2 08/13] drivers/gpio: " Juergen Gross
2026-08-19 10:23 ` [PATCH v2 09/13] drivers/misc: " Juergen Gross
2026-08-19 10:23 ` [PATCH v2 10/13] x86/msr: Remove wrmsr() Juergen Gross
2026-08-19 10:23 ` [PATCH v2 11/13] x86/msr: Remove rdmsr() Juergen Gross
2026-08-19 10:23 ` [PATCH v2 12/13] treewide: convert rdmsrq() from a macro to an inline function Juergen Gross
2026-08-19 10:23 ` Juergen Gross
2026-08-19 10:44 ` sashiko-bot
2026-08-20 6:06 ` Damien Le Moal
2026-08-20 6:06 ` Damien Le Moal
2026-08-21 4:13 ` Michael Kelley
2026-08-21 4:13 ` Michael Kelley
2026-08-19 10:23 ` [PATCH v2 13/13] x86/msr: Simplify some rdmsrq() use cases Juergen Gross
2026-08-19 10:41 ` sashiko-bot
2026-08-19 15:28 ` Sean Christopherson
2026-08-19 15:31 ` Jürgen Groß
2026-08-21 4:13 ` Michael Kelley
2026-08-21 10:57 ` [PATCH v3 " Juergen Gross
2026-08-19 14:40 ` [PATCH v2 00/13] x86/msr: Drop 32-bit MSR interfaces Dave Hansen
2026-08-19 14:40 ` Dave Hansen
2026-08-19 15:21 ` Jürgen Groß
2026-08-19 15:21 ` Jürgen Groß
2026-08-19 15:33 ` Sean Christopherson
2026-08-19 15:33 ` Sean Christopherson
2026-08-20 5:27 ` Jürgen Groß
2026-08-20 5:27 ` Jürgen Groß
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=20260819102314.1499258-8-jgross@suse.com \
--to=jgross@suse.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olivia@selenic.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.