On Wed, Apr 24, 2024 at 01:13:01PM +0200, Paolo Bonzini wrote:
> Date: Wed, 24 Apr 2024 13:13:01 +0200
> From: Paolo Bonzini <pbonz...@redhat.com>
> Subject: Re: [PATCH for-9.1 09/19] target/i386: move 60-BF opcodes to new
>  decoder
> 
> On Thu, Apr 11, 2024 at 5:05 PM Zhao Liu <zhao1....@intel.com> wrote:
> > HMM, I met Guest boot failure on this patch because of ata unrecognized.
> > I haven't located the exact error yet, so let me post my log first.
> > If there are other means I can use to dig further, I'd be happy to try
> > that too.
> >
> > # Command (boot a ubuntu Guest via TCG)
> >
> > ./qemu/build/qemu-system-x86_64 \
> > -smp 1 \
> > -name ubuntu -m 4G \
> > -cpu max -accel tcg \
> > -hda ../img_qemu/test.qcow2 -nographic \
> > -kernel ../img_qemu/kernel/vmlinuz-6.4.0-rc6+ \
> > -initrd ../img_qemu/kernel/initrd.img-6.4.0-rc6+ \
> > -append "root=/dev/sda ro console=ttyS0" \
> > -qmp unix:/tmp/qmp-sock,server=on,wait=off
> 
> The issue is that INS and OUTS are using the incorrect operand size.
> 
> While at it I also made OUTS a bit more similar to OUT:
> 
> diff --git a/target/i386/tcg/decode-new.c.inc 
> b/target/i386/tcg/decode-new.c.inc
> index 0951b042dfa..46682cfe070 100644
> --- a/target/i386/tcg/decode-new.c.inc
> +++ b/target/i386/tcg/decode-new.c.inc
> @@ -1544,8 +1544,8 @@ static const X86OpEntry opcodes_root[256] = {
>      [0x6B] = X86_OP_ENTRY3(IMUL3, G,v, E,v, I,b, sextT0),
>      [0x6C] = X86_OP_ENTRYrr(INS, Y,b, 2,w), /* DX */
>      [0x6D] = X86_OP_ENTRYrr(INS, Y,z, 2,w), /* DX */
> -    [0x6E] = X86_OP_ENTRYrr(OUTS, 2,w, X,b), /* DX */
> -    [0x6F] = X86_OP_ENTRYrr(OUTS, 2,w, X,b), /* DX */
> +    [0x6E] = X86_OP_ENTRYrr(OUTS, X,b, 2,w), /* DX */
> +    [0x6F] = X86_OP_ENTRYrr(OUTS, X,z, 2,w), /* DX */
> 
>      [0x78] = X86_OP_ENTRYr(Jcc, J,b),
>      [0x79] = X86_OP_ENTRYr(Jcc, J,b),
> @@ -1592,7 +1592,7 @@ static void gen_INC(
> 
>  static void gen_INS(DisasContext *s, CPUX86State *env, X86DecodedInsn 
> *decode)
>  {
> -    MemOp ot = decode->op[0].ot;
> +    MemOp ot = decode->op[1].ot;
>      TCGv_i32 port = tcg_temp_new_i32();
> 
>      tcg_gen_trunc_tl_i32(port, s->T1);
> @@ -2310,10 +2310,10 @@ static void gen_OUT(
> 
>  static void gen_OUTS(DisasContext *s, CPUX86State *env, X86DecodedInsn 
> *decode)
>  {
> -    MemOp ot = decode->op[2].ot;
> +    MemOp ot = decode->op[1].ot;
>      TCGv_i32 port = tcg_temp_new_i32();
> 
> -    tcg_gen_trunc_tl_i32(port, s->T0);
> +    tcg_gen_trunc_tl_i32(port, s->T1);
>      tcg_gen_ext16u_i32(port, port);
>      if (!gen_check_io(s, ot, port, SVM_IOIO_STR_MASK)) {
>          return;
> 
> 
> (sorry about any word breaking)

Thanks! With the above fix, now I re-test on each patch, and all patches
could boot Guest properly! If there is a v2, I can continue to test it.

Regards,
Zhao


Reply via email to