public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Juergen Gross <jgross@suse.com>,
	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 RFC 3/6] x86/msr: Create a new minimal set of inter-CPU MSR access functions
Date: Mon, 20 Apr 2026 11:16:31 +0200	[thread overview]
Message-ID: <20260420091634.128787-4-jgross@suse.com> (raw)
In-Reply-To: <20260420091634.128787-1-jgross@suse.com>

Like for local MSR access functions create a set of inter-CPU MSR
access functions using the "msr_" name space. For writing MSRs of
other CPUs there is no need to have serializing and non-serializing
variants.

Base the new functions on the old ones for now. This can be changed
when all callers have been changed to use the new functions only, in
order to delete the old ones then.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/include/asm/msr.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index cc21c8699e23..74e87b2b39fd 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -369,5 +369,37 @@ static inline int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8])
 #define wrmsrl(msr, val) wrmsrq(msr, val)
 #define rdmsrl_on_cpu(cpu, msr, q) rdmsrq_on_cpu(cpu, msr, q)
 
+static inline int msr_read_on_cpu(unsigned int cpu, u32 msr, u64 *val)
+{
+	return rdmsrq_on_cpu(cpu, msr, val);
+}
+
+static inline int msr_read_safe_on_cpu(unsigned int cpu, u32 msr, u64 *val)
+{
+	return rdmsrq_safe_on_cpu(cpu, msr, val);
+}
+
+static inline int msr_write_on_cpu(unsigned int cpu, u32 msr, u64 val)
+{
+	return wrmsrq_on_cpu(cpu, msr, val);
+}
+
+static inline int msr_write_safe_on_cpu(unsigned int cpu, u32 msr, u64 val)
+{
+	return wrmsrq_safe_on_cpu(cpu, msr, val);
+}
+
+static inline void msr_read_on_cpus(const struct cpumask *cpus, u32 msr,
+				    struct msr __percpu *msrs)
+{
+	rdmsr_on_cpus(cpus, msr, msrs);
+}
+
+static inline void msr_write_on_cpus(const struct cpumask *cpus, u32 msr,
+				     struct msr __percpu *msrs)
+{
+	wrmsr_on_cpus(cpus, msr, msrs);
+}
+
 #endif /* __ASSEMBLER__ */
 #endif /* _ASM_X86_MSR_H */
-- 
2.53.0


  parent reply	other threads:[~2026-04-20  9:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20  9:16 [PATCH RFC 0/6] x86/msr: Rename MSR access functions Juergen Gross
2026-04-20  9:16 ` [PATCH RFC 1/6] x86/msr: Rename msr_read() and msr_write() Juergen Gross
2026-04-20  9:16 ` [PATCH RFC 2/6] x86/msr: Create a new minimal set of local MSR access functions Juergen Gross
2026-04-20  9:16 ` Juergen Gross [this message]
2026-04-20  9:16 ` [PATCH RFC 4/6] x86/msr: Rename the *_safe_regs[_on_cpu]() MSR functions Juergen Gross
2026-04-20  9:16 ` [PATCH RFC 5/6] x86/events: Switch core parts to use new MSR access functions Juergen Gross
2026-04-20  9:16 ` [PATCH RFC 6/6] x86/cpu/mce: Switch code " Juergen Gross
2026-04-20 11:35 ` [PATCH RFC 0/6] x86/msr: Rename " Peter Zijlstra
2026-04-20 11:41   ` Peter Zijlstra
2026-04-20 11:51     ` Jürgen Groß
2026-04-20 13:44       ` Sean Christopherson
2026-04-20 14:04         ` Jürgen Groß
2026-04-20 15:34           ` H. Peter Anvin
2026-04-20 11:49   ` Jürgen Groß
2026-04-20 12:33     ` Peter Zijlstra
2026-04-20 13:01       ` Jürgen Groß
2026-04-20 13:10         ` Peter Zijlstra
2026-04-20 13:23           ` Jürgen Groß
2026-04-20 13:36           ` Sean Christopherson
2026-04-20 13:57             ` 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=20260420091634.128787-4-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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