From nobody Mon Feb 9 09:28:28 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654852265; cv=none; d=zohomail.com; s=zohoarc; b=Zq+Sh3myDq98o9SpPed5HIsrPfDbbgekOPSROuZHy94pNDM1C32aIHaceRbYiRAcsINnEUfLdU+6dRaPbvikNCZBJVRwo76IeFH+RifggN63vjBwN1XkH4+NQ9hf3j1SkQCwkUoBs7LTor5FqZ86kXpesWTvbCmR88c0jJqbSyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654852265; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M1tXPwk1x35lNtfWSfsKo03wk7orBSjzeUaNq+cCX/Q=; b=jcFpqIMN1TKoNQonena5P9GBA4+stdc14HANdwZ8IxnVmxE9fh/PWLmQctRTsmBs9QwrCo9j9ntH0ENdSdO7TBmYnqfK0JMK2U3n05p/D4dWvgxyLBoSQTy+UQlv/eirzuAV/iR1obonsC1YvFZ5aMbj9fg5tDSwEymdyEhFUCk= 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 1654852265544689.8158571494297; Fri, 10 Jun 2022 02:11:05 -0700 (PDT) Received: from localhost ([::1]:56004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzafY-0001gj-EO for importer@patchew.org; Fri, 10 Jun 2022 05:11:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzZXM-0000si-Qn for qemu-devel@nongnu.org; Fri, 10 Jun 2022 03:58:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:38913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzZXK-0006Jy-UJ for qemu-devel@nongnu.org; Fri, 10 Jun 2022 03:58:32 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-425-7Gco0GuiMU-_xojMdW5mYQ-1; Fri, 10 Jun 2022 03:58:29 -0400 Received: by mail-wm1-f72.google.com with SMTP id m23-20020a05600c3b1700b0039c6e3c169aso960512wms.2 for ; Fri, 10 Jun 2022 00:58:28 -0700 (PDT) Received: from redhat.com ([212.116.178.142]) by smtp.gmail.com with ESMTPSA id ay40-20020a05600c1e2800b00397623ff335sm2069419wmb.10.2022.06.10.00.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 00:58:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654847910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=M1tXPwk1x35lNtfWSfsKo03wk7orBSjzeUaNq+cCX/Q=; b=O+on4PkdgXKj6CD41+aOn9b5F5lIy+YnaQ7enpuLwRT2ima0UxwQWz9h2bVtq3L+FMAdkg /J1UQdGmTsCuJjXIbpx66RslRvacatIVU3T4e9iiuNb7l0G2xm951gA4viiKhKDJbpU8vx WJjO/zIafA1zSlJJL+rjc9FbC+thX5o= X-MC-Unique: 7Gco0GuiMU-_xojMdW5mYQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=M1tXPwk1x35lNtfWSfsKo03wk7orBSjzeUaNq+cCX/Q=; b=mm3c1Pnn/lnQpv+2ijsX0Y2ZQOWSpVpTfic52jf9/0cim/vBYaur2gWa/2cWsyirKb oyjvyCF1JAGe1vgdVjzdyuCZvXSo0TanfVi9X0KfDSDDhwO5EkWyCHBmDJl/6VDty7R9 xedy1VEVFdzJZY7nCW+5Gs3FHdlEAH9LM4BiEylQW1kacJl44e+e7a/BGDOxfOYyVpnq T6bhDQS2AFo4koK4bq8vnjNayWZa/1ipOhBSkCTyjZipFVKVvHaSzbD/vTchOgOTK5k+ oVz8PkZK7lk1K4LJH5WmwKd1Y7TibVMwT/iiwfY1oU/Db3ccIruC4YriWTEWChzl6cIO xndg== X-Gm-Message-State: AOAM530mzhZCZxDaCLz91MCSROiZhAktsnjpCXANOr1MJ8R6D1wqmZyC CDLj2crKg5XXAFPtbGwRPhHYfa4xz5Majg9gcRcmzcz2IYDPNS+JbemraqqFpb1s0EWpCTBiN3D xGP0Tbzl/5J/JRp3QgRwiSpXRnComFhSawngWAhv6sYuWi2L3yPGJr0VJJDEy X-Received: by 2002:a7b:c1cf:0:b0:39c:4460:cfa8 with SMTP id a15-20020a7bc1cf000000b0039c4460cfa8mr7350670wmj.21.1654847907557; Fri, 10 Jun 2022 00:58:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBoOrjjCwMQ1Z1dJuEMFHCqTbscsJiEU0sMQUNzFcOVQq2iKNPgwpZibMwuDHrG0rLtlxyfg== X-Received: by 2002:a7b:c1cf:0:b0:39c:4460:cfa8 with SMTP id a15-20020a7bc1cf000000b0039c4460cfa8mr7350642wmj.21.1654847907269; Fri, 10 Jun 2022 00:58:27 -0700 (PDT) Date: Fri, 10 Jun 2022 03:58:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Gerd Hoffmann , Ani Sinha , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 28/54] acpi: pvpanic-isa: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML Message-ID: <20220610075631.367501-29-mst@redhat.com> References: <20220610075631.367501-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220610075631.367501-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654852267327100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov .. and clean up not longer needed conditionals in DSTD build code pvpanic-isa AML will be fetched and included when ISA bridge will build its own AML code (including attached devices). Expected AML change: the device under separate _SB.PCI0.ISA scope is moved directly under Device(ISA) node. Signed-off-by: Igor Mammedov Acked-by: Gerd Hoffmann Message-Id: <20220608135340.3304695-29-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/misc/pvpanic.h | 9 --------- hw/i386/acpi-build.c | 37 ---------------------------------- hw/misc/pvpanic-isa.c | 42 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 46 deletions(-) diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index 7f16cc9b16..e520566ab0 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -33,13 +33,4 @@ struct PVPanicState { =20 void pvpanic_setup_io(PVPanicState *s, DeviceState *dev, unsigned size); =20 -static inline uint16_t pvpanic_port(void) -{ - Object *o =3D object_resolve_path_type("", TYPE_PVPANIC_ISA_DEVICE, NU= LL); - if (!o) { - return 0; - } - return object_property_get_uint(o, PVPANIC_IOPORT_PROP, NULL); -} - #endif diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b96705c688..bbe02b068e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -31,7 +31,6 @@ #include "hw/cxl/cxl.h" #include "hw/core/cpu.h" #include "target/i386/cpu.h" -#include "hw/misc/pvpanic.h" #include "hw/timer/hpet.h" #include "hw/acpi/acpi-defs.h" #include "hw/acpi/acpi.h" @@ -120,7 +119,6 @@ typedef struct AcpiMiscInfo { #endif const unsigned char *dsdt_code; unsigned dsdt_size; - uint16_t pvpanic_port; } AcpiMiscInfo; =20 typedef struct AcpiBuildPciBusHotplugState { @@ -305,7 +303,6 @@ static void acpi_get_misc_info(AcpiMiscInfo *info) #ifdef CONFIG_TPM info->tpm_version =3D tpm_get_version(tpm_find()); #endif - info->pvpanic_port =3D pvpanic_port(); } =20 /* @@ -1798,40 +1795,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, aml_append(dsdt, scope); } =20 - if (misc->pvpanic_port) { - scope =3D aml_scope("\\_SB.PCI0.ISA"); - - dev =3D aml_device("PEVT"); - aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0001"))); - - crs =3D aml_resource_template(); - aml_append(crs, - aml_io(AML_DECODE16, misc->pvpanic_port, misc->pvpanic_port, 1= , 1) - ); - aml_append(dev, aml_name_decl("_CRS", crs)); - - aml_append(dev, aml_operation_region("PEOR", AML_SYSTEM_IO, - aml_int(misc->pvpanic_port),= 1)); - field =3D aml_field("PEOR", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE= ); - aml_append(field, aml_named_field("PEPT", 8)); - aml_append(dev, field); - - /* device present, functioning, decoding, shown in UI */ - aml_append(dev, aml_name_decl("_STA", aml_int(0xF))); - - method =3D aml_method("RDPT", 0, AML_NOTSERIALIZED); - aml_append(method, aml_store(aml_name("PEPT"), aml_local(0))); - aml_append(method, aml_return(aml_local(0))); - aml_append(dev, method); - - method =3D aml_method("WRPT", 1, AML_NOTSERIALIZED); - aml_append(method, aml_store(aml_arg(0), aml_name("PEPT"))); - aml_append(dev, method); - - aml_append(scope, dev); - aml_append(dsdt, scope); - } - sb_scope =3D aml_scope("\\_SB"); { Object *pci_host; diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c index b84d4d458d..ccec50f61b 100644 --- a/hw/misc/pvpanic-isa.c +++ b/hw/misc/pvpanic-isa.c @@ -22,6 +22,7 @@ #include "qom/object.h" #include "hw/isa/isa.h" #include "standard-headers/linux/pvpanic.h" +#include "hw/acpi/acpi_aml_interface.h" =20 OBJECT_DECLARE_SIMPLE_TYPE(PVPanicISAState, PVPANIC_ISA_DEVICE) =20 @@ -63,6 +64,41 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Erro= r **errp) isa_register_ioport(d, &ps->mr, s->ioport); } =20 +static void build_pvpanic_isa_aml(AcpiDevAmlIf *adev, Aml *scope) +{ + Aml *crs, *field, *method; + PVPanicISAState *s =3D PVPANIC_ISA_DEVICE(adev); + Aml *dev =3D aml_device("PEVT"); + + aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0001"))); + + crs =3D aml_resource_template(); + aml_append(crs, + aml_io(AML_DECODE16, s->ioport, s->ioport, 1, 1) + ); + aml_append(dev, aml_name_decl("_CRS", crs)); + + aml_append(dev, aml_operation_region("PEOR", AML_SYSTEM_IO, + aml_int(s->ioport), 1)); + field =3D aml_field("PEOR", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE); + aml_append(field, aml_named_field("PEPT", 8)); + aml_append(dev, field); + + /* device present, functioning, decoding, shown in UI */ + aml_append(dev, aml_name_decl("_STA", aml_int(0xF))); + + method =3D aml_method("RDPT", 0, AML_NOTSERIALIZED); + aml_append(method, aml_store(aml_name("PEPT"), aml_local(0))); + aml_append(method, aml_return(aml_local(0))); + aml_append(dev, method); + + method =3D aml_method("WRPT", 1, AML_NOTSERIALIZED); + aml_append(method, aml_store(aml_arg(0), aml_name("PEPT"))); + aml_append(dev, method); + + aml_append(scope, dev); +} + static Property pvpanic_isa_properties[] =3D { DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicISAState, ioport, 0x505= ), DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events, @@ -73,10 +109,12 @@ static Property pvpanic_isa_properties[] =3D { static void pvpanic_isa_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + AcpiDevAmlIfClass *adevc =3D ACPI_DEV_AML_IF_CLASS(klass); =20 dc->realize =3D pvpanic_isa_realizefn; device_class_set_props(dc, pvpanic_isa_properties); set_bit(DEVICE_CATEGORY_MISC, dc->categories); + adevc->build_dev_aml =3D build_pvpanic_isa_aml; } =20 static const TypeInfo pvpanic_isa_info =3D { @@ -85,6 +123,10 @@ static const TypeInfo pvpanic_isa_info =3D { .instance_size =3D sizeof(PVPanicISAState), .instance_init =3D pvpanic_isa_initfn, .class_init =3D pvpanic_isa_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_ACPI_DEV_AML_IF }, + { }, + }, }; =20 static void pvpanic_register_types(void) --=20 MST