Re: [PATCH v2 04/13] drivers/ata: Stop using 32-bit MSR interfaces
From: Jürgen Groß
Date: Wed Aug 19 2026 - 11:32:56 EST
On 19.08.26 15:40, David Laight wrote:
On Wed, 19 Aug 2026 12:23:05 +0200
Juergen Gross <jgross@xxxxxxxx> wrote:
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
a simple #ifdef.
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
V2:
- avoid sign extension when using wrmsrq() (Sashiko bot)
---
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..e16c7f4c7c27 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,
+ (u32)pio_cmd_timings[cmdmode] << 16 | pio_timings[pairmode]);
That cast is horribly subtle.
Perhaps change the array to be u32 and shift the values in the array initialiser?
I like this idea.
I'll send V3 for this patch only as a reply to V2 of this patch.
Juergen
Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature