@@ -7591,16 +7591,6 @@ static void enter_smm(struct kvm_vcpu *vcpu)
kvm_mmu_reset_context(vcpu);
}
-static int emulator_has_longmode(struct x86_emulate_ctxt *ctxt)
-{
- u32 eax, ebx, ecx, edx;
-
- eax = 0x80000001;
- ecx = 0;
- ctxt->ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx, false);
- return edx & bit(X86_FEATURE_LM);
-}
-
#define GET_SMSTATE(type, smbase, offset) \
({ \
type __val; \
@@ -7843,7 +7833,7 @@ static int leave_smm(struct kvm_vcpu *vcpu)
* supports long mode.
*/
cr4 = ctxt->ops->get_cr(ctxt, 4);
- if (emulator_has_longmode(ctxt)) {
+ if (guest_cpuid_has(vcpu, X86_FEATURE_LM)) {
struct desc_struct cs_desc;
/* Zero CR4.PCIDE before CR0.PG. */
@@ -7882,7 +7872,7 @@ static int leave_smm(struct kvm_vcpu *vcpu)
if (ctxt->ops->pre_leave_smm(ctxt, smbase))
return X86EMUL_UNHANDLEABLE;
- if (emulator_has_longmode(ctxt))
+ if (guest_cpuid_has(vcpu, X86_FEATURE_LM))
ret = rsm_load_state_64(ctxt, smbase + 0x8000);
else
ret = rsm_load_state_32(ctxt, smbase + 0x8000);
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> --- arch/x86/kvm/x86.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)