[RFC PATCH v2 32/34] x86/msr: Rename native_read_msr_safe() to native_rdmsrq_safe()

Xin Li (Intel)
2025-04-22T08:23:58Z

Signed-off-by: Xin Li (Intel) <xin@zytor.com>
---
arch/x86/include/asm/msr.h | 4 ++--
arch/x86/kvm/svm/svm.c | 10 +++++-----
arch/x86/xen/pmu.c | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 4c7aa9e7fbac..b4447ba4d6c2 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -157,7 +157,7 @@ static __always_inline bool is_msr_imm_insn(void *ip)
* __native_rdmsrq() -----------------------
* / \ |
* / \ |
- * native_rdmsrq_no_trace() native_read_msr_safe() |
+ * native_rdmsrq_no_trace() native_rdmsrq_safe() |
* / \ |
* / \ |
* native_rdmsr_no_trace() native_rdmsrq() |
@@ -273,7 +273,7 @@ static inline u64 native_rdmsrq(u32 msr)
return val;
}

-static inline int native_read_msr_safe(u32 msr, u64 *val)
+static inline int native_rdmsrq_safe(u32 msr, u64 *val)
{
int err;

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 01dd3cd20730..251fd9366b35 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -481,7 +481,7 @@ static void svm_init_erratum_383(void)
return;

/* Use _safe variants to not break nested virtualization */
- if (native_read_msr_safe(MSR_AMD64_DC_CFG, &val))
+ if (native_rdmsrq_safe(MSR_AMD64_DC_CFG, &val))
return;

val |= (1ULL << 47);
@@ -649,9 +649,9 @@ static int svm_enable_virtualization_cpu(void)
u64 len, status = 0;
int err;

- err = native_read_msr_safe(MSR_AMD64_OSVW_ID_LENGTH, &len);
+ err = native_rdmsrq_safe(MSR_AMD64_OSVW_ID_LENGTH, &len);
if (!err)
- err = native_read_msr_safe(MSR_AMD64_OSVW_STATUS, &status);
+ err = native_rdmsrq_safe(MSR_AMD64_OSVW_STATUS, &status);

if (err)
osvw_status = osvw_len = 0;
@@ -2148,7 +2148,7 @@ static bool is_erratum_383(void)
if (!erratum_383_found)
return false;

- if (native_read_msr_safe(MSR_IA32_MC0_STATUS, &value))
+ if (native_rdmsrq_safe(MSR_IA32_MC0_STATUS, &value))
return false;

/* Bit 62 may or may not be set for this mce */
@@ -2161,7 +2161,7 @@ static bool is_erratum_383(void)
for (i = 0; i < 6; ++i)
native_wrmsrq_safe(MSR_IA32_MCx_STATUS(i), 0);

- if (!native_read_msr_safe(MSR_IA32_MCG_STATUS, &value)) {
+ if (!native_rdmsrq_safe(MSR_IA32_MCG_STATUS, &value)) {
value &= ~(1ULL << 2);
native_wrmsrq_safe(MSR_IA32_MCG_STATUS, value);
}
diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen/pmu.c
index ee908dfcff48..66d2c6fc7bfa 100644
--- a/arch/x86/xen/pmu.c
+++ b/arch/x86/xen/pmu.c
@@ -323,7 +323,7 @@ static u64 xen_amd_read_pmc(int counter)
u64 val;

msr = amd_counters_base + (counter * amd_msr_step);
- native_read_msr_safe(msr, &val);
+ native_rdmsrq_safe(msr, &val);
return val;
}

@@ -349,7 +349,7 @@ static u64 xen_intel_read_pmc(int counter)
else
msr = MSR_IA32_PERFCTR0 + counter;

- native_read_msr_safe(msr, &val);
+ native_rdmsrq_safe(msr, &val);
return val;
}

--
2.49.0