[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH-for-9.1 14/29] hw/i386/pc: Move pc_system_flash_create() to pc_pci_machine_initfn()
- To: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
- From: BALATON Zoltan <balaton@xxxxxxxxxx>
- Date: Thu, 28 Mar 2024 19:52:17 +0100 (CET)
- Cc: qemu-devel@xxxxxxxxxx, Richard Henderson <richard.henderson@xxxxxxxxxx>, Eduardo Habkost <eduardo@xxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Bernhard Beschow <shentey@xxxxxxxxx>, Thomas Huth <thuth@xxxxxxxxxx>, Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Igor Mammedov <imammedo@xxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Ani Sinha <anisinha@xxxxxxxxxx>
- Delivery-date: Thu, 28 Mar 2024 18:52:27 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Thu, 28 Mar 2024, Philippe Mathieu-Daudé wrote:
pc_system_flash_create() is only useful for PCI-based machines.
Move the call to the PCI-based init() handler.
Signed-off-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
---
hw/i386/pc.c | 2 +-
hw/i386/pc_sysfw.c | 10 ++++------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 5b96daa414..33724791fd 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1679,7 +1679,6 @@ static void pc_machine_initfn(Object *obj)
pcms->fd_bootchk = true;
pcms->default_bus_bypass_iommu = false;
- pc_system_flash_create(pcms);
pcms->pcspk = isa_new(TYPE_PC_SPEAKER);
object_property_add_alias(OBJECT(pcms), "pcspk-audiodev",
OBJECT(pcms->pcspk), "audiodev");
@@ -1694,6 +1693,7 @@ static void pc_pci_machine_initfn(Object *obj)
ppms->acpi_build_enabled = true;
+ pc_system_flash_create(PC_MACHINE(obj));
cxl_machine_init(obj, &ppms->cxl_devices_state);
ppms->machine_done.notify = pc_pci_machine_done;
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 541dcaef71..167ff24fcb 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -93,12 +93,10 @@ static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms,
void pc_system_flash_create(PCMachineState *pcms)
{
- if (pc_machine_is_pci_enabled(pcms)) {
- pcms->flash[0] = pc_pflash_create(pcms, "system.flash0",
- "pflash0");
- pcms->flash[1] = pc_pflash_create(pcms, "system.flash1",
- "pflash1");
- }
+ assert(pc_machine_is_pci_enabled(pcms));
+
+ pcms->flash[0] = pc_pflash_create(pcms, "system.flash0", "pflash0");
+ pcms->flash[1] = pc_pflash_create(pcms, "system.flash1", "pflash1");
}
This could just be inlined as it's called once, then no need for assert
and a separate function.
Regards,
BALATON Zoltan
void pc_system_flash_cleanup_unused(PCMachineState *pcms)
|