All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/20] PC and ICH9 cleanups
@ 2023-01-31 11:53 Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 01/20] hw/pci-host/i440fx: Inline sysbus_add_io() Bernhard Beschow
                   ` (19 more replies)
  0 siblings, 20 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

This series contains some cleanups I came across when working on the PC
machines. It consists of reducing the usage of global variables and
eliminating some redundancies.

The ICH9 cleanups include further QOM'ification, making it more self-contained,
and reducing its x86/pc dependencies.

Testing done:
* `make check`
' `make check-avocado`
* `qemu-system-x86_64 -M q35 -m 2G -cdrom \
   manjaro-kde-21.3.2-220704-linux515.iso`
* `qemu-system-x86_64 -M pc -m 2G -cdrom manjaro-kde-21.3.2-220704-linux515.iso`

v2:
* Factor out 'hw/i386/pc_q35: Reuse machine parameter' from 'hw/i386/pc_q35:
  Resolve redundant q35_host variable' (Zoltan)
* Lower type of phb to Object in 'hw/i386/pc_q35: Resolve redundant q35_host
  variable' (Zoltan)
* Add ICH9 cleanups

Bernhard Beschow (20):
  hw/pci-host/i440fx: Inline sysbus_add_io()
  hw/pci-host/q35: Inline sysbus_add_io()
  hw/i386/pc_q35: Reuse machine parameter
  hw/i386/pc_q35: Resolve redundant q35_host variable
  hw/i386/pc_{q35,piix}: Reuse MachineClass::desc as SMB product name
  hw/i386/pc_{q35,piix}: Minimize usage of get_system_memory()
  hw/i386/pc: Initialize ram_memory variable directly
  hw/i386/ich9: Rename Q35_MASK to ICH9_MASK
  hw/isa/lpc_ich9: Unexport PIRQ functions
  hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus
  hw/isa/lpc_ich9: Reuse memory and io address space of PCI bus
  hw/i2c/smbus_ich9: Move ich9_smb_set_irq() in front of
    ich9_smbus_realize()
  hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it
  hw/i386/pc_q35: Allow for setting properties before realizing
    TYPE_ICH9_LPC_DEVICE
  hw/isa/lpc_ich9: Connect pm stuff to lpc internally
  hw/isa/lpc_ich9: Remove redundant ich9_lpc_reset() invocation
  hw/i386/ich9: Remove redundant GSI_NUM_PINS
  hw: Move ioapic*.h to intc/
  hw/i386/ich9: Clean up includes
  hw: Move ich9.h to southbridge/

 MAINTAINERS                                 |  2 +
 include/hw/acpi/ich9.h                      |  6 +-
 include/hw/i386/pc.h                        |  1 -
 include/hw/i386/x86.h                       |  3 +-
 include/hw/{i386 => intc}/ioapic.h          |  6 +-
 include/hw/{i386 => intc}/ioapic_internal.h |  8 +--
 include/hw/{i386 => southbridge}/ich9.h     | 35 ++++------
 hw/acpi/ich9.c                              | 10 +--
 hw/acpi/ich9_tco.c                          |  2 +-
 hw/i2c/smbus_ich9.c                         | 39 +++++------
 hw/i386/acpi-build.c                        |  3 +-
 hw/i386/kvm/ioapic.c                        |  3 +-
 hw/i386/pc.c                                |  8 +--
 hw/i386/pc_piix.c                           |  8 +--
 hw/i386/pc_q35.c                            | 73 ++++++++++-----------
 hw/intc/apic.c                              |  2 +-
 hw/intc/ioapic.c                            |  4 +-
 hw/intc/ioapic_common.c                     |  4 +-
 hw/isa/lpc_ich9.c                           | 40 +++++------
 hw/pci-bridge/i82801b11.c                   |  2 +-
 hw/pci-host/i440fx.c                        |  5 +-
 hw/pci-host/q35.c                           |  6 +-
 target/i386/whpx/whpx-all.c                 |  2 +-
 tests/qtest/tco-test.c                      |  2 +-
 24 files changed, 127 insertions(+), 147 deletions(-)
 rename include/hw/{i386 => intc}/ioapic.h (93%)
 rename include/hw/{i386 => intc}/ioapic_internal.h (96%)
 rename include/hw/{i386 => southbridge}/ich9.h (91%)

-- 
2.39.1



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

* [PATCH v2 01/20] hw/pci-host/i440fx: Inline sysbus_add_io()
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 13:38   ` Thomas Huth
  2023-01-31 11:53 ` [PATCH v2 02/20] hw/pci-host/q35: " Bernhard Beschow
                   ` (18 subsequent siblings)
  19 siblings, 1 reply; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

sysbus_add_io() just wraps memory_region_add_subregion() while also
obscuring where the memory is attached. So use
memory_region_add_subregion() directly and attach it to the existing
memory region s->bus->address_space_io which is set as an alias to
get_system_io() by the pc machine.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/pci-host/i440fx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index 262f82c303..9c6882d3fc 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -27,6 +27,7 @@
 #include "qemu/range.h"
 #include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
+#include "hw/pci/pci_bus.h"
 #include "hw/pci/pci_host.h"
 #include "hw/pci-host/i440fx.h"
 #include "hw/qdev-properties.h"
@@ -217,10 +218,10 @@ static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
     PCIHostState *s = PCI_HOST_BRIDGE(dev);
     SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
 
-    sysbus_add_io(sbd, 0xcf8, &s->conf_mem);
+    memory_region_add_subregion(s->bus->address_space_io, 0xcf8, &s->conf_mem);
     sysbus_init_ioports(sbd, 0xcf8, 4);
 
-    sysbus_add_io(sbd, 0xcfc, &s->data_mem);
+    memory_region_add_subregion(s->bus->address_space_io, 0xcfc, &s->data_mem);
     sysbus_init_ioports(sbd, 0xcfc, 4);
 
     /* register i440fx 0xcf8 port as coalesced pio */
-- 
2.39.1



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

* [PATCH v2 02/20] hw/pci-host/q35: Inline sysbus_add_io()
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 01/20] hw/pci-host/i440fx: Inline sysbus_add_io() Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 13:38   ` Thomas Huth
  2023-01-31 11:53 ` [PATCH v2 03/20] hw/i386/pc_q35: Reuse machine parameter Bernhard Beschow
                   ` (17 subsequent siblings)
  19 siblings, 1 reply; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

sysbus_add_io() just wraps memory_region_add_subregion() while also
obscuring where the memory is attached. So use
memory_region_add_subregion() directly and attach it to the existing
memory region s->mch.address_space_io which is set as an alias to
get_system_io() by the q35 machine.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/pci-host/q35.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 26390863d6..fa05844319 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -50,10 +50,12 @@ static void q35_host_realize(DeviceState *dev, Error **errp)
     Q35PCIHost *s = Q35_HOST_DEVICE(dev);
     SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
 
-    sysbus_add_io(sbd, MCH_HOST_BRIDGE_CONFIG_ADDR, &pci->conf_mem);
+    memory_region_add_subregion(s->mch.address_space_io,
+                                MCH_HOST_BRIDGE_CONFIG_ADDR, &pci->conf_mem);
     sysbus_init_ioports(sbd, MCH_HOST_BRIDGE_CONFIG_ADDR, 4);
 
-    sysbus_add_io(sbd, MCH_HOST_BRIDGE_CONFIG_DATA, &pci->data_mem);
+    memory_region_add_subregion(s->mch.address_space_io,
+                                MCH_HOST_BRIDGE_CONFIG_DATA, &pci->data_mem);
     sysbus_init_ioports(sbd, MCH_HOST_BRIDGE_CONFIG_DATA, 4);
 
     /* register q35 0xcf8 port as coalesced pio */
-- 
2.39.1



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

* [PATCH v2 03/20] hw/i386/pc_q35: Reuse machine parameter
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 01/20] hw/pci-host/i440fx: Inline sysbus_add_io() Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 02/20] hw/pci-host/q35: " Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 13:49   ` Thomas Huth
  2023-01-31 11:53 ` [PATCH v2 04/20] hw/i386/pc_q35: Resolve redundant q35_host variable Bernhard Beschow
                   ` (16 subsequent siblings)
  19 siblings, 1 reply; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/i386/pc_q35.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 83c57c6eb1..351ef25f69 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -218,7 +218,7 @@ static void pc_q35_init(MachineState *machine)
     pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory,
                    pci_hole64_size);
 
-    object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host));
+    object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host));
     object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM,
                              OBJECT(ram_memory), NULL);
     object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_PCI_MEM,
-- 
2.39.1



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

* [PATCH v2 04/20] hw/i386/pc_q35: Resolve redundant q35_host variable
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (2 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 03/20] hw/i386/pc_q35: Reuse machine parameter Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 13:53   ` Thomas Huth
  2023-01-31 11:53 ` [PATCH v2 05/20] hw/i386/pc_{q35, piix}: Reuse MachineClass::desc as SMB product name Bernhard Beschow
                   ` (15 subsequent siblings)
  19 siblings, 1 reply; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

The variable is redundant to "phb" and is never used by its real type.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/i386/pc_q35.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 351ef25f69..88324af91f 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -118,8 +118,7 @@ static void pc_q35_init(MachineState *machine)
     PCMachineState *pcms = PC_MACHINE(machine);
     PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
     X86MachineState *x86ms = X86_MACHINE(machine);
-    Q35PCIHost *q35_host;
-    PCIHostState *phb;
+    Object *phb;
     PCIBus *host_bus;
     PCIDevice *lpc;
     DeviceState *lpc_dev;
@@ -206,10 +205,10 @@ static void pc_q35_init(MachineState *machine)
     }
 
     /* create pci host bus */
-    q35_host = Q35_HOST_DEVICE(qdev_new(TYPE_Q35_HOST_DEVICE));
+    phb = OBJECT(qdev_new(TYPE_Q35_HOST_DEVICE));
 
     if (pcmc->pci_enabled) {
-        pci_hole64_size = object_property_get_uint(OBJECT(q35_host),
+        pci_hole64_size = object_property_get_uint(phb,
                                                    PCI_HOST_PROP_PCI_HOLE64_SIZE,
                                                    &error_abort);
     }
@@ -218,23 +217,22 @@ static void pc_q35_init(MachineState *machine)
     pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory,
                    pci_hole64_size);
 
-    object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host));
-    object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM,
+    object_property_add_child(OBJECT(machine), "q35", phb);
+    object_property_set_link(phb, MCH_HOST_PROP_RAM_MEM,
                              OBJECT(ram_memory), NULL);
-    object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_PCI_MEM,
+    object_property_set_link(phb, MCH_HOST_PROP_PCI_MEM,
                              OBJECT(pci_memory), NULL);
-    object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_SYSTEM_MEM,
+    object_property_set_link(phb, MCH_HOST_PROP_SYSTEM_MEM,
                              OBJECT(get_system_memory()), NULL);
-    object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_IO_MEM,
+    object_property_set_link(phb, MCH_HOST_PROP_IO_MEM,
                              OBJECT(system_io), NULL);
-    object_property_set_int(OBJECT(q35_host), PCI_HOST_BELOW_4G_MEM_SIZE,
+    object_property_set_int(phb, PCI_HOST_BELOW_4G_MEM_SIZE,
                             x86ms->below_4g_mem_size, NULL);
-    object_property_set_int(OBJECT(q35_host), PCI_HOST_ABOVE_4G_MEM_SIZE,
+    object_property_set_int(phb, PCI_HOST_ABOVE_4G_MEM_SIZE,
                             x86ms->above_4g_mem_size, NULL);
     /* pci */
-    sysbus_realize_and_unref(SYS_BUS_DEVICE(q35_host), &error_fatal);
-    phb = PCI_HOST_BRIDGE(q35_host);
-    host_bus = phb->bus;
+    sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal);
+    host_bus = PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0"));
     /* create ISA bus */
     lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV,
                                           ICH9_LPC_FUNC), true,
-- 
2.39.1



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

* [PATCH v2 05/20] hw/i386/pc_{q35, piix}: Reuse MachineClass::desc as SMB product name
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (3 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 04/20] hw/i386/pc_q35: Resolve redundant q35_host variable Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 13:55   ` Thomas Huth
  2023-01-31 11:53 ` [PATCH v2 06/20] hw/i386/pc_{q35, piix}: Minimize usage of get_system_memory() Bernhard Beschow
                   ` (14 subsequent siblings)
  19 siblings, 1 reply; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow, Philippe Mathieu-Daudé

No need to repeat the descriptions.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/pc_piix.c | 2 +-
 hw/i386/pc_q35.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index df64dd8dcc..ee9d9a4175 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -197,7 +197,7 @@ static void pc_init1(MachineState *machine,
     if (pcmc->smbios_defaults) {
         MachineClass *mc = MACHINE_GET_CLASS(machine);
         /* These values are guest ABI, do not change */
-        smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
+        smbios_set_defaults("QEMU", mc->desc,
                             mc->name, pcmc->smbios_legacy_mode,
                             pcmc->smbios_uuid_encoded,
                             pcms->smbios_entry_point_type);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 88324af91f..bc4fd06c1e 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -198,7 +198,7 @@ static void pc_q35_init(MachineState *machine)
 
     if (pcmc->smbios_defaults) {
         /* These values are guest ABI, do not change */
-        smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
+        smbios_set_defaults("QEMU", mc->desc,
                             mc->name, pcmc->smbios_legacy_mode,
                             pcmc->smbios_uuid_encoded,
                             pcms->smbios_entry_point_type);
-- 
2.39.1



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

* [PATCH v2 06/20] hw/i386/pc_{q35, piix}: Minimize usage of get_system_memory()
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (4 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 05/20] hw/i386/pc_{q35, piix}: Reuse MachineClass::desc as SMB product name Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 13:58   ` [PATCH v2 06/20] hw/i386/pc_{q35,piix}: " Thomas Huth
  2023-01-31 11:53 ` [PATCH v2 07/20] hw/i386/pc: Initialize ram_memory variable directly Bernhard Beschow
                   ` (13 subsequent siblings)
  19 siblings, 1 reply; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/i386/pc_piix.c | 2 +-
 hw/i386/pc_q35.c  | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index ee9d9a4175..5bde4533cc 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -241,7 +241,7 @@ static void pc_init1(MachineState *machine,
         isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0"));
     } else {
         pci_bus = NULL;
-        isa_bus = isa_bus_new(NULL, get_system_memory(), system_io,
+        isa_bus = isa_bus_new(NULL, system_memory, system_io,
                               &error_abort);
         i8257_dma_init(isa_bus, 0);
         pcms->hpet_enabled = false;
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index bc4fd06c1e..3ae2f41cf3 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -124,6 +124,7 @@ static void pc_q35_init(MachineState *machine)
     DeviceState *lpc_dev;
     BusState *idebus[MAX_SATA_PORTS];
     ISADevice *rtc_state;
+    MemoryRegion *system_memory = get_system_memory();
     MemoryRegion *system_io = get_system_io();
     MemoryRegion *pci_memory;
     MemoryRegion *rom_memory;
@@ -191,7 +192,7 @@ static void pc_q35_init(MachineState *machine)
         rom_memory = pci_memory;
     } else {
         pci_memory = NULL;
-        rom_memory = get_system_memory();
+        rom_memory = system_memory;
     }
 
     pc_guest_info_init(pcms);
@@ -214,7 +215,7 @@ static void pc_q35_init(MachineState *machine)
     }
 
     /* allocate ram and load rom/bios */
-    pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory,
+    pc_memory_init(pcms, system_memory, rom_memory, &ram_memory,
                    pci_hole64_size);
 
     object_property_add_child(OBJECT(machine), "q35", phb);
@@ -223,7 +224,7 @@ static void pc_q35_init(MachineState *machine)
     object_property_set_link(phb, MCH_HOST_PROP_PCI_MEM,
                              OBJECT(pci_memory), NULL);
     object_property_set_link(phb, MCH_HOST_PROP_SYSTEM_MEM,
-                             OBJECT(get_system_memory()), NULL);
+                             OBJECT(system_memory), NULL);
     object_property_set_link(phb, MCH_HOST_PROP_IO_MEM,
                              OBJECT(system_io), NULL);
     object_property_set_int(phb, PCI_HOST_BELOW_4G_MEM_SIZE,
-- 
2.39.1



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

* [PATCH v2 07/20] hw/i386/pc: Initialize ram_memory variable directly
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (5 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 06/20] hw/i386/pc_{q35, piix}: Minimize usage of get_system_memory() Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 08/20] hw/i386/ich9: Rename Q35_MASK to ICH9_MASK Bernhard Beschow
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow, Philippe Mathieu-Daudé

Going through pc_memory_init() seems quite complicated for a simple
assignment.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/i386/pc.h | 1 -
 hw/i386/pc.c         | 2 --
 hw/i386/pc_piix.c    | 4 ++--
 hw/i386/pc_q35.c     | 5 ++---
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 88a120bc23..5331b9a5c5 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -163,7 +163,6 @@ void xen_load_linux(PCMachineState *pcms);
 void pc_memory_init(PCMachineState *pcms,
                     MemoryRegion *system_memory,
                     MemoryRegion *rom_memory,
-                    MemoryRegion **ram_memory,
                     uint64_t pci_hole64_size);
 uint64_t pc_pci_hole64_start(void);
 DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 6e592bd969..8898cc9961 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -936,7 +936,6 @@ static hwaddr pc_max_used_gpa(PCMachineState *pcms, uint64_t pci_hole64_size)
 void pc_memory_init(PCMachineState *pcms,
                     MemoryRegion *system_memory,
                     MemoryRegion *rom_memory,
-                    MemoryRegion **ram_memory,
                     uint64_t pci_hole64_size)
 {
     int linux_boot, i;
@@ -994,7 +993,6 @@ void pc_memory_init(PCMachineState *pcms,
      * Split single memory region and use aliases to address portions of it,
      * done for backwards compatibility with older qemus.
      */
-    *ram_memory = machine->ram;
     ram_below_4g = g_malloc(sizeof(*ram_below_4g));
     memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", machine->ram,
                              0, x86ms->below_4g_mem_size);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 5bde4533cc..00ba725656 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -143,6 +143,7 @@ static void pc_init1(MachineState *machine,
     if (xen_enabled()) {
         xen_hvm_init_pc(pcms, &ram_memory);
     } else {
+        ram_memory = machine->ram;
         if (!pcms->max_ram_below_4g) {
             pcms->max_ram_below_4g = 0xe0000000; /* default: 3.5G */
         }
@@ -205,8 +206,7 @@ static void pc_init1(MachineState *machine,
 
     /* allocate ram and load rom/bios */
     if (!xen_enabled()) {
-        pc_memory_init(pcms, system_memory,
-                       rom_memory, &ram_memory, hole64_size);
+        pc_memory_init(pcms, system_memory, rom_memory, hole64_size);
     } else {
         pc_system_flash_cleanup_unused(pcms);
         if (machine->kernel_filename != NULL) {
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 3ae2f41cf3..50fa5aa9bc 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -128,7 +128,7 @@ static void pc_q35_init(MachineState *machine)
     MemoryRegion *system_io = get_system_io();
     MemoryRegion *pci_memory;
     MemoryRegion *rom_memory;
-    MemoryRegion *ram_memory;
+    MemoryRegion *ram_memory = machine->ram;
     GSIState *gsi_state;
     ISABus *isa_bus;
     int i;
@@ -215,8 +215,7 @@ static void pc_q35_init(MachineState *machine)
     }
 
     /* allocate ram and load rom/bios */
-    pc_memory_init(pcms, system_memory, rom_memory, &ram_memory,
-                   pci_hole64_size);
+    pc_memory_init(pcms, system_memory, rom_memory, pci_hole64_size);
 
     object_property_add_child(OBJECT(machine), "q35", phb);
     object_property_set_link(phb, MCH_HOST_PROP_RAM_MEM,
-- 
2.39.1



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

* [PATCH v2 08/20] hw/i386/ich9: Rename Q35_MASK to ICH9_MASK
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (6 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 07/20] hw/i386/pc: Initialize ram_memory variable directly Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 14:00   ` Thomas Huth
  2023-01-31 11:53 ` [PATCH v2 09/20] hw/isa/lpc_ich9: Unexport PIRQ functions Bernhard Beschow
                   ` (11 subsequent siblings)
  19 siblings, 1 reply; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

The Q35_MASK macro is already defined by TYPE_Q35_HOST_DEVICE, so let
TYPE_ICH9_LPC_DEVICE have its own one to prevent potential name clash.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/i386/ich9.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 222781e8b9..36e0ccd16a 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -75,7 +75,7 @@ struct ICH9LPCState {
     qemu_irq gsi[GSI_NUM_PINS];
 };
 
-#define Q35_MASK(bit, ms_bit, ls_bit) \
+#define ICH9_MASK(bit, ms_bit, ls_bit) \
 ((uint##bit##_t)(((1ULL << ((ms_bit) + 1)) - 1) & ~((1ULL << ls_bit) - 1)))
 
 /* ICH9: Chipset Configuration Registers */
@@ -137,13 +137,13 @@ struct ICH9LPCState {
 #define ICH9_LPC_NB_PIRQS                       8       /* PCI A-H */
 
 #define ICH9_LPC_PMBASE                         0x40
-#define ICH9_LPC_PMBASE_BASE_ADDRESS_MASK       Q35_MASK(32, 15, 7)
+#define ICH9_LPC_PMBASE_BASE_ADDRESS_MASK       ICH9_MASK(32, 15, 7)
 #define ICH9_LPC_PMBASE_RTE                     0x1
 #define ICH9_LPC_PMBASE_DEFAULT                 0x1
 
 #define ICH9_LPC_ACPI_CTRL                      0x44
 #define ICH9_LPC_ACPI_CTRL_ACPI_EN              0x80
-#define ICH9_LPC_ACPI_CTRL_SCI_IRQ_SEL_MASK     Q35_MASK(8, 2, 0)
+#define ICH9_LPC_ACPI_CTRL_SCI_IRQ_SEL_MASK     ICH9_MASK(8, 2, 0)
 #define ICH9_LPC_ACPI_CTRL_9                    0x0
 #define ICH9_LPC_ACPI_CTRL_10                   0x1
 #define ICH9_LPC_ACPI_CTRL_11                   0x2
@@ -162,7 +162,7 @@ struct ICH9LPCState {
 #define ICH9_LPC_PIRQH_ROUT                     0x6b
 
 #define ICH9_LPC_PIRQ_ROUT_IRQEN                0x80
-#define ICH9_LPC_PIRQ_ROUT_MASK                 Q35_MASK(8, 3, 0)
+#define ICH9_LPC_PIRQ_ROUT_MASK                 ICH9_MASK(8, 3, 0)
 #define ICH9_LPC_PIRQ_ROUT_DEFAULT              0x80
 
 #define ICH9_LPC_GEN_PMCON_1                    0xa0
@@ -172,7 +172,7 @@ struct ICH9LPCState {
 #define ICH9_LPC_GEN_PMCON_LOCK                 0xa6
 
 #define ICH9_LPC_RCBA                           0xf0
-#define ICH9_LPC_RCBA_BA_MASK                   Q35_MASK(32, 31, 14)
+#define ICH9_LPC_RCBA_BA_MASK                   ICH9_MASK(32, 31, 14)
 #define ICH9_LPC_RCBA_EN                        0x1
 #define ICH9_LPC_RCBA_DEFAULT                   0x0
 
-- 
2.39.1



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

* [PATCH v2 09/20] hw/isa/lpc_ich9: Unexport PIRQ functions
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (7 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 08/20] hw/i386/ich9: Rename Q35_MASK to ICH9_MASK Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 10/20] hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus Bernhard Beschow
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

No need to rely on the board to wire up the ICH9 PCI IRQs. All functions
access private state of the LPC device which suggests that it should
wire up the IRQs.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/i386/ich9.h |  3 ---
 hw/i386/pc_q35.c       |  3 ---
 hw/isa/lpc_ich9.c      | 11 ++++++++---
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 36e0ccd16a..921e4c7ef6 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -9,9 +9,6 @@
 #include "hw/acpi/ich9.h"
 #include "qom/object.h"
 
-void ich9_lpc_set_irq(void *opaque, int irq_num, int level);
-int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx);
-PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin);
 void ich9_lpc_pm_init(PCIDevice *pci_lpc, bool smm_enabled);
 I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base);
 
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 50fa5aa9bc..83e4fb7868 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -267,9 +267,6 @@ static void pc_q35_init(MachineState *machine)
     for (i = 0; i < GSI_NUM_PINS; i++) {
         qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[i]);
     }
-    pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc, ICH9_LPC_NB_PIRQS);
-    pci_bus_map_irqs(host_bus, ich9_lpc_map_irq);
-    pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq);
     isa_bus = ich9_lpc->isa_bus;
 
     if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) {
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 8d541e2b54..b444faacd2 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -259,7 +259,7 @@ static void ich9_lpc_update_apic(ICH9LPCState *lpc, int gsi)
     qemu_set_irq(lpc->gsi[gsi], level);
 }
 
-void ich9_lpc_set_irq(void *opaque, int pirq, int level)
+static void ich9_lpc_set_irq(void *opaque, int pirq, int level)
 {
     ICH9LPCState *lpc = opaque;
     int pic_irq, pic_dis;
@@ -275,7 +275,7 @@ void ich9_lpc_set_irq(void *opaque, int pirq, int level)
 /* return the pirq number (PIRQ[A-H]:0-7) corresponding to
  * a given device irq pin.
  */
-int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx)
+static int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx)
 {
     BusState *bus = qdev_get_parent_bus(&pci_dev->qdev);
     PCIBus *pci_bus = PCI_BUS(bus);
@@ -286,7 +286,7 @@ int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx)
     return lpc->irr[PCI_SLOT(pci_dev->devfn)][intx];
 }
 
-PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin)
+static PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin)
 {
     ICH9LPCState *lpc = opaque;
     PCIINTxRoute route;
@@ -680,6 +680,7 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
 {
     ICH9LPCState *lpc = ICH9_LPC_DEVICE(d);
     DeviceState *dev = DEVICE(d);
+    PCIBus *pci_bus = pci_get_bus(d);
     ISABus *isa_bus;
 
     if ((lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT)) &&
@@ -728,6 +729,10 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
     isa_bus_irqs(isa_bus, lpc->gsi);
 
     i8257_dma_init(isa_bus, 0);
+
+    pci_bus_irqs(pci_bus, ich9_lpc_set_irq, d, ICH9_LPC_NB_PIRQS);
+    pci_bus_map_irqs(pci_bus, ich9_lpc_map_irq);
+    pci_bus_set_route_irq_fn(pci_bus, ich9_route_intx_pin_to_irq);
 }
 
 static bool ich9_rst_cnt_needed(void *opaque)
-- 
2.39.1



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

* [PATCH v2 10/20] hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (8 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 09/20] hw/isa/lpc_ich9: Unexport PIRQ functions Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 14:04   ` Thomas Huth
  2023-01-31 11:53 ` [PATCH v2 11/20] hw/isa/lpc_ich9: Reuse memory and io address space of PCI bus Bernhard Beschow
                   ` (9 subsequent siblings)
  19 siblings, 1 reply; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

By using qdev_get_child_bus() we can eliminate ICH9LPCState::isa_bus and
spare the ich9_lpc variable in pc_q35, too.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/i386/ich9.h | 3 ---
 hw/i386/pc_q35.c       | 4 +---
 hw/isa/lpc_ich9.c      | 5 +----
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 921e4c7ef6..05464f6965 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -1,7 +1,6 @@
 #ifndef HW_ICH9_H
 #define HW_ICH9_H
 
-#include "hw/isa/isa.h"
 #include "hw/sysbus.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/apm.h"
@@ -64,8 +63,6 @@ struct ICH9LPCState {
                                        * triggers feature lockdown */
     uint64_t smi_negotiated_features; /* guest-invisible, host endian */
 
-    /* isa bus */
-    ISABus *isa_bus;
     MemoryRegion rcrb_mem; /* root complex register block */
     Notifier machine_ready;
 
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 83e4fb7868..a4d5c89409 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -132,7 +132,6 @@ static void pc_q35_init(MachineState *machine)
     GSIState *gsi_state;
     ISABus *isa_bus;
     int i;
-    ICH9LPCState *ich9_lpc;
     PCIDevice *ahci;
     ram_addr_t lowmem;
     DriveInfo *hd[MAX_SATA_PORTS];
@@ -262,12 +261,11 @@ static void pc_q35_init(MachineState *machine)
     /* irq lines */
     gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled);
 
-    ich9_lpc = ICH9_LPC_DEVICE(lpc);
     lpc_dev = DEVICE(lpc);
     for (i = 0; i < GSI_NUM_PINS; i++) {
         qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[i]);
     }
-    isa_bus = ich9_lpc->isa_bus;
+    isa_bus = ISA_BUS(qdev_get_child_bus(lpc_dev, "isa.0"));
 
     if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) {
         pc_i8259_create(isa_bus, gsi_state->i8259_irq);
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index b444faacd2..9ab966ef88 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -710,8 +710,6 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
     memory_region_init_io(&lpc->rcrb_mem, OBJECT(d), &rcrb_mmio_ops, lpc,
                           "lpc-rcrb-mmio", ICH9_CC_SIZE);
 
-    lpc->isa_bus = isa_bus;
-
     ich9_cc_init(lpc);
     apm_init(d, &lpc->apm, ich9_apm_ctrl_changed, lpc);
 
@@ -819,8 +817,7 @@ static void build_ich9_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
 {
     Aml *field;
     BusChild *kid;
-    ICH9LPCState *s = ICH9_LPC_DEVICE(adev);
-    BusState *bus = BUS(s->isa_bus);
+    BusState *bus = qdev_get_child_bus(DEVICE(adev), "isa.0");
     Aml *sb_scope = aml_scope("\\_SB");
 
     /* ICH9 PCI to ISA irq remapping */
-- 
2.39.1



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

* [PATCH v2 11/20] hw/isa/lpc_ich9: Reuse memory and io address space of PCI bus
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (9 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 10/20] hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-02-01  0:02   ` Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 12/20] hw/i2c/smbus_ich9: Move ich9_smb_set_irq() in front of ich9_smbus_realize() Bernhard Beschow
                   ` (8 subsequent siblings)
  19 siblings, 1 reply; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

In pc_q35.c the PCI host bridge's io and memory space is initialized
with get_system_memory() and get_system_io() respectively. Therefore,
using pci_address_space() and pci_address_space_io() is equivalent. All
in all this makes the LPC function respect whatever memory spaces the
PCI bus was set up with.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/isa/lpc_ich9.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 9ab966ef88..1b7e5585b3 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -506,10 +506,10 @@ static void ich9_lpc_rcba_update(ICH9LPCState *lpc, uint32_t rcba_old)
     uint32_t rcba = pci_get_long(lpc->d.config + ICH9_LPC_RCBA);
 
     if (rcba_old & ICH9_LPC_RCBA_EN) {
-        memory_region_del_subregion(get_system_memory(), &lpc->rcrb_mem);
+        memory_region_del_subregion(pci_address_space(&lpc->d), &lpc->rcrb_mem);
     }
     if (rcba & ICH9_LPC_RCBA_EN) {
-        memory_region_add_subregion_overlap(get_system_memory(),
+        memory_region_add_subregion_overlap(pci_address_space(&lpc->d),
                                             rcba & ICH9_LPC_RCBA_BA_MASK,
                                             &lpc->rcrb_mem, 1);
     }
@@ -695,7 +695,7 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
         return;
     }
 
-    isa_bus = isa_bus_new(DEVICE(d), get_system_memory(), get_system_io(),
+    isa_bus = isa_bus_new(dev, pci_address_space(d), pci_address_space_io(d),
                           errp);
     if (!isa_bus) {
         return;
-- 
2.39.1



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

* [PATCH v2 12/20] hw/i2c/smbus_ich9: Move ich9_smb_set_irq() in front of ich9_smbus_realize()
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (10 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 11/20] hw/isa/lpc_ich9: Reuse memory and io address space of PCI bus Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 13/20] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it Bernhard Beschow
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

This is a preparation for the next commit to make it cleaner.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/i2c/smbus_ich9.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index ee50ba1f2c..06d97ac942 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -80,6 +80,18 @@ static void ich9_smbus_write_config(PCIDevice *d, uint32_t address,
     }
 }
 
+static void ich9_smb_set_irq(PMSMBus *pmsmb, bool enabled)
+{
+    ICH9SMBState *s = pmsmb->opaque;
+
+    if (enabled == s->irq_enabled) {
+        return;
+    }
+
+    s->irq_enabled = enabled;
+    pci_set_irq(&s->dev, enabled);
+}
+
 static void ich9_smbus_realize(PCIDevice *d, Error **errp)
 {
     ICH9SMBState *s = ICH9_SMB_DEVICE(d);
@@ -128,18 +140,6 @@ static void ich9_smb_class_init(ObjectClass *klass, void *data)
     adevc->build_dev_aml = build_ich9_smb_aml;
 }
 
-static void ich9_smb_set_irq(PMSMBus *pmsmb, bool enabled)
-{
-    ICH9SMBState *s = pmsmb->opaque;
-
-    if (enabled == s->irq_enabled) {
-        return;
-    }
-
-    s->irq_enabled = enabled;
-    pci_set_irq(&s->dev, enabled);
-}
-
 I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base)
 {
     PCIDevice *d =
-- 
2.39.1



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

* [PATCH v2 13/20] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (11 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 12/20] hw/i2c/smbus_ich9: Move ich9_smb_set_irq() in front of ich9_smbus_realize() Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 14/20] hw/i386/pc_q35: Allow for setting properties before realizing TYPE_ICH9_LPC_DEVICE Bernhard Beschow
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

ich9_smb_init() is a legacy init function, so modernize the code.

Note that the smb_io_base parameter was unused.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/i386/ich9.h |  1 -
 hw/i2c/smbus_ich9.c    | 13 +++----------
 hw/i386/pc_q35.c       | 11 ++++++++---
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 05464f6965..52ea116f44 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -9,7 +9,6 @@
 #include "qom/object.h"
 
 void ich9_lpc_pm_init(PCIDevice *pci_lpc, bool smm_enabled);
-I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base);
 
 void ich9_generate_smi(void);
 
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index 06d97ac942..c7fdf32db0 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -105,6 +105,9 @@ static void ich9_smbus_realize(PCIDevice *d, Error **errp)
     pm_smbus_init(&d->qdev, &s->smb, false);
     pci_register_bar(d, ICH9_SMB_SMB_BASE_BAR, PCI_BASE_ADDRESS_SPACE_IO,
                      &s->smb.io);
+
+    s->smb.set_irq = ich9_smb_set_irq;
+    s->smb.opaque = s;
 }
 
 static void build_ich9_smb_aml(AcpiDevAmlIf *adev, Aml *scope)
@@ -140,16 +143,6 @@ static void ich9_smb_class_init(ObjectClass *klass, void *data)
     adevc->build_dev_aml = build_ich9_smb_aml;
 }
 
-I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base)
-{
-    PCIDevice *d =
-        pci_create_simple_multifunction(bus, devfn, true, TYPE_ICH9_SMB_DEVICE);
-    ICH9SMBState *s = ICH9_SMB_DEVICE(d);
-    s->smb.set_irq = ich9_smb_set_irq;
-    s->smb.opaque = s;
-    return s->smb.smbus;
-}
-
 static const TypeInfo ich9_smb_info = {
     .name   = TYPE_ICH9_SMB_DEVICE,
     .parent = TYPE_PCI_DEVICE,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index a4d5c89409..fab8e57913 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -312,10 +312,15 @@ static void pc_q35_init(MachineState *machine)
     }
 
     if (pcms->smbus_enabled) {
+        PCIDevice *smb;
+
         /* TODO: Populate SPD eeprom data.  */
-        pcms->smbus = ich9_smb_init(host_bus,
-                                    PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC),
-                                    0xb100);
+        smb = pci_create_simple_multifunction(host_bus,
+                                              PCI_DEVFN(ICH9_SMB_DEV,
+                                                        ICH9_SMB_FUNC),
+                                              true, TYPE_ICH9_SMB_DEVICE);
+        pcms->smbus = I2C_BUS(qdev_get_child_bus(DEVICE(smb), "i2c"));
+
         smbus_eeprom_init(pcms->smbus, 8, NULL, 0);
     }
 
-- 
2.39.1



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

* [PATCH v2 14/20] hw/i386/pc_q35: Allow for setting properties before realizing TYPE_ICH9_LPC_DEVICE
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (12 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 13/20] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 15/20] hw/isa/lpc_ich9: Connect pm stuff to lpc internally Bernhard Beschow
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

This is a preparation to make the next patch cleaner.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/i386/pc_q35.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index fab8e57913..27a1fe351d 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -232,10 +232,11 @@ static void pc_q35_init(MachineState *machine)
     /* pci */
     sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal);
     host_bus = PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0"));
+
     /* create ISA bus */
-    lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV,
-                                          ICH9_LPC_FUNC), true,
-                                          TYPE_ICH9_LPC_DEVICE);
+    lpc = pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC), true,
+                                TYPE_ICH9_LPC_DEVICE);
+    pci_realize_and_unref(lpc, host_bus, &error_fatal);
 
     object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
                              TYPE_HOTPLUG_HANDLER,
-- 
2.39.1



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

* [PATCH v2 15/20] hw/isa/lpc_ich9: Connect pm stuff to lpc internally
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (13 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 14/20] hw/i386/pc_q35: Allow for setting properties before realizing TYPE_ICH9_LPC_DEVICE Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 16/20] hw/isa/lpc_ich9: Remove redundant ich9_lpc_reset() invocation Bernhard Beschow
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

Make TYPE_ICH9_LPC_DEVICE more self-contained by moving the call to
ich9_lpc_pm_init() from board code to its realize function. In order
to propagate x86_machine_is_smm_enabled(), introduce an "smm-enabled"
property like we have in piix4.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/acpi/ich9.h | 6 ++----
 include/hw/i386/ich9.h | 2 --
 hw/acpi/ich9.c         | 8 ++------
 hw/i386/pc_q35.c       | 5 ++---
 hw/isa/lpc_ich9.c      | 8 +++++---
 5 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index d41866a229..57a542c4b8 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -64,7 +64,7 @@ typedef struct ICH9LPCPMRegs {
     uint8_t disable_s3;
     uint8_t disable_s4;
     uint8_t s4_val;
-    uint8_t smm_enabled;
+    bool smm_enabled;
     bool smm_compat;
     bool enable_tco;
     TCOIORegs tco_regs;
@@ -72,9 +72,7 @@ typedef struct ICH9LPCPMRegs {
 
 #define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
 
-void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
-                  bool smm_enabled,
-                  qemu_irq sci_irq);
+void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq);
 
 void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base);
 extern const VMStateDescription vmstate_ich9_pm;
diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 52ea116f44..433c8942c9 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -8,8 +8,6 @@
 #include "hw/acpi/ich9.h"
 #include "qom/object.h"
 
-void ich9_lpc_pm_init(PCIDevice *pci_lpc, bool smm_enabled);
-
 void ich9_generate_smi(void);
 
 #define ICH9_CC_SIZE (16 * 1024) /* 16KB. Chipset configuration registers */
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index a93c470e9d..54bb3d83b3 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -291,9 +291,7 @@ static void pm_powerdown_req(Notifier *n, void *opaque)
     acpi_pm1_evt_power_down(&pm->acpi_regs);
 }
 
-void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
-                  bool smm_enabled,
-                  qemu_irq sci_irq)
+void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq)
 {
     memory_region_init(&pm->io, OBJECT(lpc_pci), "ich9-pm", ICH9_PMIO_SIZE);
     memory_region_set_enabled(&pm->io, false);
@@ -303,7 +301,7 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
     acpi_pm_tmr_init(&pm->acpi_regs, ich9_pm_update_sci_fn, &pm->io);
     acpi_pm1_evt_init(&pm->acpi_regs, ich9_pm_update_sci_fn, &pm->io);
     acpi_pm1_cnt_init(&pm->acpi_regs, &pm->io, pm->disable_s3, pm->disable_s4,
-                      pm->s4_val, !pm->smm_compat && !smm_enabled);
+                      pm->s4_val, !pm->smm_compat && !pm->smm_enabled);
 
     acpi_gpe_init(&pm->acpi_regs, ICH9_PMIO_GPE0_LEN);
     memory_region_init_io(&pm->io_gpe, OBJECT(lpc_pci), &ich9_gpe_ops, pm,
@@ -314,8 +312,6 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
                           "acpi-smi", 8);
     memory_region_add_subregion(&pm->io, ICH9_PMIO_SMI_EN, &pm->io_smi);
 
-    pm->smm_enabled = smm_enabled;
-
     if (pm->enable_tco) {
         acpi_pm_tco_init(&pm->tco_regs, &pm->io);
     }
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 27a1fe351d..2b34b88dc2 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -236,6 +236,8 @@ static void pc_q35_init(MachineState *machine)
     /* create ISA bus */
     lpc = pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC), true,
                                 TYPE_ICH9_LPC_DEVICE);
+    qdev_prop_set_bit(DEVICE(lpc), "smm-enabled",
+                      x86_machine_is_smm_enabled(x86ms));
     pci_realize_and_unref(lpc, host_bus, &error_fatal);
 
     object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
@@ -289,9 +291,6 @@ static void pc_q35_init(MachineState *machine)
     pc_basic_device_init(pcms, isa_bus, x86ms->gsi, &rtc_state, !mc->no_floppy,
                          0xff0104);
 
-    /* connect pm stuff to lpc */
-    ich9_lpc_pm_init(lpc, x86_machine_is_smm_enabled(x86ms));
-
     if (pcms->sata_enabled) {
         /* ahci and SATA device, for q35 1 ahci controller is built-in */
         ahci = pci_create_simple_multifunction(host_bus,
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 1b7e5585b3..7d21857d53 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -407,14 +407,13 @@ static void smi_features_ok_callback(void *opaque)
     lpc->smi_features_ok = 1;
 }
 
-void ich9_lpc_pm_init(PCIDevice *lpc_pci, bool smm_enabled)
+static void ich9_lpc_pm_init(ICH9LPCState *lpc)
 {
-    ICH9LPCState *lpc = ICH9_LPC_DEVICE(lpc_pci);
     qemu_irq sci_irq;
     FWCfgState *fw_cfg = fw_cfg_find();
 
     sci_irq = qemu_allocate_irq(ich9_set_sci, lpc, 0);
-    ich9_pm_init(lpc_pci, &lpc->pm, smm_enabled, sci_irq);
+    ich9_pm_init(PCI_DEVICE(lpc), &lpc->pm, sci_irq);
 
     if (lpc->smi_host_features && fw_cfg) {
         uint64_t host_features_le;
@@ -731,6 +730,8 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
     pci_bus_irqs(pci_bus, ich9_lpc_set_irq, d, ICH9_LPC_NB_PIRQS);
     pci_bus_map_irqs(pci_bus, ich9_lpc_map_irq);
     pci_bus_set_route_irq_fn(pci_bus, ich9_route_intx_pin_to_irq);
+
+    ich9_lpc_pm_init(lpc);
 }
 
 static bool ich9_rst_cnt_needed(void *opaque)
@@ -797,6 +798,7 @@ static const VMStateDescription vmstate_ich9_lpc = {
 static Property ich9_lpc_properties[] = {
     DEFINE_PROP_BOOL("noreboot", ICH9LPCState, pin_strap.spkr_hi, false),
     DEFINE_PROP_BOOL("smm-compat", ICH9LPCState, pm.smm_compat, false),
+    DEFINE_PROP_BOOL("smm-enabled", ICH9LPCState, pm.smm_enabled, false),
     DEFINE_PROP_BIT64("x-smi-broadcast", ICH9LPCState, smi_host_features,
                       ICH9_LPC_SMI_F_BROADCAST_BIT, true),
     DEFINE_PROP_BIT64("x-smi-cpu-hotplug", ICH9LPCState, smi_host_features,
-- 
2.39.1



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

* [PATCH v2 16/20] hw/isa/lpc_ich9: Remove redundant ich9_lpc_reset() invocation
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (14 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 15/20] hw/isa/lpc_ich9: Connect pm stuff to lpc internally Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 17/20] hw/i386/ich9: Remove redundant GSI_NUM_PINS Bernhard Beschow
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

ich9_lpc_reset() is the dc->reset callback which is called
automatically. No need to call it explicitly during k->realize.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/isa/lpc_ich9.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 7d21857d53..b2842f2743 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -57,8 +57,6 @@
 /*****************************************************************************/
 /* ICH9 LPC PCI to ISA bridge */
 
-static void ich9_lpc_reset(DeviceState *qdev);
-
 /* chipset configuration register
  * to access chipset configuration registers, pci_[sg]et_{byte, word, long}
  * are used.
@@ -439,8 +437,6 @@ static void ich9_lpc_pm_init(ICH9LPCState *lpc)
                                  sizeof lpc->smi_features_ok,
                                  true);
     }
-
-    ich9_lpc_reset(DEVICE(lpc));
 }
 
 /* APM */
-- 
2.39.1



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

* [PATCH v2 17/20] hw/i386/ich9: Remove redundant GSI_NUM_PINS
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (15 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 16/20] hw/isa/lpc_ich9: Remove redundant ich9_lpc_reset() invocation Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 18/20] hw: Move ioapic*.h to intc/ Bernhard Beschow
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

Most code uses IOAPIC_NUM_PINS. The only place where GSI_NUM_PINS defines
the size of an array is ICH9LPCState::gsi which needs to match
IOAPIC_NUM_PINS. Remove GSI_NUM_PINS for consistency.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/i386/ich9.h | 2 +-
 include/hw/i386/x86.h  | 1 -
 hw/i386/pc.c           | 6 +++---
 hw/i386/pc_q35.c       | 3 ++-
 hw/isa/lpc_ich9.c      | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 433c8942c9..d29090a9b7 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -63,7 +63,7 @@ struct ICH9LPCState {
     MemoryRegion rcrb_mem; /* root complex register block */
     Notifier machine_ready;
 
-    qemu_irq gsi[GSI_NUM_PINS];
+    qemu_irq gsi[IOAPIC_NUM_PINS];
 };
 
 #define ICH9_MASK(bit, ms_bit, ls_bit) \
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index 62fa5774f8..0becd1460e 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -134,7 +134,6 @@ bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms);
 
 /* Global System Interrupts */
 
-#define GSI_NUM_PINS IOAPIC_NUM_PINS
 #define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11))
 
 typedef struct GSIState {
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 8898cc9961..cbca3f5db5 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -28,7 +28,7 @@
 #include "hw/i386/pc.h"
 #include "hw/char/serial.h"
 #include "hw/char/parallel.h"
-#include "hw/i386/apic.h"
+#include "hw/i386/ioapic.h"
 #include "hw/i386/topology.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/vmport.h"
@@ -406,7 +406,7 @@ GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled)
     if (kvm_ioapic_in_kernel()) {
         kvm_pc_setup_irq_routing(pci_enabled);
     }
-    *irqs = qemu_allocate_irqs(gsi_handler, s, GSI_NUM_PINS);
+    *irqs = qemu_allocate_irqs(gsi_handler, s, IOAPIC_NUM_PINS);
 
     return s;
 }
@@ -1295,7 +1295,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
         sysbus_realize_and_unref(SYS_BUS_DEVICE(hpet), &error_fatal);
         sysbus_mmio_map(SYS_BUS_DEVICE(hpet), 0, HPET_BASE);
 
-        for (i = 0; i < GSI_NUM_PINS; i++) {
+        for (i = 0; i < IOAPIC_NUM_PINS; i++) {
             sysbus_connect_irq(SYS_BUS_DEVICE(hpet), i, gsi[i]);
         }
         pit_isa_irq = -1;
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 2b34b88dc2..87f1ff94be 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -43,6 +43,7 @@
 #include "hw/i386/ich9.h"
 #include "hw/i386/amd_iommu.h"
 #include "hw/i386/intel_iommu.h"
+#include "hw/i386/ioapic.h"
 #include "hw/display/ramfb.h"
 #include "hw/firmware/smbios.h"
 #include "hw/ide/pci.h"
@@ -265,7 +266,7 @@ static void pc_q35_init(MachineState *machine)
     gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled);
 
     lpc_dev = DEVICE(lpc);
-    for (i = 0; i < GSI_NUM_PINS; i++) {
+    for (i = 0; i < IOAPIC_NUM_PINS; i++) {
         qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[i]);
     }
     isa_bus = ISA_BUS(qdev_get_child_bus(lpc_dev, "isa.0"));
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index b2842f2743..808c572ae4 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -717,7 +717,7 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
                                         ICH9_RST_CNT_IOPORT, &lpc->rst_cnt_mem,
                                         1);
 
-    qdev_init_gpio_out_named(dev, lpc->gsi, ICH9_GPIO_GSI, GSI_NUM_PINS);
+    qdev_init_gpio_out_named(dev, lpc->gsi, ICH9_GPIO_GSI, IOAPIC_NUM_PINS);
 
     isa_bus_irqs(isa_bus, lpc->gsi);
 
-- 
2.39.1



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

* [PATCH v2 18/20] hw: Move ioapic*.h to intc/
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (16 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 17/20] hw/i386/ich9: Remove redundant GSI_NUM_PINS Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 19/20] hw/i386/ich9: Clean up includes Bernhard Beschow
  2023-01-31 11:53 ` [PATCH v2 20/20] hw: Move ich9.h to southbridge/ Bernhard Beschow
  19 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

The ioapic sources reside in hw/intc already. Move the headers there as
well.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 MAINTAINERS                                 | 1 +
 include/hw/i386/x86.h                       | 2 +-
 include/hw/{i386 => intc}/ioapic.h          | 6 +++---
 include/hw/{i386 => intc}/ioapic_internal.h | 8 ++++----
 hw/i386/kvm/ioapic.c                        | 3 +--
 hw/i386/pc.c                                | 2 +-
 hw/i386/pc_q35.c                            | 2 +-
 hw/intc/apic.c                              | 2 +-
 hw/intc/ioapic.c                            | 4 ++--
 hw/intc/ioapic_common.c                     | 4 ++--
 target/i386/whpx/whpx-all.c                 | 2 +-
 11 files changed, 18 insertions(+), 18 deletions(-)
 rename include/hw/{i386 => intc}/ioapic.h (93%)
 rename include/hw/{i386 => intc}/ioapic_internal.h (96%)

diff --git a/MAINTAINERS b/MAINTAINERS
index c581c11a64..f96e86c57b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1703,6 +1703,7 @@ F: include/hw/char/parallel.h
 F: include/hw/dma/i8257.h
 F: include/hw/i2c/pm_smbus.h
 F: include/hw/input/i8042.h
+F: include/hw/intc/ioapic*
 F: include/hw/isa/i8259_internal.h
 F: include/hw/isa/superio.h
 F: include/hw/timer/hpet.h
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index 0becd1460e..7eeac10e74 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -23,8 +23,8 @@
 #include "hw/i386/topology.h"
 #include "hw/boards.h"
 #include "hw/nmi.h"
+#include "hw/intc/ioapic.h"
 #include "hw/isa/isa.h"
-#include "hw/i386/ioapic.h"
 #include "qom/object.h"
 
 struct X86MachineClass {
diff --git a/include/hw/i386/ioapic.h b/include/hw/intc/ioapic.h
similarity index 93%
rename from include/hw/i386/ioapic.h
rename to include/hw/intc/ioapic.h
index ef37b8a9fd..aa122e25e3 100644
--- a/include/hw/i386/ioapic.h
+++ b/include/hw/intc/ioapic.h
@@ -17,8 +17,8 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef HW_IOAPIC_H
-#define HW_IOAPIC_H
+#ifndef HW_INTC_IOAPIC_H
+#define HW_INTC_IOAPIC_H
 
 #define IOAPIC_NUM_PINS 24
 #define IO_APIC_DEFAULT_ADDRESS 0xfec00000
@@ -30,4 +30,4 @@
 
 void ioapic_eoi_broadcast(int vector);
 
-#endif /* HW_IOAPIC_H */
+#endif /* HW_INTC_IOAPIC_H */
diff --git a/include/hw/i386/ioapic_internal.h b/include/hw/intc/ioapic_internal.h
similarity index 96%
rename from include/hw/i386/ioapic_internal.h
rename to include/hw/intc/ioapic_internal.h
index e8ff338d7f..37b8565539 100644
--- a/include/hw/i386/ioapic_internal.h
+++ b/include/hw/intc/ioapic_internal.h
@@ -19,11 +19,11 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef QEMU_IOAPIC_INTERNAL_H
-#define QEMU_IOAPIC_INTERNAL_H
+#ifndef HW_INTC_IOAPIC_INTERNAL_H
+#define HW_INTC_IOAPIC_INTERNAL_H
 
 #include "exec/memory.h"
-#include "hw/i386/ioapic.h"
+#include "hw/intc/ioapic.h"
 #include "hw/sysbus.h"
 #include "qemu/notify.h"
 #include "qom/object.h"
@@ -115,4 +115,4 @@ void ioapic_reset_common(DeviceState *dev);
 
 void ioapic_stat_update_irq(IOAPICCommonState *s, int irq, int level);
 
-#endif /* QEMU_IOAPIC_INTERNAL_H */
+#endif /* HW_INTC_IOAPIC_INTERNAL_H */
diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c
index 272e26b4a2..cd5ea5d60b 100644
--- a/hw/i386/kvm/ioapic.c
+++ b/hw/i386/kvm/ioapic.c
@@ -12,9 +12,8 @@
 
 #include "qemu/osdep.h"
 #include "monitor/monitor.h"
-#include "hw/i386/x86.h"
 #include "hw/qdev-properties.h"
-#include "hw/i386/ioapic_internal.h"
+#include "hw/intc/ioapic_internal.h"
 #include "hw/intc/kvm_irqcount.h"
 #include "sysemu/kvm.h"
 
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index cbca3f5db5..b6c353346c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -28,7 +28,6 @@
 #include "hw/i386/pc.h"
 #include "hw/char/serial.h"
 #include "hw/char/parallel.h"
-#include "hw/i386/ioapic.h"
 #include "hw/i386/topology.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/vmport.h"
@@ -47,6 +46,7 @@
 #include "multiboot.h"
 #include "hw/rtc/mc146818rtc.h"
 #include "hw/intc/i8259.h"
+#include "hw/intc/ioapic.h"
 #include "hw/timer/i8254.h"
 #include "hw/input/i8042.h"
 #include "hw/irq.h"
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 87f1ff94be..cd61d801c7 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -43,11 +43,11 @@
 #include "hw/i386/ich9.h"
 #include "hw/i386/amd_iommu.h"
 #include "hw/i386/intel_iommu.h"
-#include "hw/i386/ioapic.h"
 #include "hw/display/ramfb.h"
 #include "hw/firmware/smbios.h"
 #include "hw/ide/pci.h"
 #include "hw/ide/ahci.h"
+#include "hw/intc/ioapic.h"
 #include "hw/usb.h"
 #include "hw/usb/hcd-uhci.h"
 #include "qapi/error.h"
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 2d3e55f4e2..0ff060f721 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -20,7 +20,7 @@
 #include "qemu/thread.h"
 #include "hw/i386/apic_internal.h"
 #include "hw/i386/apic.h"
-#include "hw/i386/ioapic.h"
+#include "hw/intc/ioapic.h"
 #include "hw/intc/i8259.h"
 #include "hw/intc/kvm_irqcount.h"
 #include "hw/pci/msi.h"
diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
index 264262959d..6364ecab1b 100644
--- a/hw/intc/ioapic.c
+++ b/hw/intc/ioapic.c
@@ -24,10 +24,10 @@
 #include "qapi/error.h"
 #include "monitor/monitor.h"
 #include "hw/i386/apic.h"
-#include "hw/i386/ioapic.h"
-#include "hw/i386/ioapic_internal.h"
 #include "hw/i386/x86.h"
 #include "hw/intc/i8259.h"
+#include "hw/intc/ioapic.h"
+#include "hw/intc/ioapic_internal.h"
 #include "hw/pci/msi.h"
 #include "hw/qdev-properties.h"
 #include "sysemu/kvm.h"
diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c
index aa5f760871..b05f436dac 100644
--- a/hw/intc/ioapic_common.c
+++ b/hw/intc/ioapic_common.c
@@ -24,9 +24,9 @@
 #include "qemu/module.h"
 #include "migration/vmstate.h"
 #include "monitor/monitor.h"
-#include "hw/i386/ioapic.h"
-#include "hw/i386/ioapic_internal.h"
 #include "hw/intc/intc.h"
+#include "hw/intc/ioapic.h"
+#include "hw/intc/ioapic_internal.h"
 #include "hw/sysbus.h"
 
 /* ioapic_no count start from 0 to MAX_IOAPICS,
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index e738d83e81..3d0c0b375f 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -19,7 +19,7 @@
 #include "sysemu/runstate.h"
 #include "qemu/main-loop.h"
 #include "hw/boards.h"
-#include "hw/i386/ioapic.h"
+#include "hw/intc/ioapic.h"
 #include "hw/i386/apic_internal.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
-- 
2.39.1



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

* [PATCH v2 19/20] hw/i386/ich9: Clean up includes
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (17 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 18/20] hw: Move ioapic*.h to intc/ Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  2023-03-02 14:43   ` Igor Mammedov
  2023-01-31 11:53 ` [PATCH v2 20/20] hw: Move ich9.h to southbridge/ Bernhard Beschow
  19 siblings, 1 reply; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/i386/ich9.h | 8 +++++---
 hw/i386/acpi-build.c   | 1 +
 hw/isa/lpc_ich9.c      | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index d29090a9b7..3125863049 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -1,11 +1,13 @@
 #ifndef HW_ICH9_H
 #define HW_ICH9_H
 
-#include "hw/sysbus.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/apm.h"
-#include "hw/acpi/acpi.h"
 #include "hw/acpi/ich9.h"
+#include "hw/intc/ioapic.h"
+#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
+#include "exec/memory.h"
+#include "qemu/notify.h"
 #include "qom/object.h"
 
 void ich9_generate_smi(void);
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 127c4e2d50..266df7a153 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -59,6 +59,7 @@
 #include "hw/acpi/pcihp.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/i386/ich9.h"
+#include "hw/i386/pc.h"
 #include "hw/pci/pci_bus.h"
 #include "hw/pci-host/i440fx.h"
 #include "hw/pci-host/q35.h"
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 808c572ae4..f508f6071e 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -40,8 +40,8 @@
 #include "hw/irq.h"
 #include "hw/isa/apm.h"
 #include "hw/pci/pci.h"
-#include "hw/pci/pci_bridge.h"
 #include "hw/i386/ich9.h"
+#include "hw/i386/pc.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/ich9.h"
 #include "hw/pci/pci_bus.h"
-- 
2.39.1



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

* [PATCH v2 20/20] hw: Move ich9.h to southbridge/
  2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
                   ` (18 preceding siblings ...)
  2023-01-31 11:53 ` [PATCH v2 19/20] hw/i386/ich9: Clean up includes Bernhard Beschow
@ 2023-01-31 11:53 ` Bernhard Beschow
  19 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-01-31 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Bernhard Beschow

ICH9 is a south bridge which doesn't necessarily depend on x86, so move
it into the southbridge folder, analoguous to PIIX.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 MAINTAINERS                             | 1 +
 include/hw/{i386 => southbridge}/ich9.h | 6 +++---
 hw/acpi/ich9.c                          | 2 +-
 hw/acpi/ich9_tco.c                      | 2 +-
 hw/i2c/smbus_ich9.c                     | 2 +-
 hw/i386/acpi-build.c                    | 2 +-
 hw/i386/pc_q35.c                        | 2 +-
 hw/isa/lpc_ich9.c                       | 2 +-
 hw/pci-bridge/i82801b11.c               | 2 +-
 tests/qtest/tco-test.c                  | 2 +-
 10 files changed, 12 insertions(+), 11 deletions(-)
 rename include/hw/{i386 => southbridge}/ich9.h (99%)

diff --git a/MAINTAINERS b/MAINTAINERS
index f96e86c57b..8753fc066c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1670,6 +1670,7 @@ F: hw/i2c/smbus_ich9.c
 F: hw/acpi/piix4.c
 F: hw/acpi/ich9*.c
 F: include/hw/acpi/ich9*.h
+F: include/hw/southbridge/ich9.h
 F: include/hw/southbridge/piix.h
 F: hw/misc/sga.c
 F: hw/isa/apm.c
diff --git a/include/hw/i386/ich9.h b/include/hw/southbridge/ich9.h
similarity index 99%
rename from include/hw/i386/ich9.h
rename to include/hw/southbridge/ich9.h
index 3125863049..7004eecbf9 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/southbridge/ich9.h
@@ -1,5 +1,5 @@
-#ifndef HW_ICH9_H
-#define HW_ICH9_H
+#ifndef HW_SOUTHBRIDGE_ICH9_H
+#define HW_SOUTHBRIDGE_ICH9_H
 
 #include "hw/isa/apm.h"
 #include "hw/acpi/ich9.h"
@@ -242,4 +242,4 @@ struct ICH9LPCState {
 #define ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT          1
 #define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT       2
 
-#endif /* HW_ICH9_H */
+#endif /* HW_SOUTHBRIDGE_ICH9_H */
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 54bb3d83b3..d23bfcaa6b 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -36,7 +36,7 @@
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/ich9_tco.h"
 
-#include "hw/i386/ich9.h"
+#include "hw/southbridge/ich9.h"
 #include "hw/mem/pc-dimm.h"
 #include "hw/mem/nvdimm.h"
 
diff --git a/hw/acpi/ich9_tco.c b/hw/acpi/ich9_tco.c
index fbf97f81f4..1540f4fd46 100644
--- a/hw/acpi/ich9_tco.c
+++ b/hw/acpi/ich9_tco.c
@@ -9,7 +9,7 @@
 
 #include "qemu/osdep.h"
 #include "sysemu/watchdog.h"
-#include "hw/i386/ich9.h"
+#include "hw/southbridge/ich9.h"
 #include "migration/vmstate.h"
 
 #include "hw/acpi/ich9_tco.h"
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index c7fdf32db0..b3eb82bc2e 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -27,7 +27,7 @@
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 
-#include "hw/i386/ich9.h"
+#include "hw/southbridge/ich9.h"
 #include "qom/object.h"
 #include "hw/acpi/acpi_aml_interface.h"
 
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 266df7a153..44ed879c8a 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -55,10 +55,10 @@
 #include "hw/hyperv/vmbus-bridge.h"
 
 /* Supported chipsets: */
+#include "hw/southbridge/ich9.h"
 #include "hw/southbridge/piix.h"
 #include "hw/acpi/pcihp.h"
 #include "hw/i386/fw_cfg.h"
-#include "hw/i386/ich9.h"
 #include "hw/i386/pc.h"
 #include "hw/pci/pci_bus.h"
 #include "hw/pci-host/i440fx.h"
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index cd61d801c7..2c8c43834c 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -40,7 +40,6 @@
 #include "hw/qdev-properties.h"
 #include "hw/i386/x86.h"
 #include "hw/i386/pc.h"
-#include "hw/i386/ich9.h"
 #include "hw/i386/amd_iommu.h"
 #include "hw/i386/intel_iommu.h"
 #include "hw/display/ramfb.h"
@@ -48,6 +47,7 @@
 #include "hw/ide/pci.h"
 #include "hw/ide/ahci.h"
 #include "hw/intc/ioapic.h"
+#include "hw/southbridge/ich9.h"
 #include "hw/usb.h"
 #include "hw/usb/hcd-uhci.h"
 #include "qapi/error.h"
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index f508f6071e..2699dc574a 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -40,7 +40,7 @@
 #include "hw/irq.h"
 #include "hw/isa/apm.h"
 #include "hw/pci/pci.h"
-#include "hw/i386/ich9.h"
+#include "hw/southbridge/ich9.h"
 #include "hw/i386/pc.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/ich9.h"
diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
index f3b4a14611..0e83cd11b2 100644
--- a/hw/pci-bridge/i82801b11.c
+++ b/hw/pci-bridge/i82801b11.c
@@ -45,7 +45,7 @@
 #include "hw/pci/pci_bridge.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
-#include "hw/i386/ich9.h"
+#include "hw/southbridge/ich9.h"
 
 /*****************************************************************************/
 /* ICH9 DMI-to-PCI bridge */
diff --git a/tests/qtest/tco-test.c b/tests/qtest/tco-test.c
index d865e95dfc..0547d41173 100644
--- a/tests/qtest/tco-test.c
+++ b/tests/qtest/tco-test.c
@@ -14,7 +14,7 @@
 #include "libqos/pci-pc.h"
 #include "qapi/qmp/qdict.h"
 #include "hw/pci/pci_regs.h"
-#include "hw/i386/ich9.h"
+#include "hw/southbridge/ich9.h"
 #include "hw/acpi/ich9.h"
 #include "hw/acpi/ich9_tco.h"
 
-- 
2.39.1



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

* Re: [PATCH v2 01/20] hw/pci-host/i440fx: Inline sysbus_add_io()
  2023-01-31 11:53 ` [PATCH v2 01/20] hw/pci-host/i440fx: Inline sysbus_add_io() Bernhard Beschow
@ 2023-01-31 13:38   ` Thomas Huth
  0 siblings, 0 replies; 31+ messages in thread
From: Thomas Huth @ 2023-01-31 13:38 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Marcel Apfelbaum, Eduardo Habkost,
	Laurent Vivier, Sunil Muthuswamy, qemu-trivial

On 31/01/2023 12.53, Bernhard Beschow wrote:
> sysbus_add_io() just wraps memory_region_add_subregion() while also
> obscuring where the memory is attached. So use
> memory_region_add_subregion() directly and attach it to the existing
> memory region s->bus->address_space_io which is set as an alias to
> get_system_io() by the pc machine.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/pci-host/i440fx.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)

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



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

* Re: [PATCH v2 02/20] hw/pci-host/q35: Inline sysbus_add_io()
  2023-01-31 11:53 ` [PATCH v2 02/20] hw/pci-host/q35: " Bernhard Beschow
@ 2023-01-31 13:38   ` Thomas Huth
  0 siblings, 0 replies; 31+ messages in thread
From: Thomas Huth @ 2023-01-31 13:38 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Marcel Apfelbaum, Eduardo Habkost,
	Laurent Vivier, Sunil Muthuswamy, qemu-trivial

On 31/01/2023 12.53, Bernhard Beschow wrote:
> sysbus_add_io() just wraps memory_region_add_subregion() while also
> obscuring where the memory is attached. So use
> memory_region_add_subregion() directly and attach it to the existing
> memory region s->mch.address_space_io which is set as an alias to
> get_system_io() by the q35 machine.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/pci-host/q35.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
> index 26390863d6..fa05844319 100644
> --- a/hw/pci-host/q35.c
> +++ b/hw/pci-host/q35.c
> @@ -50,10 +50,12 @@ static void q35_host_realize(DeviceState *dev, Error **errp)
>       Q35PCIHost *s = Q35_HOST_DEVICE(dev);
>       SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>   
> -    sysbus_add_io(sbd, MCH_HOST_BRIDGE_CONFIG_ADDR, &pci->conf_mem);
> +    memory_region_add_subregion(s->mch.address_space_io,
> +                                MCH_HOST_BRIDGE_CONFIG_ADDR, &pci->conf_mem);
>       sysbus_init_ioports(sbd, MCH_HOST_BRIDGE_CONFIG_ADDR, 4);
>   
> -    sysbus_add_io(sbd, MCH_HOST_BRIDGE_CONFIG_DATA, &pci->data_mem);
> +    memory_region_add_subregion(s->mch.address_space_io,
> +                                MCH_HOST_BRIDGE_CONFIG_DATA, &pci->data_mem);
>       sysbus_init_ioports(sbd, MCH_HOST_BRIDGE_CONFIG_DATA, 4);
>   
>       /* register q35 0xcf8 port as coalesced pio */

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



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

* Re: [PATCH v2 03/20] hw/i386/pc_q35: Reuse machine parameter
  2023-01-31 11:53 ` [PATCH v2 03/20] hw/i386/pc_q35: Reuse machine parameter Bernhard Beschow
@ 2023-01-31 13:49   ` Thomas Huth
  0 siblings, 0 replies; 31+ messages in thread
From: Thomas Huth @ 2023-01-31 13:49 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Marcel Apfelbaum, Eduardo Habkost,
	Laurent Vivier, Sunil Muthuswamy, qemu-trivial

On 31/01/2023 12.53, Bernhard Beschow wrote:
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/i386/pc_q35.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 83c57c6eb1..351ef25f69 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -218,7 +218,7 @@ static void pc_q35_init(MachineState *machine)
>       pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory,
>                      pci_hole64_size);
>   
> -    object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host));
> +    object_property_add_child(OBJECT(machine), "q35", OBJECT(q35_host));
>       object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM,
>                                OBJECT(ram_memory), NULL);
>       object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_PCI_MEM,

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



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

* Re: [PATCH v2 04/20] hw/i386/pc_q35: Resolve redundant q35_host variable
  2023-01-31 11:53 ` [PATCH v2 04/20] hw/i386/pc_q35: Resolve redundant q35_host variable Bernhard Beschow
@ 2023-01-31 13:53   ` Thomas Huth
  0 siblings, 0 replies; 31+ messages in thread
From: Thomas Huth @ 2023-01-31 13:53 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Marcel Apfelbaum, Eduardo Habkost,
	Laurent Vivier, Sunil Muthuswamy, qemu-trivial

On 31/01/2023 12.53, Bernhard Beschow wrote:
> The variable is redundant to "phb" and is never used by its real type.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/i386/pc_q35.c | 26 ++++++++++++--------------
>   1 file changed, 12 insertions(+), 14 deletions(-)

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



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

* Re: [PATCH v2 05/20] hw/i386/pc_{q35, piix}: Reuse MachineClass::desc as SMB product name
  2023-01-31 11:53 ` [PATCH v2 05/20] hw/i386/pc_{q35, piix}: Reuse MachineClass::desc as SMB product name Bernhard Beschow
@ 2023-01-31 13:55   ` Thomas Huth
  0 siblings, 0 replies; 31+ messages in thread
From: Thomas Huth @ 2023-01-31 13:55 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Marcel Apfelbaum, Eduardo Habkost,
	Laurent Vivier, Sunil Muthuswamy, qemu-trivial,
	Philippe Mathieu-Daudé

On 31/01/2023 12.53, Bernhard Beschow wrote:
> No need to repeat the descriptions.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/i386/pc_piix.c | 2 +-
>   hw/i386/pc_q35.c  | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)

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



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

* Re: [PATCH v2 06/20] hw/i386/pc_{q35,piix}: Minimize usage of get_system_memory()
  2023-01-31 11:53 ` [PATCH v2 06/20] hw/i386/pc_{q35, piix}: Minimize usage of get_system_memory() Bernhard Beschow
@ 2023-01-31 13:58   ` Thomas Huth
  0 siblings, 0 replies; 31+ messages in thread
From: Thomas Huth @ 2023-01-31 13:58 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Marcel Apfelbaum, Eduardo Habkost,
	Laurent Vivier, Sunil Muthuswamy, qemu-trivial

On 31/01/2023 12.53, Bernhard Beschow wrote:
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/i386/pc_piix.c | 2 +-
>   hw/i386/pc_q35.c  | 7 ++++---
>   2 files changed, 5 insertions(+), 4 deletions(-)

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



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

* Re: [PATCH v2 08/20] hw/i386/ich9: Rename Q35_MASK to ICH9_MASK
  2023-01-31 11:53 ` [PATCH v2 08/20] hw/i386/ich9: Rename Q35_MASK to ICH9_MASK Bernhard Beschow
@ 2023-01-31 14:00   ` Thomas Huth
  0 siblings, 0 replies; 31+ messages in thread
From: Thomas Huth @ 2023-01-31 14:00 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Marcel Apfelbaum, Eduardo Habkost,
	Laurent Vivier, Sunil Muthuswamy, qemu-trivial

On 31/01/2023 12.53, Bernhard Beschow wrote:
> The Q35_MASK macro is already defined by TYPE_Q35_HOST_DEVICE, so let
> TYPE_ICH9_LPC_DEVICE have its own one to prevent potential name clash.

Ouch, good catch!

> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   include/hw/i386/ich9.h | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)

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



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

* Re: [PATCH v2 10/20] hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus
  2023-01-31 11:53 ` [PATCH v2 10/20] hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus Bernhard Beschow
@ 2023-01-31 14:04   ` Thomas Huth
  0 siblings, 0 replies; 31+ messages in thread
From: Thomas Huth @ 2023-01-31 14:04 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Marcel Apfelbaum, Eduardo Habkost,
	Laurent Vivier, Sunil Muthuswamy, qemu-trivial

On 31/01/2023 12.53, Bernhard Beschow wrote:
> By using qdev_get_child_bus() we can eliminate ICH9LPCState::isa_bus and
> spare the ich9_lpc variable in pc_q35, too.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   include/hw/i386/ich9.h | 3 ---
>   hw/i386/pc_q35.c       | 4 +---
>   hw/isa/lpc_ich9.c      | 5 +----
>   3 files changed, 2 insertions(+), 10 deletions(-)

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



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

* Re: [PATCH v2 11/20] hw/isa/lpc_ich9: Reuse memory and io address space of PCI bus
  2023-01-31 11:53 ` [PATCH v2 11/20] hw/isa/lpc_ich9: Reuse memory and io address space of PCI bus Bernhard Beschow
@ 2023-02-01  0:02   ` Bernhard Beschow
  0 siblings, 0 replies; 31+ messages in thread
From: Bernhard Beschow @ 2023-02-01  0:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial



Am 31. Januar 2023 11:53:17 UTC schrieb Bernhard Beschow <shentey@gmail.com>:
>In pc_q35.c the PCI host bridge's io and memory space is initialized
>with get_system_memory() and get_system_io() respectively. Therefore,
>using pci_address_space() and pci_address_space_io() is equivalent.

Self-NACK: pci_address_space() != get_system_memory().

Please ignore this patch. This patch can be omitted from the series w/o any syntactic or semantic conflicts. I'll omit it in v3.

>All
>in all this makes the LPC function respect whatever memory spaces the
>PCI bus was set up with.
>
>Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>---
> hw/isa/lpc_ich9.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
>index 9ab966ef88..1b7e5585b3 100644
>--- a/hw/isa/lpc_ich9.c
>+++ b/hw/isa/lpc_ich9.c
>@@ -506,10 +506,10 @@ static void ich9_lpc_rcba_update(ICH9LPCState *lpc, uint32_t rcba_old)
>     uint32_t rcba = pci_get_long(lpc->d.config + ICH9_LPC_RCBA);
> 
>     if (rcba_old & ICH9_LPC_RCBA_EN) {
>-        memory_region_del_subregion(get_system_memory(), &lpc->rcrb_mem);
>+        memory_region_del_subregion(pci_address_space(&lpc->d), &lpc->rcrb_mem);
>     }
>     if (rcba & ICH9_LPC_RCBA_EN) {
>-        memory_region_add_subregion_overlap(get_system_memory(),
>+        memory_region_add_subregion_overlap(pci_address_space(&lpc->d),
>                                             rcba & ICH9_LPC_RCBA_BA_MASK,
>                                             &lpc->rcrb_mem, 1);
>     }
>@@ -695,7 +695,7 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
>         return;
>     }
> 
>-    isa_bus = isa_bus_new(DEVICE(d), get_system_memory(), get_system_io(),
>+    isa_bus = isa_bus_new(dev, pci_address_space(d), pci_address_space_io(d),
>                           errp);
>     if (!isa_bus) {
>         return;


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

* Re: [PATCH v2 19/20] hw/i386/ich9: Clean up includes
  2023-01-31 11:53 ` [PATCH v2 19/20] hw/i386/ich9: Clean up includes Bernhard Beschow
@ 2023-03-02 14:43   ` Igor Mammedov
  0 siblings, 0 replies; 31+ messages in thread
From: Igor Mammedov @ 2023-03-02 14:43 UTC (permalink / raw)
  To: Bernhard Beschow
  Cc: qemu-devel, Richard Henderson, Ani Sinha, Michael S. Tsirkin,
	Paolo Bonzini, BALATON Zoltan, Thomas Huth, Marcel Apfelbaum,
	Eduardo Habkost, Laurent Vivier, Sunil Muthuswamy, qemu-trivial

On Tue, 31 Jan 2023 12:53:25 +0100
Bernhard Beschow <shentey@gmail.com> wrote:

this lacks commit description explaining below movements

> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>  include/hw/i386/ich9.h | 8 +++++---
>  hw/i386/acpi-build.c   | 1 +
>  hw/isa/lpc_ich9.c      | 2 +-
>  3 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
> index d29090a9b7..3125863049 100644
> --- a/include/hw/i386/ich9.h
> +++ b/include/hw/i386/ich9.h
> @@ -1,11 +1,13 @@
>  #ifndef HW_ICH9_H
>  #define HW_ICH9_H
>  
> -#include "hw/sysbus.h"
> -#include "hw/i386/pc.h"
>  #include "hw/isa/apm.h"
> -#include "hw/acpi/acpi.h"
>  #include "hw/acpi/ich9.h"
> +#include "hw/intc/ioapic.h"
> +#include "hw/pci/pci.h"
> +#include "hw/pci/pci_device.h"
> +#include "exec/memory.h"
> +#include "qemu/notify.h"
>  #include "qom/object.h"
>  
>  void ich9_generate_smi(void);
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 127c4e2d50..266df7a153 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -59,6 +59,7 @@
>  #include "hw/acpi/pcihp.h"
>  #include "hw/i386/fw_cfg.h"
>  #include "hw/i386/ich9.h"
> +#include "hw/i386/pc.h"
>  #include "hw/pci/pci_bus.h"
>  #include "hw/pci-host/i440fx.h"
>  #include "hw/pci-host/q35.h"
> diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
> index 808c572ae4..f508f6071e 100644
> --- a/hw/isa/lpc_ich9.c
> +++ b/hw/isa/lpc_ich9.c
> @@ -40,8 +40,8 @@
>  #include "hw/irq.h"
>  #include "hw/isa/apm.h"
>  #include "hw/pci/pci.h"
> -#include "hw/pci/pci_bridge.h"
>  #include "hw/i386/ich9.h"
> +#include "hw/i386/pc.h"
>  #include "hw/acpi/acpi.h"
>  #include "hw/acpi/ich9.h"
>  #include "hw/pci/pci_bus.h"



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

end of thread, other threads:[~2023-03-02 14:44 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-31 11:53 [PATCH v2 00/20] PC and ICH9 cleanups Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 01/20] hw/pci-host/i440fx: Inline sysbus_add_io() Bernhard Beschow
2023-01-31 13:38   ` Thomas Huth
2023-01-31 11:53 ` [PATCH v2 02/20] hw/pci-host/q35: " Bernhard Beschow
2023-01-31 13:38   ` Thomas Huth
2023-01-31 11:53 ` [PATCH v2 03/20] hw/i386/pc_q35: Reuse machine parameter Bernhard Beschow
2023-01-31 13:49   ` Thomas Huth
2023-01-31 11:53 ` [PATCH v2 04/20] hw/i386/pc_q35: Resolve redundant q35_host variable Bernhard Beschow
2023-01-31 13:53   ` Thomas Huth
2023-01-31 11:53 ` [PATCH v2 05/20] hw/i386/pc_{q35, piix}: Reuse MachineClass::desc as SMB product name Bernhard Beschow
2023-01-31 13:55   ` Thomas Huth
2023-01-31 11:53 ` [PATCH v2 06/20] hw/i386/pc_{q35, piix}: Minimize usage of get_system_memory() Bernhard Beschow
2023-01-31 13:58   ` [PATCH v2 06/20] hw/i386/pc_{q35,piix}: " Thomas Huth
2023-01-31 11:53 ` [PATCH v2 07/20] hw/i386/pc: Initialize ram_memory variable directly Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 08/20] hw/i386/ich9: Rename Q35_MASK to ICH9_MASK Bernhard Beschow
2023-01-31 14:00   ` Thomas Huth
2023-01-31 11:53 ` [PATCH v2 09/20] hw/isa/lpc_ich9: Unexport PIRQ functions Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 10/20] hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus Bernhard Beschow
2023-01-31 14:04   ` Thomas Huth
2023-01-31 11:53 ` [PATCH v2 11/20] hw/isa/lpc_ich9: Reuse memory and io address space of PCI bus Bernhard Beschow
2023-02-01  0:02   ` Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 12/20] hw/i2c/smbus_ich9: Move ich9_smb_set_irq() in front of ich9_smbus_realize() Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 13/20] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 14/20] hw/i386/pc_q35: Allow for setting properties before realizing TYPE_ICH9_LPC_DEVICE Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 15/20] hw/isa/lpc_ich9: Connect pm stuff to lpc internally Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 16/20] hw/isa/lpc_ich9: Remove redundant ich9_lpc_reset() invocation Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 17/20] hw/i386/ich9: Remove redundant GSI_NUM_PINS Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 18/20] hw: Move ioapic*.h to intc/ Bernhard Beschow
2023-01-31 11:53 ` [PATCH v2 19/20] hw/i386/ich9: Clean up includes Bernhard Beschow
2023-03-02 14:43   ` Igor Mammedov
2023-01-31 11:53 ` [PATCH v2 20/20] hw: Move ich9.h to southbridge/ Bernhard Beschow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.