qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/15] remove bios_name variable
@ 2020-10-26 14:30 Paolo Bonzini
  2020-10-26 14:30 ` [PATCH 01/15] alpha: remove bios_name Paolo Bonzini
                   ` (15 more replies)
  0 siblings, 16 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

The bios_name variable is mostly a duplicate of machine->firmware.
Only three cases need some care (i386, digic and rx), everything else
is mechanical.

Paolo Bonzini (15):
  alpha: remove bios_name
  digic: stash firmware into DigicState
  arm: remove bios_name
  hppa: remove bios_name
  i386: remove bios_name
  lm32: remove bios_name
  m68k: remove bios_name
  mips: remove bios_name
  moxie: remove bios_name
  ppc: remove bios_name
  rx: move BIOS load from MCU to board
  s390: remove bios_name
  sh4: remove bios_name
  sparc: remove bios_name
  vl: remove bios_name

 hw/alpha/dp264.c           |  2 +-
 hw/arm/cubieboard.c        |  2 +-
 hw/arm/digic_boards.c      |  5 +++--
 hw/arm/highbank.c          |  8 ++++----
 hw/arm/npcm7xx_boards.c    |  5 +----
 hw/arm/orangepi.c          |  2 +-
 hw/arm/sbsa-ref.c          |  2 ++
 hw/arm/vexpress.c          |  8 ++++----
 hw/arm/virt.c              |  2 ++
 hw/hppa/machine.c          |  3 +--
 hw/i386/microvm.c          |  7 +++----
 hw/i386/pc_sysfw.c         |  4 ++--
 hw/i386/x86.c              | 10 ++++------
 hw/lm32/milkymist.c        |  4 +---
 hw/m68k/mcf5208.c          | 10 +++++-----
 hw/m68k/next-cube.c        |  4 +---
 hw/m68k/q800.c             |  4 +---
 hw/mips/fuloong2e.c        |  6 +++---
 hw/mips/jazz.c             |  6 +++---
 hw/mips/malta.c            |  6 +++---
 hw/mips/mipssim.c          |  6 +++---
 hw/mips/r4k.c              |  4 +---
 hw/moxie/moxiesim.c        |  6 +++---
 hw/ppc/e500.c              |  4 ++--
 hw/ppc/mac_newworld.c      |  4 +---
 hw/ppc/mac_oldworld.c      |  4 +---
 hw/ppc/pnv.c               |  5 +----
 hw/ppc/ppc405_boards.c     |  6 ++----
 hw/ppc/prep.c              |  4 +---
 hw/ppc/spapr.c             |  4 +---
 hw/rx/rx-gdbsim.c          |  7 +++++++
 hw/rx/rx62n.c              |  9 ---------
 hw/s390x/ipl.c             |  8 ++------
 hw/s390x/s390-virtio-ccw.c |  3 ++-
 hw/sh4/shix.c              |  3 +--
 hw/sparc/leon3.c           |  4 +---
 hw/sparc/sun4m.c           |  2 +-
 hw/sparc64/sun4u.c         |  2 +-
 include/hw/arm/digic.h     |  1 +
 include/hw/i386/x86.h      |  3 ++-
 include/sysemu/sysemu.h    |  1 -
 softmmu/vl.c               |  2 --
 42 files changed, 80 insertions(+), 112 deletions(-)

-- 
2.26.2



^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH 01/15] alpha: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:09   ` Alex Bennée
  2020-10-26 18:11   ` Philippe Mathieu-Daudé
  2020-10-26 14:30 ` [PATCH 02/15] digic: stash firmware into DigicState Paolo Bonzini
                   ` (14 subsequent siblings)
  15 siblings, 2 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, philmd

Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/alpha/dp264.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 4d24518d1d..c4d407a9f1 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -107,7 +107,7 @@ static void clipper_init(MachineState *machine)
        but one explicitly written for the emulation, we might as
        well load it directly from and ELF image.  */
     palcode_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
-                                bios_name ? bios_name : "palcode-clipper");
+                                      machine->firmware ?: "palcode-clipper");
     if (palcode_filename == NULL) {
         error_report("no palcode provided");
         exit(1);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 02/15] digic: stash firmware into DigicState
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
  2020-10-26 14:30 ` [PATCH 01/15] alpha: remove bios_name Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 14:44   ` Peter Maydell
  2020-10-26 14:30 ` [PATCH 03/15] arm: remove bios_name Paolo Bonzini
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, philmd

Prepare for removing bios_name.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/arm/digic_boards.c  | 5 +++--
 include/hw/arm/digic.h | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index d5524d3e72..d320b54c44 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -55,6 +55,7 @@ static void digic4_board_init(MachineState *machine, DigicBoard *board)
     DigicState *s = DIGIC(object_new(TYPE_DIGIC));
     MachineClass *mc = MACHINE_GET_CLASS(machine);
 
+    s->firmware = machine->firmware;
     if (machine->ram_size != mc->default_ram_size) {
         char *sz = size_to_str(mc->default_ram_size);
         error_report("Invalid RAM size, should be %s", sz);
@@ -91,8 +92,8 @@ static void digic_load_rom(DigicState *s, hwaddr addr,
         return;
     }
 
-    if (bios_name) {
-        filename = bios_name;
+    if (s->firmware) {
+        filename = s->firmware;
     } else {
         filename = def_filename;
     }
diff --git a/include/hw/arm/digic.h b/include/hw/arm/digic.h
index 8f2735c284..421dae937e 100644
--- a/include/hw/arm/digic.h
+++ b/include/hw/arm/digic.h
@@ -36,6 +36,7 @@ struct DigicState {
 
     ARMCPU cpu;
 
+    const char *firmware;
     DigicTimerState timer[DIGIC4_NB_TIMERS];
     DigicUartState uart;
 };
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 03/15] arm: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
  2020-10-26 14:30 ` [PATCH 01/15] alpha: remove bios_name Paolo Bonzini
  2020-10-26 14:30 ` [PATCH 02/15] digic: stash firmware into DigicState Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:11   ` Alex Bennée
  2020-10-26 14:30 ` [PATCH 04/15] hppa: " Paolo Bonzini
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, philmd

Get the firmware name from the MachineState object.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/arm/cubieboard.c     | 2 +-
 hw/arm/highbank.c       | 8 ++++----
 hw/arm/npcm7xx_boards.c | 5 +----
 hw/arm/orangepi.c       | 2 +-
 hw/arm/sbsa-ref.c       | 2 ++
 hw/arm/vexpress.c       | 8 ++++----
 hw/arm/virt.c           | 2 ++
 7 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
index 1c6c792eb6..9d0d728180 100644
--- a/hw/arm/cubieboard.c
+++ b/hw/arm/cubieboard.c
@@ -40,7 +40,7 @@ static void cubieboard_init(MachineState *machine)
     DeviceState *carddev;
 
     /* BIOS is not supported by this board */
-    if (bios_name) {
+    if (machine->firmware) {
         error_report("BIOS not supported for this machine");
         exit(1);
     }
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index da0510d7ce..8c18971790 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -295,16 +295,16 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
     memory_region_init_ram(sysram, NULL, "highbank.sysram", 0x8000,
                            &error_fatal);
     memory_region_add_subregion(sysmem, 0xfff88000, sysram);
-    if (bios_name != NULL) {
-        sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+    if (machine->firmware != NULL) {
+        sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware);
         if (sysboot_filename != NULL) {
             if (load_image_targphys(sysboot_filename, 0xfff88000, 0x8000) < 0) {
-                error_report("Unable to load %s", bios_name);
+                error_report("Unable to load %s", machine->firmware);
                 exit(1);
             }
             g_free(sysboot_filename);
         } else {
-            error_report("Unable to find %s", bios_name);
+            error_report("Unable to find %s", machine->firmware);
             exit(1);
         }
     }
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
index 79e2e2744c..9821013bc6 100644
--- a/hw/arm/npcm7xx_boards.c
+++ b/hw/arm/npcm7xx_boards.c
@@ -33,13 +33,10 @@ static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin";
 
 static void npcm7xx_load_bootrom(MachineState *machine, NPCM7xxState *soc)
 {
+    const char *bios_name = machine->firmware ?: npcm7xx_default_bootrom;
     g_autofree char *filename = NULL;
     int ret;
 
-    if (!bios_name) {
-        bios_name = npcm7xx_default_bootrom;
-    }
-
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
     if (!filename) {
         error_report("Could not find ROM image '%s'", bios_name);
diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c
index 17a568a2b4..d6306dfdda 100644
--- a/hw/arm/orangepi.c
+++ b/hw/arm/orangepi.c
@@ -41,7 +41,7 @@ static void orangepi_init(MachineState *machine)
     DeviceState *carddev;
 
     /* BIOS is not supported by this board */
-    if (bios_name) {
+    if (machine->firmware) {
         error_report("BIOS not supported for this machine");
         exit(1);
     }
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index 01863510d0..8372ed901d 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -294,6 +294,7 @@ static bool sbsa_firmware_init(SBSAMachineState *sms,
                                MemoryRegion *sysmem,
                                MemoryRegion *secure_sysmem)
 {
+    const char *bios_name;
     int i;
     BlockBackend *pflash_blk0;
 
@@ -307,6 +308,7 @@ static bool sbsa_firmware_init(SBSAMachineState *sms,
 
     pflash_blk0 = pflash_cfi01_get_blk(sms->flash[0]);
 
+    bios_name = MACHINE(sms)->firmware;
     if (bios_name) {
         char *fname;
         MemoryRegion *mr;
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 531f3a122a..1adb663d77 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -560,7 +560,7 @@ static void vexpress_common_init(MachineState *machine)
     /*
      * If a bios file was provided, attempt to map it into memory
      */
-    if (bios_name) {
+    if (machine->firmware) {
         char *fn;
         int image_size;
 
@@ -570,16 +570,16 @@ static void vexpress_common_init(MachineState *machine)
                          "but you cannot use both options at once");
             exit(1);
         }
-        fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+        fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware);
         if (!fn) {
-            error_report("Could not find ROM image '%s'", bios_name);
+            error_report("Could not find ROM image '%s'", machine->firmware);
             exit(1);
         }
         image_size = load_image_targphys(fn, map[VE_NORFLASH0],
                                          VEXPRESS_FLASH_SIZE);
         g_free(fn);
         if (image_size < 0) {
-            error_report("Could not load ROM image '%s'", bios_name);
+            error_report("Could not load ROM image '%s'", machine->firmware);
             exit(1);
         }
     }
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index e465a988d6..5c7e3d18db 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1047,6 +1047,7 @@ static bool virt_firmware_init(VirtMachineState *vms,
                                MemoryRegion *secure_sysmem)
 {
     int i;
+    const char *bios_name;
     BlockBackend *pflash_blk0;
 
     /* Map legacy -drive if=pflash to machine properties */
@@ -1059,6 +1060,7 @@ static bool virt_firmware_init(VirtMachineState *vms,
 
     pflash_blk0 = pflash_cfi01_get_blk(vms->flash[0]);
 
+    bios_name = MACHINE(vms)->firmware;
     if (bios_name) {
         char *fname;
         MemoryRegion *mr;
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 04/15] hppa: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (2 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 03/15] arm: remove bios_name Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:12   ` Alex Bennée
  2020-10-26 18:11   ` Philippe Mathieu-Daudé
  2020-10-26 14:30 ` [PATCH 05/15] i386: " Paolo Bonzini
                   ` (11 subsequent siblings)
  15 siblings, 2 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, philmd

Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/hppa/machine.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index d5164457ee..5e745d5ea9 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -213,8 +213,7 @@ static void machine_hppa_init(MachineState *machine)
        but one explicitly written for the emulation, we might as
        well load it directly from an ELF image.  */
     firmware_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
-                                       bios_name ? bios_name :
-                                       "hppa-firmware.img");
+                                       machine->firmware ?: "hppa-firmware.img");
     if (firmware_filename == NULL) {
         error_report("no firmware provided");
         exit(1);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 05/15] i386: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (3 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 04/15] hppa: " Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:15   ` Alex Bennée
  2020-10-26 14:30 ` [PATCH 06/15] lm32: " Paolo Bonzini
                   ` (10 subsequent siblings)
  15 siblings, 1 reply; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/microvm.c     |  7 +++----
 hw/i386/pc_sysfw.c    |  4 ++--
 hw/i386/x86.c         | 10 ++++------
 include/hw/i386/x86.h |  3 ++-
 4 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 5428448b70..6cda3014d6 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -154,6 +154,7 @@ static void create_gpex(MicrovmMachineState *mms)
 
 static void microvm_devices_init(MicrovmMachineState *mms)
 {
+    const char *default_firmware;
     X86MachineState *x86ms = X86_MACHINE(mms);
     ISABus *isa_bus;
     ISADevice *rtc_state;
@@ -259,12 +260,10 @@ static void microvm_devices_init(MicrovmMachineState *mms)
         serial_hds_isa_init(isa_bus, 0, 1);
     }
 
-    if (bios_name == NULL) {
-        bios_name = x86_machine_is_acpi_enabled(x86ms)
+    default_firmware = x86_machine_is_acpi_enabled(x86ms)
             ? MICROVM_BIOS_FILENAME
             : MICROVM_QBOOT_FILENAME;
-    }
-    x86_bios_rom_init(get_system_memory(), true);
+    x86_bios_rom_init(MACHINE(mms), default_firmware, get_system_memory(), true);
 }
 
 static void microvm_memory_init(MicrovmMachineState *mms)
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index b6c0822fe3..0187f0a934 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -222,7 +222,7 @@ void pc_system_firmware_init(PCMachineState *pcms,
     BlockBackend *pflash_blk[ARRAY_SIZE(pcms->flash)];
 
     if (!pcmc->pci_enabled) {
-        x86_bios_rom_init(rom_memory, true);
+        x86_bios_rom_init(MACHINE(pcms), "bios.bin", rom_memory, true);
         return;
     }
 
@@ -243,7 +243,7 @@ void pc_system_firmware_init(PCMachineState *pcms,
 
     if (!pflash_blk[0]) {
         /* Machine property pflash0 not set, use ROM mode */
-        x86_bios_rom_init(rom_memory, false);
+        x86_bios_rom_init(MACHINE(pcms), "bios.bin", rom_memory, false);
     } else {
         if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
             /*
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 5944fc44ed..836d388248 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -54,8 +54,6 @@
 #include CONFIG_DEVICES
 #include "kvm_i386.h"
 
-#define BIOS_FILENAME "bios.bin"
-
 /* Physical Address of PVH entry point read from kernel ELF NOTE */
 static size_t pvh_start_addr;
 
@@ -1051,17 +1049,17 @@ void x86_load_linux(X86MachineState *x86ms,
     nb_option_roms++;
 }
 
-void x86_bios_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
+void x86_bios_rom_init(MachineState *ms, const char *default_firmware,
+                       MemoryRegion *rom_memory, bool isapc_ram_fw)
 {
+    const char *bios_name;
     char *filename;
     MemoryRegion *bios, *isa_bios;
     int bios_size, isa_bios_size;
     int ret;
 
     /* BIOS load */
-    if (bios_name == NULL) {
-        bios_name = BIOS_FILENAME;
-    }
+    bios_name = ms->firmware ?: default_firmware;
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
     if (filename) {
         bios_size = get_image_size(filename);
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index bfa9cb2a25..e92ddeaed1 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -101,7 +101,8 @@ void x86_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
 void x86_cpu_unplug_cb(HotplugHandler *hotplug_dev,
                        DeviceState *dev, Error **errp);
 
-void x86_bios_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw);
+void x86_bios_rom_init(MachineState *ms, const char *default_firmware,
+                       MemoryRegion *rom_memory, bool isapc_ram_fw);
 
 void x86_load_linux(X86MachineState *x86ms,
                     FWCfgState *fw_cfg,
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 06/15] lm32: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (4 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 05/15] i386: " Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:15   ` Alex Bennée
  2020-10-26 18:12   ` Philippe Mathieu-Daudé
  2020-10-26 14:30 ` [PATCH 07/15] m68k: " Paolo Bonzini
                   ` (9 subsequent siblings)
  15 siblings, 2 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Walle, philmd

Cc: Michael Walle <michael@walle.cc>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/lm32/milkymist.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
index 9f8fe9fef1..c5d3d77a2b 100644
--- a/hw/lm32/milkymist.c
+++ b/hw/lm32/milkymist.c
@@ -108,6 +108,7 @@ static void
 milkymist_init(MachineState *machine)
 {
     MachineClass *mc = MACHINE_GET_CLASS(machine);
+    const char *bios_name = machine->firmware ? BIOS_FILENAME:
     const char *kernel_filename = machine->kernel_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
     const char *initrd_filename = machine->initrd_filename;
@@ -162,9 +163,6 @@ milkymist_init(MachineState *machine)
     }
 
     /* load bios rom */
-    if (bios_name == NULL) {
-        bios_name = BIOS_FILENAME;
-    }
     bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
 
     if (bios_filename) {
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 07/15] m68k: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (5 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 06/15] lm32: " Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:17   ` Alex Bennée
                     ` (3 more replies)
  2020-10-26 14:30 ` [PATCH 08/15] mips: " Paolo Bonzini
                   ` (8 subsequent siblings)
  15 siblings, 4 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier, philmd

Cc: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/m68k/mcf5208.c   | 10 +++++-----
 hw/m68k/next-cube.c |  4 +---
 hw/m68k/q800.c      |  4 +---
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index d310a98e7b..7c8ca5ddf6 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -301,17 +301,17 @@ static void mcf5208evb_init(MachineState *machine)
     /* 0xfc0a8000 SDRAM controller.  */
 
     /* Load firmware */
-    if (bios_name) {
+    if (machine->firmware) {
         char *fn;
         uint8_t *ptr;
 
-        fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+        fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware);
         if (!fn) {
-            error_report("Could not find ROM image '%s'", bios_name);
+            error_report("Could not find ROM image '%s'", machine->firmware);
             exit(1);
         }
         if (load_image_targphys(fn, 0x0, ROM_SIZE) < 8) {
-            error_report("Could not load ROM image '%s'", bios_name);
+            error_report("Could not load ROM image '%s'", machine->firmware);
             exit(1);
         }
         g_free(fn);
@@ -323,7 +323,7 @@ static void mcf5208evb_init(MachineState *machine)
 
     /* Load kernel.  */
     if (!kernel_filename) {
-        if (qtest_enabled() || bios_name) {
+        if (qtest_enabled() || machine->firmware) {
             return;
         }
         error_report("Kernel image must be specified");
diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index e7045980b7..37bc35dfa4 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -868,6 +868,7 @@ static void next_cube_init(MachineState *machine)
     MemoryRegion *bmapm1 = g_new(MemoryRegion, 1);
     MemoryRegion *bmapm2 = g_new(MemoryRegion, 1);
     MemoryRegion *sysmem = get_system_memory();
+    const char *bios_name = machine->firmware ?: ROM_FILE;
     NeXTState *ns = NEXT_MACHINE(machine);
     DeviceState *dev;
 
@@ -924,9 +925,6 @@ static void next_cube_init(MachineState *machine)
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x0200e000);
 
     /* Load ROM here */
-    if (bios_name == NULL) {
-        bios_name = ROM_FILE;
-    }
     /* still not sure if the rom should also be mapped at 0x0*/
     memory_region_init_rom(rom, NULL, "next.rom", 0x20000, &error_fatal);
     memory_region_add_subregion(sysmem, 0x01000000, rom);
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index ce4b47c3e3..6ebcddcfb2 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -167,6 +167,7 @@ static void q800_init(MachineState *machine)
     const char *kernel_filename = machine->kernel_filename;
     const char *initrd_filename = machine->initrd_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *bios_name = machine->firmware ?: MACROM_FILENAME;
     hwaddr parameters_base;
     CPUState *cs;
     DeviceState *dev;
@@ -400,9 +401,6 @@ static void q800_init(MachineState *machine)
         rom = g_malloc(sizeof(*rom));
         memory_region_init_rom(rom, NULL, "m68k_mac.rom", MACROM_SIZE,
                                &error_abort);
-        if (bios_name == NULL) {
-            bios_name = MACROM_FILENAME;
-        }
         filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
         memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom);
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 08/15] mips: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (6 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 07/15] m68k: " Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:20   ` Alex Bennée
  2020-10-27 14:40   ` Philippe Mathieu-Daudé
  2020-10-26 14:30 ` [PATCH 09/15] moxie: " Paolo Bonzini
                   ` (7 subsequent siblings)
  15 siblings, 2 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/mips/fuloong2e.c | 6 +++---
 hw/mips/jazz.c      | 6 +++---
 hw/mips/malta.c     | 6 +++---
 hw/mips/mipssim.c   | 6 +++---
 hw/mips/r4k.c       | 4 +---
 5 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index a9e0c2f8d3..25b679011f 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -338,7 +338,7 @@ static void mips_fuloong2e_init(MachineState *machine)
         write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry);
     } else {
         filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
-                                  bios_name ?: FULOONG_BIOSNAME);
+                                  machine->firmware ?: FULOONG_BIOSNAME);
         if (filename) {
             bios_size = load_image_targphys(filename, 0x1fc00000LL,
                                             BIOS_SIZE);
@@ -348,8 +348,8 @@ static void mips_fuloong2e_init(MachineState *machine)
         }
 
         if ((bios_size < 0 || bios_size > BIOS_SIZE) &&
-            bios_name && !qtest_enabled()) {
-            error_report("Could not load MIPS bios '%s'", bios_name);
+            machine->firmware && !qtest_enabled()) {
+            error_report("Could not load MIPS bios '%s'", machine->firmware);
             exit(1);
         }
     }
diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
index 71448f72ac..aa95c6a3d3 100644
--- a/hw/mips/jazz.c
+++ b/hw/mips/jazz.c
@@ -218,7 +218,7 @@ static void mips_jazz_init(MachineState *machine,
     memory_region_add_subregion(address_space, 0xfff00000LL, bios2);
 
     /* load the BIOS image. */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name ?: BIOS_FILENAME);
+    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware ?: BIOS_FILENAME);
     if (filename) {
         bios_size = load_image_targphys(filename, 0xfff00000LL,
                                         MAGNUM_BIOS_SIZE);
@@ -227,8 +227,8 @@ static void mips_jazz_init(MachineState *machine,
         bios_size = -1;
     }
     if ((bios_size < 0 || bios_size > MAGNUM_BIOS_SIZE)
-        && bios_name && !qtest_enabled()) {
-        error_report("Could not load MIPS bios '%s'", bios_name);
+        && machine->firmware && !qtest_enabled()) {
+        error_report("Could not load MIPS bios '%s'", machine->firmware);
         exit(1);
     }
 
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 9d1a3b50b7..ef369945d1 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -1333,7 +1333,7 @@ void mips_malta_init(MachineState *machine)
         if (!dinfo) {
             /* Load a BIOS image. */
             filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
-                                      bios_name ?: BIOS_FILENAME);
+                                      machine->firmware ?: BIOS_FILENAME);
             if (filename) {
                 bios_size = load_image_targphys(filename, FLASH_ADDRESS,
                                                 BIOS_SIZE);
@@ -1342,8 +1342,8 @@ void mips_malta_init(MachineState *machine)
                 bios_size = -1;
             }
             if ((bios_size < 0 || bios_size > BIOS_SIZE) &&
-                bios_name && !qtest_enabled()) {
-                error_report("Could not load MIPS bios '%s'", bios_name);
+                machine->firmware && !qtest_enabled()) {
+                error_report("Could not load MIPS bios '%s'", machine->firmware);
                 exit(1);
             }
         }
diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c
index aaa62a0f4b..cc9b0934b3 100644
--- a/hw/mips/mipssim.c
+++ b/hw/mips/mipssim.c
@@ -177,7 +177,7 @@ mips_mipssim_init(MachineState *machine)
     /* Map the BIOS / boot exception handler. */
     memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
     /* Load a BIOS / boot exception handler image. */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name ?: BIOS_FILENAME);
+    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware ?: BIOS_FILENAME);
     if (filename) {
         bios_size = load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZE);
         g_free(filename);
@@ -185,9 +185,9 @@ mips_mipssim_init(MachineState *machine)
         bios_size = -1;
     }
     if ((bios_size < 0 || bios_size > BIOS_SIZE) &&
-        bios_name && !qtest_enabled()) {
+        machine->firmware && !qtest_enabled()) {
         /* Bail out if we have neither a kernel image nor boot vector code. */
-        error_report("Could not load MIPS bios '%s'", bios_name);
+        error_report("Could not load MIPS bios '%s'", machine->firmware);
         exit(1);
     } else {
         /* We have a boot vector start address. */
diff --git a/hw/mips/r4k.c b/hw/mips/r4k.c
index 3830854342..b27be138a4 100644
--- a/hw/mips/r4k.c
+++ b/hw/mips/r4k.c
@@ -168,6 +168,7 @@ static const int sector_len = 32 * KiB;
 static
 void mips_r4k_init(MachineState *machine)
 {
+    const char *bios_name = machine->firmware ?: BIOS_FILENAME;
     const char *kernel_filename = machine->kernel_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
     const char *initrd_filename = machine->initrd_filename;
@@ -221,9 +222,6 @@ void mips_r4k_init(MachineState *machine)
      * run.
      */
 
-    if (bios_name == NULL) {
-        bios_name = BIOS_FILENAME;
-    }
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
     if (filename) {
         bios_size = get_image_size(filename);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 09/15] moxie: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (7 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 08/15] mips: " Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:20   ` Alex Bennée
  2020-10-26 14:30 ` [PATCH 10/15] ppc: " Paolo Bonzini
                   ` (6 subsequent siblings)
  15 siblings, 1 reply; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/moxie/moxiesim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index a765e9f6be..d07d504c0d 100644
--- a/hw/moxie/moxiesim.c
+++ b/hw/moxie/moxiesim.c
@@ -133,9 +133,9 @@ static void moxiesim_init(MachineState *machine)
         loader_params.initrd_filename = initrd_filename;
         load_kernel(cpu, &loader_params);
     }
-    if (bios_name) {
-        if (load_image_targphys(bios_name, FIRMWARE_BASE, FIRMWARE_SIZE) < 0) {
-            error_report("Failed to load firmware '%s'", bios_name);
+    if (machine->firmware) {
+        if (load_image_targphys(machine->firmware, FIRMWARE_BASE, FIRMWARE_SIZE) < 0) {
+            error_report("Failed to load firmware '%s'", machine->firmware);
         }
     }
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 10/15] ppc: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (8 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 09/15] moxie: " Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:21   ` Alex Bennée
  2020-10-27  2:04   ` David Gibson
  2020-10-26 14:30 ` [PATCH 11/15] rx: move BIOS load from MCU to board Paolo Bonzini
                   ` (5 subsequent siblings)
  15 siblings, 2 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd, David Gibson

Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/ppc/e500.c          | 4 ++--
 hw/ppc/mac_newworld.c  | 4 +---
 hw/ppc/mac_oldworld.c  | 4 +---
 hw/ppc/pnv.c           | 5 +----
 hw/ppc/ppc405_boards.c | 6 ++----
 hw/ppc/prep.c          | 4 +---
 hw/ppc/spapr.c         | 4 +---
 7 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index ae39b9358e..153a74c98c 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -1035,7 +1035,7 @@ void ppce500_init(MachineState *machine)
      * -kernel to users but allows them to run through u-boot as well.
      */
     kernel_as_payload = false;
-    if (bios_name == NULL) {
+    if (machine->firmware == NULL) {
         if (machine->kernel_filename) {
             payload_name = machine->kernel_filename;
             kernel_as_payload = true;
@@ -1043,7 +1043,7 @@ void ppce500_init(MachineState *machine)
             payload_name = "u-boot.e500";
         }
     } else {
-        payload_name = bios_name;
+        payload_name = machine->firmware;
     }
 
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, payload_name);
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index f9a1cc8944..61c63819df 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -109,6 +109,7 @@ static void ppc_core99_reset(void *opaque)
 static void ppc_core99_init(MachineState *machine)
 {
     ram_addr_t ram_size = machine->ram_size;
+    const char *bios_name = machine->firmware ?: PROM_FILENAME;
     const char *kernel_filename = machine->kernel_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
     const char *initrd_filename = machine->initrd_filename;
@@ -161,9 +162,6 @@ static void ppc_core99_init(MachineState *machine)
                            &error_fatal);
     memory_region_add_subregion(get_system_memory(), PROM_BASE, bios);
 
-    if (!bios_name) {
-        bios_name = PROM_FILENAME;
-    }
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
     if (filename) {
         /* Load OpenBIOS (ELF) */
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 6c59aa5601..11623e8e67 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -83,6 +83,7 @@ static void ppc_heathrow_reset(void *opaque)
 static void ppc_heathrow_init(MachineState *machine)
 {
     ram_addr_t ram_size = machine->ram_size;
+    const char *bios_name = machine->firmware ?: PROM_FILENAME;
     const char *boot_device = machine->boot_order;
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
@@ -130,9 +131,6 @@ static void ppc_heathrow_init(MachineState *machine)
                            &error_fatal);
     memory_region_add_subregion(get_system_memory(), PROM_BASE, bios);
 
-    if (!bios_name) {
-        bios_name = PROM_FILENAME;
-    }
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
     if (filename) {
         /* Load OpenBIOS (ELF) */
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index d9e52873ea..f2b1ee83d3 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -713,6 +713,7 @@ static void pnv_chip_power10_pic_print_info(PnvChip *chip, Monitor *mon)
 
 static void pnv_init(MachineState *machine)
 {
+    const char *bios_name = machine->firmware ?: FW_FILE_NAME;
     PnvMachineState *pnv = PNV_MACHINE(machine);
     MachineClass *mc = MACHINE_GET_CLASS(machine);
     char *fw_filename;
@@ -739,10 +740,6 @@ static void pnv_init(MachineState *machine)
     pnv->pnor = PNV_PNOR(dev);
 
     /* load skiboot firmware  */
-    if (bios_name == NULL) {
-        bios_name = FW_FILE_NAME;
-    }
-
     fw_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
     if (!fw_filename) {
         error_report("Could not find OPAL firmware '%s'", bios_name);
diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
index 4687715b15..c867e46330 100644
--- a/hw/ppc/ppc405_boards.c
+++ b/hw/ppc/ppc405_boards.c
@@ -141,6 +141,7 @@ static void ref405ep_fpga_init(MemoryRegion *sysmem, uint32_t base)
 static void ref405ep_init(MachineState *machine)
 {
     MachineClass *mc = MACHINE_GET_CLASS(machine);
+    const char *bios_name = machine->firmware ?: BIOS_FILENAME;
     const char *kernel_filename = machine->kernel_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
     const char *initrd_filename = machine->initrd_filename;
@@ -206,8 +207,6 @@ static void ref405ep_init(MachineState *machine)
         memory_region_init_rom(bios, NULL, "ef405ep.bios", BIOS_SIZE,
                                &error_fatal);
 
-        if (bios_name == NULL)
-            bios_name = BIOS_FILENAME;
         filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
         if (filename) {
             bios_size = load_image_size(filename,
@@ -425,6 +424,7 @@ static void taihu_cpld_init(MemoryRegion *sysmem, uint32_t base)
 static void taihu_405ep_init(MachineState *machine)
 {
     MachineClass *mc = MACHINE_GET_CLASS(machine);
+    const char *bios_name = machine->firmware ?: BIOS_FILENAME;
     const char *kernel_filename = machine->kernel_filename;
     const char *initrd_filename = machine->initrd_filename;
     char *filename;
@@ -475,8 +475,6 @@ static void taihu_405ep_init(MachineState *machine)
     } else
 #endif
     {
-        if (bios_name == NULL)
-            bios_name = BIOS_FILENAME;
         bios = g_new(MemoryRegion, 1);
         memory_region_init_rom(bios, NULL, "taihu_405ep.bios", BIOS_SIZE,
                                &error_fatal);
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 4a0cb434a6..c6b9d1ddcb 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -237,6 +237,7 @@ static int prep_set_cmos_checksum(DeviceState *dev, void *opaque)
 
 static void ibm_40p_init(MachineState *machine)
 {
+    const char *bios_name = machine->firmware ?: "openbios-ppc";
     CPUPPCState *env = NULL;
     uint16_t cmos_checksum;
     PowerPCCPU *cpu;
@@ -271,9 +272,6 @@ static void ibm_40p_init(MachineState *machine)
 
     /* PCI host */
     dev = qdev_new("raven-pcihost");
-    if (!bios_name) {
-        bios_name = "openbios-ppc";
-    }
     qdev_prop_set_string(dev, "bios-name", bios_name);
     qdev_prop_set_uint32(dev, "elf-machine", PPC_ELF_MACHINE);
     pcihost = SYS_BUS_DEVICE(dev);
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 63315f2d0f..667d59e5ad 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2647,6 +2647,7 @@ static void spapr_machine_init(MachineState *machine)
     SpaprMachineState *spapr = SPAPR_MACHINE(machine);
     SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
     MachineClass *mc = MACHINE_GET_CLASS(machine);
+    const char *bios_name = machine->firmware ?: FW_FILE_NAME;
     const char *kernel_filename = machine->kernel_filename;
     const char *initrd_filename = machine->initrd_filename;
     PCIHostState *phb;
@@ -2970,9 +2971,6 @@ static void spapr_machine_init(MachineState *machine)
         }
     }
 
-    if (bios_name == NULL) {
-        bios_name = FW_FILE_NAME;
-    }
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
     if (!filename) {
         error_report("Could not find LPAR firmware '%s'", bios_name);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 11/15] rx: move BIOS load from MCU to board
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (9 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 10/15] ppc: " Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:24   ` Alex Bennée
  2020-10-26 14:30 ` [PATCH 12/15] s390: remove bios_name Paolo Bonzini
                   ` (4 subsequent siblings)
  15 siblings, 1 reply; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

The ROM loader state is global and not part of the MCU, and the
BIOS is in machine->firmware.  So just like the kernel case,
load it in the board.

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/rx/rx-gdbsim.c | 7 +++++++
 hw/rx/rx62n.c     | 9 ---------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
index 417ec0564b..040006c1c5 100644
--- a/hw/rx/rx-gdbsim.c
+++ b/hw/rx/rx-gdbsim.c
@@ -142,6 +142,13 @@ static void rx_gdbsim_init(MachineState *machine)
             /* Set dtb address to R1 */
             RX_CPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset;
         }
+    } else {
+        if (machine->firmware) {
+            rom_add_file_fixed(machine->firmware, RX62N_CFLASH_BASE, 0);
+        } else if (!qtest_enabled()) {
+            error_report("No bios or kernel specified");
+            exit(1);
+        }
     }
 }
 
diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c
index 6eb4eea700..17ec73fc7b 100644
--- a/hw/rx/rx62n.c
+++ b/hw/rx/rx62n.c
@@ -245,15 +245,6 @@ static void rx62n_realize(DeviceState *dev, Error **errp)
                            rxc->rom_flash_size, &error_abort);
     memory_region_add_subregion(s->sysmem, RX62N_CFLASH_BASE, &s->c_flash);
 
-    if (!s->kernel) {
-        if (bios_name) {
-            rom_add_file_fixed(bios_name, RX62N_CFLASH_BASE, 0);
-        }  else if (!qtest_enabled()) {
-            error_report("No bios or kernel specified");
-            exit(1);
-        }
-    }
-
     /* Initialize CPU */
     object_initialize_child(OBJECT(s), "cpu", &s->cpu, TYPE_RX62N_CPU);
     qdev_realize(DEVICE(&s->cpu), NULL, &error_abort);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 12/15] s390: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (10 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 11/15] rx: move BIOS load from MCU to board Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:29   ` Alex Bennée
                     ` (3 more replies)
  2020-10-26 14:30 ` [PATCH 13/15] sh4: " Paolo Bonzini
                   ` (3 subsequent siblings)
  15 siblings, 4 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, philmd

Cc: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/s390x/ipl.c             | 8 ++------
 hw/s390x/s390-virtio-ccw.c | 3 ++-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index 3d2652d75a..61e8c967d3 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -128,11 +128,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
     if (!ipl->kernel || ipl->enforce_bios) {
         uint64_t fwbase = (MIN(ram_size, 0x80000000U) - 0x200000) & ~0xffffUL;
 
-        if (bios_name == NULL) {
-            bios_name = ipl->firmware;
-        }
-
-        bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+        bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, ipl->firmware);
         if (bios_filename == NULL) {
             error_setg(errp, "could not find stage1 bootloader");
             return;
@@ -154,7 +150,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
         g_free(bios_filename);
 
         if (bios_size == -1) {
-            error_setg(errp, "could not load bootloader '%s'", bios_name);
+            error_setg(errp, "could not load bootloader '%s'", ipl->firmware);
             return;
         }
 
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index e52182f946..a521eba673 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -258,7 +258,8 @@ static void ccw_init(MachineState *machine)
     /* get a BUS */
     css_bus = virtual_css_bus_init();
     s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
-                      machine->initrd_filename, "s390-ccw.img",
+                      machine->initrd_filename,
+                      machine->firmware ?: "s390-ccw.img",
                       "s390-netboot.img", true);
 
     dev = qdev_new(TYPE_S390_PCI_HOST_BRIDGE);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 13/15] sh4: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (11 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 12/15] s390: remove bios_name Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:29   ` Alex Bennée
  2020-10-26 18:56   ` Philippe Mathieu-Daudé
  2020-10-26 14:30 ` [PATCH 14/15] sparc: " Paolo Bonzini
                   ` (2 subsequent siblings)
  15 siblings, 2 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd, Yoshinori Sato

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/sh4/shix.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
index f410c08883..d9a9fcbc59 100644
--- a/hw/sh4/shix.c
+++ b/hw/sh4/shix.c
@@ -49,6 +49,7 @@ static void shix_init(MachineState *machine)
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *rom = g_new(MemoryRegion, 1);
     MemoryRegion *sdram = g_new(MemoryRegion, 2);
+    const char *bios_name = machine->firmware ?: BIOS_FILENAME;
     
     cpu = SUPERH_CPU(cpu_create(machine->cpu_type));
 
@@ -63,8 +64,6 @@ static void shix_init(MachineState *machine)
     memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]);
 
     /* Load BIOS in 0 (and access it through P2, 0xA0000000) */
-    if (bios_name == NULL)
-        bios_name = BIOS_FILENAME;
     ret = load_image_targphys(bios_name, 0, 0x4000);
     if (ret < 0 && !qtest_enabled()) {
         error_report("Could not load SHIX bios '%s'", bios_name);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 14/15] sparc: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (12 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 13/15] sh4: " Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:30   ` Alex Bennée
                     ` (2 more replies)
  2020-10-26 14:30 ` [PATCH 15/15] vl: " Paolo Bonzini
  2020-10-26 14:51 ` [PATCH 00/15] remove bios_name variable no-reply
  15 siblings, 3 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Mark Cave-Ayland, philmd

Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/sparc/leon3.c   | 4 +---
 hw/sparc/sun4m.c   | 2 +-
 hw/sparc64/sun4u.c | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index d40b7891f6..1c50b02f81 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -185,6 +185,7 @@ static void leon3_set_pil_in(void *opaque, int n, int level)
 static void leon3_generic_hw_init(MachineState *machine)
 {
     ram_addr_t ram_size = machine->ram_size;
+    const char *bios_name = machine->firmware ?: LEON3_PROM_FILENAME;
     const char *kernel_filename = machine->kernel_filename;
     SPARCCPU *cpu;
     CPUSPARCState   *env;
@@ -259,9 +260,6 @@ static void leon3_generic_hw_init(MachineState *machine)
     memory_region_add_subregion(address_space_mem, LEON3_PROM_OFFSET, prom);
 
     /* Load boot prom */
-    if (bios_name == NULL) {
-        bios_name = LEON3_PROM_FILENAME;
-    }
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
 
     if (filename) {
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 38d1e0fd12..81d4ae9385 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -878,7 +878,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
                         hwdef->max_mem - machine->ram_size);
     }
 
-    prom_init(hwdef->slavio_base, bios_name);
+    prom_init(hwdef->slavio_base, machine->firmware);
 
     slavio_intctl = slavio_intctl_init(hwdef->intctl_base,
                                        hwdef->intctl_base + 0x10000ULL,
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 05e659c8a4..50230d261a 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -578,7 +578,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     /* set up devices */
     ram_init(0, machine->ram_size);
 
-    prom_init(hwdef->prom_addr, bios_name);
+    prom_init(hwdef->prom_addr, machine->firmware);
 
     /* Init sabre (PCI host bridge) */
     sabre = SABRE(qdev_new(TYPE_SABRE));
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 15/15] vl: remove bios_name
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (13 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 14/15] sparc: " Paolo Bonzini
@ 2020-10-26 14:30 ` Paolo Bonzini
  2020-10-26 17:30   ` Alex Bennée
  2020-10-27 14:22   ` Thomas Huth
  2020-10-26 14:51 ` [PATCH 00/15] remove bios_name variable no-reply
  15 siblings, 2 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 14:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: philmd

bios_name was a legacy variable used by machine code, but it is
no more.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/sysemu/sysemu.h | 1 -
 softmmu/vl.c            | 2 --
 2 files changed, 3 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 817ff4cf75..1336b4264a 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -8,7 +8,6 @@
 
 /* vl.c */
 
-extern const char *bios_name;
 extern int only_migratable;
 extern const char *qemu_name;
 extern QemuUUID qemu_uuid;
diff --git a/softmmu/vl.c b/softmmu/vl.c
index b7d7f43c88..7909709879 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -119,7 +119,6 @@
 
 static const char *data_dir[16];
 static int data_dir_idx;
-const char *bios_name = NULL;
 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
 int display_opengl;
 const char* keyboard_layout = NULL;
@@ -4205,7 +4204,6 @@ void qemu_init(int argc, char **argv, char **envp)
     kernel_filename = qemu_opt_get(machine_opts, "kernel");
     initrd_filename = qemu_opt_get(machine_opts, "initrd");
     kernel_cmdline = qemu_opt_get(machine_opts, "append");
-    bios_name = qemu_opt_get(machine_opts, "firmware");
 
     opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL);
     if (opts) {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH 02/15] digic: stash firmware into DigicState
  2020-10-26 14:30 ` [PATCH 02/15] digic: stash firmware into DigicState Paolo Bonzini
@ 2020-10-26 14:44   ` Peter Maydell
  2020-10-26 15:05     ` Paolo Bonzini
  0 siblings, 1 reply; 52+ messages in thread
From: Peter Maydell @ 2020-10-26 14:44 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Philippe Mathieu-Daudé, QEMU Developers

On Mon, 26 Oct 2020 at 14:30, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Prepare for removing bios_name.
>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/arm/digic_boards.c  | 5 +++--
>  include/hw/arm/digic.h | 1 +
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
> index d5524d3e72..d320b54c44 100644
> --- a/hw/arm/digic_boards.c
> +++ b/hw/arm/digic_boards.c
> @@ -55,6 +55,7 @@ static void digic4_board_init(MachineState *machine, DigicBoard *board)
>      DigicState *s = DIGIC(object_new(TYPE_DIGIC));
>      MachineClass *mc = MACHINE_GET_CLASS(machine);
>
> +    s->firmware = machine->firmware;
>      if (machine->ram_size != mc->default_ram_size) {
>          char *sz = size_to_str(mc->default_ram_size);
>          error_report("Invalid RAM size, should be %s", sz);
> @@ -91,8 +92,8 @@ static void digic_load_rom(DigicState *s, hwaddr addr,
>          return;
>      }
>
> -    if (bios_name) {
> -        filename = bios_name;
> +    if (s->firmware) {
> +        filename = s->firmware;
>      } else {
>          filename = def_filename;
>      }

The existing code is a little odd, because if the user passes -bios
then we use it in both the add_rom0 and add_rom1 callbacks;
however this ends up not mattering for the moment because the
only supported Digic board has just the rom1 and no rom0.

Anyway, rather than stashing the firmware filename in the
DigicState, you could lift the "decide whether to use
machine->firmware or the def_filename" choice up to
the callsites in digic4_board_init():

    if (board->add_rom0) {
        board->add_rom0(s, DIGIC4_ROM0_BASE,
                        machine->firmware ?: board->rom0_def_filename);
    }
(and similarly for rom1).

Then you can delete the
    if (bios_name) {
        filename = bios_name;
    } else {
        filename = def_filename;
    }
block from digic_load_rom() and rename the arguments of
digic_load_rom() and digic4_add_k8p3215uqb_rom() to just
"filename" rather than "def_filename".

Doing it that way avoids passing things around that we don't
need to, and makes it clear in the digic4_board_init() code
that we're doing something a bit suspect in possibly using
the machine->firmware file twice -- if we ever need to fix
that bug then it'll be a simple change to the logic in that
one function.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 00/15] remove bios_name variable
  2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
                   ` (14 preceding siblings ...)
  2020-10-26 14:30 ` [PATCH 15/15] vl: " Paolo Bonzini
@ 2020-10-26 14:51 ` no-reply
  15 siblings, 0 replies; 52+ messages in thread
From: no-reply @ 2020-10-26 14:51 UTC (permalink / raw)
  To: pbonzini; +Cc: philmd, qemu-devel

Patchew URL: https://patchew.org/QEMU/20201026143028.3034018-1-pbonzini@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20201026143028.3034018-1-pbonzini@redhat.com
Subject: [PATCH 00/15] remove bios_name variable

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
   288a1cc..e75de83  master     -> master
 * [new tag]         patchew/20201026143028.3034018-1-pbonzini@redhat.com -> patchew/20201026143028.3034018-1-pbonzini@redhat.com
Switched to a new branch 'test'
e6a3975 vl: remove bios_name
ff23ca8 sparc: remove bios_name
4b04e35 sh4: remove bios_name
35de573 s390: remove bios_name
a352220 rx: move BIOS load from MCU to board
83c3173 ppc: remove bios_name
c020272 moxie: remove bios_name
09bcdbc mips: remove bios_name
c618c9e m68k: remove bios_name
4ff17f7 lm32: remove bios_name
c6609bf i386: remove bios_name
2f2d724 hppa: remove bios_name
da68a51 arm: remove bios_name
5687239 digic: stash firmware into DigicState
2fae50e alpha: remove bios_name

=== OUTPUT BEGIN ===
1/15 Checking commit 2fae50e6defc (alpha: remove bios_name)
2/15 Checking commit 56872395809e (digic: stash firmware into DigicState)
3/15 Checking commit da68a516b853 (arm: remove bios_name)
WARNING: line over 80 characters
#37: FILE: hw/arm/highbank.c:299:
+        sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware);

total: 0 errors, 1 warnings, 105 lines checked

Patch 3/15 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/15 Checking commit 2f2d724e2d12 (hppa: remove bios_name)
WARNING: line over 80 characters
#21: FILE: hw/hppa/machine.c:216:
+                                       machine->firmware ?: "hppa-firmware.img");

total: 0 errors, 1 warnings, 9 lines checked

Patch 4/15 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
5/15 Checking commit c6609bf59a25 (i386: remove bios_name)
WARNING: line over 80 characters
#33: FILE: hw/i386/microvm.c:266:
+    x86_bios_rom_init(MACHINE(mms), default_firmware, get_system_memory(), true);

total: 0 errors, 1 warnings, 75 lines checked

Patch 5/15 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
6/15 Checking commit 4ff17f7afa49 (lm32: remove bios_name)
ERROR: spaces required around that ':' (ctx:VxE)
#19: FILE: hw/lm32/milkymist.c:111:
+    const char *bios_name = machine->firmware ? BIOS_FILENAME:
                                                              ^

total: 1 errors, 0 warnings, 16 lines checked

Patch 6/15 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

7/15 Checking commit c618c9eb69d3 (m68k: remove bios_name)
8/15 Checking commit 09bcdbcc744e (mips: remove bios_name)
WARNING: line over 80 characters
#44: FILE: hw/mips/jazz.c:221:
+    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware ?: BIOS_FILENAME);

WARNING: line over 80 characters
#79: FILE: hw/mips/malta.c:1346:
+                error_report("Could not load MIPS bios '%s'", machine->firmware);

WARNING: line over 80 characters
#92: FILE: hw/mips/mipssim.c:180:
+    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware ?: BIOS_FILENAME);

total: 0 errors, 3 warnings, 89 lines checked

Patch 8/15 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
9/15 Checking commit c0202725c5bf (moxie: remove bios_name)
WARNING: line over 80 characters
#22: FILE: hw/moxie/moxiesim.c:137:
+        if (load_image_targphys(machine->firmware, FIRMWARE_BASE, FIRMWARE_SIZE) < 0) {

total: 0 errors, 1 warnings, 12 lines checked

Patch 9/15 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
10/15 Checking commit 83c31730c9bd (ppc: remove bios_name)
11/15 Checking commit a3522204200e (rx: move BIOS load from MCU to board)
12/15 Checking commit 35de573a9382 (s390: remove bios_name)
13/15 Checking commit 4b04e35c1605 (sh4: remove bios_name)
14/15 Checking commit ff23ca862682 (sparc: remove bios_name)
15/15 Checking commit e6a39752a393 (vl: remove bios_name)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20201026143028.3034018-1-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 02/15] digic: stash firmware into DigicState
  2020-10-26 14:44   ` Peter Maydell
@ 2020-10-26 15:05     ` Paolo Bonzini
  0 siblings, 0 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 15:05 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Philippe Mathieu-Daudé, QEMU Developers

On 26/10/20 15:44, Peter Maydell wrote:
> Anyway, rather than stashing the firmware filename in the
> DigicState, you could lift the "decide whether to use
> machine->firmware or the def_filename" choice up to
> the callsites in digic4_board_init():
> 
>     if (board->add_rom0) {
>         board->add_rom0(s, DIGIC4_ROM0_BASE,
>                         machine->firmware ?: board->rom0_def_filename);
>     }
> (and similarly for rom1).
> 
> Then you can delete the
>     if (bios_name) {
>         filename = bios_name;
>     } else {
>         filename = def_filename;
>     }
> block from digic_load_rom() and rename the arguments of
> digic_load_rom() and digic4_add_k8p3215uqb_rom() to just
> "filename" rather than "def_filename".
> 
> Doing it that way avoids passing things around that we don't
> need to, and makes it clear in the digic4_board_init() code
> that we're doing something a bit suspect in possibly using
> the machine->firmware file twice -- if we ever need to fix
> that bug then it'll be a simple change to the logic in that
> one function.

Much better indeed, thanks!

Paolo



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 01/15] alpha: remove bios_name
  2020-10-26 14:30 ` [PATCH 01/15] alpha: remove bios_name Paolo Bonzini
@ 2020-10-26 17:09   ` Alex Bennée
  2020-10-26 18:11   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:09 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, Richard Henderson, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Cc: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 03/15] arm: remove bios_name
  2020-10-26 14:30 ` [PATCH 03/15] arm: remove bios_name Paolo Bonzini
@ 2020-10-26 17:11   ` Alex Bennée
  0 siblings, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:11 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Peter Maydell, philmd, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Get the firmware name from the MachineState object.
>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 04/15] hppa: remove bios_name
  2020-10-26 14:30 ` [PATCH 04/15] hppa: " Paolo Bonzini
@ 2020-10-26 17:12   ` Alex Bennée
  2020-10-26 18:11   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:12 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, Richard Henderson, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Cc: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 05/15] i386: remove bios_name
  2020-10-26 14:30 ` [PATCH 05/15] i386: " Paolo Bonzini
@ 2020-10-26 17:15   ` Alex Bennée
  0 siblings, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:15 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 06/15] lm32: remove bios_name
  2020-10-26 14:30 ` [PATCH 06/15] lm32: " Paolo Bonzini
@ 2020-10-26 17:15   ` Alex Bennée
  2020-10-26 18:12   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:15 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Michael Walle, philmd, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Cc: Michael Walle <michael@walle.cc>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 07/15] m68k: remove bios_name
  2020-10-26 14:30 ` [PATCH 07/15] m68k: " Paolo Bonzini
@ 2020-10-26 17:17   ` Alex Bennée
  2020-10-26 18:13   ` Philippe Mathieu-Daudé
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:17 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Laurent Vivier, philmd, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Cc: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 08/15] mips: remove bios_name
  2020-10-26 14:30 ` [PATCH 08/15] mips: " Paolo Bonzini
@ 2020-10-26 17:20   ` Alex Bennée
  2020-10-27 14:40   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:20 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 09/15] moxie: remove bios_name
  2020-10-26 14:30 ` [PATCH 09/15] moxie: " Paolo Bonzini
@ 2020-10-26 17:20   ` Alex Bennée
  0 siblings, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:20 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 10/15] ppc: remove bios_name
  2020-10-26 14:30 ` [PATCH 10/15] ppc: " Paolo Bonzini
@ 2020-10-26 17:21   ` Alex Bennée
  2020-10-27  2:04   ` David Gibson
  1 sibling, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:21 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, qemu-devel, David Gibson


Paolo Bonzini <pbonzini@redhat.com> writes:

> Cc: David Gibson <david@gibson.dropbear.id.au>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 11/15] rx: move BIOS load from MCU to board
  2020-10-26 14:30 ` [PATCH 11/15] rx: move BIOS load from MCU to board Paolo Bonzini
@ 2020-10-26 17:24   ` Alex Bennée
  2020-10-26 17:34     ` Paolo Bonzini
  0 siblings, 1 reply; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:24 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> The ROM loader state is global and not part of the MCU, and the
> BIOS is in machine->firmware.  So just like the kernel case,
> load it in the board.
>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/rx/rx-gdbsim.c | 7 +++++++
>  hw/rx/rx62n.c     | 9 ---------
>  2 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
> index 417ec0564b..040006c1c5 100644
> --- a/hw/rx/rx-gdbsim.c
> +++ b/hw/rx/rx-gdbsim.c
> @@ -142,6 +142,13 @@ static void rx_gdbsim_init(MachineState *machine)
>              /* Set dtb address to R1 */
>              RX_CPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset;
>          }
> +    } else {
> +        if (machine->firmware) {
> +            rom_add_file_fixed(machine->firmware, RX62N_CFLASH_BASE, 0);
> +        } else if (!qtest_enabled()) {
> +            error_report("No bios or kernel specified");
> +            exit(1);
> +        }
>      }
>  }
>  
> diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c
> index 6eb4eea700..17ec73fc7b 100644
> --- a/hw/rx/rx62n.c
> +++ b/hw/rx/rx62n.c
> @@ -245,15 +245,6 @@ static void rx62n_realize(DeviceState *dev, Error **errp)
>                             rxc->rom_flash_size, &error_abort);
>      memory_region_add_subregion(s->sysmem, RX62N_CFLASH_BASE, &s->c_flash);
>  
> -    if (!s->kernel) {
> -        if (bios_name) {
> -            rom_add_file_fixed(bios_name, RX62N_CFLASH_BASE, 0);
> -        }  else if (!qtest_enabled()) {
> -            error_report("No bios or kernel specified");
> -            exit(1);
> -        }
> -    }
> -

I'm confused because on the face of it these are two different models.
I'll defer to the domain expert on this one.

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 12/15] s390: remove bios_name
  2020-10-26 14:30 ` [PATCH 12/15] s390: remove bios_name Paolo Bonzini
@ 2020-10-26 17:29   ` Alex Bennée
  2020-10-26 18:58   ` Thomas Huth
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:29 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Thomas Huth, philmd, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

Might be worth mentioning the trixy path from qdev_prop_set_string to
end up in ipl->firmware because it's not obvious just from the diff.
Anyway:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 13/15] sh4: remove bios_name
  2020-10-26 14:30 ` [PATCH 13/15] sh4: " Paolo Bonzini
@ 2020-10-26 17:29   ` Alex Bennée
  2020-10-26 18:56   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:29 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, qemu-devel, Yoshinori Sato


Paolo Bonzini <pbonzini@redhat.com> writes:

> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
<snip>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 14/15] sparc: remove bios_name
  2020-10-26 14:30 ` [PATCH 14/15] sparc: " Paolo Bonzini
@ 2020-10-26 17:30   ` Alex Bennée
  2020-10-26 18:57   ` Philippe Mathieu-Daudé
  2020-10-27 16:21   ` Mark Cave-Ayland
  2 siblings, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:30 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, Mark Cave-Ayland, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 15/15] vl: remove bios_name
  2020-10-26 14:30 ` [PATCH 15/15] vl: " Paolo Bonzini
@ 2020-10-26 17:30   ` Alex Bennée
  2020-10-27 14:22   ` Thomas Huth
  1 sibling, 0 replies; 52+ messages in thread
From: Alex Bennée @ 2020-10-26 17:30 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, qemu-devel


Paolo Bonzini <pbonzini@redhat.com> writes:

> bios_name was a legacy variable used by machine code, but it is
> no more.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

well it all built which is as far as I've tested it:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 11/15] rx: move BIOS load from MCU to board
  2020-10-26 17:24   ` Alex Bennée
@ 2020-10-26 17:34     ` Paolo Bonzini
  2020-10-26 19:00       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-26 17:34 UTC (permalink / raw)
  To: Alex Bennée; +Cc: philmd, qemu-devel

On 26/10/20 18:24, Alex Bennée wrote:
> 
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
>> The ROM loader state is global and not part of the MCU, and the
>> BIOS is in machine->firmware.  So just like the kernel case,
>> load it in the board.
>>
>> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  hw/rx/rx-gdbsim.c | 7 +++++++
>>  hw/rx/rx62n.c     | 9 ---------
>>  2 files changed, 7 insertions(+), 9 deletions(-)
>>
>> diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
>> index 417ec0564b..040006c1c5 100644
>> --- a/hw/rx/rx-gdbsim.c
>> +++ b/hw/rx/rx-gdbsim.c
>> @@ -142,6 +142,13 @@ static void rx_gdbsim_init(MachineState *machine)
>>              /* Set dtb address to R1 */
>>              RX_CPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset;
>>          }
>> +    } else {
>> +        if (machine->firmware) {
>> +            rom_add_file_fixed(machine->firmware, RX62N_CFLASH_BASE, 0);
>> +        } else if (!qtest_enabled()) {
>> +            error_report("No bios or kernel specified");
>> +            exit(1);
>> +        }
>>      }
>>  }
>>  
>> diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c
>> index 6eb4eea700..17ec73fc7b 100644
>> --- a/hw/rx/rx62n.c
>> +++ b/hw/rx/rx62n.c
>> @@ -245,15 +245,6 @@ static void rx62n_realize(DeviceState *dev, Error **errp)
>>                             rxc->rom_flash_size, &error_abort);
>>      memory_region_add_subregion(s->sysmem, RX62N_CFLASH_BASE, &s->c_flash);
>>  
>> -    if (!s->kernel) {
>> -        if (bios_name) {
>> -            rom_add_file_fixed(bios_name, RX62N_CFLASH_BASE, 0);
>> -        }  else if (!qtest_enabled()) {
>> -            error_report("No bios or kernel specified");
>> -            exit(1);
>> -        }
>> -    }
>> -
> 
> I'm confused because on the face of it these are two different models.
> I'll defer to the domain expert on this one.

rx62n is the SoC, rx-gdbsim.c instead includes the rx62n7 and rx62n8
machines.

Paolo



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 01/15] alpha: remove bios_name
  2020-10-26 14:30 ` [PATCH 01/15] alpha: remove bios_name Paolo Bonzini
  2020-10-26 17:09   ` Alex Bennée
@ 2020-10-26 18:11   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 52+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-26 18:11 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Richard Henderson

On 10/26/20 3:30 PM, Paolo Bonzini wrote:
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/alpha/dp264.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 04/15] hppa: remove bios_name
  2020-10-26 14:30 ` [PATCH 04/15] hppa: " Paolo Bonzini
  2020-10-26 17:12   ` Alex Bennée
@ 2020-10-26 18:11   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 52+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-26 18:11 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Richard Henderson

On 10/26/20 3:30 PM, Paolo Bonzini wrote:
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/hppa/machine.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 06/15] lm32: remove bios_name
  2020-10-26 14:30 ` [PATCH 06/15] lm32: " Paolo Bonzini
  2020-10-26 17:15   ` Alex Bennée
@ 2020-10-26 18:12   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 52+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-26 18:12 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Michael Walle

On 10/26/20 3:30 PM, Paolo Bonzini wrote:
> Cc: Michael Walle <michael@walle.cc>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/lm32/milkymist.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c
> index 9f8fe9fef1..c5d3d77a2b 100644
> --- a/hw/lm32/milkymist.c
> +++ b/hw/lm32/milkymist.c
> @@ -108,6 +108,7 @@ static void
>   milkymist_init(MachineState *machine)
>   {
>       MachineClass *mc = MACHINE_GET_CLASS(machine);
> +    const char *bios_name = machine->firmware ? BIOS_FILENAME:

Does that build?

>       const char *kernel_filename = machine->kernel_filename;
>       const char *kernel_cmdline = machine->kernel_cmdline;
>       const char *initrd_filename = machine->initrd_filename;
> @@ -162,9 +163,6 @@ milkymist_init(MachineState *machine)
>       }
>   
>       /* load bios rom */
> -    if (bios_name == NULL) {
> -        bios_name = BIOS_FILENAME;
> -    }
>       bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>   
>       if (bios_filename) {
> 



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 07/15] m68k: remove bios_name
  2020-10-26 14:30 ` [PATCH 07/15] m68k: " Paolo Bonzini
  2020-10-26 17:17   ` Alex Bennée
@ 2020-10-26 18:13   ` Philippe Mathieu-Daudé
  2020-10-26 18:54   ` Thomas Huth
  2020-10-26 19:11   ` Laurent Vivier
  3 siblings, 0 replies; 52+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-26 18:13 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Laurent Vivier

On 10/26/20 3:30 PM, Paolo Bonzini wrote:
> Cc: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/m68k/mcf5208.c   | 10 +++++-----
>   hw/m68k/next-cube.c |  4 +---
>   hw/m68k/q800.c      |  4 +---
>   3 files changed, 7 insertions(+), 11 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 07/15] m68k: remove bios_name
  2020-10-26 14:30 ` [PATCH 07/15] m68k: " Paolo Bonzini
  2020-10-26 17:17   ` Alex Bennée
  2020-10-26 18:13   ` Philippe Mathieu-Daudé
@ 2020-10-26 18:54   ` Thomas Huth
  2020-10-26 19:11   ` Laurent Vivier
  3 siblings, 0 replies; 52+ messages in thread
From: Thomas Huth @ 2020-10-26 18:54 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Laurent Vivier, philmd

On 26/10/2020 15.30, Paolo Bonzini wrote:
> Cc: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/m68k/mcf5208.c   | 10 +++++-----
>  hw/m68k/next-cube.c |  4 +---
>  hw/m68k/q800.c      |  4 +---
>  3 files changed, 7 insertions(+), 11 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 13/15] sh4: remove bios_name
  2020-10-26 14:30 ` [PATCH 13/15] sh4: " Paolo Bonzini
  2020-10-26 17:29   ` Alex Bennée
@ 2020-10-26 18:56   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 52+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-26 18:56 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Yoshinori Sato

On 10/26/20 3:30 PM, Paolo Bonzini wrote:
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/sh4/shix.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 14/15] sparc: remove bios_name
  2020-10-26 14:30 ` [PATCH 14/15] sparc: " Paolo Bonzini
  2020-10-26 17:30   ` Alex Bennée
@ 2020-10-26 18:57   ` Philippe Mathieu-Daudé
  2020-10-27 16:21   ` Mark Cave-Ayland
  2 siblings, 0 replies; 52+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-26 18:57 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Mark Cave-Ayland

On 10/26/20 3:30 PM, Paolo Bonzini wrote:
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/sparc/leon3.c   | 4 +---
>   hw/sparc/sun4m.c   | 2 +-
>   hw/sparc64/sun4u.c | 2 +-
>   3 files changed, 3 insertions(+), 5 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 12/15] s390: remove bios_name
  2020-10-26 14:30 ` [PATCH 12/15] s390: remove bios_name Paolo Bonzini
  2020-10-26 17:29   ` Alex Bennée
@ 2020-10-26 18:58   ` Thomas Huth
  2020-10-27  8:37   ` Cornelia Huck
  2020-10-27  8:38   ` Christian Borntraeger
  3 siblings, 0 replies; 52+ messages in thread
From: Thomas Huth @ 2020-10-26 18:58 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel
  Cc: Christian Borntraeger, qemu-s390x, Cornelia Huck, philmd

On 26/10/2020 15.30, Paolo Bonzini wrote:
> Cc: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/s390x/ipl.c             | 8 ++------
>  hw/s390x/s390-virtio-ccw.c | 3 ++-
>  2 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index 3d2652d75a..61e8c967d3 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -128,11 +128,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
>      if (!ipl->kernel || ipl->enforce_bios) {
>          uint64_t fwbase = (MIN(ram_size, 0x80000000U) - 0x200000) & ~0xffffUL;
>  
> -        if (bios_name == NULL) {
> -            bios_name = ipl->firmware;
> -        }
> -
> -        bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +        bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, ipl->firmware);
>          if (bios_filename == NULL) {
>              error_setg(errp, "could not find stage1 bootloader");
>              return;
> @@ -154,7 +150,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
>          g_free(bios_filename);
>  
>          if (bios_size == -1) {
> -            error_setg(errp, "could not load bootloader '%s'", bios_name);
> +            error_setg(errp, "could not load bootloader '%s'", ipl->firmware);
>              return;
>          }
>  
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index e52182f946..a521eba673 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -258,7 +258,8 @@ static void ccw_init(MachineState *machine)
>      /* get a BUS */
>      css_bus = virtual_css_bus_init();
>      s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
> -                      machine->initrd_filename, "s390-ccw.img",
> +                      machine->initrd_filename,
> +                      machine->firmware ?: "s390-ccw.img",
>                        "s390-netboot.img", true);
>  
>      dev = qdev_new(TYPE_S390_PCI_HOST_BRIDGE);
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 11/15] rx: move BIOS load from MCU to board
  2020-10-26 17:34     ` Paolo Bonzini
@ 2020-10-26 19:00       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 52+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-26 19:00 UTC (permalink / raw)
  To: Paolo Bonzini, Alex Bennée; +Cc: Peter Maydell, qemu-devel

On 10/26/20 6:34 PM, Paolo Bonzini wrote:
> On 26/10/20 18:24, Alex Bennée wrote:
>>
>> Paolo Bonzini <pbonzini@redhat.com> writes:
>>
>>> The ROM loader state is global and not part of the MCU, and the
>>> BIOS is in machine->firmware.  So just like the kernel case,
>>> load it in the board.
>>>
>>> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>> ---
>>>   hw/rx/rx-gdbsim.c | 7 +++++++
>>>   hw/rx/rx62n.c     | 9 ---------
>>>   2 files changed, 7 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
>>> index 417ec0564b..040006c1c5 100644
>>> --- a/hw/rx/rx-gdbsim.c
>>> +++ b/hw/rx/rx-gdbsim.c
>>> @@ -142,6 +142,13 @@ static void rx_gdbsim_init(MachineState *machine)
>>>               /* Set dtb address to R1 */
>>>               RX_CPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset;
>>>           }
>>> +    } else {
>>> +        if (machine->firmware) {
>>> +            rom_add_file_fixed(machine->firmware, RX62N_CFLASH_BASE, 0);
>>> +        } else if (!qtest_enabled()) {
>>> +            error_report("No bios or kernel specified");
>>> +            exit(1);
>>> +        }
>>>       }
>>>   }
>>>   
>>> diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c
>>> index 6eb4eea700..17ec73fc7b 100644
>>> --- a/hw/rx/rx62n.c
>>> +++ b/hw/rx/rx62n.c
>>> @@ -245,15 +245,6 @@ static void rx62n_realize(DeviceState *dev, Error **errp)
>>>                              rxc->rom_flash_size, &error_abort);
>>>       memory_region_add_subregion(s->sysmem, RX62N_CFLASH_BASE, &s->c_flash);
>>>   
>>> -    if (!s->kernel) {
>>> -        if (bios_name) {
>>> -            rom_add_file_fixed(bios_name, RX62N_CFLASH_BASE, 0);

The acceptance test fails. There is some odd reset order problem,
eventually related to this discussion "CPU reset handler priority":
https://www.mail-archive.com/qemu-devel@nongnu.org/msg686362.html

>>> -        }  else if (!qtest_enabled()) {
>>> -            error_report("No bios or kernel specified");
>>> -            exit(1);
>>> -        }
>>> -    }
>>> -
>>
>> I'm confused because on the face of it these are two different models.
>> I'll defer to the domain expert on this one.

Yoshinori started to clean that here:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg734135.html

> 
> rx62n is the SoC, rx-gdbsim.c instead includes the rx62n7 and rx62n8
> machines.
> 
> Paolo
> 



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 07/15] m68k: remove bios_name
  2020-10-26 14:30 ` [PATCH 07/15] m68k: " Paolo Bonzini
                     ` (2 preceding siblings ...)
  2020-10-26 18:54   ` Thomas Huth
@ 2020-10-26 19:11   ` Laurent Vivier
  2020-10-27 13:26     ` Paolo Bonzini
  3 siblings, 1 reply; 52+ messages in thread
From: Laurent Vivier @ 2020-10-26 19:11 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Laurent Vivier, philmd

Le 26/10/2020 à 15:30, Paolo Bonzini a écrit :
> Cc: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/m68k/mcf5208.c   | 10 +++++-----
>  hw/m68k/next-cube.c |  4 +---
>  hw/m68k/q800.c      |  4 +---
>  3 files changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index d310a98e7b..7c8ca5ddf6 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -301,17 +301,17 @@ static void mcf5208evb_init(MachineState *machine)
>      /* 0xfc0a8000 SDRAM controller.  */
>  
>      /* Load firmware */
> -    if (bios_name) {
> +    if (machine->firmware) {
>          char *fn;
>          uint8_t *ptr;
>  
> -        fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +        fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware);
>          if (!fn) {
> -            error_report("Could not find ROM image '%s'", bios_name);
> +            error_report("Could not find ROM image '%s'", machine->firmware);
>              exit(1);
>          }
>          if (load_image_targphys(fn, 0x0, ROM_SIZE) < 8) {
> -            error_report("Could not load ROM image '%s'", bios_name);
> +            error_report("Could not load ROM image '%s'", machine->firmware);
>              exit(1);
>          }
>          g_free(fn);
> @@ -323,7 +323,7 @@ static void mcf5208evb_init(MachineState *machine)
>  
>      /* Load kernel.  */
>      if (!kernel_filename) {
> -        if (qtest_enabled() || bios_name) {
> +        if (qtest_enabled() || machine->firmware) {
>              return;
>          }
>          error_report("Kernel image must be specified");

Why do you do differently for mcf5208 than the others?

    const char *bios_name = machine->firmware;

and no other changes?

With or without this:

Acked-by: Laurent Vivier <laurent@vivier.eu>


> diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
> index e7045980b7..37bc35dfa4 100644
> --- a/hw/m68k/next-cube.c
> +++ b/hw/m68k/next-cube.c
> @@ -868,6 +868,7 @@ static void next_cube_init(MachineState *machine)
>      MemoryRegion *bmapm1 = g_new(MemoryRegion, 1);
>      MemoryRegion *bmapm2 = g_new(MemoryRegion, 1);
>      MemoryRegion *sysmem = get_system_memory();
> +    const char *bios_name = machine->firmware ?: ROM_FILE;
>      NeXTState *ns = NEXT_MACHINE(machine);
>      DeviceState *dev;
>  
> @@ -924,9 +925,6 @@ static void next_cube_init(MachineState *machine)
>      sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x0200e000);
>  
>      /* Load ROM here */
> -    if (bios_name == NULL) {
> -        bios_name = ROM_FILE;
> -    }
>      /* still not sure if the rom should also be mapped at 0x0*/
>      memory_region_init_rom(rom, NULL, "next.rom", 0x20000, &error_fatal);
>      memory_region_add_subregion(sysmem, 0x01000000, rom);
> diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
> index ce4b47c3e3..6ebcddcfb2 100644
> --- a/hw/m68k/q800.c
> +++ b/hw/m68k/q800.c
> @@ -167,6 +167,7 @@ static void q800_init(MachineState *machine)
>      const char *kernel_filename = machine->kernel_filename;
>      const char *initrd_filename = machine->initrd_filename;
>      const char *kernel_cmdline = machine->kernel_cmdline;
> +    const char *bios_name = machine->firmware ?: MACROM_FILENAME;
>      hwaddr parameters_base;
>      CPUState *cs;
>      DeviceState *dev;
> @@ -400,9 +401,6 @@ static void q800_init(MachineState *machine)
>          rom = g_malloc(sizeof(*rom));
>          memory_region_init_rom(rom, NULL, "m68k_mac.rom", MACROM_SIZE,
>                                 &error_abort);
> -        if (bios_name == NULL) {
> -            bios_name = MACROM_FILENAME;
> -        }
>          filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>          memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom);
>  
> 



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 10/15] ppc: remove bios_name
  2020-10-26 14:30 ` [PATCH 10/15] ppc: " Paolo Bonzini
  2020-10-26 17:21   ` Alex Bennée
@ 2020-10-27  2:04   ` David Gibson
  1 sibling, 0 replies; 52+ messages in thread
From: David Gibson @ 2020-10-27  2:04 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 8055 bytes --]

On Mon, Oct 26, 2020 at 10:30:23AM -0400, Paolo Bonzini wrote:
> Cc: David Gibson <david@gibson.dropbear.id.au>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/ppc/e500.c          | 4 ++--
>  hw/ppc/mac_newworld.c  | 4 +---
>  hw/ppc/mac_oldworld.c  | 4 +---
>  hw/ppc/pnv.c           | 5 +----
>  hw/ppc/ppc405_boards.c | 6 ++----
>  hw/ppc/prep.c          | 4 +---
>  hw/ppc/spapr.c         | 4 +---
>  7 files changed, 9 insertions(+), 22 deletions(-)
> 
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index ae39b9358e..153a74c98c 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -1035,7 +1035,7 @@ void ppce500_init(MachineState *machine)
>       * -kernel to users but allows them to run through u-boot as well.
>       */
>      kernel_as_payload = false;
> -    if (bios_name == NULL) {
> +    if (machine->firmware == NULL) {
>          if (machine->kernel_filename) {
>              payload_name = machine->kernel_filename;
>              kernel_as_payload = true;
> @@ -1043,7 +1043,7 @@ void ppce500_init(MachineState *machine)
>              payload_name = "u-boot.e500";
>          }
>      } else {
> -        payload_name = bios_name;
> +        payload_name = machine->firmware;
>      }
>  
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, payload_name);
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index f9a1cc8944..61c63819df 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -109,6 +109,7 @@ static void ppc_core99_reset(void *opaque)
>  static void ppc_core99_init(MachineState *machine)
>  {
>      ram_addr_t ram_size = machine->ram_size;
> +    const char *bios_name = machine->firmware ?: PROM_FILENAME;
>      const char *kernel_filename = machine->kernel_filename;
>      const char *kernel_cmdline = machine->kernel_cmdline;
>      const char *initrd_filename = machine->initrd_filename;
> @@ -161,9 +162,6 @@ static void ppc_core99_init(MachineState *machine)
>                             &error_fatal);
>      memory_region_add_subregion(get_system_memory(), PROM_BASE, bios);
>  
> -    if (!bios_name) {
> -        bios_name = PROM_FILENAME;
> -    }
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>      if (filename) {
>          /* Load OpenBIOS (ELF) */
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 6c59aa5601..11623e8e67 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -83,6 +83,7 @@ static void ppc_heathrow_reset(void *opaque)
>  static void ppc_heathrow_init(MachineState *machine)
>  {
>      ram_addr_t ram_size = machine->ram_size;
> +    const char *bios_name = machine->firmware ?: PROM_FILENAME;
>      const char *boot_device = machine->boot_order;
>      PowerPCCPU *cpu = NULL;
>      CPUPPCState *env = NULL;
> @@ -130,9 +131,6 @@ static void ppc_heathrow_init(MachineState *machine)
>                             &error_fatal);
>      memory_region_add_subregion(get_system_memory(), PROM_BASE, bios);
>  
> -    if (!bios_name) {
> -        bios_name = PROM_FILENAME;
> -    }
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>      if (filename) {
>          /* Load OpenBIOS (ELF) */
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index d9e52873ea..f2b1ee83d3 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -713,6 +713,7 @@ static void pnv_chip_power10_pic_print_info(PnvChip *chip, Monitor *mon)
>  
>  static void pnv_init(MachineState *machine)
>  {
> +    const char *bios_name = machine->firmware ?: FW_FILE_NAME;
>      PnvMachineState *pnv = PNV_MACHINE(machine);
>      MachineClass *mc = MACHINE_GET_CLASS(machine);
>      char *fw_filename;
> @@ -739,10 +740,6 @@ static void pnv_init(MachineState *machine)
>      pnv->pnor = PNV_PNOR(dev);
>  
>      /* load skiboot firmware  */
> -    if (bios_name == NULL) {
> -        bios_name = FW_FILE_NAME;
> -    }
> -
>      fw_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>      if (!fw_filename) {
>          error_report("Could not find OPAL firmware '%s'", bios_name);
> diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
> index 4687715b15..c867e46330 100644
> --- a/hw/ppc/ppc405_boards.c
> +++ b/hw/ppc/ppc405_boards.c
> @@ -141,6 +141,7 @@ static void ref405ep_fpga_init(MemoryRegion *sysmem, uint32_t base)
>  static void ref405ep_init(MachineState *machine)
>  {
>      MachineClass *mc = MACHINE_GET_CLASS(machine);
> +    const char *bios_name = machine->firmware ?: BIOS_FILENAME;
>      const char *kernel_filename = machine->kernel_filename;
>      const char *kernel_cmdline = machine->kernel_cmdline;
>      const char *initrd_filename = machine->initrd_filename;
> @@ -206,8 +207,6 @@ static void ref405ep_init(MachineState *machine)
>          memory_region_init_rom(bios, NULL, "ef405ep.bios", BIOS_SIZE,
>                                 &error_fatal);
>  
> -        if (bios_name == NULL)
> -            bios_name = BIOS_FILENAME;
>          filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>          if (filename) {
>              bios_size = load_image_size(filename,
> @@ -425,6 +424,7 @@ static void taihu_cpld_init(MemoryRegion *sysmem, uint32_t base)
>  static void taihu_405ep_init(MachineState *machine)
>  {
>      MachineClass *mc = MACHINE_GET_CLASS(machine);
> +    const char *bios_name = machine->firmware ?: BIOS_FILENAME;
>      const char *kernel_filename = machine->kernel_filename;
>      const char *initrd_filename = machine->initrd_filename;
>      char *filename;
> @@ -475,8 +475,6 @@ static void taihu_405ep_init(MachineState *machine)
>      } else
>  #endif
>      {
> -        if (bios_name == NULL)
> -            bios_name = BIOS_FILENAME;
>          bios = g_new(MemoryRegion, 1);
>          memory_region_init_rom(bios, NULL, "taihu_405ep.bios", BIOS_SIZE,
>                                 &error_fatal);
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index 4a0cb434a6..c6b9d1ddcb 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -237,6 +237,7 @@ static int prep_set_cmos_checksum(DeviceState *dev, void *opaque)
>  
>  static void ibm_40p_init(MachineState *machine)
>  {
> +    const char *bios_name = machine->firmware ?: "openbios-ppc";
>      CPUPPCState *env = NULL;
>      uint16_t cmos_checksum;
>      PowerPCCPU *cpu;
> @@ -271,9 +272,6 @@ static void ibm_40p_init(MachineState *machine)
>  
>      /* PCI host */
>      dev = qdev_new("raven-pcihost");
> -    if (!bios_name) {
> -        bios_name = "openbios-ppc";
> -    }
>      qdev_prop_set_string(dev, "bios-name", bios_name);
>      qdev_prop_set_uint32(dev, "elf-machine", PPC_ELF_MACHINE);
>      pcihost = SYS_BUS_DEVICE(dev);
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 63315f2d0f..667d59e5ad 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2647,6 +2647,7 @@ static void spapr_machine_init(MachineState *machine)
>      SpaprMachineState *spapr = SPAPR_MACHINE(machine);
>      SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
>      MachineClass *mc = MACHINE_GET_CLASS(machine);
> +    const char *bios_name = machine->firmware ?: FW_FILE_NAME;
>      const char *kernel_filename = machine->kernel_filename;
>      const char *initrd_filename = machine->initrd_filename;
>      PCIHostState *phb;
> @@ -2970,9 +2971,6 @@ static void spapr_machine_init(MachineState *machine)
>          }
>      }
>  
> -    if (bios_name == NULL) {
> -        bios_name = FW_FILE_NAME;
> -    }
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>      if (!filename) {
>          error_report("Could not find LPAR firmware '%s'", bios_name);

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 12/15] s390: remove bios_name
  2020-10-26 14:30 ` [PATCH 12/15] s390: remove bios_name Paolo Bonzini
  2020-10-26 17:29   ` Alex Bennée
  2020-10-26 18:58   ` Thomas Huth
@ 2020-10-27  8:37   ` Cornelia Huck
  2020-10-27  8:38   ` Christian Borntraeger
  3 siblings, 0 replies; 52+ messages in thread
From: Cornelia Huck @ 2020-10-27  8:37 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Thomas Huth, philmd, qemu-devel

On Mon, 26 Oct 2020 10:30:25 -0400
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Cc: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/s390x/ipl.c             | 8 ++------
>  hw/s390x/s390-virtio-ccw.c | 3 ++-
>  2 files changed, 4 insertions(+), 7 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 12/15] s390: remove bios_name
  2020-10-26 14:30 ` [PATCH 12/15] s390: remove bios_name Paolo Bonzini
                     ` (2 preceding siblings ...)
  2020-10-27  8:37   ` Cornelia Huck
@ 2020-10-27  8:38   ` Christian Borntraeger
  2020-10-27 13:26     ` Paolo Bonzini
  3 siblings, 1 reply; 52+ messages in thread
From: Christian Borntraeger @ 2020-10-27  8:38 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Thomas Huth, philmd



On 26.10.20 15:30, Paolo Bonzini wrote:
> Cc: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/s390x/ipl.c             | 8 ++------
>  hw/s390x/s390-virtio-ccw.c | 3 ++-
>  2 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index 3d2652d75a..61e8c967d3 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -128,11 +128,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
>      if (!ipl->kernel || ipl->enforce_bios) {
>          uint64_t fwbase = (MIN(ram_size, 0x80000000U) - 0x200000) & ~0xffffUL;
>  
> -        if (bios_name == NULL) {
> -            bios_name = ipl->firmware;
> -        }
> -
> -        bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +        bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, ipl->firmware);
>          if (bios_filename == NULL) {
>              error_setg(errp, "could not find stage1 bootloader");
>              return;
> @@ -154,7 +150,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
>          g_free(bios_filename);
>  
>          if (bios_size == -1) {
> -            error_setg(errp, "could not load bootloader '%s'", bios_name);
> +            error_setg(errp, "could not load bootloader '%s'", ipl->firmware);
>              return;
>          }
>  
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index e52182f946..a521eba673 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -258,7 +258,8 @@ static void ccw_init(MachineState *machine)
>      /* get a BUS */
>      css_bus = virtual_css_bus_init();
>      s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
> -                      machine->initrd_filename, "s390-ccw.img",
> +                      machine->initrd_filename,
> +                      machine->firmware ?: "s390-ccw.img",

Adding the elvis operator is actually a fix, no?


^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 12/15] s390: remove bios_name
  2020-10-27  8:38   ` Christian Borntraeger
@ 2020-10-27 13:26     ` Paolo Bonzini
  0 siblings, 0 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-27 13:26 UTC (permalink / raw)
  To: Christian Borntraeger, qemu-devel; +Cc: Thomas Huth, philmd

On 27/10/20 09:38, Christian Borntraeger wrote:
>>  
>> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
>> index e52182f946..a521eba673 100644
>> --- a/hw/s390x/s390-virtio-ccw.c
>> +++ b/hw/s390x/s390-virtio-ccw.c
>> @@ -258,7 +258,8 @@ static void ccw_init(MachineState *machine)
>>      /* get a BUS */
>>      css_bus = virtual_css_bus_init();
>>      s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
>> -                      machine->initrd_filename, "s390-ccw.img",
>> +                      machine->initrd_filename,
>> +                      machine->firmware ?: "s390-ccw.img",
> Adding the elvis operator is actually a fix, no?
> 

I think it was already doing the equivalent here in s390_ipl_realize

        if (bios_name == NULL) {
            bios_name = ipl->firmware;
        }

        bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);

so it was just an encapsulation violation on part of the IPL device.

Paolo



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 07/15] m68k: remove bios_name
  2020-10-26 19:11   ` Laurent Vivier
@ 2020-10-27 13:26     ` Paolo Bonzini
  0 siblings, 0 replies; 52+ messages in thread
From: Paolo Bonzini @ 2020-10-27 13:26 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel; +Cc: Laurent Vivier, philmd

On 26/10/20 20:11, Laurent Vivier wrote:
>>      /* Load kernel.  */
>>      if (!kernel_filename) {
>> -        if (qtest_enabled() || bios_name) {
>> +        if (qtest_enabled() || machine->firmware) {
>>              return;
>>          }
>>          error_report("Kernel image must be specified");
> Why do you do differently for mcf5208 than the others?
> 
>     const char *bios_name = machine->firmware;
> 
> and no other changes?

because in this case you can use machine->firmware, I'm keeping
bios_name for the cases where machine->firmware cannot be used directly
(e.g. there is a default).

Paolo



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 15/15] vl: remove bios_name
  2020-10-26 14:30 ` [PATCH 15/15] vl: " Paolo Bonzini
  2020-10-26 17:30   ` Alex Bennée
@ 2020-10-27 14:22   ` Thomas Huth
  1 sibling, 0 replies; 52+ messages in thread
From: Thomas Huth @ 2020-10-27 14:22 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 26/10/2020 15.30, Paolo Bonzini wrote:
> bios_name was a legacy variable used by machine code, but it is
> no more.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  include/sysemu/sysemu.h | 1 -
>  softmmu/vl.c            | 2 --
>  2 files changed, 3 deletions(-)
> 
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 817ff4cf75..1336b4264a 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -8,7 +8,6 @@
>  
>  /* vl.c */
>  
> -extern const char *bios_name;
>  extern int only_migratable;
>  extern const char *qemu_name;
>  extern QemuUUID qemu_uuid;
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index b7d7f43c88..7909709879 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -119,7 +119,6 @@
>  
>  static const char *data_dir[16];
>  static int data_dir_idx;
> -const char *bios_name = NULL;
>  enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
>  int display_opengl;
>  const char* keyboard_layout = NULL;
> @@ -4205,7 +4204,6 @@ void qemu_init(int argc, char **argv, char **envp)
>      kernel_filename = qemu_opt_get(machine_opts, "kernel");
>      initrd_filename = qemu_opt_get(machine_opts, "initrd");
>      kernel_cmdline = qemu_opt_get(machine_opts, "append");
> -    bios_name = qemu_opt_get(machine_opts, "firmware");
>  
>      opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL);
>      if (opts) {
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 08/15] mips: remove bios_name
  2020-10-26 14:30 ` [PATCH 08/15] mips: " Paolo Bonzini
  2020-10-26 17:20   ` Alex Bennée
@ 2020-10-27 14:40   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 52+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-27 14:40 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 10/26/20 3:30 PM, Paolo Bonzini wrote:
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/mips/fuloong2e.c | 6 +++---
>  hw/mips/jazz.c      | 6 +++---
>  hw/mips/malta.c     | 6 +++---
>  hw/mips/mipssim.c   | 6 +++---
>  hw/mips/r4k.c       | 4 +---
>  5 files changed, 13 insertions(+), 15 deletions(-)
...
> diff --git a/hw/mips/r4k.c b/hw/mips/r4k.c
> index 3830854342..b27be138a4 100644
> --- a/hw/mips/r4k.c
> +++ b/hw/mips/r4k.c
> @@ -168,6 +168,7 @@ static const int sector_len = 32 * KiB;
>  static
>  void mips_r4k_init(MachineState *machine)
>  {
> +    const char *bios_name = machine->firmware ?: BIOS_FILENAME;

Don't we have a "redefinition of global variable" warning here?

Anyway,
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>      const char *kernel_filename = machine->kernel_filename;
>      const char *kernel_cmdline = machine->kernel_cmdline;
>      const char *initrd_filename = machine->initrd_filename;
> @@ -221,9 +222,6 @@ void mips_r4k_init(MachineState *machine)
>       * run.
>       */
>  
> -    if (bios_name == NULL) {
> -        bios_name = BIOS_FILENAME;
> -    }
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>      if (filename) {
>          bios_size = get_image_size(filename);
> 



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 14/15] sparc: remove bios_name
  2020-10-26 14:30 ` [PATCH 14/15] sparc: " Paolo Bonzini
  2020-10-26 17:30   ` Alex Bennée
  2020-10-26 18:57   ` Philippe Mathieu-Daudé
@ 2020-10-27 16:21   ` Mark Cave-Ayland
  2 siblings, 0 replies; 52+ messages in thread
From: Mark Cave-Ayland @ 2020-10-27 16:21 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: philmd

On 26/10/2020 14:30, Paolo Bonzini wrote:

> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/sparc/leon3.c   | 4 +---
>   hw/sparc/sun4m.c   | 2 +-
>   hw/sparc64/sun4u.c | 2 +-
>   3 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
> index d40b7891f6..1c50b02f81 100644
> --- a/hw/sparc/leon3.c
> +++ b/hw/sparc/leon3.c
> @@ -185,6 +185,7 @@ static void leon3_set_pil_in(void *opaque, int n, int level)
>   static void leon3_generic_hw_init(MachineState *machine)
>   {
>       ram_addr_t ram_size = machine->ram_size;
> +    const char *bios_name = machine->firmware ?: LEON3_PROM_FILENAME;
>       const char *kernel_filename = machine->kernel_filename;
>       SPARCCPU *cpu;
>       CPUSPARCState   *env;
> @@ -259,9 +260,6 @@ static void leon3_generic_hw_init(MachineState *machine)
>       memory_region_add_subregion(address_space_mem, LEON3_PROM_OFFSET, prom);
>   
>       /* Load boot prom */
> -    if (bios_name == NULL) {
> -        bios_name = LEON3_PROM_FILENAME;
> -    }
>       filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>   
>       if (filename) {
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 38d1e0fd12..81d4ae9385 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -878,7 +878,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
>                           hwdef->max_mem - machine->ram_size);
>       }
>   
> -    prom_init(hwdef->slavio_base, bios_name);
> +    prom_init(hwdef->slavio_base, machine->firmware);
>   
>       slavio_intctl = slavio_intctl_init(hwdef->intctl_base,
>                                          hwdef->intctl_base + 0x10000ULL,
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index 05e659c8a4..50230d261a 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -578,7 +578,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
>       /* set up devices */
>       ram_init(0, machine->ram_size);
>   
> -    prom_init(hwdef->prom_addr, bios_name);
> +    prom_init(hwdef->prom_addr, machine->firmware);
>   
>       /* Init sabre (PCI host bridge) */
>       sabre = SABRE(qdev_new(TYPE_SABRE));

Looks good to me:

Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.


^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2020-10-27 16:23 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 14:30 [PATCH 00/15] remove bios_name variable Paolo Bonzini
2020-10-26 14:30 ` [PATCH 01/15] alpha: remove bios_name Paolo Bonzini
2020-10-26 17:09   ` Alex Bennée
2020-10-26 18:11   ` Philippe Mathieu-Daudé
2020-10-26 14:30 ` [PATCH 02/15] digic: stash firmware into DigicState Paolo Bonzini
2020-10-26 14:44   ` Peter Maydell
2020-10-26 15:05     ` Paolo Bonzini
2020-10-26 14:30 ` [PATCH 03/15] arm: remove bios_name Paolo Bonzini
2020-10-26 17:11   ` Alex Bennée
2020-10-26 14:30 ` [PATCH 04/15] hppa: " Paolo Bonzini
2020-10-26 17:12   ` Alex Bennée
2020-10-26 18:11   ` Philippe Mathieu-Daudé
2020-10-26 14:30 ` [PATCH 05/15] i386: " Paolo Bonzini
2020-10-26 17:15   ` Alex Bennée
2020-10-26 14:30 ` [PATCH 06/15] lm32: " Paolo Bonzini
2020-10-26 17:15   ` Alex Bennée
2020-10-26 18:12   ` Philippe Mathieu-Daudé
2020-10-26 14:30 ` [PATCH 07/15] m68k: " Paolo Bonzini
2020-10-26 17:17   ` Alex Bennée
2020-10-26 18:13   ` Philippe Mathieu-Daudé
2020-10-26 18:54   ` Thomas Huth
2020-10-26 19:11   ` Laurent Vivier
2020-10-27 13:26     ` Paolo Bonzini
2020-10-26 14:30 ` [PATCH 08/15] mips: " Paolo Bonzini
2020-10-26 17:20   ` Alex Bennée
2020-10-27 14:40   ` Philippe Mathieu-Daudé
2020-10-26 14:30 ` [PATCH 09/15] moxie: " Paolo Bonzini
2020-10-26 17:20   ` Alex Bennée
2020-10-26 14:30 ` [PATCH 10/15] ppc: " Paolo Bonzini
2020-10-26 17:21   ` Alex Bennée
2020-10-27  2:04   ` David Gibson
2020-10-26 14:30 ` [PATCH 11/15] rx: move BIOS load from MCU to board Paolo Bonzini
2020-10-26 17:24   ` Alex Bennée
2020-10-26 17:34     ` Paolo Bonzini
2020-10-26 19:00       ` Philippe Mathieu-Daudé
2020-10-26 14:30 ` [PATCH 12/15] s390: remove bios_name Paolo Bonzini
2020-10-26 17:29   ` Alex Bennée
2020-10-26 18:58   ` Thomas Huth
2020-10-27  8:37   ` Cornelia Huck
2020-10-27  8:38   ` Christian Borntraeger
2020-10-27 13:26     ` Paolo Bonzini
2020-10-26 14:30 ` [PATCH 13/15] sh4: " Paolo Bonzini
2020-10-26 17:29   ` Alex Bennée
2020-10-26 18:56   ` Philippe Mathieu-Daudé
2020-10-26 14:30 ` [PATCH 14/15] sparc: " Paolo Bonzini
2020-10-26 17:30   ` Alex Bennée
2020-10-26 18:57   ` Philippe Mathieu-Daudé
2020-10-27 16:21   ` Mark Cave-Ayland
2020-10-26 14:30 ` [PATCH 15/15] vl: " Paolo Bonzini
2020-10-26 17:30   ` Alex Bennée
2020-10-27 14:22   ` Thomas Huth
2020-10-26 14:51 ` [PATCH 00/15] remove bios_name variable no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).