On Wed, Jan 22, 2025 at 11:32:23AM +0100, Philippe Mathieu-Daudé wrote:
> As Daniel mentioned:
> 
>  "The number of instances of MachineClass is not large enough
>   that we save a useful amount of memory through bitfields."
> 
> Also, see recent commit ecbf3567e21 ("docs/devel/style: add a
> section about bitfield, and disallow them for packed structures").

Also developers incorrectly think these are already booleans:

$ git grep  -E 
'\b(no_parallel|no_serial|no_floppy|no_cdrom|no_sdcard|pci_allow_0_address|legacy_fw_cfg_order)\b'
 | grep -E '(true|false)'
hw/arm/sbsa-ref.c:    mc->pci_allow_0_address = true;
hw/arm/virt.c:    mc->pci_allow_0_address = true;
hw/arm/xlnx-versal-virt.c:    mc->no_cdrom = true;
hw/m68k/next-cube.c:    mc->no_cdrom = true;
hw/ppc/spapr.c:    mc->pci_allow_0_address = true;
hw/riscv/virt.c:    mc->pci_allow_0_address = true;

> 
> Convert the MachineClass bitfields used as boolean as real ones.
> 
> Suggested-by: Daniel P. Berrangé <berra...@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
> ---
>  include/hw/boards.h        | 14 +++++++-------
>  hw/arm/aspeed.c            |  6 +++---
>  hw/arm/fby35.c             |  4 ++--
>  hw/arm/npcm7xx_boards.c    |  6 +++---
>  hw/arm/raspi.c             |  6 +++---
>  hw/arm/sbsa-ref.c          |  2 +-
>  hw/arm/virt.c              |  2 +-
>  hw/arm/xilinx_zynq.c       |  2 +-
>  hw/avr/arduino.c           |  6 +++---
>  hw/core/null-machine.c     | 10 +++++-----
>  hw/i386/microvm.c          |  2 +-
>  hw/i386/pc_piix.c          |  2 +-
>  hw/i386/pc_q35.c           |  4 ++--
>  hw/loongarch/virt.c        |  2 +-
>  hw/m68k/virt.c             |  6 +++---
>  hw/ppc/pnv.c               |  2 +-
>  hw/ppc/spapr.c             |  2 +-
>  hw/riscv/virt.c            |  2 +-
>  hw/s390x/s390-virtio-ccw.c |  8 ++++----
>  hw/xtensa/sim.c            |  2 +-
>  20 files changed, 45 insertions(+), 45 deletions(-)

Reviewed-by: Daniel P. Berrangé <berra...@redhat.com>

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to