linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86/emulator: emulate movbe with operand-size prefix
@ 2023-12-12  9:59 Julian Stecklina
  2023-12-17 12:11 ` Borislav Petkov
  2024-02-09  0:22 ` Sean Christopherson
  0 siblings, 2 replies; 3+ messages in thread
From: Julian Stecklina @ 2023-12-12  9:59 UTC (permalink / raw)
  To: kvm
  Cc: Thomas Prescher, Julian Stecklina, Sean Christopherson,
	Paolo Bonzini, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, linux-kernel

From: Thomas Prescher <thomas.prescher@cyberus-technology.de>

The MOVBE instruction can come with an operand-size prefix (66h). In
this, case the x86 emulation code returns EMULATION_FAILED.

It turns out that em_movbe can already handle this case and all that
is missing is an entry in respective opcode tables to populate
gprefix->pfx_66.

Signed-off-by: Thomas Prescher <thomas.prescher@cyberus-technology.de>
Signed-off-by: Julian Stecklina <julian.stecklina@cyberus-technology.de>
---
 arch/x86/kvm/emulate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 2673cd5c46cb..08013e158b2d 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -4502,11 +4502,11 @@ static const struct instr_dual instr_dual_0f_38_f1 = {
 };
 
 static const struct gprefix three_byte_0f_38_f0 = {
-	ID(0, &instr_dual_0f_38_f0), N, N, N
+	ID(0, &instr_dual_0f_38_f0), ID(0, &instr_dual_0f_38_f0), N, N
 };
 
 static const struct gprefix three_byte_0f_38_f1 = {
-	ID(0, &instr_dual_0f_38_f1), N, N, N
+	ID(0, &instr_dual_0f_38_f1), ID(0, &instr_dual_0f_38_f1), N, N
 };
 
 /*
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: x86/emulator: emulate movbe with operand-size prefix
  2023-12-12  9:59 [PATCH] KVM: x86/emulator: emulate movbe with operand-size prefix Julian Stecklina
@ 2023-12-17 12:11 ` Borislav Petkov
  2024-02-09  0:22 ` Sean Christopherson
  1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2023-12-17 12:11 UTC (permalink / raw)
  To: Julian Stecklina
  Cc: kvm, Thomas Prescher, Sean Christopherson, Paolo Bonzini,
	Thomas Gleixner, Ingo Molnar, Dave Hansen, x86, H. Peter Anvin,
	linux-kernel

On Tue, Dec 12, 2023 at 10:59:37AM +0100, Julian Stecklina wrote:
> From: Thomas Prescher <thomas.prescher@cyberus-technology.de>
> 
> The MOVBE instruction can come with an operand-size prefix (66h). In
> this, case the x86 emulation code returns EMULATION_FAILED.
> 
> It turns out that em_movbe can already handle this case and all that
> is missing is an entry in respective opcode tables to populate
> gprefix->pfx_66.
> 
> Signed-off-by: Thomas Prescher <thomas.prescher@cyberus-technology.de>
> Signed-off-by: Julian Stecklina <julian.stecklina@cyberus-technology.de>
> ---
>  arch/x86/kvm/emulate.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 2673cd5c46cb..08013e158b2d 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -4502,11 +4502,11 @@ static const struct instr_dual instr_dual_0f_38_f1 = {
>  };
>  
>  static const struct gprefix three_byte_0f_38_f0 = {
> -	ID(0, &instr_dual_0f_38_f0), N, N, N
> +	ID(0, &instr_dual_0f_38_f0), ID(0, &instr_dual_0f_38_f0), N, N
>  };
>  
>  static const struct gprefix three_byte_0f_38_f1 = {
> -	ID(0, &instr_dual_0f_38_f1), N, N, N
> +	ID(0, &instr_dual_0f_38_f1), ID(0, &instr_dual_0f_38_f1), N, N
>  };
>  
>  /*
> -- 

Acked-by: Borislav Petkov (AMD) <bp@alien8.de>

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: x86/emulator: emulate movbe with operand-size prefix
  2023-12-12  9:59 [PATCH] KVM: x86/emulator: emulate movbe with operand-size prefix Julian Stecklina
  2023-12-17 12:11 ` Borislav Petkov
@ 2024-02-09  0:22 ` Sean Christopherson
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2024-02-09  0:22 UTC (permalink / raw)
  To: Sean Christopherson, kvm, Julian Stecklina
  Cc: Thomas Prescher, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, linux-kernel

On Tue, 12 Dec 2023 10:59:37 +0100, Julian Stecklina wrote:
> The MOVBE instruction can come with an operand-size prefix (66h). In
> this, case the x86 emulation code returns EMULATION_FAILED.
> 
> It turns out that em_movbe can already handle this case and all that
> is missing is an entry in respective opcode tables to populate
> gprefix->pfx_66.
> 
> [...]

Applied to kvm-x86 misc, thanks!  I have a KUT testcase for this now, I'll post
it at some point.

[1/1] KVM: x86/emulator: emulate movbe with operand-size prefix
      https://github.com/kvm-x86/linux/commit/03f6298c7cf6

--
https://github.com/kvm-x86/linux/tree/next

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-09  0:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-12  9:59 [PATCH] KVM: x86/emulator: emulate movbe with operand-size prefix Julian Stecklina
2023-12-17 12:11 ` Borislav Petkov
2024-02-09  0:22 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).