From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org
Cc: Juergen Gross <jgross@suse.com>,
Damien Le Moal <dlemoal@kernel.org>,
Niklas Cassel <cassel@kernel.org>
Subject: [PATCH 20/32] drivers/ata: Stop using 32-bit MSR interfaces
Date: Mon, 29 Jun 2026 08:05:11 +0200 [thread overview]
Message-ID: <20260629060526.3638272-21-jgross@suse.com> (raw)
In-Reply-To: <20260629060526.3638272-1-jgross@suse.com>
The 32-bit MSR interfaces rdmsr() and wrmsr() are planned to be
removed. Use the related 64-bit variants instead.
In drivers/ata/pata_cs5536.c don't redefine rdmsr() and wrmsr() as
empty macros for avoiding misuse, but guard the affected code via
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/ata/pata_cs5535.c | 20 ++++++++++----------
drivers/ata/pata_cs5536.c | 17 ++++++++---------
2 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c
index d793fc441b46..da98390cc49e 100644
--- a/drivers/ata/pata_cs5535.c
+++ b/drivers/ata/pata_cs5535.c
@@ -90,7 +90,7 @@ static void cs5535_set_piomode(struct ata_port *ap, struct ata_device *adev)
static const u16 pio_cmd_timings[5] = {
0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131
};
- u32 reg, __maybe_unused dummy;
+ u32 reg;
struct ata_device *pair = ata_dev_pair(adev);
int mode = adev->pio_mode - XFER_PIO_0;
@@ -102,16 +102,16 @@ static void cs5535_set_piomode(struct ata_port *ap, struct ata_device *adev)
cmdmode = min(mode, pairmode);
/* Write the other drive timing register if it changed */
if (cmdmode < pairmode)
- wrmsr(ATAC_CH0D0_PIO + 2 * pair->devno,
- pio_cmd_timings[cmdmode] << 16 | pio_timings[pairmode], 0);
+ wrmsrq(ATAC_CH0D0_PIO + 2 * pair->devno,
+ pio_cmd_timings[cmdmode] << 16 | pio_timings[pairmode]);
}
/* Write the drive timing register */
- wrmsr(ATAC_CH0D0_PIO + 2 * adev->devno,
- pio_cmd_timings[cmdmode] << 16 | pio_timings[mode], 0);
+ wrmsrq(ATAC_CH0D0_PIO + 2 * adev->devno,
+ pio_cmd_timings[cmdmode] << 16 | pio_timings[mode]);
/* Set the PIO "format 1" bit in the DMA timing register */
- rdmsr(ATAC_CH0D0_DMA + 2 * adev->devno, reg, dummy);
- wrmsr(ATAC_CH0D0_DMA + 2 * adev->devno, reg | 0x80000000UL, 0);
+ rdmsrq(ATAC_CH0D0_DMA + 2 * adev->devno, reg);
+ wrmsrq(ATAC_CH0D0_DMA + 2 * adev->devno, reg | 0x80000000UL);
}
/**
@@ -129,16 +129,16 @@ static void cs5535_set_dmamode(struct ata_port *ap, struct ata_device *adev)
static const u32 mwdma_timings[3] = {
0x7F0FFFF3, 0x7F035352, 0x7F024241
};
- u32 reg, __maybe_unused dummy;
+ u32 reg;
int mode = adev->dma_mode;
- rdmsr(ATAC_CH0D0_DMA + 2 * adev->devno, reg, dummy);
+ rdmsrq(ATAC_CH0D0_DMA + 2 * adev->devno, reg);
reg &= 0x80000000UL;
if (mode >= XFER_UDMA_0)
reg |= udma_timings[mode - XFER_UDMA_0];
else
reg |= mwdma_timings[mode - XFER_MW_DMA_0];
- wrmsr(ATAC_CH0D0_DMA + 2 * adev->devno, reg, 0);
+ wrmsrq(ATAC_CH0D0_DMA + 2 * adev->devno, reg);
}
static const struct scsi_host_template cs5535_sht = {
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
index 73e81e160c91..61d232a82b5e 100644
--- a/drivers/ata/pata_cs5536.c
+++ b/drivers/ata/pata_cs5536.c
@@ -32,11 +32,8 @@
static int use_msr;
module_param_named(msr, use_msr, int, 0644);
MODULE_PARM_DESC(msr, "Force using MSR to configure IDE function (Default: 0)");
+#define MAYBE_USE_MSR
#else
-#undef rdmsr /* avoid accidental MSR usage on, e.g. x86-64 */
-#undef wrmsr
-#define rdmsr(x, y, z) do { } while (0)
-#define wrmsr(x, y, z) do { } while (0)
#define use_msr 0
#endif
@@ -85,22 +82,24 @@ static const struct dmi_system_id udma_quirk_dmi_table[] = {
static int cs5536_read(struct pci_dev *pdev, int reg, u32 *val)
{
+#ifdef MAYBE_USE_MSR
if (unlikely(use_msr)) {
- u32 dummy __maybe_unused;
-
- rdmsr(MSR_IDE_CFG + reg, *val, dummy);
+ rdmsrq(MSR_IDE_CFG + reg, *val);
return 0;
}
+#endif
return pci_read_config_dword(pdev, PCI_IDE_CFG + reg * 4, val);
}
-static int cs5536_write(struct pci_dev *pdev, int reg, int val)
+static int cs5536_write(struct pci_dev *pdev, int reg, u32 val)
{
+#ifdef MAYBE_USE_MSR
if (unlikely(use_msr)) {
- wrmsr(MSR_IDE_CFG + reg, val, 0);
+ wrmsrq(MSR_IDE_CFG + reg, val);
return 0;
}
+#endif
return pci_write_config_dword(pdev, PCI_IDE_CFG + reg * 4, val);
}
--
2.54.0
next prev parent reply other threads:[~2026-06-29 6:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 6:04 [PATCH 00/32] x86/msr: Drop 32-bit MSR interfaces Juergen Gross
2026-06-29 6:05 ` Juergen Gross [this message]
2026-06-29 6:23 ` [PATCH 20/32] drivers/ata: Stop using " sashiko-bot
2026-06-29 7:28 ` Jürgen Groß
2026-07-03 11:25 ` [PATCH v2 " Juergen Gross
2026-06-29 6:05 ` [PATCH 31/32] treewide: convert rdmsrq() from a macro to an inline function Juergen Gross
2026-06-29 6:24 ` sashiko-bot
2026-06-29 6:52 ` [PATCH 00/32] x86/msr: Drop 32-bit MSR interfaces Arnd Bergmann
2026-06-29 7:01 ` Jürgen Groß
2026-06-29 8:06 ` Arnd Bergmann
2026-06-29 8:15 ` Jürgen Groß
2026-06-29 8:38 ` Arnd Bergmann
2026-06-30 20:06 ` H. Peter Anvin
2026-06-29 11:19 ` Ingo Molnar
2026-06-30 18:59 ` Sean Christopherson
2026-07-01 8:33 ` Jürgen Groß
2026-07-02 10:07 ` Ingo Molnar
2026-07-02 11:03 ` Juergen Gross
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=20260629060526.3638272-21-jgross@suse.com \
--to=jgross@suse.com \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.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