From nobody Fri Dec 19 16:02:07 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1593723297; cv=none; d=zohomail.com; s=zohoarc; b=Sn76tZGA9Vr93WAfUr7VUsGdQ08+jl55Efu2iwD2sFXaMixv2IYsP68wAfmql8y7doDtNJRxS31u+wqePnRd5dk4F0qZxPBdv/98847WPUozSw34CHM6b+yiQqSLIvVxwurDoxADthoVkPhub984US21xRt0wbUbIVHjtuDmvmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593723297; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=XpNi9BQIh6/R6UoPCwT5bpaemfP+wPb347uCIeZgrio=; b=eBlmYbOvpghUn9/QZh11TT17w8mgyiFVWHcQaFfBxMY0Z1qNQmeGe0fdHDdkVDSBW7+HHXNbK0MIpIaD2eW7mzt7cY2WDMSDnxbA7chsOJiOMMeDt3/OS/WWfvAxXbWIX4Fg7zDWmlIi25wBbk/FW3FsLHTLB5FOVvENbBCSVz4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593723297126521.0275149756748; Thu, 2 Jul 2020 13:54:57 -0700 (PDT) Received: from localhost ([::1]:49906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jr6ER-0004fs-Ns for importer@patchew.org; Thu, 02 Jul 2020 16:54:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jr69G-0004nf-VD for qemu-devel@nongnu.org; Thu, 02 Jul 2020 16:49:35 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:25638 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jr69B-0003a9-Ia for qemu-devel@nongnu.org; Thu, 02 Jul 2020 16:49:34 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-142-DWX1WejbPxmn5QjawD5ByQ-1; Thu, 02 Jul 2020 16:49:27 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DA05B193248C; Thu, 2 Jul 2020 20:49:25 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-62.ams2.redhat.com [10.36.112.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31BAD7742D; Thu, 2 Jul 2020 20:49:15 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6E8B331EE7; Thu, 2 Jul 2020 22:49:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593722968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=XpNi9BQIh6/R6UoPCwT5bpaemfP+wPb347uCIeZgrio=; b=Z41rElcPnKWhTcAfqlPCDFeudPKu2MIBtPDc2tvwBEjxOyEkfd21pzBoMttPL7zS085nqC clC2D639cv4Z35vFCHoY6G0jxixaL67dIVN8liyLKKzr5Yst3SHOjent6YF8TsgcQkgmvO BKKkLqGkfqigdxL1BNtfzQ4w6xmY+c4= X-MC-Unique: DWX1WejbPxmn5QjawD5ByQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v4 14/21] x86: move acpi_dev from pc/microvm Date: Thu, 2 Jul 2020 22:48:52 +0200 Message-Id: <20200702204859.9876-15-kraxel@redhat.com> In-Reply-To: <20200702204859.9876-1-kraxel@redhat.com> References: <20200702204859.9876-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=205.139.110.61; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/02 03:42:59 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Eduardo Habkost , Sergio Lopez , "Michael S. Tsirkin" , Shannon Zhao , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Igor Mammedov , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Both pc and microvm machine types have a acpi_dev field. Move it to the common base type. Signed-off-by: Gerd Hoffmann --- include/hw/i386/microvm.h | 1 - include/hw/i386/pc.h | 1 - include/hw/i386/x86.h | 1 + hw/i386/acpi-build.c | 2 +- hw/i386/acpi-microvm.c | 5 +++-- hw/i386/microvm.c | 10 ++++++---- hw/i386/pc.c | 34 +++++++++++++++++++--------------- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- 9 files changed, 32 insertions(+), 26 deletions(-) diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h index b6e0d4395af7..b8ec99aeb051 100644 --- a/include/hw/i386/microvm.h +++ b/include/hw/i386/microvm.h @@ -66,7 +66,6 @@ typedef struct { bool kernel_cmdline_fixed; Notifier machine_done; Notifier powerdown_req; - AcpiDeviceIf *acpi_dev; } MicrovmMachineState; =20 #define TYPE_MICROVM_MACHINE MACHINE_TYPE_NAME("microvm") diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index dce1273c7dad..5e4126fe817d 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -29,7 +29,6 @@ struct PCMachineState { Notifier machine_done; =20 /* Pointers to devices and objects: */ - HotplugHandler *acpi_dev; PCIBus *bus; I2CBus *smbus; PFlashCFI01 *flash[2]; diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index a350ea3609f5..de74c831c3ab 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -50,6 +50,7 @@ typedef struct { FWCfgState *fw_cfg; qemu_irq *gsi; GMappedFile *initrd_mapped_file; + HotplugHandler *acpi_dev; =20 /* RAM information (sizes, addresses, configuration): */ ram_addr_t below_4g_mem_size, above_4g_mem_size; diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b7bcbbbb2a35..c356cc71fe08 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2431,7 +2431,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) =20 acpi_add_table(table_offsets, tables_blob); acpi_build_madt(tables_blob, tables->linker, x86ms, - ACPI_DEVICE_IF(pcms->acpi_dev), true); + ACPI_DEVICE_IF(x86ms->acpi_dev), true); =20 vmgenid_dev =3D find_vmgenid_dev(); if (vmgenid_dev) { diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c index 20f297517457..5856b37a06db 100644 --- a/hw/i386/acpi-microvm.c +++ b/hw/i386/acpi-microvm.c @@ -108,7 +108,7 @@ build_dsdt_microvm(GArray *table_data, BIOSLinker *link= er, sb_scope =3D aml_scope("_SB"); fw_cfg_add_acpi_dsdt(sb_scope, x86ms->fw_cfg); isa_build_aml(ISA_BUS(isabus), sb_scope); - build_ged_aml(sb_scope, GED_DEVICE, HOTPLUG_HANDLER(mms->acpi_dev), + build_ged_aml(sb_scope, GED_DEVICE, x86ms->acpi_dev, GED_MMIO_IRQ, AML_SYSTEM_MEMORY, GED_MMIO_BASE); acpi_dsdt_add_power_button(sb_scope); acpi_dsdt_add_virtio(sb_scope, mms); @@ -135,6 +135,7 @@ static void acpi_build_microvm(AcpiBuildTables *tables, MicrovmMachineState *mms) { MachineState *machine =3D MACHINE(mms); + X86MachineState *x86ms =3D X86_MACHINE(mms); GArray *table_offsets; GArray *tables_blob =3D tables->table_data; unsigned dsdt, xsdt; @@ -178,7 +179,7 @@ static void acpi_build_microvm(AcpiBuildTables *tables, =20 acpi_add_table(table_offsets, tables_blob); acpi_build_madt(tables_blob, tables->linker, X86_MACHINE(machine), - mms->acpi_dev, false); + ACPI_DEVICE_IF(x86ms->acpi_dev), false); =20 xsdt =3D tables_blob->len; build_xsdt(tables_blob, tables->linker, table_offsets, NULL, NULL); diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index fbda323f3b2a..3d8a66cfc3ac 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -143,7 +143,7 @@ static void microvm_devices_init(MicrovmMachineState *m= ms) sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, x86ms->gsi[GED_MMIO_IRQ]); sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal); - mms->acpi_dev =3D ACPI_DEVICE_IF(dev); + x86ms->acpi_dev =3D HOTPLUG_HANDLER(dev); } =20 if (mms->pic =3D=3D ON_OFF_AUTO_ON || mms->pic =3D=3D ON_OFF_AUTO_AUTO= ) { @@ -469,11 +469,13 @@ static void microvm_powerdown_req(Notifier *notifier,= void *data) { MicrovmMachineState *mms =3D container_of(notifier, MicrovmMachineStat= e, powerdown_req); + X86MachineState *x86ms =3D X86_MACHINE(mms); =20 - if (mms->acpi_dev) { - Object *obj =3D OBJECT(mms->acpi_dev); + if (x86ms->acpi_dev) { + Object *obj =3D OBJECT(x86ms->acpi_dev); AcpiDeviceIfClass *adevc =3D ACPI_DEVICE_IF_GET_CLASS(obj); - adevc->send_event(mms->acpi_dev, ACPI_POWER_DOWN_STATUS); + adevc->send_event(ACPI_DEVICE_IF(x86ms->acpi_dev), + ACPI_POWER_DOWN_STATUS); } } =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 4af9679d039b..98d29ead09b0 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1270,6 +1270,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplu= g_dev, DeviceState *dev, Error **errp) { const PCMachineState *pcms =3D PC_MACHINE(hotplug_dev); + const X86MachineState *x86ms =3D X86_MACHINE(hotplug_dev); const PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); const MachineState *ms =3D MACHINE(hotplug_dev); const bool is_nvdimm =3D object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM); @@ -1281,7 +1282,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplu= g_dev, DeviceState *dev, * but pcms->acpi_dev is still created. Check !acpi_enabled in * addition to cover this case. */ - if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))= ) { + if (!x86ms->acpi_dev || !x86_machine_is_acpi_enabled(x86ms)) { error_setg(errp, "memory hotplug is not enabled: missing acpi device or = acpi disabled"); return; @@ -1292,7 +1293,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplu= g_dev, DeviceState *dev, return; } =20 - hotplug_handler_pre_plug(pcms->acpi_dev, dev, &local_err); + hotplug_handler_pre_plug(x86ms->acpi_dev, dev, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -1307,6 +1308,7 @@ static void pc_memory_plug(HotplugHandler *hotplug_de= v, { Error *local_err =3D NULL; PCMachineState *pcms =3D PC_MACHINE(hotplug_dev); + X86MachineState *x86ms =3D X86_MACHINE(hotplug_dev); MachineState *ms =3D MACHINE(hotplug_dev); bool is_nvdimm =3D object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM); =20 @@ -1319,7 +1321,7 @@ static void pc_memory_plug(HotplugHandler *hotplug_de= v, nvdimm_plug(ms->nvdimms_state); } =20 - hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &error_abor= t); + hotplug_handler_plug(x86ms->acpi_dev, dev, &error_abort); out: error_propagate(errp, local_err); } @@ -1328,14 +1330,14 @@ static void pc_memory_unplug_request(HotplugHandler= *hotplug_dev, DeviceState *dev, Error **errp) { Error *local_err =3D NULL; - PCMachineState *pcms =3D PC_MACHINE(hotplug_dev); + X86MachineState *x86ms =3D X86_MACHINE(hotplug_dev); =20 /* * When -no-acpi is used with Q35 machine type, no ACPI is built, * but pcms->acpi_dev is still created. Check !acpi_enabled in * addition to cover this case. */ - if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))= ) { + if (!x86ms->acpi_dev || !x86_machine_is_acpi_enabled(x86ms)) { error_setg(&local_err, "memory hotplug is not enabled: missing acpi device or = acpi disabled"); goto out; @@ -1347,7 +1349,7 @@ static void pc_memory_unplug_request(HotplugHandler *= hotplug_dev, goto out; } =20 - hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, + hotplug_handler_unplug_request(x86ms->acpi_dev, dev, &local_err); out: error_propagate(errp, local_err); @@ -1357,9 +1359,10 @@ static void pc_memory_unplug(HotplugHandler *hotplug= _dev, DeviceState *dev, Error **errp) { PCMachineState *pcms =3D PC_MACHINE(hotplug_dev); + X86MachineState *x86ms =3D X86_MACHINE(hotplug_dev); Error *local_err =3D NULL; =20 - hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_er= r); + hotplug_handler_unplug(x86ms->acpi_dev, dev, &local_err); if (local_err) { goto out; } @@ -1403,10 +1406,10 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev, Error *local_err =3D NULL; X86CPU *cpu =3D X86_CPU(dev); PCMachineState *pcms =3D PC_MACHINE(hotplug_dev); - X86MachineState *x86ms =3D X86_MACHINE(pcms); + X86MachineState *x86ms =3D X86_MACHINE(hotplug_dev); =20 - if (pcms->acpi_dev) { - hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_= err); + if (x86ms->acpi_dev) { + hotplug_handler_plug(x86ms->acpi_dev, dev, &local_err); if (local_err) { goto out; } @@ -1433,8 +1436,9 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *= hotplug_dev, Error *local_err =3D NULL; X86CPU *cpu =3D X86_CPU(dev); PCMachineState *pcms =3D PC_MACHINE(hotplug_dev); + X86MachineState *x86ms =3D X86_MACHINE(hotplug_dev); =20 - if (!pcms->acpi_dev) { + if (!x86ms->acpi_dev) { error_setg(&local_err, "CPU hot unplug not supported without ACPI"= ); goto out; } @@ -1446,7 +1450,7 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *= hotplug_dev, goto out; } =20 - hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, + hotplug_handler_unplug_request(x86ms->acpi_dev, dev, &local_err); if (local_err) { goto out; @@ -1464,9 +1468,9 @@ static void pc_cpu_unplug_cb(HotplugHandler *hotplug_= dev, Error *local_err =3D NULL; X86CPU *cpu =3D X86_CPU(dev); PCMachineState *pcms =3D PC_MACHINE(hotplug_dev); - X86MachineState *x86ms =3D X86_MACHINE(pcms); + X86MachineState *x86ms =3D X86_MACHINE(hotplug_dev); =20 - hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_er= r); + hotplug_handler_unplug(x86ms->acpi_dev, dev, &local_err); if (local_err) { goto out; } @@ -1495,7 +1499,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_d= ev, CPUX86State *env =3D &cpu->env; MachineState *ms =3D MACHINE(hotplug_dev); PCMachineState *pcms =3D PC_MACHINE(hotplug_dev); - X86MachineState *x86ms =3D X86_MACHINE(pcms); + X86MachineState *x86ms =3D X86_MACHINE(hotplug_dev); unsigned int smp_cores =3D ms->smp.cores; unsigned int smp_threads =3D ms->smp.threads; X86CPUTopoInfo topo_info; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1d832b2878b1..34944bd383e3 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -291,7 +291,7 @@ static void pc_init1(MachineState *machine, =20 object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_P= ROP, TYPE_HOTPLUG_HANDLER, - (Object **)&pcms->acpi_dev, + (Object **)&x86ms->acpi_dev, object_property_allow_set_link, OBJ_PROP_LINK_STRONG); object_property_set_link(OBJECT(machine), OBJECT(piix4_pm), diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 047ea8db28ea..92a104059076 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -240,7 +240,7 @@ static void pc_q35_init(MachineState *machine) =20 object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, - (Object **)&pcms->acpi_dev, + (Object **)&x86ms->acpi_dev, object_property_allow_set_link, OBJ_PROP_LINK_STRONG); object_property_set_link(OBJECT(machine), OBJECT(lpc), --=20 2.18.4