[PATCH RFC 3/6] x86/msr: Create a new minimal set of inter-CPU MSR access functions
From: Juergen Gross
Date: Mon Apr 20 2026 - 05:22:44 EST
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@xxxxxxxx>
---
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