The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org
Cc: Juergen Gross <jgross@suse.com>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH v2 09/13] drivers/misc: Stop using 32-bit MSR interfaces
Date: Wed, 19 Aug 2026 12:23:10 +0200	[thread overview]
Message-ID: <20260819102314.1499258-10-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/misc/cs5535-mfgpt.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/misc/cs5535-mfgpt.c b/drivers/misc/cs5535-mfgpt.c
index cdd0e7bda68d..9abfc44f70f4 100644
--- a/drivers/misc/cs5535-mfgpt.c
+++ b/drivers/misc/cs5535-mfgpt.c
@@ -45,7 +45,8 @@ static struct cs5535_mfgpt_chip {
 int cs5535_mfgpt_toggle_event(struct cs5535_mfgpt_timer *timer, int cmp,
 		int event, int enable)
 {
-	uint32_t msr, mask, value, dummy;
+	uint32_t msr, mask;
+	struct msr val;
 	int shift = (cmp == MFGPT_CMP1) ? 0 : 8;
 
 	if (!timer) {
@@ -82,14 +83,14 @@ int cs5535_mfgpt_toggle_event(struct cs5535_mfgpt_timer *timer, int cmp,
 		return -EIO;
 	}
 
-	rdmsr(msr, value, dummy);
+	rdmsrq(msr, val.q);
 
 	if (enable)
-		value |= mask;
+		val.l |= mask;
 	else
-		value &= ~mask;
+		val.l &= ~mask;
 
-	wrmsr(msr, value, dummy);
+	wrmsrq(msr, val.q);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(cs5535_mfgpt_toggle_event);
@@ -97,7 +98,7 @@ EXPORT_SYMBOL_GPL(cs5535_mfgpt_toggle_event);
 int cs5535_mfgpt_set_irq(struct cs5535_mfgpt_timer *timer, int cmp, int *irq,
 		int enable)
 {
-	uint32_t zsel, lpc, dummy;
+	struct msr zsel, lpc;
 	int shift;
 
 	if (!timer) {
@@ -113,30 +114,31 @@ int cs5535_mfgpt_set_irq(struct cs5535_mfgpt_timer *timer, int cmp, int *irq,
 	 * IRQ of the 1st. This can only happen if forcing an IRQ, calling this
 	 * with *irq==0 is safe. Currently there _are_ no 2 drivers.
 	 */
-	rdmsr(MSR_PIC_ZSEL_LOW, zsel, dummy);
+	rdmsrq(MSR_PIC_ZSEL_LOW, zsel.q);
 	shift = ((cmp == MFGPT_CMP1 ? 0 : 4) + timer->nr % 4) * 4;
-	if (((zsel >> shift) & 0xF) == 2)
+	if (((zsel.l >> shift) & 0xF) == 2)
 		return -EIO;
 
 	/* Choose IRQ: if none supplied, keep IRQ already set or use default */
 	if (!*irq)
-		*irq = (zsel >> shift) & 0xF;
+		*irq = (zsel.l >> shift) & 0xF;
 	if (!*irq)
 		*irq = CONFIG_CS5535_MFGPT_DEFAULT_IRQ;
 
 	/* Can't use IRQ if it's 0 (=disabled), 2, or routed to LPC */
 	if (*irq < 1 || *irq == 2 || *irq > 15)
 		return -EIO;
-	rdmsr(MSR_PIC_IRQM_LPC, lpc, dummy);
-	if (lpc & (1 << *irq))
+	rdmsrq(MSR_PIC_IRQM_LPC, lpc.q);
+	if (lpc.l & (1 << *irq))
 		return -EIO;
 
 	/* All chosen and checked - go for it */
 	if (cs5535_mfgpt_toggle_event(timer, cmp, MFGPT_EVENT_IRQ, enable))
 		return -EIO;
 	if (enable) {
-		zsel = (zsel & ~(0xF << shift)) | (*irq << shift);
-		wrmsr(MSR_PIC_ZSEL_LOW, zsel, dummy);
+		zsel.l = (zsel.l & ~(0xF << shift)) | (*irq << shift);
+		zsel.h = lpc.h;
+		wrmsrq(MSR_PIC_ZSEL_LOW, zsel.q);
 	}
 
 	return 0;
@@ -249,11 +251,8 @@ EXPORT_SYMBOL_GPL(cs5535_mfgpt_write);
  */
 static void reset_all_timers(void)
 {
-	uint32_t val, dummy;
-
 	/* The following undocumented bit resets the MFGPT timers */
-	val = 0xFF; dummy = 0;
-	wrmsr(MSR_MFGPT_SETUP, val, dummy);
+	wrmsrq(MSR_MFGPT_SETUP, 0xff);
 }
 
 /*
-- 
2.55.0


  parent reply	other threads:[~2026-08-19 10:24 UTC|newest]

Thread overview: 28+ 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 ` [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 ` [PATCH v2 07/13] hw_random/via-rng: " Juergen Gross
2026-08-19 10:23 ` [PATCH v2 08/13] drivers/gpio: " Juergen Gross
2026-08-19 10:23 ` Juergen Gross [this message]
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-20  6:06   ` Damien Le Moal
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 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 15:21   ` Jürgen Groß
2026-08-19 15:33   ` Sean Christopherson
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-10-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@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