Linux ATA/IDE development
 help / color / mirror / Atom feed
From: "Jürgen Groß" <jgross@suse.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	Damien Le Moal <dlemoal@kernel.org>,
	Niklas Cassel <cassel@kernel.org>
Subject: Re: [PATCH v2 04/13] drivers/ata: Stop using 32-bit MSR interfaces
Date: Wed, 19 Aug 2026 17:27:02 +0200	[thread overview]
Message-ID: <3e9b65b9-1855-4186-baef-218020f78dae@suse.com> (raw)
In-Reply-To: <20260819144024.7479a0a6@pumpkin>


[-- Attachment #1.1.1: Type: text/plain, Size: 1976 bytes --]

On 19.08.26 15:40, David Laight wrote:
> On Wed, 19 Aug 2026 12:23:05 +0200
> Juergen Gross <jgross@suse.com> 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@suse.com>
>> ---
>> 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 #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  reply	other threads:[~2026-08-19 15:27 UTC|newest]

Thread overview: 9+ 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 04/13] drivers/ata: Stop using " Juergen Gross
2026-08-19 13:40   ` David Laight
2026-08-19 15:27     ` Jürgen Groß [this message]
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:44   ` sashiko-bot
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

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=3e9b65b9-1855-4186-baef-218020f78dae@suse.com \
    --to=jgross@suse.com \
    --cc=cassel@kernel.org \
    --cc=david.laight.linux@gmail.com \
    --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