]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/msr: Don't use rdmsr_safe_on_cpu() in rdmsrq_safe_on_cpu()
authorJuergen Gross <jgross@suse.com>
Mon, 8 Jun 2026 05:17:37 +0000 (07:17 +0200)
committerIngo Molnar <mingo@kernel.org>
Mon, 8 Jun 2026 08:01:49 +0000 (10:01 +0200)
In order to prepare removal of rdmsr_safe_on_cpu(), don't use it in
rdmsrq_safe_on_cpu(), but replace it with open coding it.

This will create a nearly verbatim copy of the same code, but this is
only temporary until rdmsr_safe_on_cpu() is removed.

Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Link: https://patch.msgid.link/20260608051741.3207435-8-jgross@suse.com
arch/x86/lib/msr-smp.c

index a434c80408a0bd273533a05d217776b8d584ba1d..f3c75b681603677070caace838b85ab51088e319 100644 (file)
@@ -190,11 +190,22 @@ EXPORT_SYMBOL(wrmsrq_safe_on_cpu);
 
 int rdmsrq_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 *q)
 {
-       u32 low, high;
+       struct msr_info_completion rv;
+       call_single_data_t csd;
        int err;
 
-       err = rdmsr_safe_on_cpu(cpu, msr_no, &low, &high);
-       *q = (u64)high << 32 | low;
+       INIT_CSD(&csd, __rdmsr_safe_on_cpu, &rv);
+
+       memset(&rv, 0, sizeof(rv));
+       init_completion(&rv.done);
+       rv.msr.msr_no = msr_no;
+
+       err = smp_call_function_single_async(cpu, &csd);
+       if (!err) {
+               wait_for_completion(&rv.done);
+               err = rv.msr.err;
+       }
+       *q = rv.msr.reg.q;
 
        return err;
 }