[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/25] hw/i386/x86: Turn apic_xrupt_override into class attribute
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 11/25] hw/i386/x86: Turn apic_xrupt_override into class attribute |
Date: |
Wed, 21 Feb 2024 22:16:11 +0100 |
From: Bernhard Beschow <shentey@gmail.com>
The attribute isn't user-changeable and only true for pc-based machines. Turn it
into a class attribute which allows for inlining pc_guest_info_init() into
pc_machine_initfn().
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240208220349.4948-4-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/i386/x86.h | 3 ++-
hw/i386/acpi-common.c | 3 ++-
hw/i386/pc.c | 5 ++---
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index da19ae1546..8e306db7bb 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -34,6 +34,8 @@ struct X86MachineClass {
bool save_tsc_khz;
/* use DMA capable linuxboot option rom */
bool fwcfg_dma_enabled;
+ /* CPU and apic information: */
+ bool apic_xrupt_override;
};
struct X86MachineState {
@@ -57,7 +59,6 @@ struct X86MachineState {
uint64_t above_4g_mem_start;
/* CPU and apic information: */
- bool apic_xrupt_override;
unsigned pci_irq_mask;
unsigned apic_id_limit;
uint16_t boot_cpus;
diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c
index 43dc23f7e0..cea4b3d71c 100644
--- a/hw/i386/acpi-common.c
+++ b/hw/i386/acpi-common.c
@@ -100,6 +100,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
int i;
bool x2apic_mode = false;
MachineClass *mc = MACHINE_GET_CLASS(x86ms);
+ X86MachineClass *x86mc = X86_MACHINE_GET_CLASS(x86ms);
const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(x86ms));
AcpiTable table = { .sig = "APIC", .rev = 3, .oem_id = oem_id,
.oem_table_id = oem_table_id };
@@ -122,7 +123,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
IO_APIC_SECONDARY_ADDRESS, IO_APIC_SECONDARY_IRQBASE);
}
- if (x86ms->apic_xrupt_override) {
+ if (x86mc->apic_xrupt_override) {
build_xrupt_override(table_data, 0, 2,
0 /* Flags: Conforms to the specifications of the bus */);
}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 1733dffc00..d7183780bd 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -700,9 +700,6 @@ void pc_machine_done(Notifier *notifier, void *data)
void pc_guest_info_init(PCMachineState *pcms)
{
- X86MachineState *x86ms = X86_MACHINE(pcms);
-
- x86ms->apic_xrupt_override = true;
pcms->machine_done.notify = pc_machine_done;
qemu_add_machine_init_done_notifier(&pcms->machine_done);
}
@@ -1795,6 +1792,7 @@ static bool pc_hotplug_allowed(MachineState *ms,
DeviceState *dev, Error **errp)
static void pc_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
+ X86MachineClass *x86mc = X86_MACHINE_CLASS(oc);
PCMachineClass *pcmc = PC_MACHINE_CLASS(oc);
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
@@ -1814,6 +1812,7 @@ static void pc_machine_class_init(ObjectClass *oc, void
*data)
pcmc->pvh_enabled = true;
pcmc->kvmclock_create_always = true;
pcmc->resizable_acpi_blob = true;
+ x86mc->apic_xrupt_override = true;
assert(!mc->get_hotplug_handler);
mc->get_hotplug_handler = pc_get_hotplug_handler;
mc->hotplug_allowed = pc_hotplug_allowed;
--
2.41.0
- [PULL 01/25] hw/input/pckbd: Open-code i8042_setup_a20_line() wrapper, (continued)
- [PULL 01/25] hw/input/pckbd: Open-code i8042_setup_a20_line() wrapper, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 02/25] hw/sysbus: Inline and remove sysbus_add_io(), Philippe Mathieu-Daudé, 2024/02/21
- [PULL 03/25] hw/ppc/ppc4xx_pci: Remove unused "hw/ppc/ppc.h" header, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 04/25] hw/ppc/ppc4xx_pci: Extract PCI host definitions to hw/pci-host/ppc4xx.h, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 05/25] hw/ppc/ppc4xx_pci: Move ppc4xx_pci.c to hw/pci-host/, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 06/25] hw/ppc/ppc440_pcix: Move ppc440_pcix.c to hw/pci-host/, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 07/25] hw/i2c/smbus_slave: Add object path on error prints, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 08/25] hw/i386/pc_piix: Share pc_cmos_init() invocation between pc and isapc machines, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 09/25] hw/i386/pc: Store pointers to IDE buses in PCMachineState, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 10/25] hw/i386/pc: Do pc_cmos_init_late() from pc_machine_done(), Philippe Mathieu-Daudé, 2024/02/21
- [PULL 11/25] hw/i386/x86: Turn apic_xrupt_override into class attribute,
Philippe Mathieu-Daudé <=
- [PULL 12/25] hw/i386/pc: Merge pc_guest_info_init() into pc_machine_initfn(), Philippe Mathieu-Daudé, 2024/02/21
- [PULL 13/25] hw/i386/pc: Defer smbios_set_defaults() to machine_done, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 14/25] hw/i386/pc: Confine system flash handling to pc_sysfw, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 15/25] hw/i386/pc_sysfw: Inline pc_system_flash_create() and remove it, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 16/25] hw/i386/pc_q35: Populate interrupt handlers before realizing LPC PCI function, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 17/25] hw/isa/meson.build: Sort alphabetically, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 18/25] hw/ide: Add the possibility to disable the CompactFlash device in the build, Philippe Mathieu-Daudé, 2024/02/21
- [PULL 19/25] hw/ide: Split qdev.c into ide-bus.c and ide-dev.c, Philippe Mathieu-Daudé, 2024/02/21