Skip to contentSkip to conversation

KVM: x86: Swap the dst and src operand for MOVNTDQA

PATCH Applied Sean Christopherson 3 participants 3 messages May 6 – May 12

Subsystems (3)
lore
Share & tools
lore

Sean Christopherson

author maintainer
#0 lore raw

PATCH v2 1/1 KVM: x86: Swap the dst and src operand for MOVNTDQA

Swap the MOVNTDQA operands, as MOVNTDQA does NOT in fact have "the same characteristics as 0F E7 (MOVNTDQ)"; MOVNTDQA loads from memory and stores to registers, while MOVNTDQ loads from registers and stores to memory.

Per the SDM:

MOVNTDQ - Move packed integer values in xmm1 to m128 using non-temporal
hint.

MOVNTDQA - Move double quadword from m128 to xmm1 using non-temporal hint
if WC memory type.

Fixes c57d9bafbd0b ("KVM: x86: Add support for emulating MOVNTDQA")

---

v2: Suck less. [Josh]

v1: https://lore.kernel.org/all/[email protected]

 arch/x86/kvm/emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/emulate.c +1 -1
index c8c6cc0406d6..8013dccb3110 100644
@@ -4481,7 +4481,7 @@ static const struct opcode opcode_map_0f_38[256] = {
 	X16(N), X16(N),
 	/* 0x20 - 0x2f */
 	X8(N),
-	X2(N), GP(SrcReg | DstMem | ModRM | Mov | Aligned, &pfx_0f_e7_0f_38_2a), N, N, N, N, N,
+	X2(N), GP(SrcMem | DstReg | ModRM | Mov | Aligned, &pfx_0f_e7_0f_38_2a), N, N, N, N, N,
 	/* 0x30 - 0x7f */
 	X16(N), X16(N), X16(N), X16(N), X16(N),
 	/* 0x80 - 0xef */

base-commit: 6d35786de28116ecf78797a62b84e6bf3c45aa5a

Signature · 1 line
2.54.0.545.g6539524ca2-goog
Reviewed-by on v2 1/1
#1 lore raw
Quoted 31 lines · Sean Christopherson

Swap the MOVNTDQA operands, as MOVNTDQA does NOT in fact have "the same characteristics as 0F E7 (MOVNTDQ)"; MOVNTDQA loads from memory and stores to registers, while MOVNTDQ loads from registers and stores to memory.

Per the SDM:

MOVNTDQ - Move packed integer values in xmm1 to m128 using non-temporal
hint.

MOVNTDQA - Move double quadword from m128 to xmm1 using non-temporal hint
if WC memory type.

Fixes c57d9bafbd0b ("KVM: x86: Add support for emulating MOVNTDQA")

---

v2: Suck less. [Josh]

v1: https://lore.kernel.org/all/[email protected]

 arch/x86/kvm/emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/emulate.c +0 -0
index c8c6cc0406d6..8013dccb3110 100644

arch/x86/kvm/emulate.c static const struct opcode opcode_map_0f_38[256] = { · line 4484

Quoted 5 lines
arch/x86/kvm/emulate.c +1 -1
@@ -4481,7 +4481,7 @@ static const struct opcode opcode_map_0f_38[256] = {
        X16(N), X16(N),
        /* 0x20 - 0x2f */
        X8(N),
-       X2(N), GP(SrcReg | DstMem | ModRM | Mov | Aligned, &pfx_0f_e7_0f_38_2a), N, N, N, N, N,
+       X2(N), GP(SrcMem | DstReg | ModRM | Mov | Aligned, &pfx_0f_e7_0f_38_2a), N, N, N, N, N,

Ten Ns starting at 0x20 leaves you at 0x2a, so I buy it. :)

Quoted 9 lines
arch/x86/kvm/emulate.c +0 -0
        /* 0x30 - 0x7f */
        X16(N), X16(N), X16(N), X16(N), X16(N),
        /* 0x80 - 0xef */

base-commit: 6d35786de28116ecf78797a62b84e6bf3c45aa5a --
2.54.0.545.g6539524ca2-goog