KVM: x86: clflushopt should be treated as a no-op by emulation
PATCH 1/1 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 13e457e0eebf ("KVM: x86: Emulator does not decode clflush well")
Signed-off-by David Edmondson <[email protected]>
--- arch/x86/kvm/emulate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/kvm/emulate.c +7 -1
@@ -4046,6 +4046,12 @@ static int em_clflush(struct x86_emulate_ctxt *ctxt)return X86EMUL_CONTINUE ; } +static int em_clflushopt (struct x86_emulate_ctxt *ctxt) +{ +/* emulating clflushopt regardless of cpuid */ +return X86EMUL_CONTINUE ; +} +static int em_movsxd (struct x86_emulate_ctxt *ctxt) { ctxt->dst.val = (s32 ) ctxt->src.val;
@@ -4585,7 +4591,7 @@ static const struct opcode group11[] = { };static const struct gprefix pfx_0f_ae_7 = { -I (SrcMem | ByteOp, em_clflush),N ,N ,N , +I (SrcMem | ByteOp, em_clflush),I (SrcMem | ByteOp, em_clflushopt),N ,N , };static const struct group_dual group15 = { {
Signature · 1 line
2.28.0
Quoted 5 lines · David Edmondson
The instruction emulator ignores clflush instructions, yet fails to support clflushopt. Treat both similarly.
Fixes 13e457e0eebf ("KVM: x86: Emulator does not decode clflush well")Signed-off-by David Edmondson <[email protected]>
FWIW,
Reviewed-by Joao Martins <[email protected]>
Quoted 31 lines
--- arch/x86/kvm/emulate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)arch/x86/kvm/emulate.c +7
-1@@ -4046,6 +4046,12 @@ static int em_clflush(struct x86_emulate_ctxt *ctxt)return X86EMUL_CONTINUE ; } +static int em_clflushopt (struct x86_emulate_ctxt *ctxt) +{ +/* emulating clflushopt regardless of cpuid */ +return X86EMUL_CONTINUE ; +} +static int em_movsxd (struct x86_emulate_ctxt *ctxt) { ctxt->dst.val = (s32 ) ctxt->src.val;@@ -4585,7 +4591,7 @@ static const struct opcode group11[] = { };static const struct gprefix pfx_0f_ae_7 = { -I (SrcMem | ByteOp, em_clflush),N ,N ,N , +I (SrcMem | ByteOp, em_clflush),I (SrcMem | ByteOp, em_clflushopt),N ,N , };static const struct group_dual group15 = { {
Quoted 28 lines · David Edmondson
The instruction emulator ignores clflush instructions, yet fails to support clflushopt. Treat both similarly.
Fixes 13e457e0eebf ("KVM: x86: Emulator does not decode clflush well")Signed-off-by David Edmondson <[email protected]>--- arch/x86/kvm/emulate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)arch/x86/kvm/emulate.c +6
-0@@ -4046,6 +4046,12 @@ static int em_clflush(struct x86_emulate_ctxt *ctxt)return X86EMUL_CONTINUE ; } +static int em_clflushopt (struct x86_emulate_ctxt *ctxt) +{ +/* emulating clflushopt regardless of cpuid */ +return X86EMUL_CONTINUE ; +} +static int em_movsxd (struct x86_emulate_ctxt *ctxt) { ctxt->dst.val = (s32 ) ctxt->src.val;
arch/x86/kvm/emulate.c static const struct opcode group11[] = { · line 4597
Quoted 8 lines
arch/x86/kvm/emulate.c +1
-1@@ -4585,7 +4591,7 @@ static const struct opcode group11[] = { };static const struct gprefix pfx_0f_ae_7 = { -I (SrcMem | ByteOp, em_clflush),N ,N ,N , +I (SrcMem | ByteOp, em_clflush),I (SrcMem | ByteOp, em_clflushopt),N ,N , };static const struct group_dual group15 = { {
Queued, thanks.
Paolo