Skip to content

Commit 51b958e

Browse files
dmebonzini
authored andcommitted
KVM: x86: clflushopt should be treated as a no-op by emulation
The instruction emulator ignores clflush instructions, yet fails to support clflushopt. Treat both similarly. Fixes: 13e457e ("KVM: x86: Emulator does not decode clflush well") Signed-off-by: David Edmondson <david.edmondson@oracle.com> Message-Id: <20201103120400.240882-1-david.edmondson@oracle.com> Reviewed-by: Joao Martins <joao.m.martins@oracle.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 2c38234 commit 51b958e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

arch/x86/kvm/emulate.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4046,6 +4046,12 @@ static int em_clflush(struct x86_emulate_ctxt *ctxt)
40464046
return X86EMUL_CONTINUE;
40474047
}
40484048

4049+
static int em_clflushopt(struct x86_emulate_ctxt *ctxt)
4050+
{
4051+
/* emulating clflushopt regardless of cpuid */
4052+
return X86EMUL_CONTINUE;
4053+
}
4054+
40494055
static int em_movsxd(struct x86_emulate_ctxt *ctxt)
40504056
{
40514057
ctxt->dst.val = (s32) ctxt->src.val;
@@ -4585,7 +4591,7 @@ static const struct opcode group11[] = {
45854591
};
45864592

45874593
static const struct gprefix pfx_0f_ae_7 = {
4588-
I(SrcMem | ByteOp, em_clflush), N, N, N,
4594+
I(SrcMem | ByteOp, em_clflush), I(SrcMem | ByteOp, em_clflushopt), N, N,
45894595
};
45904596

45914597
static const struct group_dual group15 = { {

0 commit comments

Comments
 (0)