diff mbox series

[4/9] hw/i386/pc: Merge pc_guest_info_init() into pc_machine_initfn()

Message ID 20240208220349.4948-5-shentey@gmail.com
State New
Headers show
Series Simplify initialization of PC machines | expand

Commit Message

Bernhard Beschow Feb. 8, 2024, 10:03 p.m. UTC
Resolves redundant code in the piix and q35 machines.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/i386/pc.h | 2 --
 hw/i386/pc.c         | 9 +++------
 hw/i386/pc_piix.c    | 2 --
 hw/i386/pc_q35.c     | 2 --
 4 files changed, 3 insertions(+), 12 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 9, 2024, 9:17 a.m. UTC | #1
On 8/2/24 23:03, Bernhard Beschow wrote:
> Resolves redundant code in the piix and q35 machines.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   include/hw/i386/pc.h | 2 --
>   hw/i386/pc.c         | 9 +++------
>   hw/i386/pc_piix.c    | 2 --
>   hw/i386/pc_q35.c     | 2 --
>   4 files changed, 3 insertions(+), 12 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index ec0e5efcb2..287f1ab553 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -151,8 +151,6 @@  extern int fd_bootchk;
 
 void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
-void pc_guest_info_init(PCMachineState *pcms);
-
 #define PCI_HOST_PROP_RAM_MEM          "ram-mem"
 #define PCI_HOST_PROP_PCI_MEM          "pci-mem"
 #define PCI_HOST_PROP_SYSTEM_MEM       "system-mem"
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 12facf73b1..45738d8548 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -706,12 +706,6 @@  void pc_machine_done(Notifier *notifier, void *data)
     }
 }
 
-void pc_guest_info_init(PCMachineState *pcms)
-{
-    pcms->machine_done.notify = pc_machine_done;
-    qemu_add_machine_init_done_notifier(&pcms->machine_done);
-}
-
 /* setup pci memory address space mapping into system address space */
 void pc_pci_as_mapping_init(MemoryRegion *system_memory,
                             MemoryRegion *pci_address_space)
@@ -1751,6 +1745,9 @@  static void pc_machine_initfn(Object *obj)
     object_property_add_alias(OBJECT(pcms), "pcspk-audiodev",
                               OBJECT(pcms->pcspk), "audiodev");
     cxl_machine_init(obj, &pcms->cxl_devices_state);
+
+    pcms->machine_done.notify = pc_machine_done;
+    qemu_add_machine_init_done_notifier(&pcms->machine_done);
 }
 
 int pc_machine_kvm_type(MachineState *machine, const char *kvm_type)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index adb3b5ed43..4ca2dc08e7 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -226,8 +226,6 @@  static void pc_init1(MachineState *machine,
                                                &error_abort);
     }
 
-    pc_guest_info_init(pcms);
-
     if (pcmc->smbios_defaults) {
         MachineClass *mc = MACHINE_GET_CLASS(machine);
         /* These values are guest ABI, do not change */
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 53da8b552d..fe0c2849fd 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -199,8 +199,6 @@  static void pc_q35_init(MachineState *machine)
         rom_memory = system_memory;
     }
 
-    pc_guest_info_init(pcms);
-
     if (pcmc->smbios_defaults) {
         /* These values are guest ABI, do not change */
         smbios_set_defaults("QEMU", mc->desc,