From: Bernhard Beschow <shentey@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Eduardo Habkost <eduardo@habkost.net>,
Paolo Bonzini <pbonzini@redhat.com>,
Sergio Lopez <slp@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Bernhard Beschow <shentey@gmail.com>
Subject: [PATCH 3/9] hw/i386/x86: Turn apic_xrupt_override into class attribute
Date: Thu, 8 Feb 2024 23:03:43 +0100 [thread overview]
Message-ID: <20240208220349.4948-4-shentey@gmail.com> (raw)
In-Reply-To: <20240208220349.4948-1-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>
---
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 6fe29fbb87..4dc30dcb4d 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 196827531a..12facf73b1 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -708,9 +708,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);
}
@@ -1807,6 +1804,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);
@@ -1826,6 +1824,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.43.0
next prev parent reply other threads:[~2024-02-08 22:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 22:03 [PATCH 0/9] Simplify initialization of PC machines Bernhard Beschow
2024-02-08 22:03 ` [PATCH 1/9] hw/i386/x86: Let ioapic_init_gsi() take parent as pointer Bernhard Beschow
2024-02-08 22:03 ` [PATCH 2/9] hw/i386/pc_piix: Share pc_cmos_init() invocation between pc and isapc machines Bernhard Beschow
2024-02-21 14:05 ` Philippe Mathieu-Daudé
2024-02-08 22:03 ` Bernhard Beschow [this message]
2024-02-21 14:08 ` [PATCH 3/9] hw/i386/x86: Turn apic_xrupt_override into class attribute Philippe Mathieu-Daudé
2024-02-08 22:03 ` [PATCH 4/9] hw/i386/pc: Merge pc_guest_info_init() into pc_machine_initfn() Bernhard Beschow
2024-02-09 9:17 ` Philippe Mathieu-Daudé
2024-02-08 22:03 ` [PATCH 5/9] hw/i386/pc: Defer smbios_set_defaults() to machine_done Bernhard Beschow
2024-02-21 15:53 ` Philippe Mathieu-Daudé
2024-02-08 22:03 ` [PATCH 6/9] hw/i386/pc: Confine system flash handling to pc_sysfw Bernhard Beschow
2024-02-21 16:09 ` Philippe Mathieu-Daudé
2024-02-08 22:03 ` [PATCH 7/9] hw/i386/pc_sysfw: Inline pc_system_flash_create() and remove it Bernhard Beschow
2024-02-21 16:10 ` Philippe Mathieu-Daudé
2024-02-08 22:03 ` [PATCH 8/9] hw/i386/pc: Populate RTC attribute directly Bernhard Beschow
2024-02-08 22:03 ` [PATCH 9/9] hw/i386/pc_{piix, q35}: Eliminate local pci_bus/pci_host variables Bernhard Beschow
2024-02-21 15:50 ` Philippe Mathieu-Daudé
2024-02-25 10:13 ` Bernhard Beschow
2024-02-13 18:50 ` [PATCH 0/9] Simplify initialization of PC machines Bernhard Beschow
2024-02-22 14:26 ` Philippe Mathieu-Daudé
2024-02-22 15:25 ` Michael S. Tsirkin
2024-02-24 14:02 ` Bernhard Beschow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240208220349.4948-4-shentey@gmail.com \
--to=shentey@gmail.com \
--cc=eduardo@habkost.net \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=slp@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).