Skip to content

Commit aa2e4f0

Browse files
committed
KVM: x86: Unconditionally grab data from EDX:EAX in WRMSR fastpath
Always grab EDX:EAX in the WRMSR fastpath to deduplicate and simplify the case statements, and to prepare for handling immediate variants of WRMSRNS in the fastpath (the data register is explicitly provided in that case). There's no harm in reading the registers, as their values are always available, i.e. don't require VMREADs (or similarly slow operations). No real functional change intended. Cc: Xin Li <xin@zytor.com> Link: https://lore.kernel.org/r/20250805190526.1453366-8-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent aebcbb6 commit aa2e4f0

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

arch/x86/kvm/x86.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,18 +2157,16 @@ static int handle_fastpath_set_tscdeadline(struct kvm_vcpu *vcpu, u64 data)
21572157

21582158
fastpath_t handle_fastpath_set_msr_irqoff(struct kvm_vcpu *vcpu)
21592159
{
2160+
u64 data = kvm_read_edx_eax(vcpu);
21602161
u32 msr = kvm_rcx_read(vcpu);
2161-
u64 data;
21622162
bool handled;
21632163
int r;
21642164

21652165
switch (msr) {
21662166
case APIC_BASE_MSR + (APIC_ICR >> 4):
2167-
data = kvm_read_edx_eax(vcpu);
21682167
handled = !handle_fastpath_set_x2apic_icr_irqoff(vcpu, data);
21692168
break;
21702169
case MSR_IA32_TSC_DEADLINE:
2171-
data = kvm_read_edx_eax(vcpu);
21722170
handled = !handle_fastpath_set_tscdeadline(vcpu, data);
21732171
break;
21742172
default:

0 commit comments

Comments
 (0)