For all of the KVM patches, please use

  KVM: x86:

"x86/kvm" is used for guest-side code, and while I hope no one will conflate 
this
with guest code, the consistency is helpful.

On Mon, Jul 14, 2025, Peter Zijlstra wrote:
> Replace the FASTOP1SRC2*() instructions.
> 
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> ---
>  arch/x86/kvm/emulate.c |   34 ++++++++++++++++++++++++++--------
>  1 file changed, 26 insertions(+), 8 deletions(-)
> 
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -317,6 +317,24 @@ static int em_##op(struct x86_emulate_ct
>       ON64(case 8: __EM_ASM_1(op##q, rax); break;) \
>       EM_ASM_END
>  
> +/* 1-operand, using "c" (src2) */
> +#define EM_ASM_1SRC2(op, name) \
> +     EM_ASM_START(name) \
> +     case 1: __EM_ASM_1(op##b, cl); break; \
> +     case 2: __EM_ASM_1(op##w, cx); break; \
> +     case 4: __EM_ASM_1(op##l, ecx); break; \
> +     ON64(case 8: __EM_ASM_1(op##q, rcx); break;) \
> +     EM_ASM_END
> +
> +/* 1-operand, using "c" (src2) with exception */
> +#define EM_ASM_1SRC2EX(op, name) \
> +     EM_ASM_START(name) \
> +     case 1: __EM_ASM_1_EX(op##b, cl); break; \
> +     case 2: __EM_ASM_1_EX(op##w, cx); break; \
> +     case 4: __EM_ASM_1_EX(op##l, ecx); break; \
> +     ON64(case 8: __EM_ASM_1(op##q, rcx); break;) \

This needs to be __EM_ASM_1_EX().  Luckily, KVM-Unit-Tests actually has testcase
for divq (somewhere in the morass of testcases).  I also now have an extension 
to
the fastops selftest to explicitly test all four flavors of div-by-zero; I'll 
get
it posted tomorrow.

(also, don't also me how long it took me to spot the copy+paste typo; I was full
 on debugging the exception fixup code before I realized my local diff looked
 "odd", *sigh*)

Reply via email to