Skip to contentSkip to conversation

kvm: Add emulation for movups/movupd

PATCH Applied Stefan Fritsch 6 participants 10 messages Apr 1, 2018 – Jan 15, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: Add emulation for movups/movupd

This is very similar to the aligned versions movaps/movapd.

We have seen the corresponding emulation failures with openbsd as guest and with Windows 10 with intel HD graphics pass through.

---
 arch/x86/kvm/emulate.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/kvm/emulate.c +7 -1
index d91eaeb01034..7dda8e38c19a 100644
@@ -4498,6 +4498,10 @@ static const struct gprefix pfx_0f_2b = {
 	ID(0, &instr_dual_0f_2b), ID(0, &instr_dual_0f_2b), N, N,
 };
 
+static const struct gprefix pfx_0f_10_0f_11 = {
+	I(Unaligned, em_mov), I(Unaligned, em_mov), N, N,
+};
+
 static const struct gprefix pfx_0f_28_0f_29 = {
 	I(Aligned, em_mov), I(Aligned, em_mov), N, N,
 };
@@ -4709,7 +4713,9 @@ static const struct opcode twobyte_table[256] = {
 	DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N,
 	N, D(ImplicitOps | ModRM | SrcMem | NoAccess), N, N,
 	/* 0x10 - 0x1F */
-	N, N, N, N, N, N, N, N,
+	GP(ModRM | DstReg | SrcMem | Mov | Sse, &pfx_0f_10_0f_11),
+	GP(ModRM | DstMem | SrcReg | Mov | Sse, &pfx_0f_10_0f_11),
+	N, N, N, N, N, N,
 	D(ImplicitOps | ModRM | SrcMem | NoAccess),
 	N, N, N, N, N, N, D(ImplicitOps | ModRM | SrcMem | NoAccess),
 	/* 0x20 - 0x2F */
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw

[The subject could mention "x86:" as well]

2018-04-01 17:54+0200, Stefan Fritsch:

Quoted 8 lines

This is very similar to the aligned versions movaps/movapd.

We have seen the corresponding emulation failures with openbsd as guest and with Windows 10 with intel HD graphics pass through.

---

Nicely follows the implementation of aligned variants,

maintainer Applied
#2 lore raw
In reply to Stefan Fritsch
Quoted 28 lines · Stefan Fritsch

This is very similar to the aligned versions movaps/movapd.

We have seen the corresponding emulation failures with openbsd as guest and with Windows 10 with intel HD graphics pass through.

---
 arch/x86/kvm/emulate.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/kvm/emulate.c +4 -0
index d91eaeb01034..7dda8e38c19a 100644
@@ -4498,6 +4498,10 @@ static const struct gprefix pfx_0f_2b = {
 	ID(0, &instr_dual_0f_2b), ID(0, &instr_dual_0f_2b), N, N,
 };
 
+static const struct gprefix pfx_0f_10_0f_11 = {
+	I(Unaligned, em_mov), I(Unaligned, em_mov), N, N,
+};
+
 static const struct gprefix pfx_0f_28_0f_29 = {
 	I(Aligned, em_mov), I(Aligned, em_mov), N, N,
 };

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

Quoted 10 lines
arch/x86/kvm/emulate.c +3 -1
@@ -4709,7 +4713,9 @@ static const struct opcode twobyte_table[256] = {
 	DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N,
 	N, D(ImplicitOps | ModRM | SrcMem | NoAccess), N, N,
 	/* 0x10 - 0x1F */
-	N, N, N, N, N, N, N, N,
+	GP(ModRM | DstReg | SrcMem | Mov | Sse, &pfx_0f_10_0f_11),
+	GP(ModRM | DstMem | SrcReg | Mov | Sse, &pfx_0f_10_0f_11),
+	N, N, N, N, N, N,
 	D(ImplicitOps | ModRM | SrcMem | NoAccess),
 	N, N, N, N, N, N, D(ImplicitOps | ModRM | SrcMem | NoAccess),
 	/* 0x20 - 0x2F */

Applied, thanks.

Paolo

#3 lore raw
Quoted 2 lines · Paolo Bonzini
Quoted 1 line · Stefan Fritsch

This is very similar to the aligned versions movaps/movapd.

..snip..

Quoted 1 line

Applied, thanks.

Should there be a corresponding test-case?

Quoted 2 lines

Paolo

maintainer
#4 lore raw
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 2 lines · Paolo Bonzini
Quoted 1 line · Stefan Fritsch

This is very similar to the aligned versions movaps/movapd.

..snip..

Quoted 1 line

Applied, thanks.

Should there be a corresponding test-case?

Good point! Stefan, could you write one?

Thanks,

Paolo

#5 lore raw
Quoted 4 lines · On Wednesday, 4 April 2018 19:24:20 CEST Paolo Bonzini wrote:
Quoted 1 line · Konrad Rzeszutek Wilk

Should there be a corresponding test-case?

Good point! Stefan, could you write one?

Is there infrastructure for such tests? If yes, can you give me a pointer to it?

Cheers,
Stefan

#9 lore raw
In reply to Stefan Fritsch

Hi Stefan Fritsch.

[This is an automated email]

This commit has been processed by the -stable helper bot and determined to be a high probability candidate for -stable trees. (score: 5.6100)

The bot has tested the following trees: v4.15.15, v4.14.32, v4.9.92, v4.4.126,

v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

Please let us know if you'd like to have this patch included in a stable tree.

--
Thanks.
Sasha

maintainer
#6 lore raw
In reply to Stefan Fritsch
Quoted 8 lines · Stefan Fritsch
Quoted 4 lines · On Wednesday, 4 April 2018 19:24:20 CEST Paolo Bonzini wrote:
Quoted 1 line · Konrad Rzeszutek Wilk

Should there be a corresponding test-case?

Good point! Stefan, could you write one?

Is there infrastructure for such tests? If yes, can you give me a pointer to it?

Yes, check out x86/emulator.c in
https://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git. There is already a movaps test.

Paolo

#7 lore raw
Quoted 6 lines · Paolo Bonzini
Quoted 4 lines · Stefan Fritsch
Quoted 3 lines · On Wednesday, 4 April 2018 19:24:20 CEST Paolo Bonzini wrote:
Quoted 1 line · Konrad Rzeszutek Wilk

Should there be a corresponding test-case?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Good point! Stefan, could you write one?

Is there infrastructure for such tests? If yes, can you give me a pointer to it?

Yes, check out x86/emulator.c in
https://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git. There is already a movaps test.

Whatever became of this unit test? I don't see it in the kvm-unit-tests repository.

#8 lore raw

Am 13.01.21 um 00:47 schrieb Jim Mattson:

Quoted 12 lines · Paolo Bonzini
Quoted 11 lines · Stefan Fritsch
Quoted 8 lines · On Wednesday, 4 April 2018 19:24:20 CEST Paolo Bonzini wrote:
Quoted 4 lines · Konrad Rzeszutek Wilk
Quoted 1 line

Should there be a corresponding test-case?

Good point! Stefan, could you write one?

Is there infrastructure for such tests? If yes, can you give me a pointer to it?

Quoted 7 lines
Quoted 3 lines

Yes, check out x86/emulator.c in
https://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git. There is already a movaps test.

Whatever became of this unit test? I don't see it in the kvm-unit-tests repository.

Sorry, I did not get around to doing this. And it is unlikely that I will have time to do it in the near future.

Cheers,
Stefan