Skip to content

Commit ec400f6

Browse files
committed
KVM: x86: Rename local "ecx" variables to "msr" and "pmc" as appropriate
Rename "ecx" variables in {RD,WR}MSR and RDPMC helpers to "msr" and "pmc" respectively, in anticipation of adding support for the immediate variants of RDMSR and WRMSRNS, and to better document what the variables hold (versus where the data originated). No functional change intended. Link: https://lore.kernel.org/r/20250805202224.1475590-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 3c7cb84 commit ec400f6

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

arch/x86/kvm/x86.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,10 +1573,10 @@ EXPORT_SYMBOL_GPL(kvm_get_dr);
15731573

15741574
int kvm_emulate_rdpmc(struct kvm_vcpu *vcpu)
15751575
{
1576-
u32 ecx = kvm_rcx_read(vcpu);
1576+
u32 pmc = kvm_rcx_read(vcpu);
15771577
u64 data;
15781578

1579-
if (kvm_pmu_rdpmc(vcpu, ecx, &data)) {
1579+
if (kvm_pmu_rdpmc(vcpu, pmc, &data)) {
15801580
kvm_inject_gp(vcpu, 0);
15811581
return 1;
15821582
}
@@ -2027,23 +2027,23 @@ static int kvm_msr_user_space(struct kvm_vcpu *vcpu, u32 index,
20272027

20282028
int kvm_emulate_rdmsr(struct kvm_vcpu *vcpu)
20292029
{
2030-
u32 ecx = kvm_rcx_read(vcpu);
2030+
u32 msr = kvm_rcx_read(vcpu);
20312031
u64 data;
20322032
int r;
20332033

2034-
r = kvm_get_msr_with_filter(vcpu, ecx, &data);
2034+
r = kvm_get_msr_with_filter(vcpu, msr, &data);
20352035

20362036
if (!r) {
2037-
trace_kvm_msr_read(ecx, data);
2037+
trace_kvm_msr_read(msr, data);
20382038

20392039
kvm_rax_write(vcpu, data & -1u);
20402040
kvm_rdx_write(vcpu, (data >> 32) & -1u);
20412041
} else {
20422042
/* MSR read failed? See if we should ask user space */
2043-
if (kvm_msr_user_space(vcpu, ecx, KVM_EXIT_X86_RDMSR, 0,
2043+
if (kvm_msr_user_space(vcpu, msr, KVM_EXIT_X86_RDMSR, 0,
20442044
complete_fast_rdmsr, r))
20452045
return 0;
2046-
trace_kvm_msr_read_ex(ecx);
2046+
trace_kvm_msr_read_ex(msr);
20472047
}
20482048

20492049
return kvm_x86_call(complete_emulated_msr)(vcpu, r);
@@ -2052,23 +2052,23 @@ EXPORT_SYMBOL_GPL(kvm_emulate_rdmsr);
20522052

20532053
int kvm_emulate_wrmsr(struct kvm_vcpu *vcpu)
20542054
{
2055-
u32 ecx = kvm_rcx_read(vcpu);
2055+
u32 msr = kvm_rcx_read(vcpu);
20562056
u64 data = kvm_read_edx_eax(vcpu);
20572057
int r;
20582058

2059-
r = kvm_set_msr_with_filter(vcpu, ecx, data);
2059+
r = kvm_set_msr_with_filter(vcpu, msr, data);
20602060

20612061
if (!r) {
2062-
trace_kvm_msr_write(ecx, data);
2062+
trace_kvm_msr_write(msr, data);
20632063
} else {
20642064
/* MSR write failed? See if we should ask user space */
2065-
if (kvm_msr_user_space(vcpu, ecx, KVM_EXIT_X86_WRMSR, data,
2065+
if (kvm_msr_user_space(vcpu, msr, KVM_EXIT_X86_WRMSR, data,
20662066
complete_fast_msr_access, r))
20672067
return 0;
20682068
/* Signal all other negative errors to userspace */
20692069
if (r < 0)
20702070
return r;
2071-
trace_kvm_msr_write_ex(ecx, data);
2071+
trace_kvm_msr_write_ex(msr, data);
20722072
}
20732073

20742074
return kvm_x86_call(complete_emulated_msr)(vcpu, r);

0 commit comments

Comments
 (0)