ICH9 cleanup
cover ICH9 cleanup
This series includes ICH9 cleanups such as further QOM'ification, making it more self-contained, and reducing its x86/pc dependencies. While reducing x86 dependencies, the IOAPIC sources are moved from hw/i386 to hw/intc which is consistent with the header files.
The series was originally part of
https://lore.kernel.org/qemu-devel/[email protected]/ , a series which has been split into two (see Based-on tag below). It is a respin with Reviewd-By tags picked up.
Testing done:
* make check
* make check-avocado
* `qemu-system-x86_64 -M q35 -m 2G -cdrom \
manjaro-kde-21.3.2-220704-linux515.iso`
Based-on: [email protected]
"[PATCH v4 0/9] PC cleanups"
Bernhard Beschow (12):
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/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/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 | 6 ++--
hw/i386/pc_q35.c | 34 +++++++++---------
hw/intc/apic.c | 2 +-
hw/intc/ioapic.c | 4 +--
hw/intc/ioapic_common.c | 4 +--
hw/isa/lpc_ich9.c | 34 +++++++++---------
hw/pci-bridge/i82801b11.c | 2 +-
target/i386/whpx/whpx-all.c | 2 +-
tests/qtest/tco-test.c | 2 +-
20 files changed, 94 insertions(+), 113 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%)Signature · 1 line
2.39.1
PATCH 1/12 hw/i386/ich9: Rename Q35_MASK to ICH9_MASK
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.
--- include/hw/i386/ich9.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
include/hw/i386/ich9.h +5 -5
@@ -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
Signature · 1 line
2.39.1
Re: [PATCH 01/12] hw/i386/ich9: Rename Q35_MASK to ICH9_MASK
Quoted 8 lines · Bernhard Beschow
The
Q35_MASKmacro is already defined byTYPE_Q35_HOST_DEVICE, so letTYPE_ICH9_LPC_DEVICEhave its own one to prevent potential name clash.Signed-off-by Bernhard Beschow <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- include/hw/i386/ich9.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
PATCH 2/12 hw/isa/lpc_ich9: Unexport PIRQ functions
In reply to Bernhard BeschowNo 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.
--- 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(-)
include/hw/i386/ich9.h +0 -3
@@ -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);
hw/i386/pc_q35.c +0 -3
@@ -271,9 +271,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 ) {
hw/isa/lpc_ich9.c +8 -3
@@ -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)
Signature · 1 line
2.39.1
Re: [PATCH 02/12] hw/isa/lpc_ich9: Unexport PIRQ functions
Quoted 10 lines · 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 <[email protected]>--- 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(-)
PATCH 3/12 hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus
In reply to Bernhard BeschowBy using qdev_get_child_bus() we can eliminate ICH9LPCState::isa_bus and spare the ich9_lpc variable in pc_q35, too.
--- 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(-)
include/hw/i386/ich9.h +0 -3
@@ -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;
hw/i386/pc_q35.c +1 -3
@@ -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 ];
@@ -266,12 +265,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);
hw/isa/lpc_ich9.c +1 -4
@@ -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);
@@ -818,8 +816,7 @@ static void ich9_send_gpe(AcpiDeviceIf *adev, AcpiEventStatusBits ev)static void build_ich9_isa_aml (AcpiDevAmlIf *adev,Aml *scope) {Aml *field; -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 */
Signature · 1 line
2.39.1
Re: [PATCH 03/12] hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus
Quoted 10 lines · Bernhard Beschow
By using
qdev_get_child_bus()we can eliminateICH9LPCState::isa_busand spare theich9_lpcvariable inpc_q35, too.Signed-off-by Bernhard Beschow <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- 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(-)
PATCH 4/12 hw/i2c/smbus_ich9: Move ich9_smb_set_irq() in front of ich9_smbus_realize()
In reply to Bernhard BeschowThis is a preparation for the next commit to make it cleaner.
--- hw/i2c/smbus_ich9.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
hw/i2c/smbus_ich9.c +12 -12
@@ -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);
@@ -125,18 +137,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 =
Signature · 1 line
2.39.1
Re: [PATCH 04/12] hw/i2c/smbus_ich9: Move ich9_smb_set_irq() in front of ich9_smbus_realize()
Quoted 6 lines · Bernhard Beschow
This is a preparation for the next commit to make it cleaner.
Signed-off-by Bernhard Beschow <[email protected]>--- hw/i2c/smbus_ich9.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
PATCH 5/12 hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it
In reply to Bernhard Beschowich9_smb_init() is a legacy init function, so modernize the code.
Note that the smb_io_base parameter was unused.
--- 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(-)
include/hw/i386/ich9.h +0 -1
@@ -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 );
hw/i2c/smbus_ich9.c +3 -10
@@ -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)
@@ -137,16 +140,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 ,
hw/i386/pc_q35.c +8 -3
@@ -316,10 +316,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 ); }
Signature · 1 line
2.39.1
Re: [PATCH 05/12] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it
Quoted 3 lines · Bernhard Beschow
ich9_smb_init()is a legacy init function, so modernize the code.Note that the
smb_io_baseparameter was unused.
Quoted 78 lines
Signed-off-by Bernhard Beschow <[email protected]>--- 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(-)include/hw/i386/ich9.h +0
-1@@ -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 );hw/i2c/smbus_ich9.c +3
-10@@ -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)@@ -137,16 +140,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 ,hw/i386/pc_q35.c +8
-3@@ -316,10 +316,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 ); }Signature · 1 line
2.39.1
Re: [PATCH 05/12] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it
Quoted 27 lines · Corey Minyard
Quoted 3 lines · Bernhard Beschow
ich9_smb_init()is a legacy init function, so modernize the code.Note that the
smb_io_baseparameter was unused.Acked-by Corey Minyard <[email protected]>Quoted 20 lines
Signed-off-by Bernhard Beschow <[email protected]>--- 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(-)include/hw/i386/ich9.h +0
-1@@ -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 );
Quoted 11 lines
hw/i2c/smbus_ich9.c static void ich9_smbus_realize(PCIDevice *d, Error **errp) · line 110
Quoted 11 lines
hw/i2c/smbus_ich9.c +3
-0@@ -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;
Corey, shouldn't we expand pm_smbus_init() to take set_irq / opaque arguments?
Quoted 1 line
Quoted 1 line
hw/i2c/smbus_ich9.c +0
-0}
Re: [PATCH 05/12] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it
Quoted 31 lines · Philippe Mathieu-Daudé
Quoted 30 lines · Corey Minyard
Quoted 3 lines · Bernhard Beschow
ich9_smb_init()is a legacy init function, so modernize the code.Note that the
smb_io_baseparameter was unused.Acked-by Corey Minyard <[email protected]>Quoted 23 lines
Signed-off-by Bernhard Beschow <[email protected]>--- 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(-)include/hw/i386/ich9.h +0
-1@@ -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 );hw/i2c/smbus_ich9.c +0
-0@@ -105,6 +105,9 @@ static void ich9_smbus_realize(PCIDevice *d, Error **errp)pm_smbus_init (&d->qdev, &s->smb, false);
Quoted 8 lines
Quoted 5 lines
hw/i2c/smbus_ich9.c static void ich9_smbus_realize(PCIDevice *d, Error **errp) · line 110
Quoted 5 lines
hw/i2c/smbus_ich9.c +3
-0pci_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;Corey, shouldn't we expand
pm_smbus_init()to takeset_irq/ opaque arguments?
That would be nice, but the other two user of this function, hw/isa/vt82c686.c and hw/acpi/piix4.c, don't use these fields. I doubt we are getting any new users. I'm fine either way, but the value is not large.
-corey
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
hw/i2c/smbus_ich9.c +0
-0}
Philippe Mathieu-Daudé
Reviewed-byRe: [PATCH 05/12] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it
Quoted 41 lines · Corey Minyard
Quoted 31 lines · Philippe Mathieu-Daudé
Quoted 30 lines · Corey Minyard
Quoted 3 lines · Bernhard Beschow
ich9_smb_init()is a legacy init function, so modernize the code.Note that the
smb_io_baseparameter was unused.Acked-by Corey Minyard <[email protected]>Quoted 23 lines
Signed-off-by Bernhard Beschow <[email protected]>--- 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(-)include/hw/i386/ich9.h +0
-1@@ -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 );hw/i2c/smbus_ich9.c +0
-0@@ -105,6 +105,9 @@ static void ich9_smbus_realize(PCIDevice *d, Error **errp)pm_smbus_init (&d->qdev, &s->smb, false);Quoted 8 lines
Quoted 5 lines
hw/i2c/smbus_ich9.c static void ich9_smbus_realize(PCIDevice *d, Error **errp) · line 110
Quoted 5 lines
hw/i2c/smbus_ich9.c +3
-0pci_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;Corey, shouldn't we expand
pm_smbus_init()to takeset_irq/ opaque arguments?
Quoted 4 lines
That would be nice, but the other two user of this function,
hw/isa/vt82c686.candhw/acpi/piix4.c, don't use these fields. I doubt we are getting any new users. I'm fine either way, but the value is not large.
The value is in enforcing stricter APIs (providing good examples).
Re: [PATCH 05/12] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it
Quoted 42 lines · Philippe Mathieu-Daudé
Quoted 41 lines · Corey Minyard
Quoted 39 lines · Philippe Mathieu-Daudé
Quoted 27 lines · Corey Minyard
Quoted 3 lines · Bernhard Beschow
ich9_smb_init()is a legacy init function, so modernize the code.Note that the
smb_io_baseparameter was unused.Acked-by Corey Minyard <[email protected]>Quoted 20 lines
Signed-off-by Bernhard Beschow <[email protected]>--- 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(-)include/hw/i386/ich9.h +0
-1@@ -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 );hw/i2c/smbus_ich9.c +0
-1--- a/hw/i2c/smbus_ich9.cQuoted 8 lines
hw/i2c/smbus_ich9.c static void ich9_smbus_realize(PCIDevice *d, Error **errp) · line 110
Quoted 8 lines
+++
b/hw/i2c/smbus_ich9.chw/i2c/smbus_ich9.c +3
-0@@ -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;Corey, shouldn't we expand
pm_smbus_init()to takeset_irq/ opaque arguments?
Quoted 6 lines
Quoted 4 lines
That would be nice, but the other two user of this function,
hw/isa/vt82c686.candhw/acpi/piix4.c, don't use these fields. I doubt we are getting any new users. I'm fine either way, but the value is not large.The value is in enforcing stricter APIs (providing good examples).
I agree, and the change would be good, but IMHO it's beyond the scope of this change and would slow things down.
I'll prepare a patch that does this.
Thanks,
-corey
Quoted 4 lines
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
PATCH 6/12 hw/i386/pc_q35: Allow for setting properties before realizing TYPE_ICH9_LPC_DEVICE
In reply to Bernhard BeschowThis is a preparation to make the next patch cleaner.
--- hw/i386/pc_q35.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/i386/pc_q35.c +3 -3
@@ -236,9 +236,9 @@ static void pc_q35_init(MachineState *machine) phb =PCI_HOST_BRIDGE (q35_host); host_bus = phb->bus;/* 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,
Signature · 1 line
2.39.1
Re: [PATCH 06/12] hw/i386/pc_q35: Allow for setting properties before realizing TYPE_ICH9_LPC_DEVICE
Quoted 6 lines · Bernhard Beschow
This is a preparation to make the next patch cleaner.
Signed-off-by Bernhard Beschow <[email protected]>--- hw/i386/pc_q35.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
PATCH 7/12 hw/isa/lpc_ich9: Connect pm stuff to lpc internally
In reply to Bernhard BeschowMake 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.
--- 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(-)
include/hw/acpi/ich9.h +2 -4
@@ -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;
include/hw/i386/ich9.h +0 -2
@@ -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 */
hw/acpi/ich9.c +2 -6
@@ -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); }
hw/i386/pc_q35.c +2 -3
@@ -238,6 +238,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,
@@ -292,9 +294,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,
hw/isa/lpc_ich9.c +5 -3
@@ -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,
Signature · 1 line
2.39.1
Re: [PATCH 07/12] hw/isa/lpc_ich9: Connect pm stuff to lpc internally
Quoted 5 lines · Bernhard Beschow
Make
TYPE_ICH9_LPC_DEVICEmore self-contained by moving the call toich9_lpc_pm_init()from board code to its realize function. In order to propagatex86_machine_is_smm_enabled(), introduce an "smm-enabled" property like we have in piix4.
Quoted 8 lines
Signed-off-by Bernhard Beschow <[email protected]>--- 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(-)
PATCH 8/12 hw/isa/lpc_ich9: Remove redundant ich9_lpc_reset() invocation
In reply to Bernhard Beschowich9_lpc_reset() is the dc->reset callback which is called automatically. No need to call it explicitly during k->realize.
--- hw/isa/lpc_ich9.c | 4 ---- 1 file changed, 4 deletions(-)
hw/isa/lpc_ich9.c +0 -4
@@ -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 */
Signature · 1 line
2.39.1
Re: [PATCH 08/12] hw/isa/lpc_ich9: Remove redundant ich9_lpc_reset() invocation
Quoted 7 lines · Bernhard Beschow
ich9_lpc_reset()is thedc->resetcallback which is called automatically. No need to call it explicitly duringk->realize.Signed-off-by Bernhard Beschow <[email protected]>--- hw/isa/lpc_ich9.c | 4 ---- 1 file changed, 4 deletions(-)
PATCH 9/12 hw/i386/ich9: Remove redundant GSI_NUM_PINS
In reply to Bernhard BeschowMost 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.
--- 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(-)
include/hw/i386/ich9.h +1 -1
@@ -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) \
include/hw/i386/x86.h +0 -1
@@ -136,7 +136,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 {
hw/i386/pc.c +3 -3
@@ -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 ;
hw/i386/pc_q35.c +2 -1
@@ -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"
@@ -268,7 +269,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" ));
hw/isa/lpc_ich9.c +1 -1
@@ -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);
Signature · 1 line
2.39.1
Re: [PATCH 09/12] hw/i386/ich9: Remove redundant GSI_NUM_PINS
Quoted 4 lines · Bernhard Beschow
Most code uses
IOAPIC_NUM_PINS. The only place whereGSI_NUM_PINSdefines the size of an array isICH9LPCState::gsiwhich needs to matchIOAPIC_NUM_PINS. RemoveGSI_NUM_PINSfor consistency.
Quoted 8 lines
Signed-off-by Bernhard Beschow <[email protected]>--- 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(-)
PATCH 10/12 hw: Move ioapic*.h to intc/
In reply to Bernhard BeschowThe ioapic sources reside in hw/intc already. Move the headers there as well.
---
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%)MAINTAINERS +1 -0
@@ -1708,6 +1708,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
include/hw/i386/x86.h +1 -1
@@ -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 {
include/hw/intc/ioapic.h renamed from include/hw/i386/ioapic.h +3 -3
@@ -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 */
include/hw/intc/ioapic_internal.h renamed from include/hw/i386/ioapic_internal.h +4 -4
@@ -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 */
hw/i386/kvm/ioapic.c +1 -2
@@ -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"
hw/i386/pc.c +1 -1
@@ -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"
hw/i386/pc_q35.c +1 -1
@@ -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"
hw/intc/apic.c +1 -1
@@ -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"
hw/intc/ioapic.c +2 -2
@@ -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"
hw/intc/ioapic_common.c +2 -2
@@ -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,
target/i386/whpx/whpx-all.c +1 -1
@@ -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"
Signature · 1 line
2.39.1
Re: [PATCH 10/12] hw: Move ioapic*.h to intc/
Quoted 9 lines · Bernhard Beschow
The ioapic sources reside in hw/intc already. Move the headers there as well.
Signed-off-by Bernhard Beschow <[email protected]>--- MAINTAINERS | 1 + include/hw/i386/x86.h | 2 +- include/hw/{i386 => intc}/ioapic.h | 6 +++--- include/hw/{i386 => intc}/ioapic_internal.h | 8 ++++----
Quoted 10 lines
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%) renameinclude/hw/{i386=>intc}/ioapic_internal.h(96%)
PATCH 11/12 hw/i386/ich9: Clean up includes
In reply to Bernhard Beschow--- 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(-)
include/hw/i386/ich9.h +5 -3
@@ -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 );
hw/i386/acpi-build.c +1 -0
@@ -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"
hw/isa/lpc_ich9.c +1 -1
@@ -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"
Signature · 1 line
2.39.1
Re: [PATCH 11/12] hw/i386/ich9: Clean up includes
Quoted 6 lines · Bernhard Beschow
Signed-off-by Bernhard Beschow <[email protected]>--- 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(-)
PATCH 12/12 hw: Move ich9.h to southbridge/
In reply to Bernhard BeschowICH9 is a south bridge which doesn't necessarily depend on x86, so move it into the southbridge folder, analoguous to PIIX.
---
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%)MAINTAINERS +1 -0
@@ -1675,6 +1675,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
include/hw/southbridge/ich9.h renamed from include/hw/i386/ich9.h +3 -3
@@ -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 */
hw/acpi/ich9.c +1 -1
@@ -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"
hw/acpi/ich9_tco.c +1 -1
@@ -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"
hw/i2c/smbus_ich9.c +1 -1
@@ -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"
hw/i386/acpi-build.c +1 -1
@@ -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"
hw/i386/pc_q35.c +1 -1
@@ -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"
hw/isa/lpc_ich9.c +1 -1
@@ -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"
hw/pci-bridge/i82801b11.c +1 -1
@@ -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 */
tests/qtest/tco-test.c +1 -1
@@ -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"
Signature · 1 line
2.39.1
Re: [PATCH 12/12] hw: Move ich9.h to southbridge/
Quoted 16 lines · 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 <[email protected]>--- 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(-)
Quoted 1 line
rename
include/hw/{i386=>southbridge}/ich9.h(99%)
Re: [PATCH 12/12] hw: Move ich9.h to southbridge/
In reply to Bernhard BeschowQuoted 2 lines · Bernhard Beschow
ICH9 is a south bridge which doesn't necessarily depend on x86, so move it into the southbridge folder, analoguous to PIIX.
However it is still tied to it due to:
hw/isa/lpc_ich9.c:315: cpu_interrupt(first_cpu, CPU_INTERRUPT_SMI);hw/isa/lpc_ich9.c:462: cpu_interrupt(cs, CPU_INTERRUPT_SMI);hw/isa/lpc_ich9.c:465: cpu_interrupt(current_cpu, CPU_INTERRUPT_SMI);
target/i386/cpu.h:1145:#define CPU_INTERRUPT_SMI CPU_INTERRUPT_TGT_EXT_2
Quoted 14 lines
Signed-off-by Bernhard Beschow <[email protected]>--- 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%)
Re: [PATCH 12/12] hw: Move ich9.h to southbridge/
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Bernhard Beschow
ICH9 is a south bridge which doesn't necessarily depend on x86, so move it into the southbridge folder, analoguous to PIIX.
However it is still tied to it due to:
hw/isa/lpc_ich9.c:315:cpu_interrupt(first_cpu, CPU_INTERRUPT_SMI);hw/isa/lpc_ich9.c:462:cpu_interrupt(cs, CPU_INTERRUPT_SMI);hw/isa/lpc_ich9.c:465: cpu_interrupt(current_cpu,CPU_INTERRUPT_SMI);
target/i386/cpu.h:1145:#defineCPU_INTERRUPT_SMICPU_INTERRUPT_TGT_EXT_2
I guess at least the commit log should be changed then.
Quoted 14 lines
Quoted 14 lines
Signed-off-by Bernhard Beschow <[email protected]>--- 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%)