mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org,
	linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org
Cc: Juergen Gross <jgross@suse.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH 04/32] acpi: Stop using 32-bit MSR interfaces
Date: Mon, 29 Jun 2026 08:04:55 +0200	[thread overview]
Message-ID: <20260629060526.3638272-5-jgross@suse.com> (raw)
In-Reply-To: <20260629060526.3638272-1-jgross@suse.com>

The 32-bit MSR interfaces rdmsr(), wrmsr(), rdmsr_safe() and
wrmsr_safe() are planned to be removed. Use the related 64-bit variants
instead.

In processor_throttling.c drop needless initializers.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/kernel/acpi/sleep.c        | 20 ++++++++------------
 drivers/acpi/processor_perflib.c    | 11 ++++++-----
 drivers/acpi/processor_throttling.c | 14 ++------------
 3 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 91fa262f0e30..8dfe98784bf9 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -61,6 +61,7 @@ int x86_acpi_suspend_lowlevel(void)
 {
 	struct wakeup_header *header =
 		(struct wakeup_header *) __va(real_mode_header->wakeup_header);
+	struct msr val;
 
 	if (header->signature != WAKEUP_HEADER_SIGNATURE) {
 		printk(KERN_ERR "wakeup header does not match\n");
@@ -82,13 +83,10 @@ int x86_acpi_suspend_lowlevel(void)
 	 * with 2-MB L2 Cache and Intel® Processor A100 and A110 on 90
 	 * nm process with 512-KB L2 Cache Specification Update".
 	 */
-	if (!rdmsr_safe(MSR_EFER,
-			&header->pmode_efer_low,
-			&header->pmode_efer_high) &&
-	    !wrmsr_safe(MSR_EFER,
-			header->pmode_efer_low,
-			header->pmode_efer_high))
+	if (!rdmsrq_safe(MSR_EFER, &val.q) && !wrmsrq_safe(MSR_EFER, val.q))
 		header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_EFER);
+	header->pmode_efer_low = val.l;
+	header->pmode_efer_high = val.h;
 #endif /* !CONFIG_64BIT */
 
 	header->pmode_cr0 = read_cr0();
@@ -96,14 +94,12 @@ int x86_acpi_suspend_lowlevel(void)
 		header->pmode_cr4 = __read_cr4();
 		header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_CR4);
 	}
-	if (!rdmsr_safe(MSR_IA32_MISC_ENABLE,
-			&header->pmode_misc_en_low,
-			&header->pmode_misc_en_high) &&
-	    !wrmsr_safe(MSR_IA32_MISC_ENABLE,
-			header->pmode_misc_en_low,
-			header->pmode_misc_en_high))
+	if (!rdmsrq_safe(MSR_IA32_MISC_ENABLE, &val.q) &&
+	    !wrmsrq_safe(MSR_IA32_MISC_ENABLE, val.q))
 		header->pmode_behavior |=
 			(1 << WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE);
+	header->pmode_misc_en_low = val.l;
+	header->pmode_misc_en_high = val.h;
 	header->realmode_flags = acpi_realmode_flags;
 	header->real_magic = 0x12345678;
 
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index fdf55c285c9a..9e25d6124efd 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -287,7 +287,8 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
  */
 static void amd_fixup_frequency(struct acpi_processor_px *px, int i)
 {
-	u32 hi, lo, fid, did;
+	struct msr val;
+	u32 fid, did;
 	int index = px->control & 0x00000007;
 
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
@@ -295,16 +296,16 @@ static void amd_fixup_frequency(struct acpi_processor_px *px, int i)
 
 	if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10) ||
 	    boot_cpu_data.x86 == 0x11) {
-		rdmsr(MSR_AMD_PSTATE_DEF_BASE + index, lo, hi);
+		rdmsrq(MSR_AMD_PSTATE_DEF_BASE + index, val.q);
 		/*
 		 * MSR C001_0064+:
 		 * Bit 63: PstateEn. Read-write. If set, the P-state is valid.
 		 */
-		if (!(hi & BIT(31)))
+		if (!(val.h & BIT(31)))
 			return;
 
-		fid = lo & 0x3f;
-		did = (lo >> 6) & 7;
+		fid = val.l & 0x3f;
+		did = (val.l >> 6) & 7;
 		if (boot_cpu_data.x86 == 0x10)
 			px->core_frequency = (100 * (fid + 0x10)) >> did;
 		else
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index c0f92b93747d..d1605e0ab61f 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -698,20 +698,13 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
 #ifdef CONFIG_X86
 static int acpi_throttling_rdmsr(u64 *value)
 {
-	u64 msr_high, msr_low;
-	u64 msr = 0;
 	int ret = -1;
 
 	if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
 		!this_cpu_has(X86_FEATURE_ACPI)) {
 		pr_err("HARDWARE addr space,NOT supported yet\n");
 	} else {
-		msr_low = 0;
-		msr_high = 0;
-		rdmsr_safe(MSR_IA32_THERM_CONTROL,
-			(u32 *)&msr_low, (u32 *) &msr_high);
-		msr = (msr_high << 32) | msr_low;
-		*value = (u64) msr;
+		rdmsrq_safe(MSR_IA32_THERM_CONTROL, value);
 		ret = 0;
 	}
 	return ret;
@@ -720,15 +713,12 @@ static int acpi_throttling_rdmsr(u64 *value)
 static int acpi_throttling_wrmsr(u64 value)
 {
 	int ret = -1;
-	u64 msr;
 
 	if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
 		!this_cpu_has(X86_FEATURE_ACPI)) {
 		pr_err("HARDWARE addr space,NOT supported yet\n");
 	} else {
-		msr = value;
-		wrmsr_safe(MSR_IA32_THERM_CONTROL,
-			msr & 0xffffffff, msr >> 32);
+		wrmsrq_safe(MSR_IA32_THERM_CONTROL, value);
 		ret = 0;
 	}
 	return ret;
-- 
2.54.0


  parent reply	other threads:[~2026-06-29  6:05 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  6:04 [PATCH 00/32] x86/msr: Drop " Juergen Gross
2026-06-29  6:04 ` [PATCH 01/32] thermal/intel: Stop using " Juergen Gross
2026-07-02  9:31   ` Ingo Molnar
2026-07-02 11:18     ` Jürgen Groß
2026-07-03 11:22   ` [PATCH v2 " Juergen Gross
2026-07-06 12:47     ` Rafael J. Wysocki (Intel)
2026-07-17  9:26     ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:04 ` [PATCH 02/32] powercap: " Juergen Gross
2026-06-29 11:25   ` Ingo Molnar
2026-06-29 11:33     ` Jürgen Groß
2026-06-29 12:31       ` Ingo Molnar
2026-06-29 12:52         ` Jürgen Groß
2026-07-06 12:48   ` Rafael J. Wysocki (Intel)
2026-07-17  9:26   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:04 ` [PATCH 03/32] edac: " Juergen Gross
2026-06-30  1:50   ` Zhuo, Qiuxu
2026-07-02 10:15   ` [tip: x86/msr] EDAC: " tip-bot2 for Juergen Gross
2026-06-29  6:04 ` Juergen Gross [this message]
2026-06-30 12:30   ` [PATCH 04/32] acpi: " Rafael J. Wysocki (Intel)
2026-06-30 12:42     ` Jürgen Groß
2026-07-02  9:17     ` Ingo Molnar
2026-07-02 11:33       ` Rafael J. Wysocki (Intel)
2026-07-04  8:26         ` Ingo Molnar
2026-07-06 12:50           ` Rafael J. Wysocki (Intel)
2026-07-17  9:26   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:04 ` [PATCH 05/32] x86/mtrr: " Juergen Gross
2026-06-29 11:33   ` Ingo Molnar
2026-06-29 11:41     ` Jürgen Groß
2026-06-29 12:27       ` Ingo Molnar
2026-06-29 13:04         ` Jürgen Groß
2026-07-02  9:15           ` Ingo Molnar
2026-07-03 11:23   ` [PATCH v2 " Juergen Gross
2026-07-17  9:42     ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:04 ` [PATCH 06/32] x86/msr: Stop using 32-bit MSR interfaces in lib/msr-smp.c Juergen Gross
2026-07-02 10:16   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:04 ` [PATCH 07/32] x86/msr: Remove wrmsr_safe() Juergen Gross
2026-06-29  6:04 ` [PATCH 08/32] x86/mce: Stop using 32-bit MSR interfaces Juergen Gross
2026-07-02 10:16   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-07-03 10:55   ` [PATCH] x86/mce: Fix build warning after MSR-interface switch Juergen Gross
2026-07-17  9:28     ` Ingo Molnar
2026-07-17 10:18       ` Jürgen Groß
2026-07-17 10:25         ` Ingo Molnar
2026-07-17 11:03           ` Jürgen Groß
2026-06-29  6:05 ` [PATCH 09/32] KVM/x86: Stop using 32-bit MSR interfaces Juergen Gross
2026-07-17  9:42   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 10/32] x86/hygon: " Juergen Gross
2026-07-02 10:16   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 11/32] x86/pci: " Juergen Gross
2026-07-02 10:16   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 12/32] x86/amd: " Juergen Gross
2026-07-02 10:16   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 13/32] x86/featctl: " Juergen Gross
2026-07-02  9:39   ` Ingo Molnar
2026-07-02 11:19     ` Jürgen Groß
2026-07-03 11:24   ` [PATCH v2 " Juergen Gross
2026-07-17  9:42     ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 14/32] x86/tsc: " Juergen Gross
2026-07-02 10:15   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 15/32] x86/msr: Remove rdmsr_safe() Juergen Gross
2026-06-29  6:05 ` [PATCH 16/32] cpufreq: Stop using 32-bit MSR interfaces Juergen Gross
2026-06-29 14:55   ` Zhongqiu Han
2026-06-30  6:38     ` Juergen Gross
2026-07-03 11:24   ` [PATCH v2 " Juergen Gross
2026-07-05  4:51     ` Zhongqiu Han
2026-07-17  9:42     ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 17/32] x86/resctrl: " Juergen Gross
2026-07-01 16:49   ` Reinette Chatre
2026-07-02 10:15   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 18/32] x86/apic: " Juergen Gross
2026-07-02 10:15   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 19/32] x86/cpu: " Juergen Gross
2026-07-02 10:15   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-07-03 21:48     ` Borislav Petkov
2026-07-06  8:30       ` Juergen Gross
2026-07-06 14:26         ` Borislav Petkov
2026-07-06 14:39           ` Jürgen Groß
2026-07-17  9:36       ` Ingo Molnar
2026-07-17 10:18         ` Jürgen Groß
2026-07-17 10:26           ` Ingo Molnar
2026-06-29  6:05 ` [PATCH 20/32] drivers/ata: " Juergen Gross
2026-07-03 11:25   ` [PATCH v2 " Juergen Gross
2026-06-29  6:05 ` [PATCH 21/32] agp/nvidia: " Juergen Gross
2026-06-29  6:05 ` [PATCH 22/32] fbdev/geode: " Juergen Gross
2026-06-29  6:05 ` [PATCH 23/32] hw_random/via-rng: " Juergen Gross
2026-06-29  6:05 ` [PATCH 24/32] drivers/gpio: " Juergen Gross
2026-06-29 10:33   ` Bartosz Golaszewski
2026-07-01  8:13   ` Linus Walleij
2026-07-01  8:32     ` Juergen Gross
2026-06-29  6:05 ` [PATCH 25/32] drivers/misc: " Juergen Gross
2026-06-29  6:05 ` [PATCH 26/32] x86/msr: Remove wrmsr() Juergen Gross
2026-06-29  6:05 ` [PATCH 27/32] x86/hyperv: Stop using 32-bit MSR interfaces Juergen Gross
2026-07-03  9:39   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 28/32] x86/olpc: " Juergen Gross
2026-07-03  9:39   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 29/32] hwmon: " Juergen Gross
2026-06-29 15:05   ` Guenter Roeck
2026-07-03  9:39   ` [tip: x86/msr] " tip-bot2 for Juergen Gross
2026-06-29  6:05 ` [PATCH 30/32] x86/msr: Remove rdmsr() 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:05 ` [PATCH 32/32] x86/msr: Simplify some rdmsrq() use cases Juergen Gross
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:30         ` Jan Beulich
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
2026-07-17  9:38               ` Ingo Molnar

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-5-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=tglx@kernel.org \
    --cc=x86@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