Skip to contentSkip to conversation

hw/i386/pc: Trivial cleanups

PATCH In review Philippe Mathieu-Daudé 4 participants 12 messages Mar 1, 2024 – Mar 8, 2024

lore
Share & tools
lore
#0 lore raw

cover hw/i386/pc: Trivial cleanups

Trivial cleanups, mostly around the 'isapc' machine.

Philippe Mathieu-Daudé (4):
hw/i386/pc: Remove pc_compat_1_4..1.7[] left over declarations hw/i386/pc: Use generated NotifyVmexitOption_str() hw/i386/pc: Remove 'host_type' argument from pc_init1() hw/i386/pc: Have pc_init_isa() pass a NULL pci_type argument

 include/hw/i386/pc.h | 12 ------------
 hw/i386/pc_piix.c    | 18 ++++++------------
 2 files changed, 6 insertions(+), 24 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/4 hw/i386/pc: Remove pc_compat_1_4..1.7[] left over declarations

These definitions were removed in commit ea985d235b ("pc_piix: remove pc-i440fx-1.4 up to pc-i440fx-1.7").

---
 include/hw/i386/pc.h | 12 ------------
 1 file changed, 12 deletions(-)
include/hw/i386/pc.h +0 -12
index 5065590281..b958023187 100644
@@ -288,18 +288,6 @@ extern const size_t pc_compat_2_1_len;
 extern GlobalProperty pc_compat_2_0[];
 extern const size_t pc_compat_2_0_len;
 
-extern GlobalProperty pc_compat_1_7[];
-extern const size_t pc_compat_1_7_len;
-
-extern GlobalProperty pc_compat_1_6[];
-extern const size_t pc_compat_1_6_len;
-
-extern GlobalProperty pc_compat_1_5[];
-extern const size_t pc_compat_1_5_len;
-
-extern GlobalProperty pc_compat_1_4[];
-extern const size_t pc_compat_1_4_len;
-
 #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
     static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
     { \
Signature · 1 line
2.41.0
#3 lore raw

PATCH 2/4 hw/i386/pc: Use generated NotifyVmexitOption_str()

In reply to Philippe Mathieu-Daudé

NotifyVmexitOption_str() is QAPI-generated in "qapi/qapi-types-run-state.h", which "sysemu/runstate.h" already includes.

---
 hw/i386/pc_piix.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
hw/i386/pc_piix.c +1 -3
index ce6aad758d..0e688ed655 100644
@@ -60,6 +60,7 @@
 #include "hw/xen/xen.h"
 #include "migration/global_state.h"
 #include "migration/misc.h"
+#include "sysemu/runstate.h"
 #include "sysemu/numa.h"
 #include "hw/hyperv/vmbus-bridge.h"
 #include "hw/mem/nvdimm.h"
@@ -382,9 +383,6 @@ static const QEnumLookup PCSouthBridgeOption_lookup = {
     .size = PC_SOUTH_BRIDGE_OPTION_MAX
 };
 
-#define NotifyVmexitOption_str(val) \
-    qapi_enum_lookup(&NotifyVmexitOption_lookup, (val))
-
 static int pc_get_south_bridge(Object *obj, Error **errp)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
Signature · 1 line
2.41.0
#5 lore raw

PATCH 3/4 hw/i386/pc: Remove 'host_type' argument from pc_init1()

In reply to Philippe Mathieu-Daudé

All callers use host_type=TYPE_I440FX_PCI_HOST_BRIDGE. Directly use this definition within pc_init1().

---
 hw/i386/pc_piix.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
hw/i386/pc_piix.c +5 -9
index 0e688ed655..400b1c1e15 100644
@@ -100,8 +100,7 @@ static void piix_intx_routing_notifier_xen(PCIDevice *dev)
 }
 
 /* PC hardware initialisation */
-static void pc_init1(MachineState *machine,
-                     const char *host_type, const char *pci_type)
+static void pc_init1(MachineState *machine, const char *pci_type)
 {
     PCMachineState *pcms = PC_MACHINE(machine);
     PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
@@ -193,7 +192,7 @@ static void pc_init1(MachineState *machine,
         memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
         rom_memory = pci_memory;
 
-        phb = OBJECT(qdev_new(host_type));
+        phb = OBJECT(qdev_new(TYPE_I440FX_PCI_HOST_BRIDGE));
         object_property_add_child(OBJECT(machine), "i440fx", phb);
         object_property_set_link(phb, PCI_HOST_PROP_RAM_MEM,
                                  OBJECT(ram_memory), &error_fatal);
@@ -450,7 +449,7 @@ static void pc_compat_2_0_fn(MachineState *machine)
 #ifdef CONFIG_ISAPC
 static void pc_init_isa(MachineState *machine)
 {
-    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, TYPE_I440FX_PCI_DEVICE);
+    pc_init1(machine, TYPE_I440FX_PCI_DEVICE);
 }
 #endif
 
@@ -460,9 +459,7 @@ static void pc_xen_hvm_init_pci(MachineState *machine)
     const char *pci_type = xen_igd_gfx_pt_enabled() ?
                 TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE : TYPE_I440FX_PCI_DEVICE;
 
-    pc_init1(machine,
-             TYPE_I440FX_PCI_HOST_BRIDGE,
-             pci_type);
+    pc_init1(machine, pci_type);
 }
 
 static void pc_xen_hvm_init(MachineState *machine)
@@ -487,8 +484,7 @@ static void pc_xen_hvm_init(MachineState *machine)
         if (compat) { \
             compat(machine); \
         } \
-        pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
-                 TYPE_I440FX_PCI_DEVICE); \
+        pc_init1(machine, TYPE_I440FX_PCI_DEVICE); \
     } \
     DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
 
Signature · 1 line
2.41.0
#7 lore raw

PATCH 4/4 hw/i386/pc: Have pc_init_isa() pass a NULL pci_type argument

In reply to Philippe Mathieu-Daudé

The "isapc" machine only provides an ISA bus, not a PCI one, and doesn't instanciate any i440FX south bridge.
Its machine class defines PCMachineClass::pci_enabled = false, and pc_init1() only uses the pci_type argument when pci_enabled is true. Since for this machine the argument is not used, passing NULL makes more sense.

---
 hw/i386/pc_piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_piix.c +1 -1
index 400b1c1e15..fa5f93f99f 100644
@@ -449,7 +449,7 @@ static void pc_compat_2_0_fn(MachineState *machine)
 #ifdef CONFIG_ISAPC
 static void pc_init_isa(MachineState *machine)
 {
-    pc_init1(machine, TYPE_I440FX_PCI_DEVICE);
+    pc_init1(machine, NULL);
 }
 #endif
 
Signature · 1 line
2.41.0
Reviewed-by on v1 4/4
#8 lore raw

Re: [PATCH 4/4] hw/i386/pc: Have pc_init_isa() pass a NULL pci_type argument

Am 1. März 2024 18:59:36 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:

Quoted 8 lines

The "isapc" machine only provides an ISA bus, not a PCI one, and doesn't instanciate any i440FX south bridge.
Its machine class defines PCMachineClass::pci_enabled = false, and pc_init1() only uses the pci_type argument when pci_enabled is true. Since for this machine the argument is not used, passing NULL makes more sense.

#9 lore raw
In reply to Philippe Mathieu-Daudé

Am 1. März 2024 18:59:32 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:

Quoted 7 lines

Trivial cleanups, mostly around the 'isapc' machine.

Philippe Mathieu-Daudé (4):
hw/i386/pc: Remove pc_compat_1_4..1.7[] left over declarations hw/i386/pc: Use generated NotifyVmexitOption_str() hw/i386/pc: Remove 'host_type' argument from pc_init1() hw/i386/pc: Have pc_init_isa() pass a NULL pci_type argument

Ping. Will this series make it into 9.0? AFAICS all patches are reviewed.

Quoted 5 lines

include/hw/i386/pc.h | 12 ------------
hw/i386/pc_piix.c | 18 ++++++------------

2 files changed, 6 insertions(+), 24 deletions(-)
#10 lore raw

07.03.2024 21:57, Bernhard Beschow :

Quoted 10 lines

Am 1. März 2024 18:59:32 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:

Quoted 7 lines

Trivial cleanups, mostly around the 'isapc' machine.

Philippe Mathieu-Daudé (4):
hw/i386/pc: Remove pc_compat_1_4..1.7[] left over declarations hw/i386/pc: Use generated NotifyVmexitOption_str() hw/i386/pc: Remove 'host_type' argument from pc_init1() hw/i386/pc: Have pc_init_isa() pass a NULL pci_type argument

Ping. Will this series make it into 9.0? AFAICS all patches are reviewed.

Philippe, are you submitting this through you misc tree, or should I pick it for trivial-patches? I'm often a bit in doubt about patches you Cc to qemu-trivial@, - a few times we both tried to submit them.

/mjt

#11 lore raw
Quoted 10 lines · Michael Tokarev

07.03.2024 21:57, Bernhard Beschow :

Quoted 9 lines

Am 1. März 2024 18:59:32 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:

Quoted 7 lines

Trivial cleanups, mostly around the 'isapc' machine.

Philippe Mathieu-Daudé (4):
  hw/i386/pc: Remove pc_compat_1_4..1.7[] left over declarations hw/i386/pc: Use generated NotifyVmexitOption_str() hw/i386/pc: Remove 'host_type' argument from pc_init1() hw/i386/pc: Have pc_init_isa() pass a NULL pci_type argument

Quoted 5 lines
Quoted 1 line

Ping. Will this series make it into 9.0? AFAICS all patches are reviewed.

Philippe, are you submitting this through you misc tree, or should I pick it for trivial-patches?  I'm often a bit in doubt about patches you Cc to qemu-trivial@, - a few times we both tried to submit them.

Yes, series queued, thanks!