[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 21/30] hw/i386/x86: Let ioapic_init_gsi() take parent as pointer
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 21/30] hw/i386/x86: Let ioapic_init_gsi() take parent as pointer |
Date: |
Tue, 27 Feb 2024 09:39:37 +0100 |
From: Bernhard Beschow <shentey@gmail.com>
Rather than taking a QOM name which has to be resolved, let's pass the parent
directly as pointer. This simplifies the code.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-ID: <20240224135851.100361-2-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/i386/x86.h | 2 +-
hw/i386/microvm.c | 2 +-
hw/i386/pc_piix.c | 7 +++----
hw/i386/pc_q35.c | 2 +-
hw/i386/x86.c | 7 +++----
5 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index 8e306db7bb..4dc30dcb4d 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -139,7 +139,7 @@ typedef struct GSIState {
qemu_irq x86_allocate_cpu_irq(void);
void gsi_handler(void *opaque, int n, int level);
-void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
+void ioapic_init_gsi(GSIState *gsi_state, Object *parent);
DeviceState *ioapic_init_secondary(GSIState *gsi_state);
/* pc_sysfw.c */
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index ca55aecc3b..61a772dfe6 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -175,7 +175,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)
&error_abort);
isa_bus_register_input_irqs(isa_bus, x86ms->gsi);
- ioapic_init_gsi(gsi_state, "machine");
+ ioapic_init_gsi(gsi_state, OBJECT(mms));
if (ioapics > 1) {
x86ms->ioapic2 = ioapic_init_secondary(gsi_state);
}
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index ec7c07b362..7724396ead 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -107,6 +107,7 @@ static void pc_init1(MachineState *machine,
X86MachineState *x86ms = X86_MACHINE(machine);
MemoryRegion *system_memory = get_system_memory();
MemoryRegion *system_io = get_system_io();
+ Object *phb = NULL;
PCIBus *pci_bus = NULL;
ISABus *isa_bus;
Object *piix4_pm = NULL;
@@ -189,8 +190,6 @@ static void pc_init1(MachineState *machine,
}
if (pcmc->pci_enabled) {
- Object *phb;
-
pci_memory = g_new(MemoryRegion, 1);
memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
rom_memory = pci_memory;
@@ -303,8 +302,8 @@ static void pc_init1(MachineState *machine,
pc_i8259_create(isa_bus, gsi_state->i8259_irq);
}
- if (pcmc->pci_enabled) {
- ioapic_init_gsi(gsi_state, "i440fx");
+ if (phb) {
+ ioapic_init_gsi(gsi_state, phb);
}
if (tcg_enabled()) {
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 53fb3db26d..c89ff63579 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -263,7 +263,7 @@ static void pc_q35_init(MachineState *machine)
pc_i8259_create(isa_bus, gsi_state->i8259_irq);
}
- ioapic_init_gsi(gsi_state, "q35");
+ ioapic_init_gsi(gsi_state, OBJECT(phb));
if (tcg_enabled()) {
x86_register_ferr_irq(x86ms->gsi[13]);
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 684dce90e9..807e09bcdb 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -640,20 +640,19 @@ void gsi_handler(void *opaque, int n, int level)
}
}
-void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name)
+void ioapic_init_gsi(GSIState *gsi_state, Object *parent)
{
DeviceState *dev;
SysBusDevice *d;
unsigned int i;
- assert(parent_name);
+ assert(parent);
if (kvm_ioapic_in_kernel()) {
dev = qdev_new(TYPE_KVM_IOAPIC);
} else {
dev = qdev_new(TYPE_IOAPIC);
}
- object_property_add_child(object_resolve_path(parent_name, NULL),
- "ioapic", OBJECT(dev));
+ object_property_add_child(parent, "ioapic", OBJECT(dev));
d = SYS_BUS_DEVICE(dev);
sysbus_realize_and_unref(d, &error_fatal);
sysbus_mmio_map(d, 0, IO_APIC_DEFAULT_ADDRESS);
--
2.41.0
- [PULL 10/30] hw/acpi: move object_resolve_type_unambiguous to core QOM, (continued)
- [PULL 10/30] hw/acpi: move object_resolve_type_unambiguous to core QOM, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 11/30] hw/ppc/sam460ex: do not use usb_bus_find(), Philippe Mathieu-Daudé, 2024/02/27
- [PULL 12/30] hw/sh4/r2d: do not use usb_bus_find(), Philippe Mathieu-Daudé, 2024/02/27
- [PULL 13/30] hw/mips/loongson3_virt: do not require CONFIG_USB, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 14/30] hw/hppa: do not require CONFIG_USB, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 16/30] hw/ppc/pseries: do not require CONFIG_USB, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 17/30] hw/usb: remove usb_bus_find, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 15/30] hw/ppc/mac_newworld: do not require CONFIG_USB, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 18/30] hw/usb: extract sysbus-ohci to a separate file, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 19/30] hw/usb: remove duplicate file in system_ss, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 21/30] hw/i386/x86: Let ioapic_init_gsi() take parent as pointer,
Philippe Mathieu-Daudé <=
- [PULL 22/30] hw/i386/sgx: Use QDev API, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 20/30] hw/nvme: fix invalid endian conversion, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 23/30] hw/i386/q35: Include missing 'hw/acpi/acpi.h' header, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 24/30] hw/i386/pc: Rename "bus" attribute to "pcibus", Philippe Mathieu-Daudé, 2024/02/27
- [PULL 25/30] hw/i386/pc_{piix, q35}: Eliminate local pci_bus/pci_host variables, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 26/30] hw/i386/pc: Remove unneeded class attribute "kvmclock_enabled", Philippe Mathieu-Daudé, 2024/02/27
- [PULL 27/30] hw/i386/pc: Populate RTC attribute directly, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 28/30] hw/arm/sbsa-ref: Do not open-code ahci_ide_create_devs(), Philippe Mathieu-Daudé, 2024/02/27
- [PULL 29/30] hw/ide: Remove last two uses of ide/internal.h outside of hw/ide/, Philippe Mathieu-Daudé, 2024/02/27
- [PULL 30/30] hw/ide: Include 'ide-internal.h' from current path, Philippe Mathieu-Daudé, 2024/02/27