[Qemu-commits] [qemu/qemu] d0414d: target/i386: generate simpler code for ROL/ROR wit...

2024-05-23 Thread Richard Henderson via Qemu-commits
  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: d0414d71f612651699de019b911a772b07d0ac4a
  
https://github.com/qemu/qemu/commit/d0414d71f612651699de019b911a772b07d0ac4a
  Author: Paolo Bonzini 
  Date:   2024-05-22 (Wed, 22 May 2024)

  Changed paths:
M target/i386/tcg/emit.c.inc

  Log Message:
  ---
  target/i386: generate simpler code for ROL/ROR with immediate count

gen_rot_carry and gen_rot_overflow are meant to be called with count == NULL
if the count cannot be zero.  However this is not done in gen_ROL and gen_ROR,
and writing everywhere "can_be_zero ? count : NULL" is burdensome and less
readable.  Just pass can_be_zero as a separate argument.

gen_RCL and gen_RCR use a conditional branch to skip the computation
if count is zero, so they can pass false unconditionally to gen_rot_overflow.

Signed-off-by: Paolo Bonzini 
Reviewed-by: Richard Henderson 
Message-ID: <20240522123914.608516-1-pbonz...@redhat.com>
Signed-off-by: Paolo Bonzini 


  Commit: ec56891984e682c0e6a7bbf5a51372648a60a353
  
https://github.com/qemu/qemu/commit/ec56891984e682c0e6a7bbf5a51372648a60a353
  Author: Paolo Bonzini 
  Date:   2024-05-22 (Wed, 22 May 2024)

  Changed paths:
M target/i386/helper.h
M target/i386/tcg/decode-new.c.inc
M target/i386/tcg/emit.c.inc
M target/i386/tcg/int_helper.c

  Log Message:
  ---
  target/i386: clean up AAM/AAD

The 32-bit AAM/AAD opcodes are using helpers that read and write flags and
env->regs[R_EAX].  Clean them up so that the table correctly includes AX
as a 16-bit input and output.

No real reason to do it to be honest, but they are nice one-output helpers
and it removes the masking of env->regs[R_EAX] that generic load/writeback
code already does.

Signed-off-by: Paolo Bonzini 
Reviewed-by: Richard Henderson 
Message-ID: <20240522123912.608497-1-pbonz...@redhat.com>
Signed-off-by: Paolo Bonzini 


  Commit: a44ea3fa7f2aa1d809fdca1b84a52695b53d8ad0
  
https://github.com/qemu/qemu/commit/a44ea3fa7f2aa1d809fdca1b84a52695b53d8ad0
  Author: Bernhard Beschow 
  Date:   2024-05-22 (Wed, 22 May 2024)

  Changed paths:
M hw/i386/pc.c
M hw/i386/pc_piix.c
M hw/i386/pc_q35.c
M hw/i386/pc_sysfw.c
M include/hw/i386/pc.h

  Log Message:
  ---
  hw/i386/pc_sysfw: Alias rather than copy isa-bios region

In the -bios case the "isa-bios" memory region is an alias to the BIOS mapped
to the top of the 4G memory boundary. Do the same in the -pflash case, but only
for new machine versions for migration compatibility. This establishes common
behavior and makes pflash commands work in the "isa-bios" region which some
real-world legacy bioses rely on.

Note that in the sev_enabled() case, the "isa-bios" memory region in the -pflash
case will now also point to encrypted memory, just like it already does in the
-bios case.

When running `info mtree` before and after this commit with
`qemu-system-x86_64 -S -drive \
if=pflash,format=raw,readonly=on,file=/usr/share/qemu/bios-256k.bin` and running
`diff -u before.mtree after.mtree` results in the following changes in the
memory tree:

   --- before.mtree
   +++ after.mtree
   @@ -71,7 +71,7 @@
- (prio -1, i/o): pci
000a-000b (prio 1, i/o): vga-lowmem
000c-000d (prio 1, rom): pc.rom
   -  000e-000f (prio 1, rom): isa-bios
   +  000e-000f (prio 1, romd): alias isa-bios 
@system.flash0 0002-0003
000a-000b (prio 1, i/o): alias smram-region 
@pci 000a-000b
000c-000c3fff (prio 1, i/o): alias pam-pci @pci 
000c-000c3fff
000c4000-000c7fff (prio 1, i/o): alias pam-pci @pci 
000c4000-000c7fff
   @@ -108,7 +108,7 @@
- (prio -1, i/o): pci
000a-000b (prio 1, i/o): vga-lowmem
000c-000d (prio 1, rom): pc.rom
   -  000e-000f (prio 1, rom): isa-bios
   +  000e-000f (prio 1, romd): alias isa-bios 
@system.flash0 0002-0003
000a-000b (prio 1, i/o): alias smram-region 
@pci 000a-000b
000c-000c3fff (prio 1, i/o): alias pam-pci @pci 
000c-000c3fff
000c4000-000c7fff (prio 1, i/o): alias pam-pci @pci 
000c4000-000c7fff
   @@ -131,11 +131,14 @@
   memory-region: pc.ram
   -07ff (prio 0, ram): pc.ram

   +memory-region: system.flash0
   +  fffc- (prio 0, romd): system.flash0
   +
   memory-region: pci
   - (prio -1, i/o): pci
000a-0

[Qemu-commits] [qemu/qemu] d0414d: target/i386: generate simpler code for ROL/ROR wit...

2024-05-23 Thread Richard Henderson via Qemu-commits
  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: d0414d71f612651699de019b911a772b07d0ac4a
  
https://github.com/qemu/qemu/commit/d0414d71f612651699de019b911a772b07d0ac4a
  Author: Paolo Bonzini 
  Date:   2024-05-22 (Wed, 22 May 2024)

  Changed paths:
M target/i386/tcg/emit.c.inc

  Log Message:
  ---
  target/i386: generate simpler code for ROL/ROR with immediate count

gen_rot_carry and gen_rot_overflow are meant to be called with count == NULL
if the count cannot be zero.  However this is not done in gen_ROL and gen_ROR,
and writing everywhere "can_be_zero ? count : NULL" is burdensome and less
readable.  Just pass can_be_zero as a separate argument.

gen_RCL and gen_RCR use a conditional branch to skip the computation
if count is zero, so they can pass false unconditionally to gen_rot_overflow.

Signed-off-by: Paolo Bonzini 
Reviewed-by: Richard Henderson 
Message-ID: <20240522123914.608516-1-pbonz...@redhat.com>
Signed-off-by: Paolo Bonzini 


  Commit: ec56891984e682c0e6a7bbf5a51372648a60a353
  
https://github.com/qemu/qemu/commit/ec56891984e682c0e6a7bbf5a51372648a60a353
  Author: Paolo Bonzini 
  Date:   2024-05-22 (Wed, 22 May 2024)

  Changed paths:
M target/i386/helper.h
M target/i386/tcg/decode-new.c.inc
M target/i386/tcg/emit.c.inc
M target/i386/tcg/int_helper.c

  Log Message:
  ---
  target/i386: clean up AAM/AAD

The 32-bit AAM/AAD opcodes are using helpers that read and write flags and
env->regs[R_EAX].  Clean them up so that the table correctly includes AX
as a 16-bit input and output.

No real reason to do it to be honest, but they are nice one-output helpers
and it removes the masking of env->regs[R_EAX] that generic load/writeback
code already does.

Signed-off-by: Paolo Bonzini 
Reviewed-by: Richard Henderson 
Message-ID: <20240522123912.608497-1-pbonz...@redhat.com>
Signed-off-by: Paolo Bonzini 


  Commit: a44ea3fa7f2aa1d809fdca1b84a52695b53d8ad0
  
https://github.com/qemu/qemu/commit/a44ea3fa7f2aa1d809fdca1b84a52695b53d8ad0
  Author: Bernhard Beschow 
  Date:   2024-05-22 (Wed, 22 May 2024)

  Changed paths:
M hw/i386/pc.c
M hw/i386/pc_piix.c
M hw/i386/pc_q35.c
M hw/i386/pc_sysfw.c
M include/hw/i386/pc.h

  Log Message:
  ---
  hw/i386/pc_sysfw: Alias rather than copy isa-bios region

In the -bios case the "isa-bios" memory region is an alias to the BIOS mapped
to the top of the 4G memory boundary. Do the same in the -pflash case, but only
for new machine versions for migration compatibility. This establishes common
behavior and makes pflash commands work in the "isa-bios" region which some
real-world legacy bioses rely on.

Note that in the sev_enabled() case, the "isa-bios" memory region in the -pflash
case will now also point to encrypted memory, just like it already does in the
-bios case.

When running `info mtree` before and after this commit with
`qemu-system-x86_64 -S -drive \
if=pflash,format=raw,readonly=on,file=/usr/share/qemu/bios-256k.bin` and running
`diff -u before.mtree after.mtree` results in the following changes in the
memory tree:

   --- before.mtree
   +++ after.mtree
   @@ -71,7 +71,7 @@
- (prio -1, i/o): pci
000a-000b (prio 1, i/o): vga-lowmem
000c-000d (prio 1, rom): pc.rom
   -  000e-000f (prio 1, rom): isa-bios
   +  000e-000f (prio 1, romd): alias isa-bios 
@system.flash0 0002-0003
000a-000b (prio 1, i/o): alias smram-region 
@pci 000a-000b
000c-000c3fff (prio 1, i/o): alias pam-pci @pci 
000c-000c3fff
000c4000-000c7fff (prio 1, i/o): alias pam-pci @pci 
000c4000-000c7fff
   @@ -108,7 +108,7 @@
- (prio -1, i/o): pci
000a-000b (prio 1, i/o): vga-lowmem
000c-000d (prio 1, rom): pc.rom
   -  000e-000f (prio 1, rom): isa-bios
   +  000e-000f (prio 1, romd): alias isa-bios 
@system.flash0 0002-0003
000a-000b (prio 1, i/o): alias smram-region 
@pci 000a-000b
000c-000c3fff (prio 1, i/o): alias pam-pci @pci 
000c-000c3fff
000c4000-000c7fff (prio 1, i/o): alias pam-pci @pci 
000c4000-000c7fff
   @@ -131,11 +131,14 @@
   memory-region: pc.ram
   -07ff (prio 0, ram): pc.ram

   +memory-region: system.flash0
   +  fffc- (prio 0, romd): system.flash0
   +
   memory-region: pci
   - (prio -1, i/o): pci
000a-