Skip to content

Commit 1a81d9d

Browse files
stellarhoppersean-jc
authored andcommitted
KVM: VMX: Define a VMX glue macro for kvm_complete_insn_gp()
Define kvm_complete_insn_gp() as vmx_complete_emulated_msr() and use the glue wrapper in vt_complete_emulated_msr() so that VT's .complete_emulated_msr() implementation follows the soon-to-be-standard pattern of: vt_abc: if (is_td()) return tdx_abc(); return vmx_abc(); This will allow generating such wrappers via a macro, which in turn will make it trivially easy to skip the wrappers entirely when KVM_INTEL_TDX=n. Suggested-by: Sean Christopherson <[email protected]> Link: https://lore.kernel.org/kvm/[email protected]/ Cc: Sean Christopherson <[email protected]> Cc: Rick Edgecombe <[email protected]> Signed-off-by: Vishal Verma <[email protected]> Link: https://lore.kernel.org/r/[email protected] [sean: massage shortlog+changelog] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 84ad4d8 commit 1a81d9d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

arch/x86/kvm/vmx/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ static int vt_complete_emulated_msr(struct kvm_vcpu *vcpu, int err)
240240
if (is_td_vcpu(vcpu))
241241
return tdx_complete_emulated_msr(vcpu, err);
242242

243-
return kvm_complete_insn_gp(vcpu, err);
243+
return vmx_complete_emulated_msr(vcpu, err);
244244
}
245245

246246
#ifdef CONFIG_KVM_SMM

arch/x86/kvm/vmx/x86_ops.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu);
5757
void vmx_update_exception_bitmap(struct kvm_vcpu *vcpu);
5858
int vmx_get_feature_msr(u32 msr, u64 *data);
5959
int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info);
60+
#define vmx_complete_emulated_msr kvm_complete_insn_gp
6061
u64 vmx_get_segment_base(struct kvm_vcpu *vcpu, int seg);
6162
void vmx_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);
6263
void vmx_set_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);

0 commit comments

Comments
 (0)