From patchwork Mon Sep 16 17:10:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805677 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39749142E77 for ; Mon, 16 Sep 2024 17:11:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506663; cv=none; b=dIKcapSaob3xgpBBwwvRkFqnQBwpSh8VRjUZQ0KtpLyjD55iQAj3a7/XpcVnW0pHy8ytum7d4B1nKR+Gn6RAZazTc5JmX7AM8lVCmOi2fFqjv7WvhA46KqGcuMOTCkQur5vtq8BkT5aSgHz9EPiNVkBd2bOa/IQyl0FxjCu9X2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506663; c=relaxed/simple; bh=ERVt4zg78JP0O+v61imXzchUrZU7pMLsVKQHvCF2v2I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NMZwk3bL5I8qAWKXZ7Ttw0Cp0F9ZpacU8H631TtKnFdl5dlRErBJlenN1F1UOmYyrpeE8oi2JDEfWNL4uyyaK43E8gxVBHGOIL2g2Wl2B39nUTpvrkYSz6MSXXsM88YFFDuAp+pTxRDtDWSgreb3LI7F1RYlic90a7T4205OOWU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6rz117Bqz6K6ZC; Tue, 17 Sep 2024 01:10:53 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id C813E140AB8; Tue, 17 Sep 2024 01:10:57 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:10:54 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 01/15] hw/acpi: Fix ordering of BDF in Generic Initiator PCI Device Handle. Date: Mon, 16 Sep 2024 18:10:06 +0100 Message-ID: <20240916171017.1841767-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To frapeml500008.china.huawei.com (7.182.85.71) The ordering in ACPI specification [1] has bus number in the lowest byte. As ACPI tables are little endian this is the reverse of the ordering used by PCI_BUILD_BDF(). As a minimal fix split the QEMU BDF up into bus and devfn and write them as single bytes in the correct order. [1] ACPI Spec 6.3, Table 5.80 Fixes: 0a5b5acdf2d8 ("hw/acpi: Implement the SRAT GI affinity structure") Reviewed-by: Igor Mammedov Tested-by: "Huang, Ying" Signed-off-by: Jonathan Cameron --- hw/acpi/acpi_generic_initiator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/acpi/acpi_generic_initiator.c b/hw/acpi/acpi_generic_initiator.c index 17b9a052f5..3d2b567999 100644 --- a/hw/acpi/acpi_generic_initiator.c +++ b/hw/acpi/acpi_generic_initiator.c @@ -92,7 +92,8 @@ build_srat_generic_pci_initiator_affinity(GArray *table_data, int node, /* Device Handle - PCI */ build_append_int_noprefix(table_data, handle->segment, 2); - build_append_int_noprefix(table_data, handle->bdf, 2); + build_append_int_noprefix(table_data, PCI_BUS_NUM(handle->bdf), 1); + build_append_int_noprefix(table_data, PCI_BDF_TO_DEVFN(handle->bdf), 1); for (index = 0; index < 12; index++) { build_append_int_noprefix(table_data, 0, 1); } From patchwork Mon Sep 16 17:10:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805678 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42E09142E77 for ; Mon, 16 Sep 2024 17:11:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506697; cv=none; b=e8FDLjeA/yiSPYIE1mDCCH0aj47hvT0waCj1OS9LRosGbuhbWYyu7jfASq5x7N3noIBuPK1OCcDXYoYk90wsOrop5YjRjWqowc2Xx2yU/Qz0CWhmgD5EK2JhAP9LKBQyaTwJ93TGPlUTb05JzekuXVC2WdSz+I9t3mkeKmr8mx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506697; c=relaxed/simple; bh=/cSPAVnoDPaRuHJab/WmV77yj0HQ3wLTgitWcHmBcq8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=k6cpq5AWFwo/ISXZWJmZ3mcjuffmhODdb7Qa406YZow8U3KjGA0sRNm4LrKWXVdRjhHBHHMEMSDoV4XBwihX2h6JkyZ5GBa4CHDfj8DKsJpL7XFN7k1vhwT0pLVPxGheT30lWIHXJLb3QaF0YwBhiyNDegUnkfM/J1sumdemupw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6rvS057dz6LD7m; Tue, 17 Sep 2024 01:07:48 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 00C54140B39; Tue, 17 Sep 2024 01:11:33 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:11:29 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 02/15] hw/acpi/GI: Fix trivial parameter alignment issue. Date: Mon, 16 Sep 2024 18:10:07 +0100 Message-ID: <20240916171017.1841767-3-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To frapeml500008.china.huawei.com (7.182.85.71) Before making additional modification, tidy up this misleading indentation. Reviewed-by: Ankit Agrawal Reviewed-by: Igor Mammedov Tested-by: "Huang, Ying" Signed-off-by: Jonathan Cameron --- hw/acpi/acpi_generic_initiator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi/acpi_generic_initiator.c b/hw/acpi/acpi_generic_initiator.c index 3d2b567999..4a02c19468 100644 --- a/hw/acpi/acpi_generic_initiator.c +++ b/hw/acpi/acpi_generic_initiator.c @@ -133,7 +133,7 @@ static int build_all_acpi_generic_initiators(Object *obj, void *opaque) dev_handle.segment = 0; dev_handle.bdf = PCI_BUILD_BDF(pci_bus_num(pci_get_bus(pci_dev)), - pci_dev->devfn); + pci_dev->devfn); build_srat_generic_pci_initiator_affinity(table_data, gi->node, &dev_handle); From patchwork Mon Sep 16 17:10:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805679 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2543168DA for ; Mon, 16 Sep 2024 17:12:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506732; cv=none; b=g+WXDWQ+SxPchfYtLzA2Bbqd1PzeBzW6Mj68mxFSjmbkWJwSvU35rDQMFX7+tUt4R66cBgiXOGTjDHWoAvRxbzDmNuyNHerT/SRjUlp81pdWJFh2X9X9nTvXMkqLwSnKEkd/j6hzs99xmbLJ0b1rEnsvPtTtHr1j+Yf8PbdOjEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506732; c=relaxed/simple; bh=EnsiJKQBbN75x+3QxBA9dwv2O6Ruxpk0IaPidF6l6bQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KxHI4Yv2TaCkx0/Z5Y6FhxaZ2HN7YvZ7rBmuzwbXxHKBW2Mrs1+rlA6yt40TAkiwtKeWdW1dLnDcYTFlWJH+tm+WUiO/bhJS3K9V766kdpWLuV76+2T7MIK6atmMgu13IITvSoYJ1JgVOgBKlglA8ifGqzKU/VgxBC82nlv0riw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6rw712Kkz6LD7N; Tue, 17 Sep 2024 01:08:23 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 21E4B140B39; Tue, 17 Sep 2024 01:12:08 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:12:04 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 03/15] hw/acpi: Move AML building code for Generic Initiators to aml_build.c Date: Mon, 16 Sep 2024 18:10:08 +0100 Message-ID: <20240916171017.1841767-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To frapeml500008.china.huawei.com (7.182.85.71) Rather than attempting to create a generic function with mess of the two different device handle types, use a PCI handle specific variant. If the ACPI handle form is needed then that can be introduced alongside this with little duplicated code. Drop the PCIDeviceHandle in favor of just passing the bus, devfn and segment directly. devfn kept as a single byte because ARI means that in this case it is just an 8 bit function number. Suggested-by: Igor Mammedov Link: https://lore.kernel.org/qemu-devel/20240618142333.102be976@imammedo.users.ipa.redhat.com/ Tested-by: "Huang, Ying" Reviewed-by: Igor Mammedov Signed-off-by: Jonathan Cameron --- include/hw/acpi/acpi_generic_initiator.h | 23 ------------- include/hw/acpi/aml-build.h | 4 +++ hw/acpi/acpi_generic_initiator.c | 39 ++------------------- hw/acpi/aml-build.c | 44 ++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 59 deletions(-) diff --git a/include/hw/acpi/acpi_generic_initiator.h b/include/hw/acpi/acpi_generic_initiator.h index a304bad73e..7b98676713 100644 --- a/include/hw/acpi/acpi_generic_initiator.h +++ b/include/hw/acpi/acpi_generic_initiator.h @@ -19,29 +19,6 @@ typedef struct AcpiGenericInitiator { uint16_t node; } AcpiGenericInitiator; -/* - * ACPI 6.3: - * Table 5-81 Flags – Generic Initiator Affinity Structure - */ -typedef enum { - /* - * If clear, the OSPM ignores the contents of the Generic - * Initiator/Port Affinity Structure. This allows system firmware - * to populate the SRAT with a static number of structures, but only - * enable them as necessary. - */ - GEN_AFFINITY_ENABLED = (1 << 0), -} GenericAffinityFlags; - -/* - * ACPI 6.3: - * Table 5-80 Device Handle - PCI - */ -typedef struct PCIDeviceHandle { - uint16_t segment; - uint16_t bdf; -} PCIDeviceHandle; - void build_srat_generic_pci_initiator(GArray *table_data); #endif diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index a3784155cb..33eef85791 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -486,6 +486,10 @@ Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set, uint32_t io_offset, void build_srat_memory(GArray *table_data, uint64_t base, uint64_t len, int node, MemoryAffinityFlags flags); +void build_srat_pci_generic_initiator(GArray *table_data, int node, + uint16_t segment, uint8_t bus, + uint8_t devfn); + void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms, const char *oem_id, const char *oem_table_id); diff --git a/hw/acpi/acpi_generic_initiator.c b/hw/acpi/acpi_generic_initiator.c index 4a02c19468..7665b16107 100644 --- a/hw/acpi/acpi_generic_initiator.c +++ b/hw/acpi/acpi_generic_initiator.c @@ -74,40 +74,11 @@ static void acpi_generic_initiator_class_init(ObjectClass *oc, void *data) acpi_generic_initiator_set_node, NULL, NULL); } -/* - * ACPI 6.3: - * Table 5-78 Generic Initiator Affinity Structure - */ -static void -build_srat_generic_pci_initiator_affinity(GArray *table_data, int node, - PCIDeviceHandle *handle) -{ - uint8_t index; - - build_append_int_noprefix(table_data, 5, 1); /* Type */ - build_append_int_noprefix(table_data, 32, 1); /* Length */ - build_append_int_noprefix(table_data, 0, 1); /* Reserved */ - build_append_int_noprefix(table_data, 1, 1); /* Device Handle Type: PCI */ - build_append_int_noprefix(table_data, node, 4); /* Proximity Domain */ - - /* Device Handle - PCI */ - build_append_int_noprefix(table_data, handle->segment, 2); - build_append_int_noprefix(table_data, PCI_BUS_NUM(handle->bdf), 1); - build_append_int_noprefix(table_data, PCI_BDF_TO_DEVFN(handle->bdf), 1); - for (index = 0; index < 12; index++) { - build_append_int_noprefix(table_data, 0, 1); - } - - build_append_int_noprefix(table_data, GEN_AFFINITY_ENABLED, 4); /* Flags */ - build_append_int_noprefix(table_data, 0, 4); /* Reserved */ -} - static int build_all_acpi_generic_initiators(Object *obj, void *opaque) { MachineState *ms = MACHINE(qdev_get_machine()); AcpiGenericInitiator *gi; GArray *table_data = opaque; - PCIDeviceHandle dev_handle; PCIDevice *pci_dev; Object *o; @@ -130,13 +101,9 @@ static int build_all_acpi_generic_initiators(Object *obj, void *opaque) } pci_dev = PCI_DEVICE(o); - - dev_handle.segment = 0; - dev_handle.bdf = PCI_BUILD_BDF(pci_bus_num(pci_get_bus(pci_dev)), - pci_dev->devfn); - - build_srat_generic_pci_initiator_affinity(table_data, - gi->node, &dev_handle); + build_srat_pci_generic_initiator(table_data, gi->node, 0, + pci_bus_num(pci_get_bus(pci_dev)), + pci_dev->devfn); return 0; } diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 6d4517cfbe..968b654e58 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1938,6 +1938,50 @@ void build_srat_memory(GArray *table_data, uint64_t base, build_append_int_noprefix(table_data, 0, 8); /* Reserved */ } +/* + * ACPI Spec Revision 6.3 + * Table 5-80 Device Handle - PCI + */ +static void build_append_srat_pci_device_handle(GArray *table_data, + uint16_t segment, + uint8_t bus, uint8_t devfn) +{ + /* PCI segment number */ + build_append_int_noprefix(table_data, segment, 2); + /* PCI Bus Device Function */ + build_append_int_noprefix(table_data, bus, 1); + build_append_int_noprefix(table_data, devfn, 1); + /* Reserved */ + build_append_int_noprefix(table_data, 0, 12); +} + +/* + * ACPI spec, Revision 6.3 + * 5.2.16.6 Generic Initiator Affinity Structure + * With PCI Device Handle. + */ +void build_srat_pci_generic_initiator(GArray *table_data, int node, + uint16_t segment, uint8_t bus, + uint8_t devfn) +{ + /* Type */ + build_append_int_noprefix(table_data, 5, 1); + /* Length */ + build_append_int_noprefix(table_data, 32, 1); + /* Reserved */ + build_append_int_noprefix(table_data, 0, 1); + /* Device Handle Type: PCI */ + build_append_int_noprefix(table_data, 1, 1); + /* Proximity Domain */ + build_append_int_noprefix(table_data, node, 4); + /* Device Handle */ + build_append_srat_pci_device_handle(table_data, segment, bus, devfn); + /* Flags - GI Enabled */ + build_append_int_noprefix(table_data, 1, 4); + /* Reserved */ + build_append_int_noprefix(table_data, 0, 4); +} + /* * ACPI spec 5.2.17 System Locality Distance Information Table * (Revision 2.0 or later) From patchwork Mon Sep 16 17:10:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805680 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BAFC1581E0 for ; Mon, 16 Sep 2024 17:12:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506767; cv=none; b=KV8GtBNdhMuW0iofz19czazDKt1zkrMNJrEYEaG7pZeAEQGsP3oS4zeJEAQlp7lGLyD6vhrDPM+5W7zRPp5iSlMFKsP0QmtqVaFKMrD7PRnvSN39CzY0n2hRH+z+TlFtGkKxbzIqE9iyXWu0P2aIebdu6dV96mh8Yg4dk1e39jU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506767; c=relaxed/simple; bh=hZ1jCf/KxMlX02vhXb3vK0pbG07k7JiXkxWSJ/MC73o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bfiGzgWNkX0IbNPrbDpIjS+2hInI+M9iVvM6jdGj/cLaDqpaCYud4Kiig7UBY3pZlBQpNapVhk4ITncdDx8QmInHedy6g61hd28UwSn1CC6myDVaw4IWv8Kzi/dQ4nhi5mAgTbPclbzL9ItUqanOq/vngeQvH44ibOcdXXhSW44= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6rwp1d9dz6LD7f; Tue, 17 Sep 2024 01:08:58 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 33F72140D1A; Tue, 17 Sep 2024 01:12:43 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:12:39 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 04/15] hw/acpi: Rename build_all_acpi_generic_initiators() to build_acpi_generic_initiator() Date: Mon, 16 Sep 2024 18:10:09 +0100 Message-ID: <20240916171017.1841767-5-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To frapeml500008.china.huawei.com (7.182.85.71) Igor noted that this function only builds one instance, so was rather misleadingly named. Fix that. Suggested-by: Igor Mammedov Reviewed-by: Igor Mammedov Tested-by: "Huang, Ying" Signed-off-by: Jonathan Cameron --- hw/acpi/acpi_generic_initiator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/acpi/acpi_generic_initiator.c b/hw/acpi/acpi_generic_initiator.c index 7665b16107..73bafaaaea 100644 --- a/hw/acpi/acpi_generic_initiator.c +++ b/hw/acpi/acpi_generic_initiator.c @@ -74,7 +74,7 @@ static void acpi_generic_initiator_class_init(ObjectClass *oc, void *data) acpi_generic_initiator_set_node, NULL, NULL); } -static int build_all_acpi_generic_initiators(Object *obj, void *opaque) +static int build_acpi_generic_initiator(Object *obj, void *opaque) { MachineState *ms = MACHINE(qdev_get_machine()); AcpiGenericInitiator *gi; @@ -111,6 +111,6 @@ static int build_all_acpi_generic_initiators(Object *obj, void *opaque) void build_srat_generic_pci_initiator(GArray *table_data) { object_child_foreach_recursive(object_get_root(), - build_all_acpi_generic_initiators, + build_acpi_generic_initiator, table_data); } From patchwork Mon Sep 16 17:10:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805681 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA6C6158870 for ; Mon, 16 Sep 2024 17:13:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506802; cv=none; b=b94ut2Sc3opy9v/MgoyVQAeX8rFTwa+byAZFxHO2bse+99ja2bs/nG+MJICUwpD3QReoS4FQF6xRiK7FqvoqeWVWm6BAb/algr5Gi4kl0Idcn911qFBN9/GAcLo/aRWjnBKi27nZ7QCpETS/HRiYvWqcXN05prTfgjyyFU8aq5c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506802; c=relaxed/simple; bh=f6gj0B4NS1vg3nBHIYwN3jfybjlCPYDFcnnT2r82GXA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rYzl3k/XVMc/JMCcfhIbg73l/0dtSTYa5o/NQYJMU8NWKh9HJVB0r4MR+YEHGHrCsBTB7GTvRZP8qPurkBcmpUpcb+PtIReM7e8kdOw2X4LJJoNOoSx9G1SSlf2aD8lFk3vHHJhBqxPhW+M1rYFsk0aanLML3gddfFesrmk9L5c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6rxT3DGpz6LD7S; Tue, 17 Sep 2024 01:09:33 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 6C735140AB8; Tue, 17 Sep 2024 01:13:18 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:13:14 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 05/15] hw/pci: Add a busnr property to pci_props and use for acpi/gi Date: Mon, 16 Sep 2024 18:10:10 +0100 Message-ID: <20240916171017.1841767-6-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To frapeml500008.china.huawei.com (7.182.85.71) Using a property allows us to hide the internal details of the PCI device from the code to build a SRAT Generic Initiator Affinity Structure with PCI Device Handle. Suggested-by: Igor Mammedov Reviewed-by: Igor Mammedov Signed-off-by: Jonathan Cameron --- hw/acpi/acpi_generic_initiator.c | 14 +++++++++----- hw/pci/pci.c | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/hw/acpi/acpi_generic_initiator.c b/hw/acpi/acpi_generic_initiator.c index 73bafaaaea..365feb527f 100644 --- a/hw/acpi/acpi_generic_initiator.c +++ b/hw/acpi/acpi_generic_initiator.c @@ -9,6 +9,7 @@ #include "hw/boards.h" #include "hw/pci/pci_device.h" #include "qemu/error-report.h" +#include "qapi/error.h" typedef struct AcpiGenericInitiatorClass { ObjectClass parent_class; @@ -79,7 +80,8 @@ static int build_acpi_generic_initiator(Object *obj, void *opaque) MachineState *ms = MACHINE(qdev_get_machine()); AcpiGenericInitiator *gi; GArray *table_data = opaque; - PCIDevice *pci_dev; + int32_t devfn; + uint8_t bus; Object *o; if (!object_dynamic_cast(obj, TYPE_ACPI_GENERIC_INITIATOR)) { @@ -100,10 +102,12 @@ static int build_acpi_generic_initiator(Object *obj, void *opaque) exit(1); } - pci_dev = PCI_DEVICE(o); - build_srat_pci_generic_initiator(table_data, gi->node, 0, - pci_bus_num(pci_get_bus(pci_dev)), - pci_dev->devfn); + bus = object_property_get_uint(o, "busnr", &error_fatal); + devfn = object_property_get_int(o, "addr", &error_fatal); + /* devfn is constrained in PCI to be 8 bit but storage is an int32_t */ + assert(devfn >= 0 && devfn < PCI_DEVFN_MAX); + + build_srat_pci_generic_initiator(table_data, gi->node, 0, bus, devfn); return 0; } diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 87da35ca9b..0b6bdaa0d7 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -67,6 +67,19 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev); static void pcibus_reset_hold(Object *obj, ResetType type); static bool pcie_has_upstream_port(PCIDevice *dev); +static void prop_pci_busnr_get(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + uint8_t busnr = pci_dev_bus_num(PCI_DEVICE(obj)); + + visit_type_uint8(v, name, &busnr, errp); +} + +static const PropertyInfo prop_pci_busnr = { + .name = "busnr", + .get = prop_pci_busnr_get, +}; + static Property pci_props[] = { DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1), DEFINE_PROP_STRING("romfile", PCIDevice, romfile), @@ -87,6 +100,7 @@ static Property pci_props[] = { QEMU_PCIE_ARI_NEXTFN_1_BITNR, false), DEFINE_PROP_SIZE32("x-max-bounce-buffer-size", PCIDevice, max_bounce_buffer_size, DEFAULT_MAX_BOUNCE_BUFFER_SIZE), + { .name = "busnr", .info = &prop_pci_busnr }, DEFINE_PROP_END_OF_LIST() }; From patchwork Mon Sep 16 17:10:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805682 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAACA15852F for ; Mon, 16 Sep 2024 17:13:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506837; cv=none; b=h1kO3QVd2AEcFZter3RDdAqu57C/qhwneFO1b3LpExAKRaaWJjEHpE1Mq/EDDk2a2MQ8qJST4PoPJ8yNW/DWBMTU1Y1YJT9KJDOisWapWwIvOafBZLxxwXAhikGg73RMEbyNjDSe/RflEcr2B8o+oQHixX+wGhkYgTKCEC4ZM8w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506837; c=relaxed/simple; bh=y6TvWmYsdhbQ46osVYz9XPduaG5yHQtNhW0vkcCXhZw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KWp1GxAVgXTvebu3qhuzgFnI1ILuqq+TART2OEvKAPiBiB8IfBHpMWscYl8ZYUtY96jnpAlT2cAI7apXrSFArWNVTxUK9+mYw+nHDoQ8wkWfUZOj2rCZ6VNizx68q780eiG+oaXoqglpN/nTkTtfl5VTtgmgskFNTgst9cYT9m8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6ry84KrSz6LD7N; Tue, 17 Sep 2024 01:10:08 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 90E87140AB8; Tue, 17 Sep 2024 01:13:53 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:13:50 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 06/15] acpi/pci: Move Generic Initiator object handling into acpi/pci.* Date: Mon, 16 Sep 2024 18:10:11 +0100 Message-ID: <20240916171017.1841767-7-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To frapeml500008.china.huawei.com (7.182.85.71) Whilst ACPI SRAT Generic Initiator Afinity Structures are able to refer to both PCI and ACPI Device Handles, the QEMU implementation only implements the PCI Device Handle case. For now move the code into the existing hw/acpi/pci.c file and header. If support for ACPI Device Handles is added in the future, perhaps this will be moved again. Also push the struct AcpiGenericInitiator down into the c file as not used outside pci.c. Suggested-by: Igor Mammedov Tested-by: "Huang, Ying" Reviewed-by: Igor Mammedov Signed-off-by: Jonathan Cameron --- include/hw/acpi/acpi_generic_initiator.h | 24 ----- include/hw/acpi/pci.h | 3 + hw/acpi/acpi_generic_initiator.c | 120 ---------------------- hw/acpi/pci.c | 124 +++++++++++++++++++++++ hw/arm/virt-acpi-build.c | 1 - hw/i386/acpi-build.c | 1 - hw/acpi/meson.build | 1 - 7 files changed, 127 insertions(+), 147 deletions(-) diff --git a/include/hw/acpi/acpi_generic_initiator.h b/include/hw/acpi/acpi_generic_initiator.h deleted file mode 100644 index 7b98676713..0000000000 --- a/include/hw/acpi/acpi_generic_initiator.h +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved - */ - -#ifndef ACPI_GENERIC_INITIATOR_H -#define ACPI_GENERIC_INITIATOR_H - -#include "qom/object_interfaces.h" - -#define TYPE_ACPI_GENERIC_INITIATOR "acpi-generic-initiator" - -typedef struct AcpiGenericInitiator { - /* private */ - Object parent; - - /* public */ - char *pci_dev; - uint16_t node; -} AcpiGenericInitiator; - -void build_srat_generic_pci_initiator(GArray *table_data); - -#endif diff --git a/include/hw/acpi/pci.h b/include/hw/acpi/pci.h index 467a99461c..3015a8171c 100644 --- a/include/hw/acpi/pci.h +++ b/include/hw/acpi/pci.h @@ -40,4 +40,7 @@ Aml *aml_pci_device_dsm(void); void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus); void build_pci_bridge_aml(AcpiDevAmlIf *adev, Aml *scope); + +void build_srat_generic_pci_initiator(GArray *table_data); + #endif diff --git a/hw/acpi/acpi_generic_initiator.c b/hw/acpi/acpi_generic_initiator.c deleted file mode 100644 index 365feb527f..0000000000 --- a/hw/acpi/acpi_generic_initiator.c +++ /dev/null @@ -1,120 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved - */ - -#include "qemu/osdep.h" -#include "hw/acpi/acpi_generic_initiator.h" -#include "hw/acpi/aml-build.h" -#include "hw/boards.h" -#include "hw/pci/pci_device.h" -#include "qemu/error-report.h" -#include "qapi/error.h" - -typedef struct AcpiGenericInitiatorClass { - ObjectClass parent_class; -} AcpiGenericInitiatorClass; - -OBJECT_DEFINE_TYPE_WITH_INTERFACES(AcpiGenericInitiator, acpi_generic_initiator, - ACPI_GENERIC_INITIATOR, OBJECT, - { TYPE_USER_CREATABLE }, - { NULL }) - -OBJECT_DECLARE_SIMPLE_TYPE(AcpiGenericInitiator, ACPI_GENERIC_INITIATOR) - -static void acpi_generic_initiator_init(Object *obj) -{ - AcpiGenericInitiator *gi = ACPI_GENERIC_INITIATOR(obj); - - gi->node = MAX_NODES; - gi->pci_dev = NULL; -} - -static void acpi_generic_initiator_finalize(Object *obj) -{ - AcpiGenericInitiator *gi = ACPI_GENERIC_INITIATOR(obj); - - g_free(gi->pci_dev); -} - -static void acpi_generic_initiator_set_pci_device(Object *obj, const char *val, - Error **errp) -{ - AcpiGenericInitiator *gi = ACPI_GENERIC_INITIATOR(obj); - - gi->pci_dev = g_strdup(val); -} - -static void acpi_generic_initiator_set_node(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - AcpiGenericInitiator *gi = ACPI_GENERIC_INITIATOR(obj); - MachineState *ms = MACHINE(qdev_get_machine()); - uint32_t value; - - if (!visit_type_uint32(v, name, &value, errp)) { - return; - } - - if (value >= MAX_NODES) { - error_printf("%s: Invalid NUMA node specified\n", - TYPE_ACPI_GENERIC_INITIATOR); - exit(1); - } - - gi->node = value; - ms->numa_state->nodes[gi->node].has_gi = true; -} - -static void acpi_generic_initiator_class_init(ObjectClass *oc, void *data) -{ - object_class_property_add_str(oc, "pci-dev", NULL, - acpi_generic_initiator_set_pci_device); - object_class_property_add(oc, "node", "int", NULL, - acpi_generic_initiator_set_node, NULL, NULL); -} - -static int build_acpi_generic_initiator(Object *obj, void *opaque) -{ - MachineState *ms = MACHINE(qdev_get_machine()); - AcpiGenericInitiator *gi; - GArray *table_data = opaque; - int32_t devfn; - uint8_t bus; - Object *o; - - if (!object_dynamic_cast(obj, TYPE_ACPI_GENERIC_INITIATOR)) { - return 0; - } - - gi = ACPI_GENERIC_INITIATOR(obj); - if (gi->node >= ms->numa_state->num_nodes) { - error_printf("%s: Specified node %d is invalid.\n", - TYPE_ACPI_GENERIC_INITIATOR, gi->node); - exit(1); - } - - o = object_resolve_path_type(gi->pci_dev, TYPE_PCI_DEVICE, NULL); - if (!o) { - error_printf("%s: Specified device must be a PCI device.\n", - TYPE_ACPI_GENERIC_INITIATOR); - exit(1); - } - - bus = object_property_get_uint(o, "busnr", &error_fatal); - devfn = object_property_get_int(o, "addr", &error_fatal); - /* devfn is constrained in PCI to be 8 bit but storage is an int32_t */ - assert(devfn >= 0 && devfn < PCI_DEVFN_MAX); - - build_srat_pci_generic_initiator(table_data, gi->node, 0, bus, devfn); - - return 0; -} - -void build_srat_generic_pci_initiator(GArray *table_data) -{ - object_child_foreach_recursive(object_get_root(), - build_acpi_generic_initiator, - table_data); -} diff --git a/hw/acpi/pci.c b/hw/acpi/pci.c index 20b70dcd81..3e1db161cc 100644 --- a/hw/acpi/pci.c +++ b/hw/acpi/pci.c @@ -24,8 +24,13 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "qom/object_interfaces.h" +#include "qapi/error.h" +#include "hw/boards.h" #include "hw/acpi/aml-build.h" #include "hw/acpi/pci.h" +#include "hw/pci/pci_device.h" #include "hw/pci/pcie_host.h" /* @@ -59,3 +64,122 @@ void build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info, acpi_table_end(linker, &table); } + +typedef struct AcpiGenericInitiator { + /* private */ + Object parent; + + /* public */ + char *pci_dev; + uint16_t node; +} AcpiGenericInitiator; + +typedef struct AcpiGenericInitiatorClass { + ObjectClass parent_class; +} AcpiGenericInitiatorClass; + +#define TYPE_ACPI_GENERIC_INITIATOR "acpi-generic-initiator" + +OBJECT_DEFINE_TYPE_WITH_INTERFACES(AcpiGenericInitiator, acpi_generic_initiator, + ACPI_GENERIC_INITIATOR, OBJECT, + { TYPE_USER_CREATABLE }, + { NULL }) + +OBJECT_DECLARE_SIMPLE_TYPE(AcpiGenericInitiator, ACPI_GENERIC_INITIATOR) + +static void acpi_generic_initiator_init(Object *obj) +{ + AcpiGenericInitiator *gi = ACPI_GENERIC_INITIATOR(obj); + + gi->node = MAX_NODES; + gi->pci_dev = NULL; +} + +static void acpi_generic_initiator_finalize(Object *obj) +{ + AcpiGenericInitiator *gi = ACPI_GENERIC_INITIATOR(obj); + + g_free(gi->pci_dev); +} + +static void acpi_generic_initiator_set_pci_device(Object *obj, const char *val, + Error **errp) +{ + AcpiGenericInitiator *gi = ACPI_GENERIC_INITIATOR(obj); + + gi->pci_dev = g_strdup(val); +} + +static void acpi_generic_initiator_set_node(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + AcpiGenericInitiator *gi = ACPI_GENERIC_INITIATOR(obj); + MachineState *ms = MACHINE(qdev_get_machine()); + uint32_t value; + + if (!visit_type_uint32(v, name, &value, errp)) { + return; + } + + if (value >= MAX_NODES) { + error_printf("%s: Invalid NUMA node specified\n", + TYPE_ACPI_GENERIC_INITIATOR); + exit(1); + } + + gi->node = value; + ms->numa_state->nodes[gi->node].has_gi = true; +} + +static void acpi_generic_initiator_class_init(ObjectClass *oc, void *data) +{ + object_class_property_add_str(oc, "pci-dev", NULL, + acpi_generic_initiator_set_pci_device); + object_class_property_add(oc, "node", "int", NULL, + acpi_generic_initiator_set_node, NULL, NULL); +} + +static int build_acpi_generic_initiator(Object *obj, void *opaque) +{ + MachineState *ms = MACHINE(qdev_get_machine()); + AcpiGenericInitiator *gi; + GArray *table_data = opaque; + int32_t devfn; + uint8_t bus; + Object *o; + + if (!object_dynamic_cast(obj, TYPE_ACPI_GENERIC_INITIATOR)) { + return 0; + } + + gi = ACPI_GENERIC_INITIATOR(obj); + if (gi->node >= ms->numa_state->num_nodes) { + error_printf("%s: Specified node %d is invalid.\n", + TYPE_ACPI_GENERIC_INITIATOR, gi->node); + exit(1); + } + + o = object_resolve_path_type(gi->pci_dev, TYPE_PCI_DEVICE, NULL); + if (!o) { + error_printf("%s: Specified device must be a PCI device.\n", + TYPE_ACPI_GENERIC_INITIATOR); + exit(1); + } + + bus = object_property_get_uint(o, "busnr", &error_fatal); + devfn = object_property_get_uint(o, "addr", &error_fatal); + /* devfn is constrained in PCI to be 8 bit but storage is an int32_t */ + assert(devfn >= 0 && devfn < PCI_DEVFN_MAX); + + build_srat_pci_generic_initiator(table_data, gi->node, 0, bus, devfn); + + return 0; +} + +void build_srat_generic_pci_initiator(GArray *table_data) +{ + object_child_foreach_recursive(object_get_root(), + build_acpi_generic_initiator, + table_data); +} diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index f76fb117ad..b5973c9148 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -57,7 +57,6 @@ #include "migration/vmstate.h" #include "hw/acpi/ghes.h" #include "hw/acpi/viot.h" -#include "hw/acpi/acpi_generic_initiator.h" #include "hw/virtio/virtio-acpi.h" #include "target/arm/multiprocessing.h" diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4967aa7459..afb2fa2edc 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -68,7 +68,6 @@ #include "hw/acpi/utils.h" #include "hw/acpi/pci.h" #include "hw/acpi/cxl.h" -#include "hw/acpi/acpi_generic_initiator.h" #include "qom/qom-qobject.h" #include "hw/i386/amd_iommu.h" diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build index 7f8ccc9b7a..c8854f4d48 100644 --- a/hw/acpi/meson.build +++ b/hw/acpi/meson.build @@ -1,6 +1,5 @@ acpi_ss = ss.source_set() acpi_ss.add(files( - 'acpi_generic_initiator.c', 'acpi_interface.c', 'aml-build.c', 'bios-linker-loader.c', From patchwork Mon Sep 16 17:10:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805686 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 974641591F0 for ; Mon, 16 Sep 2024 17:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506872; cv=none; b=toCTx5UCYsIH3zUT1xTsVyoUsZ3+LbmsNSOrVuPNjeOOgAqH0eFqYPMTa3WQ5/ImQJ05PebcFF6YZshb9IfUuIm3/MKO36zzihzRDkItsQKd4JgM4Vd7Uu9Isj9oNTz8W6AdI3mWvNZGrmy6wwEJ41rxNUwGoVArxgmoPhiV1nE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506872; c=relaxed/simple; bh=VbEk9oGoC7JXuhXMBQTxrYqnocvxUs3On/sKVYDVuvA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MX0NkjQph/Dc+r9F2X/QGA2DvX3h/SDdZqivIZSIqJm+C/habCDWvSTj+rgxMwnHy2CiaK3W3Wv6PsBHz0c5EVFa79wYN0Xr+2ivbuixVEX9BYum6OFybizmyLpdt8D9nc+Qd0kzFtlDt8oEtnEFBX/WcKB49H4Y5LNSq7efROE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6ryJ3vd3z6K5rP; Tue, 17 Sep 2024 01:10:16 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id A7CB8140A77; Tue, 17 Sep 2024 01:14:28 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:14:25 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 07/15] hw/pci-bridge: Add acpi_uid property to TYPE_PXB_BUS Date: Mon, 16 Sep 2024 18:10:12 +0100 Message-ID: <20240916171017.1841767-8-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To frapeml500008.china.huawei.com (7.182.85.71) Enable ACPI table creation for PCI Expander Bridges to be independent of PCI internals. Note that the UID is currently the PCI bus number. This is motivated by the forthcoming ACPI Generic Port SRAT entries which can be made completely independent of PCI internals. Suggested-by: Igor Mammedov Tested-by: "Huang, Ying" Reviewed-by: Igor Mammedov Signed-off-by: Jonathan Cameron --- hw/pci-bridge/pci_expander_bridge.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c index dfaea6cbf4..3d52ea5867 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -85,12 +85,25 @@ static uint16_t pxb_bus_numa_node(PCIBus *bus) return pxb->numa_node; } +static void prop_pxb_uid_get(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + uint32_t uid = pci_bus_num(PCI_BUS(obj)); + + visit_type_uint32(v, name, &uid, errp); +} + static void pxb_bus_class_init(ObjectClass *class, void *data) { PCIBusClass *pbc = PCI_BUS_CLASS(class); pbc->bus_num = pxb_bus_num; pbc->numa_node = pxb_bus_numa_node; + + object_class_property_add(class, "acpi_uid", "uint32", + prop_pxb_uid_get, NULL, NULL, NULL); + object_class_property_set_description(class, "acpi_uid", + "ACPI Unique ID used to distinguish this PCI Host Bridge / ACPI00016"); } static const TypeInfo pxb_bus_info = { From patchwork Mon Sep 16 17:10:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805687 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B865015CD60 for ; Mon, 16 Sep 2024 17:15:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506907; cv=none; b=EYpsMzD32qvEcYfNnmtzHNtEmhum9ad59DdgsBlSkSFm/pa/Cn20Wl70Cxu/QrLtScrNre9lbdvFx2xzCWvZZ1OEUZi4e9jz6dd6OYMFMwKt4eG8a34W8qysZOAYlxAolc5vKXtV12AO1hphJB/Hnl4wGc2vN9t7ryJ4+WbokKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506907; c=relaxed/simple; bh=/D3epognXrF7xKcl8a/DY0JU1LV/qHy629Ep94660Eg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f7fTDWaaYd6O/uPMLEJGc7OgZlTonaOlZvv1Er79RU7ooaSY9lrnEImqjW0OMug5rJ5Uux5eQ7iO4qyLD465ZyKie8qrwmnGIpNq6XchPM4xFsuEGH8wCSktTaivbwq2TaP9O0FgwNq7w3eMskPkHe9YjG9iUban8YkoKmk2rbY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6s3l0ZgTz67lLG; Tue, 17 Sep 2024 01:14:59 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id B7F19140AB8; Tue, 17 Sep 2024 01:15:03 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:15:00 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 08/15] hw/i386/acpi: Use TYPE_PXB_BUS property acpi_uid for DSDT Date: Mon, 16 Sep 2024 18:10:13 +0100 Message-ID: <20240916171017.1841767-9-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To frapeml500008.china.huawei.com (7.182.85.71) Rather than relying on PCI internals, use the new acpi_property to obtain the ACPI _UID values. These are still the same as the PCI Bus numbers so no functional change. Suggested-by: Igor Mammedov Tested-by: "Huang, Ying" Reviewed-by: Igor Mammedov Signed-off-by: Jonathan Cameron --- hw/i386/acpi-build.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index afb2fa2edc..88227e343e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1475,6 +1475,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, QLIST_FOREACH(bus, &bus->child, sibling) { uint8_t bus_num = pci_bus_num(bus); uint8_t numa_node = pci_bus_numa_node(bus); + uint32_t uid; /* look only for expander root buses */ if (!pci_bus_is_root(bus)) { @@ -1485,6 +1486,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, root_bus_limit = bus_num - 1; } + uid = object_property_get_uint(OBJECT(bus), "acpi_uid", + &error_fatal); scope = aml_scope("\\_SB"); if (pci_bus_is_cxl(bus)) { @@ -1492,7 +1495,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, } else { dev = aml_device("PC%.02X", bus_num); } - aml_append(dev, aml_name_decl("_UID", aml_int(bus_num))); + aml_append(dev, aml_name_decl("_UID", aml_int(uid))); aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num))); if (pci_bus_is_cxl(bus)) { struct Aml *aml_pkg = aml_package(2); From patchwork Mon Sep 16 17:10:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805688 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C435E15AAD7 for ; Mon, 16 Sep 2024 17:15:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506942; cv=none; b=aMh8gb4QEq730YIpqYarc8tvmFf3ApFBxc6yWQ62Fk1qMLhTiw7zdZp77V/AZtXPmn5F1KM4cLiELur95y4HtThKNR2UCpeavO0gaD2nPmCQXOE9NehgDq/plCHcPHYzdTQPpROI+/gwjhNPBnT8mC2qN6xH3HswGEVvt4qKJxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726506942; c=relaxed/simple; bh=01ZRlvOWEgHI4VqhCDdNvvbN2D64ZHkgSUUo7cXZsG8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CFaC+XV7qAA7PDPqx3ov6aFTxtXZmplDGf04tVFXlwILgdo4TzrMKK6tbHT7zvoy30CauUZ8XchpxREPSj442gSPdArB/WdPVk5SvxPl5OB4TztS9TuMipET8l10vjzmCBKlVgWkgyjX5Ka0aYVa/2s52w3YoMasD1sg06RwJrE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6s0B0DjZz6LD7S; Tue, 17 Sep 2024 01:11:54 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 06C94140CF4; Tue, 17 Sep 2024 01:15:39 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:15:35 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 09/15] hw/pci-host/gpex-acpi: Use acpi_uid property. Date: Mon, 16 Sep 2024 18:10:14 +0100 Message-ID: <20240916171017.1841767-10-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To frapeml500008.china.huawei.com (7.182.85.71) Reduce the direct use of PCI internals inside ACPI table creation. Suggested-by: Igor Mammedov Tested-by: "Huang, Ying" Reviewed-by: Igor Mammedov Signed-off-by: Jonathan Cameron --- hw/pci-host/gpex-acpi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/pci-host/gpex-acpi.c b/hw/pci-host/gpex-acpi.c index 391fabb8a8..e8b4c64c5f 100644 --- a/hw/pci-host/gpex-acpi.c +++ b/hw/pci-host/gpex-acpi.c @@ -141,6 +141,7 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg) QLIST_FOREACH(bus, &bus->child, sibling) { uint8_t bus_num = pci_bus_num(bus); uint8_t numa_node = pci_bus_numa_node(bus); + uint32_t uid; bool is_cxl = pci_bus_is_cxl(bus); if (!pci_bus_is_root(bus)) { @@ -156,6 +157,8 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg) nr_pcie_buses = bus_num; } + uid = object_property_get_uint(OBJECT(bus), "acpi_uid", + &error_fatal); dev = aml_device("PC%.02X", bus_num); if (is_cxl) { struct Aml *pkg = aml_package(2); @@ -168,7 +171,7 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg) aml_append(dev, aml_name_decl("_CID", aml_string("PNP0A03"))); } aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num))); - aml_append(dev, aml_name_decl("_UID", aml_int(bus_num))); + aml_append(dev, aml_name_decl("_UID", aml_int(uid))); aml_append(dev, aml_name_decl("_STR", aml_unicode("pxb Device"))); aml_append(dev, aml_name_decl("_CCA", aml_int(1))); if (numa_node != NUMA_NODE_UNASSIGNED) { From patchwork Mon Sep 16 17:41:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805720 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 123A6158D96 for ; Mon, 16 Sep 2024 17:41:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508491; cv=none; b=FjCt6pNd8GySiGeXw16gnoKMNlNpzI6MCeNeDJI8U1o7KFy4sqm8vVaTWvGWUqufrHqo3UTk65DhXrTFEoY4sy0q+lKfYKkdxEq4hq4WTjOgwwqT2gXXYZF6gyJrsqSp5xvT2979g6hA70cx8QYO3WcARGa3H5G42STtWy4yZ0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508491; c=relaxed/simple; bh=fEmMJbzoYxVOc4lJjw2wSUfXnM0rC8lLJHM7Rd/Tl2Y=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Tl/1OuYLa2qpWhlN5NiyhyNo9XzGHT6+yGcm5XBI84NNPxCK8ykNDIjUcG6AzpXx3Z+wVV9phmXt5fe4/jHZ785RQ5Sy5R+xFXGF4Zp5UtTPU2t/5lkt22gqu527l8ay0GW/MSS6i9KZDzba7YKSh0ZyxWBCdhcNurf3rRoLlEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6sYy0fgGz6L6qT; Tue, 17 Sep 2024 01:37:42 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 1B1ED140A77; Tue, 17 Sep 2024 01:41:27 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:41:23 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 10/15] hw/acpi: Generic Port Affinity Structure support Date: Mon, 16 Sep 2024 18:41:22 +0100 Message-ID: <20240916174122.1843197-1-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To frapeml500008.china.huawei.com (7.182.85.71) These are very similar to the recently added Generic Initiators but instead of representing an initiator of memory traffic they represent an edge point beyond which may lie either targets or initiators. Here we add these ports such that they may be targets of hmat_lb records to describe the latency and bandwidth from host side initiators to the port. A discoverable mechanism such as UEFI CDAT read from CXL devices and switches is used to discover the remainder of the path, and the OS can build up full latency and bandwidth numbers as need for work and data placement decisions. Acked-by: Markus Armbruster Tested-by: "Huang, Ying" Signed-off-by: Jonathan Cameron --- v6: ACPI node parameters as uint32_t rather than int. Add very brief description of object_class properties. Add some more explanation to the node parameter. This is proving challenging to describe. --- qapi/qom.json | 41 ++++++++++ include/hw/acpi/aml-build.h | 3 + include/hw/acpi/pci.h | 2 +- include/hw/pci/pci_bridge.h | 1 + hw/acpi/aml-build.c | 39 ++++++++++ hw/acpi/pci.c | 116 +++++++++++++++++++++++++++- hw/arm/virt-acpi-build.c | 2 +- hw/i386/acpi-build.c | 2 +- hw/pci-bridge/pci_expander_bridge.c | 1 - 9 files changed, 202 insertions(+), 5 deletions(-) diff --git a/qapi/qom.json b/qapi/qom.json index 321ccd708a..a8beeabf1f 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -844,6 +844,45 @@ 'data': { 'pci-dev': 'str', 'node': 'uint32' } } +## +# @AcpiGenericPortProperties: +# +# Properties for acpi-generic-port objects. +# +# @pci-bus: QOM path of the PCI bus of the hostbridge associated with +# this SRAT Generic Port Affinity Structure. This is the same as +# the bus parameter for the root ports attached to this host +# bridge. The resulting SRAT Generic Port Affinity Structure will +# refer to the ACPI object in DSDT that represents the host bridge +# (e.g. ACPI0016 for CXL host bridges). See ACPI 6.5 Section +# 5.2.16.7 for more information. +# +# @node: Similar to a NUMA node ID, but instead of providing a +# reference point used for defining NUMA distances and access +# characteristics to memory or from an initiator (e.g. CPU), this +# node defines the boundary point between non-discoverable system +# buses which must be described by firmware, and a discoverable +# bus. NUMA distances and access characteristics are defined to +# and from that point. For system software to establish full +# initiator to target characteristics this information must be +# combined with information retrieved from the discoverable part +# of the path. An example would use CDAT (see UEFI.org) +# information read from devices and switches in conjunction with +# link characteristics read from PCIe Configuration space. +# To get the full path latency from CPU to CXL attached DRAM +# CXL device: Add the latency from CPU to Generic Port (from +# HMAT indexed via the the node ID in this SRAT structure) to +# that for CXL bus links, the latency across intermediate switches +# and from the EP port to the actual memory. Bandwidth is more +# complex as there may be interleaving across multiple devices +# and shared links in the path. +# +# Since: 9.1 +## +{ 'struct': 'AcpiGenericPortProperties', + 'data': { 'pci-bus': 'str', + 'node': 'uint32' } } + ## # @RngProperties: # @@ -1043,6 +1082,7 @@ { 'enum': 'ObjectType', 'data': [ 'acpi-generic-initiator', + 'acpi-generic-port', 'authz-list', 'authz-listfile', 'authz-pam', @@ -1118,6 +1158,7 @@ 'discriminator': 'qom-type', 'data': { 'acpi-generic-initiator': 'AcpiGenericInitiatorProperties', + 'acpi-generic-port': 'AcpiGenericPortProperties', 'authz-list': 'AuthZListProperties', 'authz-listfile': 'AuthZListFileProperties', 'authz-pam': 'AuthZPAMProperties', diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 33eef85791..47a4692a7d 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -490,6 +490,9 @@ void build_srat_pci_generic_initiator(GArray *table_data, int node, uint16_t segment, uint8_t bus, uint8_t devfn); +void build_srat_acpi_generic_port(GArray *table_data, uint32_t node, + const char *hid, uint32_t uid); + void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms, const char *oem_id, const char *oem_table_id); diff --git a/include/hw/acpi/pci.h b/include/hw/acpi/pci.h index 3015a8171c..6359d574fd 100644 --- a/include/hw/acpi/pci.h +++ b/include/hw/acpi/pci.h @@ -41,6 +41,6 @@ Aml *aml_pci_device_dsm(void); void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus); void build_pci_bridge_aml(AcpiDevAmlIf *adev, Aml *scope); -void build_srat_generic_pci_initiator(GArray *table_data); +void build_srat_generic_affinity_structures(GArray *table_data); #endif diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h index 5cd452115a..5456e24883 100644 --- a/include/hw/pci/pci_bridge.h +++ b/include/hw/pci/pci_bridge.h @@ -102,6 +102,7 @@ typedef struct PXBPCIEDev { PXBDev parent_obj; } PXBPCIEDev; +#define TYPE_PXB_CXL_BUS "pxb-cxl-bus" #define TYPE_PXB_DEV "pxb" OBJECT_DECLARE_SIMPLE_TYPE(PXBDev, PXB_DEV) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 968b654e58..4aa4debf44 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1955,6 +1955,19 @@ static void build_append_srat_pci_device_handle(GArray *table_data, build_append_int_noprefix(table_data, 0, 12); } +static void build_append_srat_acpi_device_handle(GArray *table_data, + const char *hid, + uint32_t uid) +{ + assert(strlen(hid) == 8); + /* Device Handle - ACPI */ + for (int i = 0; i < sizeof(hid); i++) { + build_append_int_noprefix(table_data, hid[i], 1); + } + build_append_int_noprefix(table_data, uid, 4); + build_append_int_noprefix(table_data, 0, 4); +} + /* * ACPI spec, Revision 6.3 * 5.2.16.6 Generic Initiator Affinity Structure @@ -1982,6 +1995,32 @@ void build_srat_pci_generic_initiator(GArray *table_data, int node, build_append_int_noprefix(table_data, 0, 4); } +/* + * ACPI spec, Revision 6.5 + * 5.2.16.7 Generic Port Affinity Structure + * With ACPI Device Handle. + */ +void build_srat_acpi_generic_port(GArray *table_data, uint32_t node, + const char *hid, uint32_t uid) +{ + /* Type */ + build_append_int_noprefix(table_data, 6, 1); + /* Length */ + build_append_int_noprefix(table_data, 32, 1); + /* Reserved */ + build_append_int_noprefix(table_data, 0, 1); + /* Device Handle Type: ACPI */ + build_append_int_noprefix(table_data, 0, 1); + /* Proximity Domain */ + build_append_int_noprefix(table_data, node, 4); + /* Device Handle */ + build_append_srat_acpi_device_handle(table_data, hid, uid); + /* Flags - GP Enabled */ + build_append_int_noprefix(table_data, 1, 4); + /* Reserved */ + build_append_int_noprefix(table_data, 0, 4); +} + /* * ACPI spec 5.2.17 System Locality Distance Information Table * (Revision 2.0 or later) diff --git a/hw/acpi/pci.c b/hw/acpi/pci.c index 3e1db161cc..d7a0e91f01 100644 --- a/hw/acpi/pci.c +++ b/hw/acpi/pci.c @@ -30,6 +30,7 @@ #include "hw/boards.h" #include "hw/acpi/aml-build.h" #include "hw/acpi/pci.h" +#include "hw/pci/pci_bridge.h" #include "hw/pci/pci_device.h" #include "hw/pci/pcie_host.h" @@ -177,9 +178,122 @@ static int build_acpi_generic_initiator(Object *obj, void *opaque) return 0; } -void build_srat_generic_pci_initiator(GArray *table_data) +typedef struct AcpiGenericPort { + /* private */ + Object parent; + + /* public */ + char *pci_bus; + uint32_t node; +} AcpiGenericPort; + +typedef struct AcpiGenericPortClass { + ObjectClass parent_class; +} AcpiGenericPortClass; + +#define TYPE_ACPI_GENERIC_PORT "acpi-generic-port" + +OBJECT_DEFINE_TYPE_WITH_INTERFACES(AcpiGenericPort, acpi_generic_port, + ACPI_GENERIC_PORT, OBJECT, + { TYPE_USER_CREATABLE }, + { NULL }) + +OBJECT_DECLARE_SIMPLE_TYPE(AcpiGenericPort, ACPI_GENERIC_PORT) + +static void acpi_generic_port_init(Object *obj) +{ + AcpiGenericPort *gp = ACPI_GENERIC_PORT(obj); + + gp->node = MAX_NODES; + gp->pci_bus = NULL; +} + +static void acpi_generic_port_finalize(Object *obj) +{ + AcpiGenericPort *gp = ACPI_GENERIC_PORT(obj); + + g_free(gp->pci_bus); +} + +static void acpi_generic_port_set_pci_bus(Object *obj, const char *val, + Error **errp) +{ + AcpiGenericPort *gp = ACPI_GENERIC_PORT(obj); + + gp->pci_bus = g_strdup(val); +} + +static void acpi_generic_port_set_node(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + AcpiGenericPort *gp = ACPI_GENERIC_PORT(obj); + uint32_t value; + + if (!visit_type_uint32(v, name, &value, errp)) { + return; + } + + if (value >= MAX_NODES) { + error_printf("%s: Invalid NUMA node specified\n", + TYPE_ACPI_GENERIC_INITIATOR); + exit(1); + } + + gp->node = value; +} + +static void acpi_generic_port_class_init(ObjectClass *oc, void *data) +{ + object_class_property_add_str(oc, "pci-bus", NULL, + acpi_generic_port_set_pci_bus); + object_class_property_set_description(oc, "pci-bus", + "PCI Bus of the host bridge associated with this GP affinity structure"); + object_class_property_add(oc, "node", "int", NULL, + acpi_generic_port_set_node, NULL, NULL); + object_class_property_set_description(oc, "node", + "The NUMA node like ID to index HMAT/SLIT NUMA properties involving GP"); +} + +static int build_acpi_generic_port(Object *obj, void *opaque) +{ + MachineState *ms = MACHINE(qdev_get_machine()); + const char *hid = "ACPI0016"; + GArray *table_data = opaque; + AcpiGenericPort *gp; + uint32_t uid; + Object *o; + + if (!object_dynamic_cast(obj, TYPE_ACPI_GENERIC_PORT)) { + return 0; + } + + gp = ACPI_GENERIC_PORT(obj); + + if (gp->node >= ms->numa_state->num_nodes) { + error_printf("%s: node %d is invalid.\n", + TYPE_ACPI_GENERIC_PORT, gp->node); + exit(1); + } + + o = object_resolve_path_type(gp->pci_bus, TYPE_PXB_CXL_BUS, NULL); + if (!o) { + error_printf("%s: device must be a CXL host bridge.\n", + TYPE_ACPI_GENERIC_PORT); + exit(1); + } + + uid = object_property_get_uint(o, "acpi_uid", &error_fatal); + build_srat_acpi_generic_port(table_data, gp->node, hid, uid); + + return 0; +} + +void build_srat_generic_affinity_structures(GArray *table_data) { object_child_foreach_recursive(object_get_root(), build_acpi_generic_initiator, table_data); + object_child_foreach_recursive(object_get_root(), build_acpi_generic_port, + table_data); } diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index b5973c9148..620992c92c 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -510,7 +510,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) } } - build_srat_generic_pci_initiator(table_data); + build_srat_generic_affinity_structures(table_data); if (ms->nvdimms_state->is_enabled) { nvdimm_build_srat(table_data); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 88227e343e..d01e704162 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1973,7 +1973,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) build_srat_memory(table_data, 0, 0, 0, MEM_AFFINITY_NOFLAGS); } - build_srat_generic_pci_initiator(table_data); + build_srat_generic_affinity_structures(table_data); /* * Entry is required for Windows to enable memory hotplug in OS diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c index 3d52ea5867..4578e03024 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -38,7 +38,6 @@ DECLARE_INSTANCE_CHECKER(PXBBus, PXB_BUS, DECLARE_INSTANCE_CHECKER(PXBBus, PXB_PCIE_BUS, TYPE_PXB_PCIE_BUS) -#define TYPE_PXB_CXL_BUS "pxb-cxl-bus" DECLARE_INSTANCE_CHECKER(PXBBus, PXB_CXL_BUS, TYPE_PXB_CXL_BUS) From patchwork Mon Sep 16 17:42:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805721 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA49A1311A7 for ; Mon, 16 Sep 2024 17:42:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508566; cv=none; b=bByKzZeAk6oSF8mvIQRMlw2vpo+oJHfDQ2H2QVuaZNRwNowAI33MRYDiDZkmxBtKMdL0j/k66V3vcLcDHBtKu1f73kpf1UX8SrwPLS4Dh26wgPL3AM6KoXzyB74KhIausZGnrKjQu2HrGrUyfPoAgGWAS6n0slCU2Kf9JdbDkjs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508566; c=relaxed/simple; bh=a93Hv/8J/mPYqYBuk2diyaWglYlPkV6YTW9VGJ5/23k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A3hTFYK5nkGujjyuYbMYnpyeMkuHp66g4fA38lm5RPhQufr389torS2qnP0TSMDujvwXYresPkhR8c6tp4CzADuq31AAepopV6mqdlbRzJcqM9mApVOhVBL8g4XjsTpyjs3+g1DzXTeAasNkGyKjgVqlaMj0LvGcjm+MjXHgW8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6sZt3xSXz6K9F9; Tue, 17 Sep 2024 01:38:30 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id B7004140AB8; Tue, 17 Sep 2024 01:42:42 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:42:39 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 11/15] hw/acpi: Make storage of node id uint32_t to reduce fragility Date: Mon, 16 Sep 2024 18:42:37 +0100 Message-ID: <20240916174237.1843213-1-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To frapeml500008.china.huawei.com (7.182.85.71) From review of generic port introduction. The value is handled as a uint32_t so store it in that type. The value cannot in reality exceed MAX_NODES which is currently 128 but if the types are matched there is no need to rely on that restriction. Signed-off-by: Jonathan Cameron --- v6: New patch bringing Generic Initiator handling inline with updated generic ports code following Igor's review. Kind of suggested-by Igor, indirectly... --- include/hw/acpi/aml-build.h | 2 +- hw/acpi/aml-build.c | 2 +- hw/acpi/pci.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 47a4692a7d..4fd5da49e7 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -486,7 +486,7 @@ Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set, uint32_t io_offset, void build_srat_memory(GArray *table_data, uint64_t base, uint64_t len, int node, MemoryAffinityFlags flags); -void build_srat_pci_generic_initiator(GArray *table_data, int node, +void build_srat_pci_generic_initiator(GArray *table_data, uint32_t node, uint16_t segment, uint8_t bus, uint8_t devfn); diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 4aa4debf44..91540df826 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1973,7 +1973,7 @@ static void build_append_srat_acpi_device_handle(GArray *table_data, * 5.2.16.6 Generic Initiator Affinity Structure * With PCI Device Handle. */ -void build_srat_pci_generic_initiator(GArray *table_data, int node, +void build_srat_pci_generic_initiator(GArray *table_data, uint32_t node, uint16_t segment, uint8_t bus, uint8_t devfn) { diff --git a/hw/acpi/pci.c b/hw/acpi/pci.c index d7a0e91f01..a4835ce563 100644 --- a/hw/acpi/pci.c +++ b/hw/acpi/pci.c @@ -72,7 +72,7 @@ typedef struct AcpiGenericInitiator { /* public */ char *pci_dev; - uint16_t node; + uint32_t node; } AcpiGenericInitiator; typedef struct AcpiGenericInitiatorClass { From patchwork Mon Sep 16 17:43:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805722 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFD75143C63 for ; Mon, 16 Sep 2024 17:43:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508612; cv=none; b=jk//WNGqQItG23oe6k/w69+95DIECo7g5VwJamEo99XprXFmQsPCFAhDpBB2fi2wnO3PM/r6nbUfRG1IUmAJOfRW29PT7bPt//g6vvWB9FNl3D+revjd80hrTYR3FKtvh2ltVW+VUrPh+oaG5laLa7MVjTR7bdHZbffkCsx4g/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508612; c=relaxed/simple; bh=/b6WDxYssbFp0mRr8WuZq3pBxpdeX+p4nZMjQYn+T4s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ehI15068tqiHN/ISeoMdutmAAmFz/nj2ibgafIgK+1itLvI1ktu2iPVR21XTobIGr8TEvtmHRgIPIqKPzvBAREG5agp/CJEOVh7PAlMWZrQ1oH+Dct/47M92HdWz4+zuusDnMAOuiXzRUXoB7fFsm1AGpy66fhM1Oqn2is4Bwso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6sbk4vJNz6K9FF; Tue, 17 Sep 2024 01:39:14 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id D842E140CF4; Tue, 17 Sep 2024 01:43:26 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:43:23 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 12/15] hw/acpi: Generic Initiator - add missing object class property descriptions. Date: Mon, 16 Sep 2024 18:43:21 +0100 Message-ID: <20240916174321.1843228-1-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To frapeml500008.china.huawei.com (7.182.85.71) From review of the Generic Ports support. These properties had no description set so add one. Signed-off-by: Jonathan Cameron --- v6: New patch based on Igor's review of Generic Ports patch. --- hw/acpi/pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/acpi/pci.c b/hw/acpi/pci.c index a4835ce563..f88f450af3 100644 --- a/hw/acpi/pci.c +++ b/hw/acpi/pci.c @@ -137,8 +137,12 @@ static void acpi_generic_initiator_class_init(ObjectClass *oc, void *data) { object_class_property_add_str(oc, "pci-dev", NULL, acpi_generic_initiator_set_pci_device); + object_class_property_set_description(oc, "pci-dev", + "PCI device to associate with the node"); object_class_property_add(oc, "node", "int", NULL, acpi_generic_initiator_set_node, NULL, NULL); + object_class_property_set_description(oc, "node", + "NUMA node associated with the PCI device"); } static int build_acpi_generic_initiator(Object *obj, void *opaque) From patchwork Mon Sep 16 17:44:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805723 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 920DB1311A7 for ; Mon, 16 Sep 2024 17:44:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508654; cv=none; b=V9uIUI5CwTI5tnAaj+kL2cHk6TvkcBzj6VrynzTohrmoi4Ly/NmbFtpVM79ApodboLgllsCQIKHSQgM9r+euqQyZmX7jh4B765rpA2nSHFaREabxdB0r5O8qOdjfDt94N6XtjH1NHtdNbDc15Tdhyzm6f/NSO9Jdutqkz1GJzl8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508654; c=relaxed/simple; bh=rGFRZcGLMS2YgYzFMHupPKYItz0EjJgOeHO94cvbXBo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=db7jXnyQDamMHdVa6U+Ecc/c9BEspNS+4ZcNXUEn04mvyV5shEidxreTuGvFXxh8lY3Je9AwxDcX2VjL1yRKDK0YNkLmQzzkQ9Qsca0R42YH7tp8ov8U5Usnlqake+LNLOApjzkhlYE6J7FVLfbp3Sk6BZnEgKGlzGUPclU1fBE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6sjK6GTNz6K6Xx; Tue, 17 Sep 2024 01:44:05 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 97B02140F1C; Tue, 17 Sep 2024 01:44:10 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:44:07 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 13/15] bios-tables-test: Allow for new acpihmat-generic-x test data. Date: Mon, 16 Sep 2024 18:44:05 +0100 Message-ID: <20240916174405.1843243-1-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To frapeml500008.china.huawei.com (7.182.85.71) The test to be added exercises many corner cases of the SRAT and HMAT table generation. Signed-off-by: Jonathan Cameron --- tests/qtest/bios-tables-test-allowed-diff.h | 5 +++++ tests/data/acpi/x86/q35/APIC.acpihmat-generic-x | 0 tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x | 0 tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x | 0 tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x | 0 tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x | 0 6 files changed, 5 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..3c0967078f 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,6 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/x86/q35/APIC.acpihmat-generic-x", +"tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x", +"tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x", +"tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x", +"tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x", diff --git a/tests/data/acpi/x86/q35/APIC.acpihmat-generic-x b/tests/data/acpi/x86/q35/APIC.acpihmat-generic-x new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x b/tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x b/tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x b/tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x b/tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x new file mode 100644 index 0000000000..e69de29bb2 From patchwork Mon Sep 16 17:44:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805727 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C535B158A1F for ; Mon, 16 Sep 2024 17:44:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508699; cv=none; b=SNSAk1sfwvtkaUSQtvKZnmvv1ppzkgVOBcFIQMq1upk+H/OGJMub6+jexxgQfTBJyKCZnaiChs2658zIPVAccbFsVFtYxZimg0T5FDre+9nlwXRnqsbL4whL/jOI2BGSDvkCpXm/xzndapmIYLLhp/4TSmTJZiBjA6l9YvAkJE8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508699; c=relaxed/simple; bh=HrGqrE/krTgnaMKimhFeaPcIzX9ZalGKLXtgUJp5V80=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j1SsjzsuYUL2QBFTdmbBUu0i5wxn5LPDKW/eUyp6StgMZiUWGTp4efBWVPOgEDAMX9rUMY7FoKC/w3331eMebf1O0kxdXvSQ8vr01sfDZ0+74Bck3RWA8J0wsBZQFNL4PHXKXcorvO6F8ORtoMd52opQv0wOFxgMtUCi+pp3FCk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6skB18Nwz6K5XF; Tue, 17 Sep 2024 01:44:50 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id DCC72140F1C; Tue, 17 Sep 2024 01:44:54 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:44:51 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 14/15] bios-tables-test: Add complex SRAT / HMAT test for GI GP Date: Mon, 16 Sep 2024 18:44:49 +0100 Message-ID: <20240916174449.1843258-1-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To frapeml500008.china.huawei.com (7.182.85.71) Add a test with 6 nodes to exercise most interesting corner cases of SRAT and HMAT generation including the new Generic Initiator and Generic Port Affinity structures. More details of the set up in the following patch adding the table data. Signed-off-by: Jonathan Cameron --- tests/qtest/bios-tables-test.c | 97 ++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 36e5c0adde..f568c4a21c 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1910,6 +1910,101 @@ static void test_acpi_q35_tcg_acpi_hmat_noinitiator(void) free_test_data(&data); } +/* Test intended to hit corner cases of SRAT and HMAT */ +static void test_acpi_q35_tcg_acpi_hmat_generic_x(void) +{ + test_data data = {}; + + data.machine = MACHINE_Q35; + data.arch = "x86"; + data.variant = ".acpihmat-generic-x"; + test_acpi_one(" -machine hmat=on,cxl=on" + " -smp 3,sockets=3" + " -m 128M,maxmem=384M,slots=2" + " -device pcie-root-port,chassis=1,id=pci.1" + " -device pci-testdev,bus=pci.1," + "multifunction=on,addr=00.0" + " -device pci-testdev,bus=pci.1,addr=00.1" + " -device pci-testdev,bus=pci.1,id=gidev,addr=00.2" + " -device pxb-cxl,bus_nr=64,bus=pcie.0,id=cxl.1" + " -object memory-backend-ram,size=64M,id=ram0" + " -object memory-backend-ram,size=64M,id=ram1" + " -numa node,nodeid=0,cpus=0,memdev=ram0" + " -numa node,nodeid=1" + " -object acpi-generic-initiator,id=gi0,pci-dev=gidev,node=1" + " -numa node,nodeid=2" + " -object acpi-generic-port,id=gp0,pci-bus=cxl.1,node=2" + " -numa node,nodeid=3,cpus=1" + " -numa node,nodeid=4,memdev=ram1" + " -numa node,nodeid=5,cpus=2" + " -numa hmat-lb,initiator=0,target=0,hierarchy=memory," + "data-type=access-latency,latency=10" + " -numa hmat-lb,initiator=0,target=0,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=800M" + " -numa hmat-lb,initiator=0,target=2,hierarchy=memory," + "data-type=access-latency,latency=100" + " -numa hmat-lb,initiator=0,target=2,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=200M" + " -numa hmat-lb,initiator=0,target=4,hierarchy=memory," + "data-type=access-latency,latency=100" + " -numa hmat-lb,initiator=0,target=4,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=200M" + " -numa hmat-lb,initiator=0,target=5,hierarchy=memory," + "data-type=access-latency,latency=200" + " -numa hmat-lb,initiator=0,target=5,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=400M" + " -numa hmat-lb,initiator=1,target=0,hierarchy=memory," + "data-type=access-latency,latency=500" + " -numa hmat-lb,initiator=1,target=0,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=100M" + " -numa hmat-lb,initiator=1,target=2,hierarchy=memory," + "data-type=access-latency,latency=50" + " -numa hmat-lb,initiator=1,target=2,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=400M" + " -numa hmat-lb,initiator=1,target=4,hierarchy=memory," + "data-type=access-latency,latency=50" + " -numa hmat-lb,initiator=1,target=4,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=800M" + " -numa hmat-lb,initiator=1,target=5,hierarchy=memory," + "data-type=access-latency,latency=500" + " -numa hmat-lb,initiator=1,target=5,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=100M" + " -numa hmat-lb,initiator=3,target=0,hierarchy=memory," + "data-type=access-latency,latency=20" + " -numa hmat-lb,initiator=3,target=0,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=400M" + " -numa hmat-lb,initiator=3,target=2,hierarchy=memory," + "data-type=access-latency,latency=80" + " -numa hmat-lb,initiator=3,target=2,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=200M" + " -numa hmat-lb,initiator=3,target=4,hierarchy=memory," + "data-type=access-latency,latency=80" + " -numa hmat-lb,initiator=3,target=4,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=200M" + " -numa hmat-lb,initiator=3,target=5,hierarchy=memory," + "data-type=access-latency,latency=20" + " -numa hmat-lb,initiator=3,target=5,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=400M" + " -numa hmat-lb,initiator=5,target=0,hierarchy=memory," + "data-type=access-latency,latency=20" + " -numa hmat-lb,initiator=5,target=0,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=400M" + " -numa hmat-lb,initiator=5,target=2,hierarchy=memory," + "data-type=access-latency,latency=80" + " -numa hmat-lb,initiator=5,target=4,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=200M" + " -numa hmat-lb,initiator=5,target=4,hierarchy=memory," + "data-type=access-latency,latency=80" + " -numa hmat-lb,initiator=5,target=2,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=200M" + " -numa hmat-lb,initiator=5,target=5,hierarchy=memory," + "data-type=access-latency,latency=10" + " -numa hmat-lb,initiator=5,target=5,hierarchy=memory," + "data-type=access-bandwidth,bandwidth=800M", + &data); + free_test_data(&data); +} + #ifdef CONFIG_POSIX static void test_acpi_erst(const char *machine, const char *arch) { @@ -2388,6 +2483,8 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet); qtest_add_func("acpi/q35/acpihmat-noinitiator", test_acpi_q35_tcg_acpi_hmat_noinitiator); + qtest_add_func("acpi/q35/acpihmat-genericx", + test_acpi_q35_tcg_acpi_hmat_generic_x); /* i386 does not support memory hotplug */ if (strcmp(arch, "i386")) { From patchwork Mon Sep 16 17:45:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13805728 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B8CCE57D for ; Mon, 16 Sep 2024 17:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508753; cv=none; b=LVMuCvQQTuYuAE5wcjM+E1ZSwnbZLptJGCg1bp0LP+4JGIbr1f8/BjvsFlFpxSv7uv0d72YW5TB8aXGyrmrwBukiN/pRpRND4afshLUF3X0VMiLcD6Ji1sWth4QbTn5pkDRwU6+jW848g/OJSRB3PxKg06NgdWv8x/8KQArJyp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726508753; c=relaxed/simple; bh=4BBySxzL2kwxgQBYkK5RabwQYlarT9iVRfpo3Q2OEhE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Pgv/OtT4Ynrb0F/dO/kGAGNTKBGd2UeUZq9XzLZQQP+TQQG2iNtYyPGgvWo7aQxTU+/ilVTJwu9b2dHeOuyP1OktiAjdrmrX9g3TVzAVrgJu3Wu+R4+xOebsXaxD7UQ9uv5FpODwVA68YCEZWf6UCrw5MgeJk0xo3TxvzIWs7tI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4X6sfz26wbz6LD8B; Tue, 17 Sep 2024 01:42:03 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 4E33C140AB8; Tue, 17 Sep 2024 01:45:48 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Sep 2024 19:45:44 +0200 From: Jonathan Cameron To: , , Markus Armbruster , , CC: , , , , Richard Henderson , Dave Jiang , Huang Ying , Paolo Bonzini , , Michael Roth , Ani Sinha Subject: [PATCH v6 15/15] bios-tables-test: Add data for complex numa test (GI, GP etc) Date: Mon, 16 Sep 2024 18:45:43 +0100 Message-ID: <20240916174543.1843276-1-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> References: <20240916171017.1841767-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To frapeml500008.china.huawei.com (7.182.85.71) Given this is a new configuration, there are affects on APIC, CEDT and DSDT, but the key elements are in SRAT (plus related data in HMAT). The configuration has node to exercise many different combinations. 0) CPUs + Memory 1) GI only 2) GP only 3) CPUS only 4) Memory only 5) CPUs + HP memory GI node, GP Node, Memory only node, hotplug memory only node, latency and bandwidth such that in Linux Access0 (any initiator) and Access1 (CPU initiators only) given different answers. Following cropped to remove details of each entry. [000h 0000 004h] Signature : "SRAT" [System Resource Affinity Table] ... [030h 0048 001h] Subtable Type : 00 [Processor Local APIC/SAPIC Affinity] ... [032h 0050 001h] Proximity Domain Low(8) : 00 [033h 0051 001h] Apic ID : 00 ... [040h 0064 001h] Subtable Type : 00 [Processor Local APIC/SAPIC Affinity] ... [042h 0066 001h] Proximity Domain Low(8) : 03 [043h 0067 001h] Apic ID : 01 ... [050h 0080 001h] Subtable Type : 00 [Processor Local APIC/SAPIC Affinity] ... [052h 0082 001h] Proximity Domain Low(8) : 05 [053h 0083 001h] Apic ID : 02 ... [060h 0096 001h] Subtable Type : 01 [Memory Affinity] ... [062h 0098 004h] Proximity Domain : 00000000 ... [068h 0104 008h] Base Address : 0000000000000000 [070h 0112 008h] Address Length : 00000000000A0000 ... [088h 0136 001h] Subtable Type : 01 [Memory Affinity] ... [08Ah 0138 004h] Proximity Domain : 00000000 ... [090h 0144 008h] Base Address : 0000000000100000 [098h 0152 008h] Address Length : 0000000003F00000 ... [0B0h 0176 001h] Subtable Type : 01 [Memory Affinity] ... [0B2h 0178 004h] Proximity Domain : 00000004 ... [0B8h 0184 008h] Base Address : 0000000004000000 [0C0h 0192 008h] Address Length : 0000000004000000 ... some zero length entries follow... [1A0h 0416 001h] Subtable Type : 05 [Generic Initiator Affinity] [1A1h 0417 001h] Length : 20 [1A2h 0418 001h] Reserved1 : 00 [1A3h 0419 001h] Device Handle Type : 01 [1A4h 0420 004h] Proximity Domain : 00000001 [1A8h 0424 010h] Device Handle : 00 00 01 02 00 00 00 00 00 00 00 00 00 00 00 00 [1B8h 0440 004h] Flags (decoded below) : 00000001 Enabled : 1 Architectural Transactions : 0 [1BCh 0444 004h] Reserved2 : 00000000 [1C0h 0448 001h] Subtable Type : 06 [Generic Port Affinity] [1C1h 0449 001h] Length : 20 [1C2h 0450 001h] Reserved1 : 00 [1C3h 0451 001h] Device Handle Type : 00 [1C4h 0452 004h] Proximity Domain : 00000002 [1C8h 0456 010h] Device Handle : 41 43 50 49 30 30 31 36 40 00 00 00 00 00 00 00 [1D8h 0472 004h] Flags (decoded below) : 00000001 Enabled : 1 Architectural Transactions : 0 [1DCh 0476 004h] Reserved2 : 00000000 [1E0h 0480 001h] Subtable Type : 01 [Memory Affinity] ... [1E2h 0482 004h] Proximity Domain : 00000005 ... [1E8h 0488 008h] Base Address : 0000000100000000 [1F0h 0496 008h] Address Length : 0000000090000000 Example block from HMAT: [0F0h 0240 002h] Structure Type : 0001 [System Locality Latency and Bandwidth Information] [0F2h 0242 002h] Reserved : 0000 [0F4h 0244 004h] Length : 00000078 [0F8h 0248 001h] Flags (decoded below) : 00 Memory Hierarchy : 0 Use Minimum Transfer Size : 0 Non-sequential Transfers : 0 [0F9h 0249 001h] Data Type : 03 [0FAh 0250 001h] Minimum Transfer Size : 00 [0FBh 0251 001h] Reserved1 : 00 [0FCh 0252 004h] Initiator Proximity Domains # : 00000004 [100h 0256 004h] Target Proximity Domains # : 00000006 [104h 0260 004h] Reserved2 : 00000000 [108h 0264 008h] Entry Base Unit : 0000000000000004 [110h 0272 004h] Initiator Proximity Domain List : 00000000 [114h 0276 004h] Initiator Proximity Domain List : 00000001 [118h 0280 004h] Initiator Proximity Domain List : 00000003 [11Ch 0284 004h] Initiator Proximity Domain List : 00000005 [120h 0288 004h] Target Proximity Domain List : 00000000 [124h 0292 004h] Target Proximity Domain List : 00000001 [128h 0296 004h] Target Proximity Domain List : 00000002 [12Ch 0300 004h] Target Proximity Domain List : 00000003 [130h 0304 004h] Target Proximity Domain List : 00000004 [134h 0308 004h] Target Proximity Domain List : 00000005 [138h 0312 002h] Entry : 00C8 [13Ah 0314 002h] Entry : 0000 [13Ch 0316 002h] Entry : 0032 [13Eh 0318 002h] Entry : 0000 [140h 0320 002h] Entry : 0032 [142h 0322 002h] Entry : 0064 [144h 0324 002h] Entry : 0019 [146h 0326 002h] Entry : 0000 [148h 0328 002h] Entry : 0064 [14Ah 0330 002h] Entry : 0000 [14Ch 0332 002h] Entry : 00C8 [14Eh 0334 002h] Entry : 0019 [150h 0336 002h] Entry : 0064 [152h 0338 002h] Entry : 0000 [154h 0340 002h] Entry : 0032 [156h 0342 002h] Entry : 0000 [158h 0344 002h] Entry : 0032 [15Ah 0346 002h] Entry : 0064 [15Ch 0348 002h] Entry : 0064 [15Eh 0350 002h] Entry : 0000 [160h 0352 002h] Entry : 0032 [162h 0354 002h] Entry : 0000 [164h 0356 002h] Entry : 0032 [166h 0358 002h] Entry : 00C8 Note the zeros represent entries where the target node has no memory. These could be surpressed but it isn't 'wrong' to provide them and it is (probably) permissible under ACPI to hotplug memory into these nodes later. Signed-off-by: Jonathan Cameron --- v6: Rebased - required data update. --- tests/qtest/bios-tables-test-allowed-diff.h | 5 ----- tests/data/acpi/x86/q35/APIC.acpihmat-generic-x | Bin 0 -> 136 bytes tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x | Bin 0 -> 68 bytes tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x | Bin 0 -> 12566 bytes tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x | Bin 0 -> 360 bytes tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x | Bin 0 -> 520 bytes 6 files changed, 5 deletions(-) diff --git a/tests/data/acpi/x86/q35/APIC.acpihmat-generic-x b/tests/data/acpi/x86/q35/APIC.acpihmat-generic-x index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..317ddb3fbed94e4f49a87976fdc7f23b1a6c3fdc 100644 GIT binary patch literal 136 zcmZ<^@O18AU|?WQaPoKd2v%^42yj*a0!E-1hz+6{7#{os(;N&85Soz@LNhUeXht58 ongjnpBoh}9gBTzdD=U!Z1+h3eVJt470*DwlH<-o3_8({j09efo0RR91 literal 0 HcmV?d00001 diff --git a/tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x b/tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..31c9011663639b4a0f4816f3b2b06398f94682f7 100644 GIT binary patch literal 68 zcmZ>EbqR4{U|?Xhb@F%i2v%^42yj*a0!E-1hz+6{7!(*BfFy(s;xkNuupuM>Qf*={9! zi`+VP5pNK{R)DPIhiwzCx7{~7;O_RVeJJ`?tbz8SeKSxL4N#y!ANsP7T@>pA#j4+# zGe@2wDPWD=+5k0Y?)m%X&YkbxnNx0-*XI|N^8UPZF03{eN|);40{(eQDQeT-+-mBw zYTYfDR@z=Bk@8yiGP;eQQaborxpZO0`-`p4_d1Kw?l3v)9nkZWfjyW+UJ^K>cI^amfv0M zt&MfJX6O7|EBd$NKRbHl^!MJqReb!7fBl08H~bV7mhd-?zsF3rDnU+(mBpLe&t zkH}nKTkOq!-qn}6FGpA64)r|Bau>N;?B58^j#bLdXsUOrdtJq|Nl$fphd<{8p1l1} z|JgkGt?09ZKZ#!W`!MQvdJ_+~{Y1YL`}gj5ltRam?sb16&W|P3l^@7H)-%_;97U< zVRPNfJkI***1a4FA^I;Y;HSLMy4$Rr!L9note?WYA|WglDraz^v=%kI%o8>vAuO$3 zh!*Or8E3K zJ3(o(uE(=H{#*l!QKKMw0P*9gP27f$x|^!InZ?-bs*g6jjgL0&c>ct*0q(u#jQ)Uw zc$05Ky1p7Nt03FPUoYMwDYtXcqw&p!Khblu-dL~a&%S>*pGjp9tG0HwqPXp$y{z(C z>h}{6RzyfbsH*%_3i;tSvYwI13X0QwP1`|LM6!f`t((x6&@~cSifTe>OQ>o~h-8Uu zv~E&cN(Mo~h-4{IQrc27NNGz^O|hjU57EXs=HMLDmZCbwmXbU~8|S!# zb6i`B>bQ#&qK$LH!8zgJoN#eMv~i{#oM{JV+QkXc#yRQWoOEzbx;P=)IDH4F@8I-Z zoDglC83$*^!I^P!LbP#a9h_MQXV%3D(Z)ID;GA-BPPsTC+Bl~joYM}@X%{C%8|RFJ zbH>3r)@PqaYD3l<{g}Q2WQ^J3DL$m=ir=kaL&0n zA=)?t2WQ~m3|yQLZJY-joCh472V9&GZJhHC&Upvtyo(c}jT1D+YnEP>4mvmwx;P=) zI1f2E4>>pwxi}%(IA73~MY9sVpe;*gv3r3n!)GE{mW}RV$MUdadDyjtXj{JMSib03 zzUW#)v@MS~mPZ`RBd#Sx+wvvH@+HUeCD#(7ZTYgclr{ckZ7FN~%WNqNH$<`&COPWF zJnFc)h~G1DN>qD7!9%~gcfWa^=fz=l8}AS??>2oe+o%6fVdd5WwgKMz4!b&o(H z3N#QX>k5Hdszjiyx<{Z8k&O^2>l%q-!mBVQS;~kJfkH$^S{DS$x<)b>wIvZKtBPpj z1c96yP1j@SF5(H|g5`nU+wj=_DC^$i&tg9_Spq45TD648qB2b8e69me- z+7bk6sS<&*s6yP1j@SF5(H|g5`nU+wj=_DC^$i&tg9_Spq45TD648qB2b8e69me-+7bk6sS<&* zsm1bDtEJ2BZA z-hW9WbaQszpZj!LO(wxm3Tv>!YO3z2V5Z$%FRDJJP;Z6$G&WZFYEB-f$-&h!k10>%3%1^bA+#0;VU|P zWgvWIpYRnEet9tb*mHzmw!$y#@XG_?m-h+3Y{IV$h97^9@GDmM6&-$MApFWc;a5!f z>R|YZ=Llc5!dG?p>OlDFKH;kfpQ7bxFno@~%i@7o13d1$IqCKVsom-3>iwbFMqQSq!=3zLD;Ro}0jRhu4iEcicD9 z-OzJzz;%arkRf;6H`3kEyqw}buIzUobX*4r{`0uek$PtuA+v~Ib^e6ZPA?FGoYuHc^+ADRwk5k34 zzFH_0PN`h&45wK2FTa(P{q}mJ(v)m{tP#j|Dy&~vsJ?eA{^spJT)27d{r7I)ymIY* z)$+o6?W}odrhI?J`!f4w*2~@jIxOqhv;Q*dXIuAPC!weo!g^)R3s={gUf75(df0g{ z(9g1`l3^H?vAdrq&1BfD)E1y#F0LD#qD0EyX7aSy|f)v$8nlaoNT>v`K^?VpK#G}z+g9W zi0Oc&J9vSR#r_PA0fw&B&h|S&G)8EjFOWCr3LZxK4_4;GX1JE#2Sz$vtGt^}?8fR! z>|On$lJ8#iVs$n4I#=W$?k@~ zi#R`sM_uo|Iy7`NAL1+bDaj3Wdjn}bdb@XWNKMZe+*V3-Xk>5^cDJw4aa<+E=W*n4 zQ(d8{a0LNci=)8}`9eOoH%E_iG#Q?2u4nfd=h4$;$Ug=z-X1YFv7Z?1CDrSLofzhk z*|k3YU7G9k)GIpe!NgAYX?o+yh>Gj889%MCp+T?7!88sW*E0l0ZEau20(U7=t&eLd zdP4MjwBrEpsCy1PPdmu8&BI&pEN7lL^OLQQ&ylw!Y)?_Zsb}fXJLjIeL_)jE?z!_5 zAa+U4PwY7y3tq&Nk2S1aDJ&_oT+u2(GasZpX02dRwayHv4;_nG>39{3uKm$_H}5QL z4J~B6XzCRV@BY3zL@QXePREDJ_YbvpiWOdV;F+m27SmCAt>GtH z_ujN_9pywGlTo8oTfk2hKQ(IA(5hc*FSPD`ZG?VNo%W+jv+YInoJ8~#M0DWUy7%e` z?PNqtXLPP|5kJjvA;1wdCIB8v%1IGJWLjRNk3Ngz5r)pXhUdTa3SHaX{o;2XcE}>` zki*_wm!soR>UgnE<%Ly!#pX=GmGW**Hd zH-D{Gk={4ZG`;gt@siO!jAk{a+eAjxsF5QyYE?3zMva`@q;6`EEeZNES@(j6)JNBE zlI-cuS>5T~+UucKjjq*t<%uqJV*)jfFYO(X??EQ01d||Yc*mD~AMV@0gyuACO>-Uz zwPT7*mt%5H7h}qkE}1(-W_!(3CxTZo4PFT zXmO!OGFN_ZncvIKej3(J@bLJj)9q4ejs75IdF!E-4R1a9Y(iI-&`&bmyil*JbhzHA zDQbth9iq&HR(-3?1TT^!>rA*e^DqCkwfzqdqQCpbcMs>@`RD)LxBBGhFIatodXpte zO_!}uc3h9rE2s7in1#&=1g7$plVo>-@KEC<9E4QJa?+!p{*6b|Zdps^mfle6&(+@d zt+EE};_;~rZ3M|d43#xtgUX!B&^C!V=Kwdcp59-?sSGRXO)ol?VO0_B<0md_fKzRm z(3Z04Wy%_mincUm4YFUxWet)6monz9B--jp>+6fSF!47jX8R83ifByY+ZBnp=`NCsTiAgXjK!vn8z(y0uO zydF(1Ymf}MtU+*^vIa@slr=~cE^CksxU4}`O<98^Z^{}Z3YRqqPA+Q@RXUYHdXhYy z%5d^JTP|ym47jX8ROwX4!bztx7EUf}kPNu2L2%Nk46Eu9qEi`&5{1he1Sgj@2u@Sh zAjzAu28qID4T6))8bsBUHAwQNtU;o1S%YN2WeuWAr!p2!I+d|-V(SHxWWZ$&g42{W zNb;tvL85S3gJi&E4Weqw8YFpB)*w;1tU+*cS%aw3sSGEi$CgfIIC*_PxvW7l;Ian6 zY04TTc~jOPQMjx@GT^cXQ8i@^lDsKvkSJW%AUL_KK~zmygCuXt8YBvrHAn_r)*z~; ztU;1DWepOA%NisDE^81~Q`R8Ko3aLp!etGT0hcw1swr!b!s1}@yEf> zkmu9vo;;=BnSZK_P0gFMk2h#K-JyR8<&>eO@oN27d`11GbLBCv{HeL}Wav}mF@42C zB=?01D}r6Z|$jJ({R1$XRI&Mh4F=P4>hsa{7TiU^#%_$ zmD4`^vc({c*q*4D*_m#`Ixy|G4{CJ8!=+QpW&Zkp;!pEBnq?2@o0OWrA z*==a;yt({t$lJG5=PS_#Y&R^C_CUtDvD_H#0_KWK`b9Rkx=44iwUcQU3hi{eSZ)B# z8_mMkS->6h6!w&xi)DPGQe#OP$Ekr5>I2P1V+rL1dK^~}7TFc{=d;bi5)0UADB<%J zb2X&{7n>K>RPYr&A!C|l*zh8S`yHiXx_H0isXmqO;_Kl?2YHZwUVlYUoiOQApZ14< zzfyn5`B&vHc%yuAZ9UP;e7NPQPY618Jx8}&J2TD2XSX3qvn*&XKkGS4d%3HP^9jG> zXLDhSzfA7^)>}!srKCw$Jv!mUY3%tD{e<*WPAhC=pRZ7RnSNI2rmg4n*YbaVdHiuXbCgJe2=?5_5_6rPLrY{sBH+U9BUX;P(+<+ROfjrDLZ zn+)R6LaANHDpp?lnDQu{ndWkl=VCUYFqG6$G95{D(17k0y60Y_Ngf=nhimI_LZ#?* yA2H4sJku!q$p97bxc>WZk}@@O@6fhb@SE5eTU4|)xwn(gMeSAxsngz}qw#;E+Y7Y- literal 0 HcmV?d00001 diff --git a/tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x b/tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0e5765f6ee4c07638c70647ae145e968718b67cd 100644 GIT binary patch literal 360 zcmeb9bqvX1WME+Ock*}k2v%^42yj*a0-z8Bhz+7)Km*7?=EKC%X^=V)XaHgs5CaPU znNtB32dQC$vIW$k3?Kzk!wkf%P$3YX2`UEC0}=;`ae=W2gAr7W703dq;{anOBsL>h pJ=k8L!N~R^yOS7uPXNsZ*=NL%!XOExQ-JsckOiV);t2K$1^{D&4*>uG literal 0 HcmV?d00001 diff --git a/tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x b/tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b45838adb7d304f8a36c38c90d89f3629ec48353 100644 GIT binary patch literal 520 zcmWFzatz^MVqjn_cJg=j2v%^42yj*a0!9V~1`r!WgD@Njp!1m-QRP{gkok-naGg*F z7hC|lI-mt$@PQeo5LF!uOc=(1(J1c3v=^ogl^*QsSQQwc;mZh&B?N$l37Y}~14zQr eIl$Avz|hPAsstv_sKE*qfydhfm;gM0fdT+OoeTj0 literal 0 HcmV?d00001 diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index 3c0967078f..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,6 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/x86/q35/APIC.acpihmat-generic-x", -"tests/data/acpi/x86/q35/CEDT.acpihmat-generic-x", -"tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x", -"tests/data/acpi/x86/q35/HMAT.acpihmat-generic-x", -"tests/data/acpi/x86/q35/SRAT.acpihmat-generic-x",