From nobody Sat Apr 27 17:15:28 2024 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=1615832997; cv=none; d=zohomail.com; s=zohoarc; b=ifVxaLunyZ54PnX/YJqn+ZRsZUJYRXqW4CaX89UM4xvf19YSAG99tAYB2mjCyO3V/Nvi0cejBtN1Zk1Ai2WOfFYT7Hn30yOgb8I1X30ivpkUYTlysg5Ge6VBXXs/GYYAfPrgv9Dbn4kZcpOX/aUSiZedtHP/GBn/Sa+WXz3WitM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615832997; h=Content-Type:Content-Transfer-Encoding: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=Z8uzy9cdH+QpKa0Ce1jSI+ZBkDmwSE5ooKw0vWr7Avc=; b=jrnXDEzp/dafiBLgMVx500tLA3HCppBUpD5JoM7yKP0c9ispC3J02kCAybqlmZhxF88Hpf5jmAjPObE/a3GyzJMGuzFCUcOPdHHQa40d86Nhkc5rt9iKV87rBmgxT86sNLD+Z5KxseEh1ddE7zNwIY1iodpI7348EgZ/26k1gwA= 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 1615832997847258.0494636194469; Mon, 15 Mar 2021 11:29:57 -0700 (PDT) Received: from localhost ([::1]:57824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLryW-0008B8-Gk for importer@patchew.org; Mon, 15 Mar 2021 14:29:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLrX1-0001JU-VP for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58919) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLrWy-0008Pu-UC for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:31 -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-7-srNwl1WRNWS1OMzTgUnRuw-1; Mon, 15 Mar 2021 14:01:24 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B221C100731F for ; Mon, 15 Mar 2021 18:01:11 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF2D28000C; Mon, 15 Mar 2021 18:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831288; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z8uzy9cdH+QpKa0Ce1jSI+ZBkDmwSE5ooKw0vWr7Avc=; b=ZdKRgcF6+dsqUZlUf0h0bSet8hQGgwuCGLjdujZlfZ+b2bjLAuno0mJSKdqfrV6bRycYDX QMmZ7Zy3EhHCqUegAX/xyoIdr0hLXKl4cgT1WnFFIfQB/MItM0e02bvoz6xIl1f7WL0snh iRDdI3GAaWbcOq/OdYuJ1bXiD0i0H6c= X-MC-Unique: srNwl1WRNWS1OMzTgUnRuw-1 From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 1/6] tests: acpi: temporary whitelist DSDT changes Date: Mon, 15 Mar 2021 14:00:57 -0400 Message-Id: <20210315180102.3008391-2-imammedo@redhat.com> In-Reply-To: <20210315180102.3008391-1-imammedo@redhat.com> References: <20210315180102.3008391-1-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=imammedo@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=imammedo@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jusual@redhat.com, laine@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- tests/qtest/bios-tables-test-allowed-diff.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..fddcfc061f 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,12 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT", +"tests/data/acpi/pc/DSDT.acpihmat", +"tests/data/acpi/pc/DSDT.bridge", +"tests/data/acpi/pc/DSDT.cphp", +"tests/data/acpi/pc/DSDT.dimmpxm", +"tests/data/acpi/pc/DSDT.hpbridge", +"tests/data/acpi/pc/DSDT.hpbrroot", +"tests/data/acpi/pc/DSDT.ipmikcs", +"tests/data/acpi/pc/DSDT.memhp", +"tests/data/acpi/pc/DSDT.numamem", +"tests/data/acpi/pc/DSDT.roothp", --=20 2.27.0 From nobody Sat Apr 27 17:15:28 2024 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=1615832798; cv=none; d=zohomail.com; s=zohoarc; b=VSBYSc/TYXQUWfMirwtZmB57Vh4caAeU7rZg7/AtFr87ri5qycFPOnfyWgMmVhOnm/Si8kBbk2vkEDka13ABgD0lCP9LA9HlVWvqnIHzwOUP88a09zuj+3I/xkEQ0929o9AC/xYmjCiCGxE3h4eRgF6qJnVQFevqNbyvXaANR4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615832798; h=Content-Type:Content-Transfer-Encoding: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=tOBcNpzTLRc+kcMrgDtow2laLgRQVOebIYmbeYy1IHE=; b=mIbzt8zRXnppXKACYsW5OPAFCjcVit3RiiFhNJrLFV2j8YxU4Ap/tW9kFXs6Xbb8JaVAsvhK4KU1c8uH0RbxrhWduhSgiLNYQB5UbjnUhPWOJm1kHSGZ2StLGrFmVnmIvh5k40mil8E/W18YjgySfE9YPRgcHXESmPwvmwKjlbM= 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 1615832798338846.9840274435147; Mon, 15 Mar 2021 11:26:38 -0700 (PDT) Received: from localhost ([::1]:49120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLrvJ-0004ZP-81 for importer@patchew.org; Mon, 15 Mar 2021 14:26:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLrX1-0001J7-PA for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30220) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lLrWy-0008Pm-LX for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:31 -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-497-Xvhu1o0wPRGBkPyVTXr49g-1; Mon, 15 Mar 2021 14:01:25 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D08A21015CB9 for ; Mon, 15 Mar 2021 18:01:12 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C483F84411; Mon, 15 Mar 2021 18:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831287; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tOBcNpzTLRc+kcMrgDtow2laLgRQVOebIYmbeYy1IHE=; b=FNatv9kRvkziAgejvA5F65QSdVG2lRyq75Rh5cr9Gw2ebhbxTUleXa1ohWflVAPyrYmPWd tg9XPkTe2gWRqWcNWaWw4YvNYeLt2sqi+6GXfMli6/ds06RFT/CwlLmoiBhylMYmumQvq7 PkjRB7oCaqd8Kbb76xDy0se3nrLWKSU= X-MC-Unique: Xvhu1o0wPRGBkPyVTXr49g-1 From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 2/6] pci: introduce apci-index property for PCI device Date: Mon, 15 Mar 2021 14:00:58 -0400 Message-Id: <20210315180102.3008391-3-imammedo@redhat.com> In-Reply-To: <20210315180102.3008391-1-imammedo@redhat.com> References: <20210315180102.3008391-1-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=imammedo@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=imammedo@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jusual@redhat.com, laine@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" In x86/ACPI world, linux distros are using predictable network interface naming since systemd v197. Which on QEMU based VMs results into path based naming scheme, that names network interfaces based on PCI topology. With itm on has to plug NIC in exactly the same bus/slot, which was used when disk image was first provisioned/configured or one risks to loose network configuration due to NIC being renamed to actually used topology. That also restricts freedom to reshape PCI configuration of VM without need to reconfigure used guest image. systemd also offers "onboard" naming scheme which is preferred over PCI slot/topology one, provided that firmware implements: " PCI Firmware Specification 3.1 4.6.7. DSM for Naming a PCI or PCI Express Device Under Operating Systems " that allows to assign user defined index to PCI device, which systemd will use to name NIC. For example, using -device e1000,acpi-index=3D100 guest will rename NIC to 'eno100', where 'eno' is default prefix for "onboard" naming scheme. This doesn't require any advance configuration on guest side to com in effect at 'onboard' scheme takes priority over path based naming. Hope is that 'acpi-index' it will be easier to consume by management layer, compared to forcing specific PCI topology and/or having several disk image templates for different topologies and will help to simplify process of spawning VM from the same template without need to reconfigure guest NIC. This patch adds, 'acpi-index'* property and wires up a 32bit register on top of pci hotplug register block to pass index value to AML code at runtime. Following patch will add corresponding _DSM code and wire it up to PCI devices described in ACPI. *) name comes from linux kernel terminology Signed-off-by: Igor Mammedov --- v1: * fix build failure of mips target * move out handling acpi-index into separate MMIO register, instead of abusing unused PCI hotplug registers (mst) * default acpi-index property value to 0 * set and check for max acpi-index value (systemd limitation) --- include/hw/acpi/pcihp.h | 9 +++++-- include/hw/pci/pci.h | 1 + hw/acpi/pci.c | 1 - hw/acpi/pcihp.c | 58 +++++++++++++++++++++++++++++++++++++++-- hw/acpi/piix4.c | 3 ++- hw/acpi/trace-events | 2 ++ hw/i386/acpi-build.c | 13 ++++++++- hw/pci/pci.c | 1 + 8 files changed, 81 insertions(+), 7 deletions(-) diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h index dfd375820f..2dd90aea30 100644 --- a/include/hw/acpi/pcihp.h +++ b/include/hw/acpi/pcihp.h @@ -46,6 +46,7 @@ typedef struct AcpiPciHpPciStatus { typedef struct AcpiPciHpState { AcpiPciHpPciStatus acpi_pcihp_pci_status[ACPI_PCIHP_MAX_HOTPLUG_BUS]; uint32_t hotplug_select; + uint32_t acpi_index; PCIBus *root; MemoryRegion io; bool legacy_piix; @@ -71,13 +72,17 @@ void acpi_pcihp_reset(AcpiPciHpState *s, bool acpihp_ro= ot_off); =20 extern const VMStateDescription vmstate_acpi_pcihp_pci_status; =20 -#define VMSTATE_PCI_HOTPLUG(pcihp, state, test_pcihp) \ +bool vmstate_acpi_pcihp_use_acpi_index(void *opaque, int version_id); + +#define VMSTATE_PCI_HOTPLUG(pcihp, state, test_pcihp, test_acpi_index) \ VMSTATE_UINT32_TEST(pcihp.hotplug_select, state, \ test_pcihp), \ VMSTATE_STRUCT_ARRAY_TEST(pcihp.acpi_pcihp_pci_status, state, \ ACPI_PCIHP_MAX_HOTPLUG_BUS, \ test_pcihp, 1, \ vmstate_acpi_pcihp_pci_status, \ - AcpiPciHpPciStatus) + AcpiPciHpPciStatus), \ + VMSTATE_UINT32_TEST(pcihp.acpi_index, state, \ + test_acpi_index) =20 #endif diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 1bc231480f..6be4e0c460 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -359,6 +359,7 @@ struct PCIDevice { =20 /* ID of standby device in net_failover pair */ char *failover_pair_id; + uint32_t acpi_index; }; =20 void pci_register_bar(PCIDevice *pci_dev, int region_num, diff --git a/hw/acpi/pci.c b/hw/acpi/pci.c index ec455c3b25..75b1103ec4 100644 --- a/hw/acpi/pci.c +++ b/hw/acpi/pci.c @@ -59,4 +59,3 @@ void build_mcfg(GArray *table_data, BIOSLinker *linker, A= cpiMcfgInfo *info, build_header(linker, table_data, (void *)(table_data->data + mcfg_star= t), "MCFG", table_data->len - mcfg_start, 1, oem_id, oem_tabl= e_id); } - diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 9dc4d3e2db..ceab287bd3 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -39,12 +39,13 @@ #include "trace.h" =20 #define ACPI_PCIHP_ADDR 0xae00 -#define ACPI_PCIHP_SIZE 0x0014 +#define ACPI_PCIHP_SIZE 0x0018 #define PCI_UP_BASE 0x0000 #define PCI_DOWN_BASE 0x0004 #define PCI_EJ_BASE 0x0008 #define PCI_RMV_BASE 0x000c #define PCI_SEL_BASE 0x0010 +#define PCI_AIDX_BASE 0x0014 =20 typedef struct AcpiPciHpFind { int bsel; @@ -251,9 +252,13 @@ void acpi_pcihp_reset(AcpiPciHpState *s, bool acpihp_r= oot_off) acpi_pcihp_update(s); } =20 +#define ONBOARD_INDEX_MAX (16 * 1024 - 1) + void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { + PCIDevice *pdev =3D PCI_DEVICE(dev); + /* Only hotplugged devices need the hotplug capability. */ if (dev->hotplugged && acpi_pcihp_get_bsel(pci_get_bus(PCI_DEVICE(dev))) < 0) { @@ -261,6 +266,17 @@ void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hot= plug_dev, ACPI_PCIHP_PROP_BSEL "' set"); return; } + + /* + * capped by systemd (see: udev-builtin-net_id.c) + * as it's the only known user honor it to avoid users + * misconfigure QEMU and then wonder why acpi-index doesn't work + */ + if (pdev->acpi_index > ONBOARD_INDEX_MAX) { + error_setg(errp, "acpi-index should be less or equal to %u", + ONBOARD_INDEX_MAX); + return; + } } =20 void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState= *s, @@ -347,7 +363,6 @@ static uint64_t pci_read(void *opaque, hwaddr addr, uns= igned int size) trace_acpi_pci_down_read(val); break; case PCI_EJ_BASE: - /* No feature defined yet */ trace_acpi_pci_features_read(val); break; case PCI_RMV_BASE: @@ -357,6 +372,12 @@ static uint64_t pci_read(void *opaque, hwaddr addr, un= signed int size) case PCI_SEL_BASE: val =3D s->hotplug_select; trace_acpi_pci_sel_read(val); + break; + case PCI_AIDX_BASE: + val =3D s->acpi_index; + s->acpi_index =3D 0; + trace_acpi_pci_acpi_index_read(val); + break; default: break; } @@ -367,8 +388,35 @@ static uint64_t pci_read(void *opaque, hwaddr addr, un= signed int size) static void pci_write(void *opaque, hwaddr addr, uint64_t data, unsigned int size) { + int slot; + PCIBus *bus; + BusChild *kid, *next; AcpiPciHpState *s =3D opaque; + + s->acpi_index =3D 0; switch (addr) { + case PCI_AIDX_BASE: + /* + * fetch acpi-index for specified slot so that follow up read from + * PCI_AIDX_BASE can return it to guest + */ + slot =3D ctz32(data); + + if (s->hotplug_select >=3D ACPI_PCIHP_MAX_HOTPLUG_BUS) { + break; + } + + bus =3D acpi_pcihp_find_hotplug_bus(s, s->hotplug_select); + QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) { + Object *o =3D OBJECT(kid->child); + PCIDevice *dev =3D PCI_DEVICE(o); + if (PCI_SLOT(dev->devfn) =3D=3D slot) { + s->acpi_index =3D object_property_get_uint(o, "acpi-index"= , NULL); + break; + } + } + trace_acpi_pci_acpi_index_write(s->hotplug_select, slot, s->acpi_i= ndex); + break; case PCI_EJ_BASE: if (s->hotplug_select >=3D ACPI_PCIHP_MAX_HOTPLUG_BUS) { break; @@ -413,6 +461,12 @@ void acpi_pcihp_init(Object *owner, AcpiPciHpState *s,= PCIBus *root_bus, OBJ_PROP_FLAG_READ); } =20 +bool vmstate_acpi_pcihp_use_acpi_index(void *opaque, int version_id) +{ + AcpiPciHpState *s =3D opaque; + return s->acpi_index; +} + const VMStateDescription vmstate_acpi_pcihp_pci_status =3D { .name =3D "acpi_pcihp_pci_status", .version_id =3D 1, diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 1efc0ded9f..6056d51667 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -297,7 +297,8 @@ static const VMStateDescription vmstate_acpi =3D { 2, vmstate_pci_status, struct AcpiPciHpPciStatus), VMSTATE_PCI_HOTPLUG(acpi_pci_hotplug, PIIX4PMState, - vmstate_test_use_acpi_hotplug_bridge), + vmstate_test_use_acpi_hotplug_bridge, + vmstate_acpi_pcihp_use_acpi_index), VMSTATE_END_OF_LIST() }, .subsections =3D (const VMStateDescription*[]) { diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events index f91ced477d..dcc1438f3a 100644 --- a/hw/acpi/trace-events +++ b/hw/acpi/trace-events @@ -41,6 +41,8 @@ acpi_pci_unplug_request(int bsel, int slot) "bsel: %d slo= t: %d" acpi_pci_up_read(uint32_t val) "%" PRIu32 acpi_pci_down_read(uint32_t val) "%" PRIu32 acpi_pci_features_read(uint32_t val) "%" PRIu32 +acpi_pci_acpi_index_read(uint32_t val) "%" PRIu32 +acpi_pci_acpi_index_write(unsigned bsel, unsigned slot, uint32_t aidx) "bs= el: %u slot: %u aidx: %" PRIu32 acpi_pci_rmv_read(uint32_t val) "%" PRIu32 acpi_pci_sel_read(uint32_t val) "%" PRIu32 acpi_pci_ej_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <=3D=3D %" = PRIu64 diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 442b4629a9..e49fae2bfd 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1168,9 +1168,10 @@ static void build_piix4_pci_hotplug(Aml *table) aml_append(scope, field); =20 aml_append(scope, - aml_operation_region("BNMR", AML_SYSTEM_IO, aml_int(0xae10), 0x04)= ); + aml_operation_region("BNMR", AML_SYSTEM_IO, aml_int(0xae10), 0x08)= ); field =3D aml_field("BNMR", AML_DWORD_ACC, AML_NOLOCK, AML_WRITE_AS_ZE= ROS); aml_append(field, aml_named_field("BNUM", 32)); + aml_append(field, aml_named_field("PIDX", 32)); aml_append(scope, field); =20 aml_append(scope, aml_mutex("BLCK", 0)); @@ -1184,6 +1185,16 @@ static void build_piix4_pci_hotplug(Aml *table) aml_append(method, aml_return(aml_int(0))); aml_append(scope, method); =20 + method =3D aml_method("AIDX", 2, AML_NOTSERIALIZED); + aml_append(method, aml_acquire(aml_name("BLCK"), 0xFFFF)); + aml_append(method, aml_store(aml_arg(0), aml_name("BNUM"))); + aml_append(method, + aml_store(aml_shiftleft(aml_int(1), aml_arg(1)), aml_name("PIDX"))= ); + aml_append(method, aml_store(aml_name("PIDX"), aml_local(0))); + aml_append(method, aml_release(aml_name("BLCK"))); + aml_append(method, aml_return(aml_local(0))); + aml_append(scope, method); + aml_append(table, scope); } =20 diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 0eadcdbc9e..ac9a24889c 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -79,6 +79,7 @@ static Property pci_props[] =3D { QEMU_PCIE_EXTCAP_INIT_BITNR, true), DEFINE_PROP_STRING("failover_pair_id", PCIDevice, failover_pair_id), + DEFINE_PROP_UINT32("acpi-index", PCIDevice, acpi_index, 0), DEFINE_PROP_END_OF_LIST() }; =20 --=20 2.27.0 From nobody Sat Apr 27 17:15:28 2024 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=1615832235; cv=none; d=zohomail.com; s=zohoarc; b=lHoUisVl+aY0J2r7d84jZWnrzDc0dFXiE1qHTbx99+vQ3H/Hi7O4RRH41ZzgUhjdHqAVc1pFwIRlXTbiHEDi+evlDXVciiOOO60cdYO7DMpdUcvxsc2Dm82URAlcAx5Vsu3K0mOXVPy5l8qdijxoJDsncmOiNXTAGnzkiMzNOPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615832235; h=Content-Type:Content-Transfer-Encoding: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=uSujXLTODn5r9rn7t65nMSl2p8WacSXGNR2GupPDUDs=; b=f7eicM3IXgUjqw0P8LoF/yLqGed/+Hys4YjEEg4R91EpLPm57WJfPkFAczGqx8Sz30Sw+IVi2LnZwhHLEapGqczBtKCDV2cEETqjChK1UwkpW0B+Rew5QPj6PDXUjTizRLDTVrPyxU61Ksyk3pOeesgLb65NB94+0yLKW2U7WZQ= 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 1615832235955602.3148090364147; Mon, 15 Mar 2021 11:17:15 -0700 (PDT) Received: from localhost ([::1]:55452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLrmB-0003JE-Ni for importer@patchew.org; Mon, 15 Mar 2021 14:17:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLrX4-0001MB-GB for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lLrX2-0008TG-FX for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01: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-410-fSA_HAjcPOyiz4ehUr_S1w-1; Mon, 15 Mar 2021 14:01:27 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23DE5192D796 for ; Mon, 15 Mar 2021 18:01:14 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25AD8620DE; Mon, 15 Mar 2021 18:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831291; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uSujXLTODn5r9rn7t65nMSl2p8WacSXGNR2GupPDUDs=; b=arDLFCEMtRanp1mDClIE6tKL964+dMYdA5mXT+A18cb+Vyluvx9krZGHLzhhkz/bkVjcvB wwrB1OeBtiw3nMoEPG6wmxVoreQqqFBQNaBsHG6NFa03TX1eNYPPRW77J8xQp05bqmRadu sdWEktBgkhWP/r6iamW7JQrKndKG94I= X-MC-Unique: fSA_HAjcPOyiz4ehUr_S1w-1 From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 3/6] pci: acpi: ensure that acpi-index is unique Date: Mon, 15 Mar 2021 14:00:59 -0400 Message-Id: <20210315180102.3008391-4-imammedo@redhat.com> In-Reply-To: <20210315180102.3008391-1-imammedo@redhat.com> References: <20210315180102.3008391-1-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=imammedo@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=63.128.21.124; envelope-from=imammedo@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jusual@redhat.com, laine@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" it helps to avoid device naming conflicts when guest OS is configured to use acpi-index for naming. Spec ialso says so: PCI Firmware Specification Revision 3.2 4.6.7. _DSM for Naming a PCI or PCI Express Device Under Operating Systems " Instance number must be unique under \_SB scope. This instance number does = not have to be sequential in a given system configuration. " Signed-off-by: Igor Mammedov --- hw/acpi/pcihp.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index ceab287bd3..f4cb3c979d 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -52,6 +52,21 @@ typedef struct AcpiPciHpFind { PCIBus *bus; } AcpiPciHpFind; =20 +static gint g_cmp_uint32(gconstpointer a, gconstpointer b, gpointer user_d= ata) +{ + return a - b; +} + +static GSequence *pci_acpi_index_list(void) +{ + static GSequence *used_acpi_index_list; + + if (!used_acpi_index_list) { + used_acpi_index_list =3D g_sequence_new(NULL); + } + return used_acpi_index_list; +} + static int acpi_pcihp_get_bsel(PCIBus *bus) { Error *local_err =3D NULL; @@ -277,6 +292,23 @@ void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hot= plug_dev, ONBOARD_INDEX_MAX); return; } + + /* + * make sure that acpi-index is unique across all present PCI devices + */ + if (pdev->acpi_index) { + GSequence *used_indexes =3D pci_acpi_index_list(); + + if (g_sequence_lookup(used_indexes, GINT_TO_POINTER(pdev->acpi_ind= ex), + g_cmp_uint32, NULL)) { + error_setg(errp, "a PCI device with acpi-index =3D %" PRIu32 + " already exist", pdev->acpi_index); + return; + } + g_sequence_insert_sorted(used_indexes, + GINT_TO_POINTER(pdev->acpi_index), + g_cmp_uint32, NULL); + } } =20 void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState= *s, @@ -315,8 +347,22 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug= _dev, AcpiPciHpState *s, void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpSta= te *s, DeviceState *dev, Error **errp) { + PCIDevice *pdev =3D PCI_DEVICE(dev); + trace_acpi_pci_unplug(PCI_SLOT(PCI_DEVICE(dev)->devfn), acpi_pcihp_get_bsel(pci_get_bus(PCI_DEVICE(dev))= )); + + /* + * clean up acpi-index so it could reused by another device + */ + if (pdev->acpi_index) { + GSequence *used_indexes =3D pci_acpi_index_list(); + + g_sequence_remove(g_sequence_lookup(used_indexes, + GINT_TO_POINTER(pdev->acpi_index), + g_cmp_uint32, NULL)); + } + qdev_unrealize(dev); } =20 --=20 2.27.0 From nobody Sat Apr 27 17:15:28 2024 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=1615833199; cv=none; d=zohomail.com; s=zohoarc; b=WY2MzeNLmP9GzL3MGPpUqyHtKsMJ+z50ZJbUH/qlzbDeIYj1kehjQbZP0SScnf6/XrJTefjf9ZhgUtpswUQ5M5EEOvZqwHM0FhHOzOL25lbaOtn1oLOIgVz7FOlweUm6AF+9FzS+ly+iZCPRB+vgDo8YmEFmkIuPfmEu/L/xjMY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615833199; h=Content-Type:Content-Transfer-Encoding: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=8KCQD1VbP/El2QMv+N/Bo91+TjtRK+FqTRcECwRqos0=; b=aU27DN5ezNF5neESV5Crm01eKanOdpU7wCAcSePkQqNTuUJuCeuh0mNPesregFBpGxPGCyI7vWC1Pajt3HgTSnItyJH1ZfDt6cOCDYnjU1mGFmV20Cu34p8aiux5unJQCceUPCIoNLTgV/Ko3BOy+XikxZ8taoYYeWOuHBg61oE= 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 1615833199703793.6819943325668; Mon, 15 Mar 2021 11:33:19 -0700 (PDT) Received: from localhost ([::1]:38328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLs1m-0003Qw-Jg for importer@patchew.org; Mon, 15 Mar 2021 14:33:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLrX4-0001Ly-Bs for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lLrX2-0008T9-Bm for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:33 -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-177-EzfHAUj8ObG0Q1RjRx1kQQ-1; Mon, 15 Mar 2021 14:01:29 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A26880159F for ; Mon, 15 Mar 2021 18:01:15 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B0D9620DE; Mon, 15 Mar 2021 18:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831291; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8KCQD1VbP/El2QMv+N/Bo91+TjtRK+FqTRcECwRqos0=; b=OCJ64WzXgB05t/Lp+zomNFufoOoxQRTKpjSU0DJ6vA2x3vG30e8siT+ZzDf+EsEnx0xq+s PZYNTOi6iszF7q2PO+YWkTx2yLhnMk9d65IVpvPipM6dyLMMu7mbRxnW8dBRt9SnLZeEwA RB2ENYj3a2FJhRGRwnqyXabEp2fSGBQ= X-MC-Unique: EzfHAUj8ObG0Q1RjRx1kQQ-1 From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 4/6] acpi: add aml_to_decimalstring() and aml_call6() helpers Date: Mon, 15 Mar 2021 14:01:00 -0400 Message-Id: <20210315180102.3008391-5-imammedo@redhat.com> In-Reply-To: <20210315180102.3008391-1-imammedo@redhat.com> References: <20210315180102.3008391-1-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=imammedo@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=imammedo@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jusual@redhat.com, laine@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" it will be used by follow up patches Signed-off-by: Igor Mammedov --- include/hw/acpi/aml-build.h | 3 +++ hw/acpi/aml-build.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 380d3e3924..e652106e26 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -301,6 +301,7 @@ Aml *aml_arg(int pos); Aml *aml_to_integer(Aml *arg); Aml *aml_to_hexstring(Aml *src, Aml *dst); Aml *aml_to_buffer(Aml *src, Aml *dst); +Aml *aml_to_decimalstring(Aml *src, Aml *dst); Aml *aml_store(Aml *val, Aml *target); Aml *aml_and(Aml *arg1, Aml *arg2, Aml *dst); Aml *aml_or(Aml *arg1, Aml *arg2, Aml *dst); @@ -323,6 +324,8 @@ Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2= , Aml *arg3); Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *a= rg4); Aml *aml_call5(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *a= rg4, Aml *arg5); +Aml *aml_call6(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *a= rg4, + Aml *arg5, Aml *arg6); Aml *aml_gpio_int(AmlConsumerAndProducer con_and_pro, AmlLevelAndEdge edge_level, AmlActiveHighAndLow active_level, AmlShared shared, diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index a2cd7a5830..d33ce8954a 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -634,6 +634,19 @@ Aml *aml_to_buffer(Aml *src, Aml *dst) return var; } =20 +/* ACPI 2.0a: 17.2.4.4 Type 2 Opcodes Encoding: DefToDecimalString */ +Aml *aml_to_decimalstring(Aml *src, Aml *dst) +{ + Aml *var =3D aml_opcode(0x97 /* ToDecimalStringOp */); + aml_append(var, src); + if (dst) { + aml_append(var, dst); + } else { + build_append_byte(var->buf, 0x00 /* NullNameOp */); + } + return var; +} + /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefStore */ Aml *aml_store(Aml *val, Aml *target) { @@ -835,6 +848,21 @@ Aml *aml_call5(const char *method, Aml *arg1, Aml *arg= 2, Aml *arg3, Aml *arg4, return var; } =20 +/* helper to call method with 5 arguments */ +Aml *aml_call6(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *a= rg4, + Aml *arg5, Aml *arg6) +{ + Aml *var =3D aml_alloc(); + build_append_namestring(var->buf, "%s", method); + aml_append(var, arg1); + aml_append(var, arg2); + aml_append(var, arg3); + aml_append(var, arg4); + aml_append(var, arg5); + aml_append(var, arg6); + return var; +} + /* * ACPI 5.0: 6.4.3.8.1 GPIO Connection Descriptor * Type 1, Large Item Name 0xC --=20 2.27.0 From nobody Sat Apr 27 17:15:28 2024 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=1615832099; cv=none; d=zohomail.com; s=zohoarc; b=OheCKVUr7ZfV2CEvrppR/34HbBALcIPyeR973bZacbKAVGiY9CWL4s7i7z254bGHyNYOMYuBIZpNdRPU+vjwLKErV94Fmt1QaVnOyXSLCtt45RjERjuTogUSN55B8sIZ7v2C4rs79/v0JRXX3laR5C0GlLVX0SUwEpkn6+fwPMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615832099; h=Content-Type:Content-Transfer-Encoding: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=LTjtKhVyccdrs+NK4uuVWt3Q+46eNlxQFeKHIpcboq0=; b=mHKy4CSjPfjzO9nIU0CTAjlXWWBsDI/V+WWxgtvvuNw56dz2QAsJ1bF/7b07fnFR6BKHZh8aw7bu4PVQi0NfZP4A0yw78CKZgQKwFigcVI1xvqF6voBRipLAZyBfSHAFsT3ADyxlkESbI46Se1lBz2AKgDh3o7scBVbRyvV+r0A= 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 1615832099315869.2365303722514; Mon, 15 Mar 2021 11:14:59 -0700 (PDT) Received: from localhost ([::1]:51896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLrk2-0001lV-9m for importer@patchew.org; Mon, 15 Mar 2021 14:14:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLrX7-0001QS-08 for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:24592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lLrX4-0008UY-G4 for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:36 -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-304-Mygt6-evOQeJRiznab9R8Q-1; Mon, 15 Mar 2021 14:01:32 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9EEBA0C13 for ; Mon, 15 Mar 2021 18:01:16 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B13405B4A8; Mon, 15 Mar 2021 18:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831293; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LTjtKhVyccdrs+NK4uuVWt3Q+46eNlxQFeKHIpcboq0=; b=M64Zushe9aB2wsVTc9NXUdwczAacGrmpQ0Hw5Fv5gK3DjTcTo57+gof5rcnob6ABbeamLN lLTJpMyMkqNbTvymBJJnuo28/FSxn9sWPInZIvuu5bVISq9UBGZKPJGbq4ItGdQlZXk5kW cZsEc3zZGEjbuA1jU3opepcgtSo6ed4= X-MC-Unique: Mygt6-evOQeJRiznab9R8Q-1 From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 5/6] pci: acpi: add _DSM method to PCI devices Date: Mon, 15 Mar 2021 14:01:01 -0400 Message-Id: <20210315180102.3008391-6-imammedo@redhat.com> In-Reply-To: <20210315180102.3008391-1-imammedo@redhat.com> References: <20210315180102.3008391-1-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=imammedo@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=63.128.21.124; envelope-from=imammedo@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jusual@redhat.com, laine@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Implement _DSM according to: PCI Firmware Specification 3.1 4.6.7. DSM for Naming a PCI or PCI Express Device Under Operating Systems and wire it up to cold and hot-plugged PCI devices. Feature depends on ACPI hotplug being enabled (as that provides PCI devices descriptions in ACPI and MMIO registers that are reused to fetch acpi-index). acpi-index should work for - cold plugged NICs: $QEMU -device e1000,acpi-index=3D100 =3D> 'eno100' - hot-plugged (monitor) device_add e1000,acpi-index=3D200,id=3Dremove_me =3D> 'eno200' - re-plugged (monitor) device_del remove_me (monitor) device_add e1000,acpi-index=3D1 =3D> 'eno1' Windows also sees index under "PCI Label Id" field in properties dialog but otherwise it doesn't seem to have any effect. Signed-off-by: Igor Mammedov --- v1: * drop optional text label * do not report capability if PIDX is not supported (i.e. old QEMU) --- include/hw/acpi/pci.h | 1 + hw/i386/acpi-build.c | 105 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 103 insertions(+), 3 deletions(-) diff --git a/include/hw/acpi/pci.h b/include/hw/acpi/pci.h index e514f179d8..b5deee0a9d 100644 --- a/include/hw/acpi/pci.h +++ b/include/hw/acpi/pci.h @@ -35,4 +35,5 @@ typedef struct AcpiMcfgInfo { =20 void build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info, const char *oem_id, const char *oem_table_id); +Aml *aml_pci_device_dsm(void); #endif diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index e49fae2bfd..d14a5fab62 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -397,6 +397,13 @@ static void build_append_pci_bus_devices(Aml *parent_s= cope, PCIBus *bus, aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN")) ); aml_append(dev, method); + method =3D aml_method("_DSM", 4, AML_SERIALIZED); + aml_append(method, + aml_return(aml_call6("PDSM", aml_arg(0), aml_arg(1), + aml_arg(2), aml_arg(3), + aml_name("BSEL"), aml_name("_SUN"= ))) + ); + aml_append(dev, method); aml_append(parent_scope, dev); =20 build_append_pcihp_notify_entry(notify_method, slot); @@ -424,6 +431,16 @@ static void build_append_pci_bus_devices(Aml *parent_s= cope, PCIBus *bus, dev =3D aml_device("S%.02X", PCI_DEVFN(slot, 0)); aml_append(dev, aml_name_decl("_ADR", aml_int(slot << 16))); =20 + if (bsel) { + aml_append(dev, aml_name_decl("_SUN", aml_int(slot))); + method =3D aml_method("_DSM", 4, AML_SERIALIZED); + aml_append(method, aml_return( + aml_call6("PDSM", aml_arg(0), aml_arg(1), aml_arg(2), + aml_arg(3), aml_name("BSEL"), aml_name("_SUN")) + )); + aml_append(dev, method); + } + if (pc->class_id =3D=3D PCI_CLASS_DISPLAY_VGA) { /* add VGA specific AML methods */ int s3d; @@ -446,9 +463,7 @@ static void build_append_pci_bus_devices(Aml *parent_sc= ope, PCIBus *bus, aml_append(method, aml_return(aml_int(s3d))); aml_append(dev, method); } else if (hotplug_enabled_dev) { - /* add _SUN/_EJ0 to make slot hotpluggable */ - aml_append(dev, aml_name_decl("_SUN", aml_int(slot))); - + /* add _EJ0 to make slot hotpluggable */ method =3D aml_method("_EJ0", 1, AML_NOTSERIALIZED); aml_append(method, aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN")) @@ -511,6 +526,88 @@ static void build_append_pci_bus_devices(Aml *parent_s= cope, PCIBus *bus, qobject_unref(bsel); } =20 +Aml *aml_pci_device_dsm(void) +{ + Aml *method, *UUID, *ifctx, *ifctx1, *ifctx2, *ifctx3, *elsectx; + Aml *acpi_index =3D aml_local(0); + Aml *zero =3D aml_int(0); + Aml *bnum =3D aml_arg(4); + Aml *func =3D aml_arg(2); + Aml *rev =3D aml_arg(1); + Aml *sun =3D aml_arg(5); + + method =3D aml_method("PDSM", 6, AML_SERIALIZED); + + /* + * PCI Firmware Specification 3.1 + * 4.6. _DSM Definitions for PCI + */ + UUID =3D aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D"); + ifctx =3D aml_if(aml_equal(aml_arg(0), UUID)); + { + aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sun), acpi_ind= ex)); + ifctx1 =3D aml_if(aml_equal(func, zero)); + { + uint8_t byte_list[1]; + + ifctx2 =3D aml_if(aml_equal(rev, aml_int(2))); + { + /* + * advertise function 7 if device has acpi-index + * acpi_index values: + * 0: not present (default value) + * FFFFFFFF: not supported (old QEMU without PIDX reg) + * other: device's acpi-index + */ + ifctx3 =3D aml_if(aml_lnot( + aml_or(aml_equal(acpi_index, zero), + aml_equal(acpi_index, aml_int(0xFFFFFFFF)), NUL= L) + )); + { + byte_list[0] =3D + 1 /* have supported functions */ | + 1 << 7 /* support for function 7 */ + ; + aml_append(ifctx3, aml_return(aml_buffer(1, byte_list)= )); + } + aml_append(ifctx2, ifctx3); + } + aml_append(ifctx1, ifctx2); + + byte_list[0] =3D 0; /* nothing supported */ + aml_append(ifctx1, aml_return(aml_buffer(1, byte_list))); + } + aml_append(ifctx, ifctx1); + elsectx =3D aml_else(); + /* + * PCI Firmware Specification 3.1 + * 4.6.7. _DSM for Naming a PCI or PCI Express Device Under + * Operating Systems + */ + ifctx1 =3D aml_if(aml_equal(func, aml_int(7))); + { + Aml *pkg =3D aml_package(2); + Aml *ret =3D aml_local(1); + + aml_append(pkg, zero); + /* + * optional, if not impl. should return null string + */ + aml_append(pkg, aml_string("%s", "")); + aml_append(ifctx1, aml_store(pkg, ret)); + /* + * update apci-index to actual value + */ + aml_append(ifctx1, aml_store(acpi_index, aml_index(ret, zero)= )); + aml_append(ifctx1, aml_return(ret)); + } + aml_append(elsectx, ifctx1); + aml_append(ifctx, elsectx); + } + aml_append(method, ifctx); + return method; +} + /** * build_prt_entry: * @link_name: link name for PCI route entry @@ -1195,6 +1292,8 @@ static void build_piix4_pci_hotplug(Aml *table) aml_append(method, aml_return(aml_local(0))); aml_append(scope, method); =20 + aml_append(scope, aml_pci_device_dsm()); + aml_append(table, scope); } =20 --=20 2.27.0 From nobody Sat Apr 27 17:15:28 2024 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=1615832205; cv=none; d=zohomail.com; s=zohoarc; b=GLbOpvBkIXLzocrCoYDbcjM47dCPtqejAZtv/LxyZsBVip5aIi68vHWRNKzHmkA8SAjDFboJ7+2DdNaXirouSJil6JM6PcY3gnH7C24UCPz2PM4kRA3zKjwpo34Hw7nGDAl9wI4B0S4ZxocylJe082sP9/VTeBaOrM1lInedK9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615832205; h=Content-Type:Content-Transfer-Encoding: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=iZSacFnjYtBZyJX0tQKTFbw4S/vvW5hlbH2DcnkszzI=; b=RCAv/rtA4blURJEKyYln+/SnWbajMuPbb4pFkDdNMcccZ+HRceylQ8RDoeTAJS6ZfgjPgEmLE4neH6PcdNaRgEhtJKFodKLZ7j1NHBl0Tk9HhyHOaYC85Vgqc4wOMCKpS6miiLM0oK0pC6LtqjmkV4e2MDAN7eak21aznZP068M= 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 1615832205386332.35887220245627; Mon, 15 Mar 2021 11:16:45 -0700 (PDT) Received: from localhost ([::1]:55112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLrlk-0003Ai-3F for importer@patchew.org; Mon, 15 Mar 2021 14:16:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLrXA-0001TB-NB for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24032) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLrX6-0008VP-EQ for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:01:40 -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-29-QyYuCoXeORG2_zQ67fgxig-1; Mon, 15 Mar 2021 14:01:33 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D4D61025EC0 for ; Mon, 15 Mar 2021 18:01:18 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B207620DE; Mon, 15 Mar 2021 18:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831295; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iZSacFnjYtBZyJX0tQKTFbw4S/vvW5hlbH2DcnkszzI=; b=NDeC+eu65syAQDT8s5Gulr6fLE1E35fu1ev7L+ciYcDBI//mAq8gqbpNBzJmtnZKCQev6d dPr8VHqXTrQYbmw4F9Xk8zyeVvanYS638d5f+nli1qPg74Iht1hZ2aMpwsTPYoSddI3grY ch92geEVJot5Fs2AUbokCUYAvys1U/I= X-MC-Unique: QyYuCoXeORG2_zQ67fgxig-1 From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 6/6] tests: acpi: update expected blobs Date: Mon, 15 Mar 2021 14:01:02 -0400 Message-Id: <20210315180102.3008391-7-imammedo@redhat.com> In-Reply-To: <20210315180102.3008391-1-imammedo@redhat.com> References: <20210315180102.3008391-1-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=imammedo@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=imammedo@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jusual@redhat.com, laine@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" expected changes are: * larger BNMR operation region * new PIDX field and method to fetch acpi-index * PDSM method that implements PCI device _DSM + per device _DSM that calls PDSM @@ -221,10 +221,11 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ",= 0x00000001) B0EJ, 32 } - OperationRegion (BNMR, SystemIO, 0xAE10, 0x04) + OperationRegion (BNMR, SystemIO, 0xAE10, 0x08) Field (BNMR, DWordAcc, NoLock, WriteAsZeros) { - BNUM, 32 + BNUM, 32, + PIDX, 32 } Mutex (BLCK, 0x00) @@ -236,6 +237,52 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", = 0x00000001) Release (BLCK) Return (Zero) } + + Method (AIDX, 2, NotSerialized) + { + Acquire (BLCK, 0xFFFF) + BNUM =3D Arg0 + PIDX =3D (One << Arg1) + Local0 =3D PIDX /* \_SB_.PCI0.PIDX */ + Release (BLCK) + Return (Local0) + } + + Method (PDSM, 6, Serialized) + { + If ((Arg0 =3D=3D ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d= ") /* Device Labeling Interface */)) + { + Local0 =3D AIDX (Arg4, Arg5) + If ((Arg2 =3D=3D Zero)) + { + If ((Arg1 =3D=3D 0x02)) + { + If (!((Local0 =3D=3D Zero) | (Local0 =3D=3D 0xFFFF= FFFF))) + { + Return (Buffer (One) + { + 0x81 = // . + }) + } + } + + Return (Buffer (One) + { + 0x00 = // . + }) + } + ElseIf ((Arg2 =3D=3D 0x07)) + { + Local1 =3D Package (0x02) + { + Zero, + "" + } + Local1 [Zero] =3D Local0 + Return (Local1) + } + } + } } Scope (_SB) @@ -785,7 +832,7 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0= x00000001) 0xAE00, // Range Minimum 0xAE00, // Range Maximum 0x01, // Alignment - 0x14, // Length + 0x18, // Length ) }) } @@ -842,11 +889,22 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ",= 0x00000001) Device (S00) { Name (_ADR, Zero) // _ADR: Address + Name (_SUN, Zero) // _SUN: Slot User Number + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Met= hod + { + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + } } Device (S10) { Name (_ADR, 0x00020000) // _ADR: Address + Name (_SUN, 0x02) // _SUN: Slot User Number + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Met= hod + { + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + } + Method (_S1D, 0, NotSerialized) // _S1D: S1 Device State { Return (Zero) [...] Signed-off-by: Igor Mammedov --- tests/qtest/bios-tables-test-allowed-diff.h | 11 ----------- tests/data/acpi/pc/DSDT | Bin 5065 -> 6002 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 6390 -> 7327 bytes tests/data/acpi/pc/DSDT.bridge | Bin 6924 -> 8668 bytes tests/data/acpi/pc/DSDT.cphp | Bin 5529 -> 6466 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 6719 -> 7656 bytes tests/data/acpi/pc/DSDT.hpbridge | Bin 5026 -> 5969 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 5137 -> 6074 bytes tests/data/acpi/pc/DSDT.memhp | Bin 6424 -> 7361 bytes tests/data/acpi/pc/DSDT.nohpet | Bin 4923 -> 5860 bytes tests/data/acpi/pc/DSDT.numamem | Bin 5071 -> 6008 bytes tests/data/acpi/pc/DSDT.roothp | Bin 5261 -> 6210 bytes 12 files changed, 11 deletions(-) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index fddcfc061f..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,12 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT", -"tests/data/acpi/pc/DSDT.acpihmat", -"tests/data/acpi/pc/DSDT.bridge", -"tests/data/acpi/pc/DSDT.cphp", -"tests/data/acpi/pc/DSDT.dimmpxm", -"tests/data/acpi/pc/DSDT.hpbridge", -"tests/data/acpi/pc/DSDT.hpbrroot", -"tests/data/acpi/pc/DSDT.ipmikcs", -"tests/data/acpi/pc/DSDT.memhp", -"tests/data/acpi/pc/DSDT.numamem", -"tests/data/acpi/pc/DSDT.roothp", diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT index 11ef89bd322271ee30f3971b880dadfda565d413..b9dd9b38e4ef720636ba19ccbdf= 262de8a6439d5 100644 GIT binary patch delta 1301 zcmajfKTE?<5CHH?>Yo~-P1puW8^!=3DsfM~y4g)ZgSKKwr>LO{d zYeBzxD9F0DuE=3D^;8_%TFO)~C_Rix=3D;D`m|IIjyWUn@*mVojs-ilsGilW`q_!TT**6 zs-X?I>28u2L!9t5|M+6e?Q6&3H*Mrj(Hz>Vv}3yyqzLW^DR8VCIyoRV5Swqd4tS!E zIivw}H`Ka*lnJ1MqTn-N*Ma!^GqZm6h6-WyqGWSj#A>xL-Dw(qLAj zMm%o$t)#jRe#^+}Acd{gT)ao8%NL5<)X{=3DjUF|XwZOa3&f1YDIJ&;=3Dc5-NB=3DlNnWL zXS4Lmtjb+P>Yp0x^!OJnV4#SBQw-c-;2i@)1IQLh43sc%hJjlQd|+TWfNY^)U>5`D v7`Vs4Ck93ZWQ!#XI2gFVzyk)pFfb+}TP$OsjDbrGG{k7&-$zh?6`z?OB0Yu? delta 345 zcmeyQcT%0pCDmqyI*(Jxoj<9FtEldGoSFH*!1q`35;V`GxvUR%O=3DP{Dhf@ zlTl>yN1jY0*MgY%V5fKi-~0e)PXi98U{@c8=3DqB!91A};uct@8YAV(|M5X#|UU|?dH ze2Q0=3DQFHQ3UJd5xCe6vZd=3DR=3D2N^gbIKcTcOKSaI}N*{&NoB|MWUno5hN?(Q2l7bNV zSSY;^Niz1tEIsTJI1M z;R^c&qHCv$uugr2h%P}yL|x5So&uS77=3D|~$H_Tk#ccQVtNvgEghyXCp7u*%gDn8O; zGk%v=3D^9qW*Dhf(o9?zwvbu#XluJTjKPReRgAuDFuZL>(r<{nc5N=3DzCIZGskUgO~bq zk}7+wtdkUd0nYn4fB&M+?aN1@S9#<{lug>JvSnCNQU+^;lsMK393Kz^h~aK`4%j{i zQ=3D`2#b!=3DS$6bP&%7Rvp zsqwh((v#9ExO6qI03XsjbGdCgU9nW&q>dJ}`bwXg=3Dvp@b`{y~f*8{%OFCl>qG?|gS z-E5X#X?3BGB>j_-UXOo41p_A-xW>R62EqYkND%|u7&yhiEe75(Fv=3Draq%dG&;0yzI w82G?IB#3OWgn=3DCloMWJcflmyK4I^8mF|dn)1_mB5@HHG8`u7oB218HG4_Q%&Gynhq delta 345 zcmbPl`OT2aCD5fk8Y+yrWAHkfRlB2<7lFFfcJp z{w^fTs5x0oSc5sbNpo@(l%5BrA3uWnZzLCZcw@l zN}q$$LgEnlFep6>O5cOhN)izHG$_3aO232BMv@TuGAO+ZO8PErv0HYv@`$E9vC F0szp9V*vmF diff --git a/tests/data/acpi/pc/DSDT.bridge b/tests/data/acpi/pc/DSDT.bridge index a234075518fa8e187349d64c313779cc25db8299..a9b4d5659457f6de30b993962bc= e673c9413d81d 100644 GIT binary patch delta 2375 zcmeA%yW`B|66_LkN0EVn@y153Jxok~f|E}$c?)qwHwrlU`35;V`Gxu_1bDhcOjcml zs~6FB1TvYTm7RQ?z5o9&$N)(fR5E5VfRq$~h=3Dgc$kmQmC5f`=3DqmtbGM1wO2kGX#aX z1TL7Ld>U+8Mk$u^4C=3DGt@91WedKNWpDF3fM#mSYb#=3D zK@1@U?SvHk=3DOf^TyM#>O5F=3Dnh13v);afD3hB&2{*fPfYE37NnpPQV0HLJATHDd;Ao zU>hL?4+$yYks#m;b3zK%3lcD)myiiN2q`cSB47odq$WRF3AMReh?9v4n6XE*C9sqR XhQnyKgoMLrwuFSk0A))($$N|dt?#vOym?uo8@ZkQe1n{w{6c*vt1|0te!|Sd z$tW`UBTuH0$CH@&V5fKihbIBfo(3FF!LB|G(M{aJ1_tpQ@s2J*K#o?hA(X?zz`(>X z`3$eDq<>kkp#?+*P>`7ctdTLgNoBGkpE7fFlg8u(K6N0iIe9Uk2AF;hrM3AX{Cp_A z8A^YL($)eH`FbdQ7)rAXLd3nHbU&2745h_|Ao9^rdOnnX45ihDA@bQ!dOei>45iIQ uAoA5vdOwtA7KMnrL+NfPeI7~+i$UbW#WWYs5MyH0oIH$uxS3tyDkA`KW3MOx diff --git a/tests/data/acpi/pc/DSDT.cphp b/tests/data/acpi/pc/DSDT.cphp index 6ac47a7d1001c711b957f8e28cab1a143d2cf65f..8d86155e275aa688f8767dd92c4= b9df08b4a18ad 100644 GIT binary patch delta 1301 zcmajfPfG$(5CHJmRZAArT~{%oL(ri_2sI*z2wOMkkGqJQ5NxpPA#$x?uLU7`icZyw zsM`wr1;R^E5!Iz`eSj`OMM&SleB~*Kd52+m^LxY0<(((*Gn}l+D^eVQIk@1iSymOu zBfA{->vdjIm10g(OUiIzQC=3Dm(p7B~FIoC~DeMHLVmOCB0Ld*6JV*w>L4W>Ryi>?`w z`wFtA1f9H(R0NUZpQoPQwaH!ODArcu4>`rAy|%VZXM|M2i4%)s9r1XNm_W=3Dxr+dH^ zJWQPiXvUlICz##^%Fz|r^fk(EO!N3Lvjxlh9flmyG0U5&H8Hv@XS0<{JoRhA995 delta 345 zcmX?PG*g?)CDrP7Q%eJ6|N=3DF2wBTK$O1Uo3)NE$a8dda&hJf?77a}@g5#xhaysFaw8<3c z#kiJ87+zyS&Vbj@=3D2Z|QhC7$fVbkUEg*E0_LNCtLXgz<{2S9#3PpTD&ZoeKG9AKAT zneGUFBGu4Cp|iDGiC%QUB?ewG&>$jD3}7IOfg=3DoDVc;DDjZMfFLl{`bz%d4{G4O$b yKr^z%Fa}mIaDssw418fA6hXEa#lR{C&Mc({V$fHZ`=3D5fk8Y+yrWAHkfRlB2<7lFFfcJp zb`X(e)SMhIqQM;9q&ayplztASwM8M~`A~W@l>QE-t;Hbn^-%gSlx7!)h4H0*T(%n${ytL+K0ht?& E09A8hhX4Qo diff --git a/tests/data/acpi/pc/DSDT.hpbridge b/tests/data/acpi/pc/DSDT.hpb= ridge index 9dfac45eab12b680bc963d0528553a7149a378cc..5d8ba195055f2eda74223323bae= b88390ea36739 100644 GIT binary patch delta 1315 zcmajf&o9GZ7zgmDZ~d62SZ6X42Z_imi)ACik**?GYxW|NO4{AFA?X#7Wpi=3Dmy;IVN zh)BfM&4r5)#M!~c-yo)M>?Gmo;mwmipMKxxx%4>tn2hl^w+LO#l#Au5!xf9FR&eeho1RVvR63afvl^qx zq!q9xv>XI1x@bT+V)=3D8)9-ppIEUj|K8)kK;fu`zK1|UCPB7c1l_VZF2c)*JxZMCX`>)@^)xGj8 Fd;_9>h+F^w delta 354 zcmcbpw@97KCDyN1jY0zucJkV5fKix7+|{PXi98U{@c8=3DqB!91A};uct@8YAV(|M5X#|UU|?dH ze2Q0Ah(FlS0-^vY#tc-XIa!iVgBe7}Lg|H2`YDvwk2(eNzQg0e`@P3|hp!duE()5VZFeI8O!r<0aBMzIBrYrS zWp3u+b4EOF z@m5OP0^Tx;c~ByjznAFI?JCvU0d=3D%sHa7#t(w`Lp*k3QOgBlcn-jW6$&}3O7dN9PQ z0a6OarUtc`O&^?L-~j{g7~n(54l5Yg#lQsy9x?EN0bvZeB7p%L1D6!Vd-n=3DZ)joeOtzCq4TexbgTbD8xv>#*=3D} zGKx&LQ5)9r+>htx)IBqI0z0Zg0vMWiijo=3D{L_SD6od##5wU3%vMNZilar`V z#4&|TZqi9qq`2tjR}fT0{0_BGI|*`cIF5I}cib)SBGZ`QRYP5A^Z_u5EB=3D;cb%8vx zOHs}|h{(FOtjPMR)}LQc*GPY0v?7kowo=3Dv{kaNmXv*{LT+1+Ivpv0xYHV0|Zw?(xx zuNqp9m+K%!A;w3Zvrliv_?~tmeQL=3DEMRRGd?H$`2ASLjU#Nk;lcDhe&AarB3a))v0PqWSJz(}Q334eomHFDbWyn@!rj}P0Qk-ne<-n{C z8>y7VS+nXgaF(&EgD6?8xk5gjuIQA?)X{=3DjT?`uOwhaNWzn*9Rdmy&@rB(2OCK)x- z&c^7KS(SriBRbUg-{T)}gn?@eyka06LuQ!7z$ONcF>r%{cMJ$3vc(hzwlHvtfjbO* vU?3JpwwT6%gMl*)++*Mq1MyyDix~`*F>sE71_r(`AW6gFKOaFoE4?t^B&CLx delta 344 zcmX?TIm3v{CD#vOym?uo8@ZkQe1n{w{6c*vt1|0te!?8h z$0#z{K`7J6wIC)w*ePDXH$TAH(}2S%*wu$2x`{j3z#yI@-q9rp$k7TmgmQQo7?>C) zOA5;}YEHHg)?kiq(wtlar4K-977>WJ2bAuC(ifn#h$uup0!q(;(hs1tiWo#b14^%f z(jTC-i8w^Q0!r_J(32z}!Y)v{14^HP(gKnY`4A{Q14`e4(h5=3D#`4lLU+8Ff0^bAUZjV zi@iXIm5G6uA+aE#Bawk&Nuq$CS$wclyujuYOe~y?5|htzXV!Zxi~)-|EDUh=3DG~jRw zcJ*P1Zqf`kFo@@fcXSD2;D`?n^uW8JStxAax*#=3Dq4|gU_+=3D{9tH*` zhQDP&P9ut!X$7CxeZ(f$@Ms6oR-ymlvzfj-F)0y-(hcWYT zGKx%2=3DE*d2Er^K^c8VA9%@1()G~jRwcJ*P1ZsHC$Fo@@fcXSB?aHJGEDG$+r8(vP9EIv+$l8%nQ-(x0KUIX^_c8cOen(#!%7ad#-)4W-XR zX<X=3Df3Ld^?mrEuy)ZNAw0G E0LKMiz5oCK diff --git a/tests/data/acpi/pc/DSDT.numamem b/tests/data/acpi/pc/DSDT.numa= mem index 195f8da900c5fc56c504adfef756af8f74f5823d..8632dfe8a8bdd991871a1e63316= 2eb9a2e1497ea 100644 GIT binary patch delta 1291 zcmajePfG$(5CHJmXO?aLTQjVXkUE$IqCs@6b)!so5jP>&VAq>k!4eS`gygAfy<0J!!Ae?^EQ&|8uV zd9;I|sK~{PsFdVbAuFxYm@C-`Pt7|i(I&)vCfDhh6;?KPxhgPXvS4U&RC0Dv?2`h!S?Lki#oF>A4Oi}k?V|XvRNCOhBZNJV2#i!PprY?eQE$TydCF(Ex5P? z7N8ZehG;Fs_n9F#0Uwl2yi^2_u9g%CM|5W|ug$irRBP+Zv4YlI?orc!)(b#>Jx{tdgq?Y532b1=3Dv_uDd zej@hJQQu^=3DTZ`6ozybzL44h!#1_SRHi29K$7BR4efm00JV&DSw1Ct_3mi!A|i4zWD*po(3FF!LB|G(M{aJ1_tpQ@s2J*K#o?hA(X?zz`(>X z`2w#jqvquIyc*2WO`4O9`5<&Tl->=3Dc|3hhKeu#WKls*lm`2`^2!BBcSl)eq6QB+?S&!o%~1L{l;#$Ji2Fn7$x!+_l$I8S$j6InZeAdI GgAo8NGGr|P diff --git a/tests/data/acpi/pc/DSDT.roothp b/tests/data/acpi/pc/DSDT.roothp index 1d0a2c2f3cc4bfac75948d2ed6a69403cd18379b..cee3b4d80b51ad30153953ace46= 127923ce8b271 100644 GIT binary patch delta 1279 zcmeCxJY>M-66_MP562flQ`oWhWnJ@BjY`GCR!(lh0_DkB3=3D1SDXL2zu5S~;!Ie}qv0?&USU|1r^ z%-9Gb7#4~z5S^SQ#Km49#LC3L%aB-*(2>Z%uq1J_A2Sapqr~KBo=3Dh%}busb5PVoW` z>n5M$v1jsIF`1uNjL~MY8n3d9hUJd*T77|i$hLD2qgcK<85paVqAq5qL6f7pB;2a?ZKM5&N;V0k=3De?khX2q{=3Df zNWld{3Vst(pe8`T7lDKn)DTjzoRES`gcSTGq(DQEfG>gxDX1f)U?m|1R|qNiPe_55 T5CLC=3D3Tg7A<^Ij3LJ~{>th0qv delta 353 zcmX?P(5uPi66_MvE5g9QSh|sG4-=3DCI$K(@C-n=3DZ)joeOtzCq4TexbgTRhjiRKVjzK zWE7eFktdVOvnD1!*ePDXv1W1#uf3#yS+Jo+JV(5vOArqO12Y4MQ?RQKLv)kM|#jWZ(b* --=20 2.27.0