From nobody Thu Dec 18 08:06:56 2025 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=1665427784; cv=none; d=zohomail.com; s=zohoarc; b=luGWvgLugS9W4Av1bsdvZsRb4QXOYXgBcST4TxWKGOKhC48Aaw9bllNadghcoJMviB11tOZKAfv0/gTS/BAqos3ja6McVrGSDtggo7ZXnUgqLJN+fcToYQYZhrE1+XL78oqYXme8hid4mgE2wUuNVuak8mraRZPzyGP6loVHVHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665427784; 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=8LtbWC4TRYOxMw/Xs0vATAQEBjGtMGazJ9tDVXsGFzE=; b=K+2cgMCZE2a0VrhxsmeR96Y6CNXeCUqUMiRw24BoSSkNOaV+hUKScKfgzpTHDBvGpYKb1OSIFs2QX7NfMX8WHYSyZDprOCa5Jg0DByczeCznlib65npBxISvXuD2KKnu5hd9Fn2HiK3LnbWXunfATJ/DFLLy8peQsykMxqtni4k= 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 1665427784804515.7452100739565; Mon, 10 Oct 2022 11:49:44 -0700 (PDT) Received: from localhost ([::1]:36326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohxqQ-00017y-DT for importer@patchew.org; Mon, 10 Oct 2022 14:49:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohwdX-0004fx-J9 for qemu-devel@nongnu.org; Mon, 10 Oct 2022 13:32:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:34735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohwdV-0007aC-TP for qemu-devel@nongnu.org; Mon, 10 Oct 2022 13:32:19 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-383-_Jr2wz_tP1OSIdEDcriwrQ-1; Mon, 10 Oct 2022 13:32:16 -0400 Received: by mail-wm1-f70.google.com with SMTP id v191-20020a1cacc8000000b003bdf7b78dccso7298888wme.3 for ; Mon, 10 Oct 2022 10:32:15 -0700 (PDT) Received: from redhat.com ([2.55.183.131]) by smtp.gmail.com with ESMTPSA id q22-20020a7bce96000000b003c21ba7d7d6sm11552899wmj.44.2022.10.10.10.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 10:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665423137; 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=8LtbWC4TRYOxMw/Xs0vATAQEBjGtMGazJ9tDVXsGFzE=; b=G/4XXpkpypuj0x5iXc8q81yB3kUT53C5rldQCsZu0boNtQsWMAnEteYEU3wghjdin8uhcM ZK/d9y3ngh95JfCgi9KlNhGfjF1/b5+nykkGJlSGcg6fBy3+EshPixPtN6vN3/jQi78npJ 4lXe0qWfxo9jCq8KR8+/1j0Dvdeqh3c= X-MC-Unique: _Jr2wz_tP1OSIdEDcriwrQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8LtbWC4TRYOxMw/Xs0vATAQEBjGtMGazJ9tDVXsGFzE=; b=Eywgao3rI8CHQX6RdLg9U9Ebo8IRHu5lTlFw7X0SJ/5PqLNw85MkMj5WHCDpIxyjnY GAsfYs2qBo+we1pvhJqiejbMkVuZ/tB2xEvGAy+Z3GayHaSf0eZK78XZTCvJmtcJIj2y /ZrX79W2xWlrxoTzBhoH+1Zsz6URG2YaDKbk20HzbZxGHhBZMYz8FDXmGGkQbO5YWtP7 RaMexF5th2Y+q1JFQ5A1+Cj99SBMk4L/XPxbAgnT4NWmbzhq05kI85vp1Tx0GyH8CMUZ l2qHiSqrtX7Fi2GyVtCCYh4z+Xc+nV64zGNn6zXSE7BDHD5NZZCxspXggJwlGza6y9uK 3TIA== X-Gm-Message-State: ACrzQf254OUrUusVtK9mRIoJGKxkNywfdzufM5TFEX5kNDdPwaTN4e4R ISuTtUMI4lGKPGoodEvF7rzxvpcY6uFsFxBSs09nU6S30ESehnwg6ha9dWIMXuy5yFHdw4xSyU/ MwSjr78un53HUSa5oP9KBJZwAoJXbbGGx/QUA+2Y1NKjNu8B2qGV+IEQBc0L1 X-Received: by 2002:a05:6000:1866:b0:22f:2616:5613 with SMTP id d6-20020a056000186600b0022f26165613mr8683152wri.145.1665423134677; Mon, 10 Oct 2022 10:32:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tX0DZMi289p+RyrFYG5anzF9TgWYOuca2FLAhp/2bxrtXtFs1H1JAjgex4HsDpYnInE0lHw== X-Received: by 2002:a05:6000:1866:b0:22f:2616:5613 with SMTP id d6-20020a056000186600b0022f26165613mr8683132wri.145.1665423134344; Mon, 10 Oct 2022 10:32:14 -0700 (PDT) Date: Mon, 10 Oct 2022 13:32:10 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 47/55] x86: acpi: cleanup PCI device _DSM duplication Message-ID: <20221010172813.204597-48-mst@redhat.com> References: <20221010172813.204597-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221010172813.204597-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1665427786882100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov add ASUN variable to hotpluggable slots and use it instead of _SUN which has the same value to reuse _DMS code on both branches (hot- and non-hotpluggable). No functional change. Signed-off-by: Igor Mammedov Message-Id: <20220701133515.137890-10-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 56 +++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index a19900c4e4..eb92b05197 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -374,6 +374,25 @@ build_facs(GArray *table_data) g_array_append_vals(table_data, reserved, 40); /* Reserved */ } =20 +Aml *aml_pci_device_dsm(void) +{ + Aml *method; + + method =3D aml_method("_DSM", 4, AML_SERIALIZED); + { + Aml *params =3D aml_local(0); + Aml *pkg =3D aml_package(2); + aml_append(pkg, aml_name("BSEL")); + aml_append(pkg, aml_name("ASUN")); + aml_append(method, aml_store(pkg, params)); + aml_append(method, + aml_return(aml_call5("PDSM", aml_arg(0), aml_arg(1), + aml_arg(2), aml_arg(3), params)) + ); + } + return method; +} + static void build_append_pcihp_notify_entry(Aml *method, int slot) { Aml *if_ctx; @@ -423,26 +442,17 @@ static void build_append_pci_bus_devices(Aml *parent_= scope, PCIBus *bus, break; } dev =3D aml_device("S%.02X", devfn); - aml_append(dev, aml_name_decl("_SUN", aml_int(slot))); + aml_append(dev, aml_name_decl("ASUN", aml_int(slot))); aml_append(dev, aml_name_decl("_ADR", aml_int(adr))); + aml_append(dev, aml_name_decl("_SUN", aml_int(slot))); method =3D aml_method("_EJ0", 1, AML_NOTSERIALIZED); aml_append(method, aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN")) ); aml_append(dev, method); - method =3D aml_method("_DSM", 4, AML_SERIALIZED); - { - Aml *params =3D aml_local(0); - Aml *pkg =3D aml_package(2); - aml_append(pkg, aml_name("BSEL")); - aml_append(pkg, aml_name("_SUN")); - aml_append(method, aml_store(pkg, params)); - aml_append(method, - aml_return(aml_call5("PDSM", aml_arg(0), aml_arg(1= ), - aml_arg(2), aml_arg(3), param= s)) - ); - } - aml_append(dev, method); + + aml_append(dev, aml_pci_device_dsm()); + aml_append(parent_scope, dev); =20 build_append_pcihp_notify_entry(notify_method, slot); @@ -485,19 +495,7 @@ static void build_append_pci_bus_devices(Aml *parent_s= cope, PCIBus *bus, * enumeration order in linux kernel, so use another variable = for it */ aml_append(dev, aml_name_decl("ASUN", aml_int(slot))); - method =3D aml_method("_DSM", 4, AML_SERIALIZED); - { - Aml *params =3D aml_local(0); - Aml *pkg =3D aml_package(2); - aml_append(pkg, aml_name("BSEL")); - aml_append(pkg, aml_name("ASUN")); - aml_append(method, aml_store(pkg, params)); - aml_append(method, aml_return( - aml_call5("PDSM", aml_arg(0), aml_arg(1), aml_arg(2), - aml_arg(3), params) - )); - } - aml_append(dev, method); + aml_append(dev, aml_pci_device_dsm()); } =20 if (pc->class_id =3D=3D PCI_CLASS_DISPLAY_VGA) { @@ -585,7 +583,7 @@ static void build_append_pci_bus_devices(Aml *parent_sc= ope, PCIBus *bus, qobject_unref(bsel); } =20 -Aml *aml_pci_device_dsm(void) +static Aml *aml_pci_pdsm(void) { Aml *method, *UUID, *ifctx, *ifctx1; Aml *ret =3D aml_local(0); @@ -1368,7 +1366,7 @@ static void build_x86_acpi_pci_hotplug(Aml *table, ui= nt64_t pcihp_addr) aml_append(method, aml_return(aml_local(0))); aml_append(scope, method); =20 - aml_append(scope, aml_pci_device_dsm()); + aml_append(scope, aml_pci_pdsm()); =20 aml_append(table, scope); } --=20 MST