Skip to content

Commit 087c857

Browse files
dmegregkh
authored andcommitted
KVM: x86: clflushopt should be treated as a no-op by emulation
commit 51b958e upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7ae6f2d commit 087c857

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
@@ -4050,6 +4050,12 @@ static int em_clflush(struct x86_emulate_ctxt *ctxt)
40504050
return X86EMUL_CONTINUE;
40514051
}
40524052

4053+
static int em_clflushopt(struct x86_emulate_ctxt *ctxt)
4054+
{
4055+
/* emulating clflushopt regardless of cpuid */
4056+
return X86EMUL_CONTINUE;
4057+
}
4058+
40534059
static int em_movsxd(struct x86_emulate_ctxt *ctxt)
40544060
{
40554061
ctxt->dst.val = (s32) ctxt->src.val;
@@ -4592,7 +4598,7 @@ static const struct opcode group11[] = {
45924598
};
45934599

45944600
static const struct gprefix pfx_0f_ae_7 = {
4595-
I(SrcMem | ByteOp, em_clflush), N, N, N,
4601+
I(SrcMem | ByteOp, em_clflush), I(SrcMem | ByteOp, em_clflushopt), N, N,
45964602
};
45974603

45984604
static const struct group_dual group15 = { {

0 commit comments

Comments
 (0)