mbox series

[v2,0/8] hw/boards: Try to make sense of MachineClass::no_sdcard flag

Message ID 20250204180746.58357-1-philmd@linaro.org (mailing list archive)
Headers show
Series hw/boards: Try to make sense of MachineClass::no_sdcard flag | expand

Message

Philippe Mathieu-Daudé Feb. 4, 2025, 6:07 p.m. UTC
Invert MachineClass 'no_sdcard' flag logic and rename it
to 'create_default_sdcard_drive' to make sense of this
default value applied to all machines.
We use the OnOffAuto tri-state to catch implicit default
values. Then we toggle the logic and remove invalid uses.
No logical change intended (except the assertion added).

Philippe Mathieu-Daudé (8):
  hw/boards: Convert no_sdcard flag to OnOffAuto tri-state
  hw/boards: Explicit no_sdcard=false as ON_OFF_AUTO_OFF
  hw/boards: Rename no_sdcard -> auto_create_sdcard
  hw/boards: Remove all invalid uses of auto_create_sdcard=true
  hw/ppc/e500: Remove empty ppce500_machine_class_init()
  hw/arm: Remove all invalid uses of auto_create_sdcard=true
  hw/riscv: Remove all invalid uses of auto_create_sdcard=true
  hw/boards: Ensure machine setting auto_create_sdcard expose a SD Bus

 include/hw/boards.h        |  2 +-
 hw/arm/cubieboard.c        |  1 +
 hw/arm/integratorcp.c      |  1 +
 hw/arm/mcimx7d-sabre.c     |  2 ++
 hw/arm/npcm7xx_boards.c    |  5 +++++
 hw/arm/omap_sx1.c          |  2 ++
 hw/arm/orangepi.c          |  1 +
 hw/arm/realview.c          |  4 ++++
 hw/arm/stellaris.c         |  1 +
 hw/arm/vexpress.c          |  2 ++
 hw/arm/xilinx_zynq.c       |  1 -
 hw/core/null-machine.c     |  1 -
 hw/riscv/microchip_pfsoc.c |  1 +
 hw/riscv/sifive_u.c        |  1 +
 hw/s390x/s390-virtio-ccw.c |  1 -
 system/vl.c                | 16 ++++++++++++----
 16 files changed, 34 insertions(+), 8 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 4, 2025, 6:10 p.m. UTC | #1
On 4/2/25 19:07, Philippe Mathieu-Daudé wrote:
> Invert MachineClass 'no_sdcard' flag logic and rename it
> to 'create_default_sdcard_drive' to make sense of this
> default value applied to all machines.
> We use the OnOffAuto tri-state to catch implicit default
> values. Then we toggle the logic and remove invalid uses.
> No logical change intended (except the assertion added).
> 
> Philippe Mathieu-Daudé (8):
>    hw/boards: Convert no_sdcard flag to OnOffAuto tri-state
>    hw/boards: Explicit no_sdcard=false as ON_OFF_AUTO_OFF
>    hw/boards: Rename no_sdcard -> auto_create_sdcard
>    hw/boards: Remove all invalid uses of auto_create_sdcard=true
>    hw/ppc/e500: Remove empty ppce500_machine_class_init()
>    hw/arm: Remove all invalid uses of auto_create_sdcard=true
>    hw/riscv: Remove all invalid uses of auto_create_sdcard=true
>    hw/boards: Ensure machine setting auto_create_sdcard expose a SD Bus
> 
>   include/hw/boards.h        |  2 +-
>   hw/arm/cubieboard.c        |  1 +
>   hw/arm/integratorcp.c      |  1 +
>   hw/arm/mcimx7d-sabre.c     |  2 ++
>   hw/arm/npcm7xx_boards.c    |  5 +++++
>   hw/arm/omap_sx1.c          |  2 ++
>   hw/arm/orangepi.c          |  1 +
>   hw/arm/realview.c          |  4 ++++
>   hw/arm/stellaris.c         |  1 +
>   hw/arm/vexpress.c          |  2 ++
>   hw/arm/xilinx_zynq.c       |  1 -
>   hw/core/null-machine.c     |  1 -
>   hw/riscv/microchip_pfsoc.c |  1 +
>   hw/riscv/sifive_u.c        |  1 +
>   hw/s390x/s390-virtio-ccw.c |  1 -

We can now easily see the machines automatically creating SDcard:

$ git grep 'auto_create_sdcard = true'
hw/arm/cubieboard.c:125:    mc->auto_create_sdcard = true;
hw/arm/integratorcp.c:691:    mc->auto_create_sdcard = true;
hw/arm/npcm7xx_boards.c:484:    mc->auto_create_sdcard = true;
hw/arm/npcm7xx_boards.c:497:    mc->auto_create_sdcard = true;
hw/arm/npcm7xx_boards.c:510:    mc->auto_create_sdcard = true;
hw/arm/npcm7xx_boards.c:523:    mc->auto_create_sdcard = true;
hw/arm/npcm7xx_boards.c:536:    mc->auto_create_sdcard = true;
hw/arm/omap_sx1.c:219:    mc->auto_create_sdcard = true;
hw/arm/omap_sx1.c:238:    mc->auto_create_sdcard = true;
hw/arm/orangepi.c:124:    mc->auto_create_sdcard = true;
hw/arm/realview.c:418:    mc->auto_create_sdcard = true;
hw/arm/realview.c:439:    mc->auto_create_sdcard = true;
hw/arm/realview.c:458:    mc->auto_create_sdcard = true;
hw/arm/realview.c:478:    mc->auto_create_sdcard = true;
hw/arm/stellaris.c:1444:    mc->auto_create_sdcard = true;
hw/arm/vexpress.c:806:    mc->auto_create_sdcard = true;
hw/arm/vexpress.c:822:    mc->auto_create_sdcard = true;
hw/riscv/microchip_pfsoc.c:653:    mc->auto_create_sdcard = true;
hw/riscv/sifive_u.c:727:    mc->auto_create_sdcard = true;