Skip to content

Commit 4067c23

Browse files
committed
KVM: x86: Allow SYSENTER in Compatibility Mode for all Intel compat vCPUs
Emulate SYSENTER in Compatibility Mode for all vCPUs models that are compatible with Intel's architecture, as the behavior if SYSENTER is architecturally defined in Intel's SDM, i.e. should be followed by any CPU that implements Intel's architecture. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent dc2b8b2 commit 4067c23

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

arch/x86/kvm/emulate.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,6 +2354,7 @@ setup_syscalls_segments(struct desc_struct *cs, struct desc_struct *ss)
23542354
ss->avl = 0;
23552355
}
23562356

2357+
#ifdef CONFIG_X86_64
23572358
static bool vendor_intel(struct x86_emulate_ctxt *ctxt)
23582359
{
23592360
u32 eax, ebx, ecx, edx;
@@ -2362,6 +2363,7 @@ static bool vendor_intel(struct x86_emulate_ctxt *ctxt)
23622363
ctxt->ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx, true);
23632364
return is_guest_vendor_intel(ebx, ecx, edx);
23642365
}
2366+
#endif
23652367

23662368
static int em_syscall(struct x86_emulate_ctxt *ctxt)
23672369
{
@@ -2444,11 +2446,11 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt)
24442446
return emulate_gp(ctxt, 0);
24452447

24462448
/*
2447-
* Not recognized on AMD in compat mode (but is recognized in legacy
2448-
* mode).
2449+
* Intel's architecture allows SYSENTER in compatibility mode, but AMD
2450+
* does not. Note, AMD does allow SYSENTER in legacy protected mode.
24492451
*/
2450-
if ((ctxt->mode != X86EMUL_MODE_PROT64) && (efer & EFER_LMA)
2451-
&& !vendor_intel(ctxt))
2452+
if ((ctxt->mode != X86EMUL_MODE_PROT64) && (efer & EFER_LMA) &&
2453+
!ctxt->ops->guest_cpuid_is_intel_compatible(ctxt))
24522454
return emulate_ud(ctxt);
24532455

24542456
/* sysenter/sysexit have not been tested in 64bit mode. */

0 commit comments

Comments
 (0)