Skip to content

Commit ebec254

Browse files
bonzinisean-jc
authored andcommitted
KVM: x86: Enable support for emulating AVX MOV instructions
Some users of KVM have emulated devices (typically added to private forks of QEMU) that execute AVX instructions on PCI BARs. Whenever the guest OS tries to do that, an illegal instruction exception or emulation failure is triggered. Add the Avx flag to move instructions: - (66) 0f 10 - MOVUPS/MOVUPD from memory - (66) 0f 11 - MOVUPS/MOVUPD to memory - 66 0f 6f - MOVDQA from memory - 66 0f 7f - MOVDQA to memory - f3 0f 6f - MOVDQU from memory - f3 0f 7f - MOVDQU to memory - (66) 0f 28 - MOVAPS/MOVAPD from memory - (66) 0f 29 - MOVAPS/MOVAPD to memory - (66) 0f 2b - MOVNTPS/MOVNTPD to memory - 66 0f e7 - MOVNTDQ to memory - 66 0f 38 2a - MOVNTDQA to memory Co-developed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Keith Busch <kbusch@kernel.org> Link: https://lore.kernel.org/kvm/BD108C42-0382-4B17-B601-434A4BD038E7@fb.com/T/ Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Link: https://patch.msgid.link/20251114003633.60689-11-pbonzini@redhat.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent f0585a7 commit ebec254

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

arch/x86/kvm/emulate.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4121,7 +4121,7 @@ static const struct group_dual group15 = { {
41214121
} };
41224122

41234123
static const struct gprefix pfx_0f_6f_0f_7f = {
4124-
I(Mmx, em_mov), I(Sse | Aligned, em_mov), N, I(Sse | Unaligned, em_mov),
4124+
I(Mmx, em_mov), I(Sse | Avx | Aligned, em_mov), N, I(Sse | Avx | Unaligned, em_mov),
41254125
};
41264126

41274127
static const struct instr_dual instr_dual_0f_2b = {
@@ -4141,7 +4141,7 @@ static const struct gprefix pfx_0f_28_0f_29 = {
41414141
};
41424142

41434143
static const struct gprefix pfx_0f_e7_0f_38_2a = {
4144-
N, I(Sse, em_mov), N, N,
4144+
N, I(Sse | Avx, em_mov), N, N,
41454145
};
41464146

41474147
static const struct escape escape_d9 = { {
@@ -4354,8 +4354,8 @@ static const struct opcode twobyte_table[256] = {
43544354
DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N,
43554355
N, D(ImplicitOps | ModRM | SrcMem | NoAccess), N, N,
43564356
/* 0x10 - 0x1F */
4357-
GP(ModRM | DstReg | SrcMem | Mov | Sse, &pfx_0f_10_0f_11),
4358-
GP(ModRM | DstMem | SrcReg | Mov | Sse, &pfx_0f_10_0f_11),
4357+
GP(ModRM | DstReg | SrcMem | Mov | Sse | Avx, &pfx_0f_10_0f_11),
4358+
GP(ModRM | DstMem | SrcReg | Mov | Sse | Avx, &pfx_0f_10_0f_11),
43594359
N, N, N, N, N, N,
43604360
D(ImplicitOps | ModRM | SrcMem | NoAccess), /* 4 * prefetch + 4 * reserved NOP */
43614361
D(ImplicitOps | ModRM | SrcMem | NoAccess), N, N,
@@ -4371,9 +4371,9 @@ static const struct opcode twobyte_table[256] = {
43714371
IIP(ModRM | SrcMem | Priv | Op3264 | NoMod, em_dr_write, dr_write,
43724372
check_dr_write),
43734373
N, N, N, N,
4374-
GP(ModRM | DstReg | SrcMem | Mov | Sse, &pfx_0f_28_0f_29),
4375-
GP(ModRM | DstMem | SrcReg | Mov | Sse, &pfx_0f_28_0f_29),
4376-
N, GP(ModRM | DstMem | SrcReg | Mov | Sse, &pfx_0f_2b),
4374+
GP(ModRM | DstReg | SrcMem | Mov | Sse | Avx, &pfx_0f_28_0f_29),
4375+
GP(ModRM | DstMem | SrcReg | Mov | Sse | Avx, &pfx_0f_28_0f_29),
4376+
N, GP(ModRM | DstMem | SrcReg | Mov | Sse | Avx, &pfx_0f_2b),
43774377
N, N, N, N,
43784378
/* 0x30 - 0x3F */
43794379
II(ImplicitOps | Priv, em_wrmsr, wrmsr),

0 commit comments

Comments
 (0)