From nobody Fri Oct 18 06:19:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1707429977; cv=none; d=zohomail.com; s=zohoarc; b=Qr49PkLJj7HFyQm9TqsNez7uBYPHi63yoDB57nntmdCo+SjMpW5RfFF/D/DywEKu/IB50J9FCdHKgsYNvHSMB9eysLcJOueX0sj4bEMjdiyPJr2sxVHHxHJpXn3LDgCtaaqMtTUiShU9eQhrD71fBBUZf2CPNxgKLg1VFWUGXd8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707429977; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kGkMYPa+RTmey7fKt7GCaGAdkjjOt2z+kR77UOLngnA=; b=ivzBPKsVpoaaN4qDkELwnviag92/XKbjuYWZK/Qy2jP2dHtRa6XkOHeArrESaV7A9YfuwEKoyroRloowFJpd5ZcjbATWzQTNc+XesPXsX1VvR1W36aH80mfyqYmNSvaEQSjLZX+WARrXq3aqAt1jWrXltj63RwRdNifT/eWKDos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707429977955484.18075354130826; Thu, 8 Feb 2024 14:06:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYCV3-0007Fw-6W; Thu, 08 Feb 2024 17:04:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rYCV1-0007EK-DW for qemu-devel@nongnu.org; Thu, 08 Feb 2024 17:04:03 -0500 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rYCUz-0005DZ-J8 for qemu-devel@nongnu.org; Thu, 08 Feb 2024 17:04:03 -0500 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a370e7e1e02so33473166b.0 for ; Thu, 08 Feb 2024 14:04:01 -0800 (PST) Received: from archlinux.. (pd95ed842.dip0.t-ipconnect.de. [217.94.216.66]) by smtp.gmail.com with ESMTPSA id ti9-20020a170907c20900b00a3109a492d4sm109753ejc.20.2024.02.08.14.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 14:03:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707429839; x=1708034639; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kGkMYPa+RTmey7fKt7GCaGAdkjjOt2z+kR77UOLngnA=; b=ErTRD+1sKzeCzmbNbeV/qYQL+tHjPB5a57hpe4MbDoUjUw/uKFUPwylN01Psrgx1BX INePWk0o51uRG8JjlUbPcaagC12toprgvW0B2v2fZskq93n1r9wfQ1uo4kneStNouLvD NUDFKhTNQ0QVayToaOuXJxAjmMCyT+EFMgRssf17Yx7WKD2W4eq+trVkgN5JPBn0c/PD xJj06i1GfDX0SvdLqCqlWGd0QZ8l4P1KJodrHXRKdGh/Yv/yuQfeC+yX1BIgoYYwErMq hCEEgXbctEpmA8DkIRGvrulsSB7FMaE3BmKSp8h+KXDIkVEgMXNUqN8bD3N7wXVuve2o xn0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707429839; x=1708034639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kGkMYPa+RTmey7fKt7GCaGAdkjjOt2z+kR77UOLngnA=; b=pfB+cR2IZF/6yPdNxn3CFGoTYYV2rrqzDKeJM+F2ktIUQHtnkVAuH4srkcm7t5II9v y8OkbK6HxtqX0bwSg7Jr1HsZ8l6+G34iQdqJhEK1UOjOoOgA/rGqGTBgSzjGuvPVbxjj PDXkwFjOo+uRGZL2uiv5Z6hMLOipDazeEg6Kk7HNdSlsHVaidFM834LM1tXpcH3ynDKJ Se33Ntf3QupVB8EQCenVCN91EUfFXMJ9Dp6rHWVSFGZtugGQD2OorMjIhl7a3sc7IIB3 1yFqL/HZC6ZSEzCKjD7z1/E07MyKW2Lus77ys6Xx0lz5+fubam2sdmEwN+WBaEE/JDS+ R30A== X-Gm-Message-State: AOJu0YzvxVzU4gCAapORQjgFnaRdLHU4Nm6ozX4PD2HLjEimZjS0hrdR dQuV1NXKmnG9EL++gr0bGItH2mDUM9AC9LrhEu2belB0VJnTbmycZA1moRS+ X-Google-Smtp-Source: AGHT+IE70RhJvm38m4K85ijmn6DrkCmTf5Z/Do+Ow2gedNT3DNH3MkJd9uJecMDbTP4tAdZ/ReuZ9w== X-Received: by 2002:a17:906:fc09:b0:a38:5cf1:b58 with SMTP id ov9-20020a170906fc0900b00a385cf10b58mr437105ejb.47.1707429839171; Thu, 08 Feb 2024 14:03:59 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVTP5j4+eaVgRgr9gGGYsJplIhXQbB7Sc8/MO7oPlYuHJl0v/0bn8Z41U4wMNUvdQdwXQfPFgkHr6OdUkKKaWq/f73HAnkVNqDN4uP56en6uZ64QyLkBLzP3qzTP74aZCa2NQbBXyXbZGJZk9jbewVVOhRPi5wbcopDmDJ3hYr71ofZF9k0wnAeR5gt+gxb+TPSJCHHzaEMOneXBGGHvumF/Y5VuTkK1VdWKhNNexE/bJZTPj5S From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Eduardo Habkost , Paolo Bonzini , Sergio Lopez , Richard Henderson , Marcel Apfelbaum , Bernhard Beschow Subject: [PATCH 3/9] hw/i386/x86: Turn apic_xrupt_override into class attribute Date: Thu, 8 Feb 2024 23:03:43 +0100 Message-ID: <20240208220349.4948-4-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240208220349.4948-1-shentey@gmail.com> References: <20240208220349.4948-1-shentey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=shentey@gmail.com; helo=mail-ej1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1707429978956100003 Content-Type: text/plain; charset="utf-8" The attribute isn't user-changeable and only true for pc-based machines. Tu= rn it into a class attribute which allows for inlining pc_guest_info_init() into pc_machine_initfn(). Signed-off-by: Bernhard Beschow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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; }; =20 struct X86MachineState { @@ -57,7 +59,6 @@ struct X86MachineState { uint64_t above_4g_mem_start; =20 /* 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 *li= nker, int i; bool x2apic_mode =3D false; MachineClass *mc =3D MACHINE_GET_CLASS(x86ms); + X86MachineClass *x86mc =3D X86_MACHINE_GET_CLASS(x86ms); const CPUArchIdList *apic_ids =3D mc->possible_cpu_arch_ids(MACHINE(x8= 6ms)); AcpiTable table =3D { .sig =3D "APIC", .rev =3D 3, .oem_id =3D oem_id, .oem_table_id =3D oem_table_id }; @@ -122,7 +123,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *li= nker, IO_APIC_SECONDARY_ADDRESS, IO_APIC_SECONDARY_IRQBASE); } =20 - 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) =20 void pc_guest_info_init(PCMachineState *pcms) { - X86MachineState *x86ms =3D X86_MACHINE(pcms); - - x86ms->apic_xrupt_override =3D true; pcms->machine_done.notify =3D pc_machine_done; qemu_add_machine_init_done_notifier(&pcms->machine_done); } @@ -1807,6 +1804,7 @@ static bool pc_hotplug_allowed(MachineState *ms, Devi= ceState *dev, Error **errp) static void pc_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); + X86MachineClass *x86mc =3D X86_MACHINE_CLASS(oc); PCMachineClass *pcmc =3D PC_MACHINE_CLASS(oc); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); =20 @@ -1826,6 +1824,7 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) pcmc->pvh_enabled =3D true; pcmc->kvmclock_create_always =3D true; pcmc->resizable_acpi_blob =3D true; + x86mc->apic_xrupt_override =3D true; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler =3D pc_get_hotplug_handler; mc->hotplug_allowed =3D pc_hotplug_allowed; --=20 2.43.0