Skip to content

Commit e5779f2

Browse files
sean-jcgregkh
authored andcommitted
KVM: x86: Rename local "ecx" variables to "msr" and "pmc" as appropriate
[ Upstream commit ec400f6c2f2703cb6c698dd00b28cfdb8ee5cdcc ] 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/[email protected] Signed-off-by: Sean Christopherson <[email protected]> Stable-dep-of: 9d7dfb95da2c ("KVM: VMX: Inject #UD if guest tries to execute SEAMCALL or TDCALL") Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ce0138d commit e5779f2

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

arch/x86/kvm/x86.c

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

15801580
int kvm_emulate_rdpmc(struct kvm_vcpu *vcpu)
15811581
{
1582-
u32 ecx = kvm_rcx_read(vcpu);
1582+
u32 pmc = kvm_rcx_read(vcpu);
15831583
u64 data;
15841584

1585-
if (kvm_pmu_rdpmc(vcpu, ecx, &data)) {
1585+
if (kvm_pmu_rdpmc(vcpu, pmc, &data)) {
15861586
kvm_inject_gp(vcpu, 0);
15871587
return 1;
15881588
}
@@ -2033,23 +2033,23 @@ static int kvm_msr_user_space(struct kvm_vcpu *vcpu, u32 index,
20332033

20342034
int kvm_emulate_rdmsr(struct kvm_vcpu *vcpu)
20352035
{
2036-
u32 ecx = kvm_rcx_read(vcpu);
2036+
u32 msr = kvm_rcx_read(vcpu);
20372037
u64 data;
20382038
int r;
20392039

2040-
r = kvm_get_msr_with_filter(vcpu, ecx, &data);
2040+
r = kvm_get_msr_with_filter(vcpu, msr, &data);
20412041

20422042
if (!r) {
2043-
trace_kvm_msr_read(ecx, data);
2043+
trace_kvm_msr_read(msr, data);
20442044

20452045
kvm_rax_write(vcpu, data & -1u);
20462046
kvm_rdx_write(vcpu, (data >> 32) & -1u);
20472047
} else {
20482048
/* MSR read failed? See if we should ask user space */
2049-
if (kvm_msr_user_space(vcpu, ecx, KVM_EXIT_X86_RDMSR, 0,
2049+
if (kvm_msr_user_space(vcpu, msr, KVM_EXIT_X86_RDMSR, 0,
20502050
complete_fast_rdmsr, r))
20512051
return 0;
2052-
trace_kvm_msr_read_ex(ecx);
2052+
trace_kvm_msr_read_ex(msr);
20532053
}
20542054

20552055
return kvm_x86_call(complete_emulated_msr)(vcpu, r);
@@ -2058,23 +2058,23 @@ EXPORT_SYMBOL_GPL(kvm_emulate_rdmsr);
20582058

20592059
int kvm_emulate_wrmsr(struct kvm_vcpu *vcpu)
20602060
{
2061-
u32 ecx = kvm_rcx_read(vcpu);
2061+
u32 msr = kvm_rcx_read(vcpu);
20622062
u64 data = kvm_read_edx_eax(vcpu);
20632063
int r;
20642064

2065-
r = kvm_set_msr_with_filter(vcpu, ecx, data);
2065+
r = kvm_set_msr_with_filter(vcpu, msr, data);
20662066

20672067
if (!r) {
2068-
trace_kvm_msr_write(ecx, data);
2068+
trace_kvm_msr_write(msr, data);
20692069
} else {
20702070
/* MSR write failed? See if we should ask user space */
2071-
if (kvm_msr_user_space(vcpu, ecx, KVM_EXIT_X86_WRMSR, data,
2071+
if (kvm_msr_user_space(vcpu, msr, KVM_EXIT_X86_WRMSR, data,
20722072
complete_fast_msr_access, r))
20732073
return 0;
20742074
/* Signal all other negative errors to userspace */
20752075
if (r < 0)
20762076
return r;
2077-
trace_kvm_msr_write_ex(ecx, data);
2077+
trace_kvm_msr_write_ex(msr, data);
20782078
}
20792079

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

0 commit comments

Comments
 (0)