From nobody Fri May 3 10:10:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+92554+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1660841282179552.3332539606683; Thu, 18 Aug 2022 09:48:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id IhMEYY1788612xFJUVtyS28R; Thu, 18 Aug 2022 09:48:01 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.63]) by mx.groups.io with SMTP id smtpd.web11.44243.1660841280264214224 for ; Thu, 18 Aug 2022 09:48:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bMKzw3n9pl/ExV6hnNNGH9UZ66ml1l4AosK/xUXIBZzgMntQKSUk2X6nlvhGpAQ22/KYh+aJJ52nbBC6QM8qXmInFa21etD1bbKT4zYjrRqN/IzqDMEZGZQrxZR7XO2A5WYLDVsctz/vbqxM2iyx5MXA449leBJ96iH0T6XX0y5q1pM6ZjuaS7VZrBY50zx6Q6coEDA0RPr0XmyJHFM1q0A3lwO+Pg1IWIPNeoYgUrtINpVBnG6hETDwmc5WW22WB2R8lj0CnIc0ld1e8hRP7+scU4xVagC4bOVrHLqSoOt883qI7lFtHuMPTurc8C6wflgEwz+sKtt0jxHQ58dJUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9chLKlYIPVroteZsvN5R10w406gOWCrS/kYNre1hpCw=; b=nJeC9mhbuGKb+6XwkmAzDrERZ7G0fkjvv7e6Nm6WLdLCEt/ljGKoIUrCtBQqfdzU2pZ33KN5qgu0oTbKurrKA9rgkmL/Kk5mxeI1b+EVlIKff2SZknrIQj3LWZJYZfuo4RxgZacUohRVJBCiPWdjmOQuNbMQCQ531Stlraqpe3hSxrpip06O2Z0xQiqa4xw0uFQqVGDu5Zbh8PIIvQqjhJfXRcxN+O/Pt3RZZQdIcG89aZttikm5lHf2mw8lfjuVI5EqoNEH0KouZCn1ZhkBr0C+PGDjoNPOFWnU3QNzjeSm5O+I9rMLU86i+GcoHlfloAWsX1bgijT5ay6rW9Dhqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=arm.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none X-Received: from BN9PR03CA0229.namprd03.prod.outlook.com (2603:10b6:408:f8::24) by SN7PR12MB6813.namprd12.prod.outlook.com (2603:10b6:806:267::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.16; Thu, 18 Aug 2022 16:47:58 +0000 X-Received: from BN8NAM11FT078.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f8:cafe::b) by BN9PR03CA0229.outlook.office365.com (2603:10b6:408:f8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.12 via Frontend Transport; Thu, 18 Aug 2022 16:47:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+92554+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT078.mail.protection.outlook.com (10.13.176.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5546.7 via Frontend Transport; Thu, 18 Aug 2022 16:47:57 +0000 X-Received: from drhqmail201.nvidia.com (10.126.190.180) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Thu, 18 Aug 2022 16:47:55 +0000 X-Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Thu, 18 Aug 2022 09:47:54 -0700 X-Received: from ed7fa55790ac.nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Thu, 18 Aug 2022 09:47:54 -0700 From: "Jeff Brasen via groups.io" To: CC: , , , Jeff Brasen Subject: [edk2-devel] [PATCH v2] DynamicTablesPkg: Fix nested processor containers Date: Thu, 18 Aug 2022 10:47:55 -0600 Message-ID: MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b626474-9719-451c-52c6-08da813967a5 X-MS-TrafficTypeDiagnostic: SN7PR12MB6813:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: E6Cs7djPLFxGiWmicKfN9hVA65F6wn/frbi6zAeMB20Yf8spQdUdW6vAgmkDm1xSuyvr2aBtQjKunDr7uc00/Py1lEee+se1iiX7DWjsVzDVAv6MjGFViYpnVthgGw2M+BWJnOExXzsidYllWmWDrKljbYqq/vMiEHxm/O8RbJinZTquIX5kbVIS1f2JcL/MKbDEywEhCbtOMCmvOiS/DvDhOuvV66yXFDkJ0iza9Ta5r6507UrcSq9JT3EoCYnkYa1P3+122c5WqucLMw4ojGcrRjzlSE9t4X2eNjFGEYn5WWkq73GNe8cG4OV07MxcBtNxaKwbpbgnagppaB+G4t0KnzhJjCj7Yf1pHYMdYAUXdI29xljSk1NV9sZqHZp2Wxoka4FsayLVZXFae23XyKRTsvEsm+yh7eCN2j1icK9pK+C7nR88uMp9nFSaFW5aXNNhnCAoKQlRNOeg/WRrLUO2hhp70w6oYxgSVuJruFbc6uxfPO2uu9Wb8IH7J1y1UL558B3Q1yrw5dytzURQ1D3tHG/jvg31rT03VexwERcgpzee+tTcttNEE6CJ8FedmaJhqw65qeWL8l0MgoWT6luBxPby3LLq2/E6pDTyI7ZYWZ0Ny0UI6OuLzATsTpEMOmbAbBgE0DIfKeDRFwZ0j5aqwUcELZkNmwuds0+BxOBbBOPQYYtPXPPqONmqXVXKQhegfKsZw2JmzGPUVdG2Jao2Jx/mOfmZt5AYC1ox358qt2fLKE8vXL5YN3QqIgB2Y1A2TRhTQ1GsYmZZ5+gSheXo0rK43DSGv8R6ZmVrUm4zmPWCj3PJ+PdF7UHA0J7v X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2022 16:47:57.6478 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b626474-9719-451c-52c6-08da813967a5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT078.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6813 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jbrasen@nvidia.com X-Gm-Message-State: v3SCYrjC8FumomcAEELW3Yd6x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1660841281; bh=XUZ3LsUmSCneYs5Raez1gAKRvkaLY1Q4iDRiZssTD/g=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=NF/cfgdrHZkSHy+ex5GE6mBR9pEvzg8mlAbRHEArKVUnyQFfIxdcYooypw7G9lvEWD3 xhPu4goSMyP1/3zL1gxMo573gJE3qU7tAAumv3sVB/CLM1Wm4xh3n7CWRcsmVHdXKwQB4 Pw++yLM9V2lTLw204d9UOeH/Dqte2Zg6DuY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1660841283475100001 Content-Type: text/plain; charset="utf-8" Current code will generate duplicate UID if there are nested processor containers in the topology. For example if there is a socket/cluster/core layout. Change references to processor container from cluster to be more accurate on what is being created. Signed-off-by: Jeff Brasen Reviewed-by: Sami Mujawar --- .../SsdtCpuTopologyGenerator.c | 94 ++++++++++--------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/Ss= dtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTop= ologyLibArm/SsdtCpuTopologyGenerator.c index 3266d8dd98..8561f48e1f 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c @@ -587,10 +587,10 @@ CreateAmlCpuFromProcHierarchy ( return Status; } =20 -/** Create a Cluster in the AML namespace. +/** Create a Processor Container in the AML namespace. =20 Any CM_ARM_PROC_HIERARCHY_INFO object with the following flags is - assumed to be a cluster: + assumed to be a processor container: - EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL - EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID - EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF @@ -605,13 +605,13 @@ CreateAmlCpuFromProcHierarchy ( @param [in] Generator The SSDT Cpu Topology generator. @param [in] CfgMgrProtocol Pointer to the Configuration Manager Protocol Interface. - @param [in] ParentNode Parent node to attach the Cluster - node to. + @param [in] ParentNode Parent node to attach the processor + container node to. @param [in] ProcHierarchyNodeInfo CM_ARM_PROC_HIERARCHY_INFO object us= ed to create the node. - @param [in] ClusterIndex Index used to generate the node name. - @param [out] ClusterNodePtr If success, contains the created Clu= ster - node. + @param [in] ProcContainerIndex Index used to generate the node name. + @param [out] ProcContainerNodePtr If success, contains the created pro= cessor + container node. =20 @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @@ -620,43 +620,43 @@ CreateAmlCpuFromProcHierarchy ( STATIC EFI_STATUS EFIAPI -CreateAmlCluster ( +CreateAmlProcessorContainer ( IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN AML_NODE_HANDLE ParentNode, IN CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNo= deInfo, - IN UINT32 ClusterIndex, - OUT AML_OBJECT_NODE_HANDLE *ClusterNodePtr + IN UINT32 ProcContainerInd= ex, + OUT AML_OBJECT_NODE_HANDLE *ProcContainerNo= dePtr ) { EFI_STATUS Status; - AML_OBJECT_NODE_HANDLE ClusterNode; - CHAR8 AslNameCluster[AML_NAME_SEG_SIZE + 1]; + AML_OBJECT_NODE_HANDLE ProcContainerNode; + CHAR8 AslNameProcContainer[AML_NAME_SEG_SIZE + 1]; =20 ASSERT (Generator !=3D NULL); ASSERT (CfgMgrProtocol !=3D NULL); ASSERT (ParentNode !=3D NULL); ASSERT (ProcHierarchyNodeInfo !=3D NULL); - ASSERT (ClusterNodePtr !=3D NULL); + ASSERT (ProcContainerNodePtr !=3D NULL); =20 - Status =3D WriteAslName ('C', ClusterIndex, AslNameCluster); + Status =3D WriteAslName ('C', ProcContainerIndex, AslNameProcContainer); if (EFI_ERROR (Status)) { ASSERT (0); return Status; } =20 - Status =3D AmlCodeGenDevice (AslNameCluster, ParentNode, &ClusterNode); + Status =3D AmlCodeGenDevice (AslNameProcContainer, ParentNode, &ProcCont= ainerNode); if (EFI_ERROR (Status)) { ASSERT (0); return Status; } =20 - // Use the ClusterIndex for the _UID value as there is no AcpiProcessorU= id + // Use the ProcContainerIndex for the _UID value as there is no AcpiProc= essorUid // and EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID is set for non-Cpus. Status =3D AmlCodeGenNameInteger ( "_UID", - ClusterIndex, - ClusterNode, + ProcContainerIndex, + ProcContainerNode, NULL ); if (EFI_ERROR (Status)) { @@ -667,7 +667,7 @@ CreateAmlCluster ( Status =3D AmlCodeGenNameString ( "_HID", ACPI_HID_PROCESSOR_CONTAINER_DEVICE, - ClusterNode, + ProcContainerNode, NULL ); if (EFI_ERROR (Status)) { @@ -681,7 +681,7 @@ CreateAmlCluster ( Status =3D CreateAmlLpiMethod ( Generator, ProcHierarchyNodeInfo, - ClusterNode + ProcContainerNode ); if (EFI_ERROR (Status)) { ASSERT (0); @@ -689,23 +689,25 @@ CreateAmlCluster ( } } =20 - *ClusterNodePtr =3D ClusterNode; + *ProcContainerNodePtr =3D ProcContainerNode; =20 return Status; } =20 /** Create an AML representation of the Cpu topology. =20 - A cluster is by extension any non-leave device in the cpu topology. + A processor container is by extension any non-leave device in the cpu to= pology. =20 - @param [in] Generator The SSDT Cpu Topology generator. - @param [in] CfgMgrProtocol Pointer to the Configuration Manager - Protocol Interface. - @param [in] NodeToken Token of the CM_ARM_PROC_HIERARCHY_INFO - currently handled. - Cannot be CM_NULL_TOKEN. - @param [in] ParentNode Parent node to attach the created - node to. + @param [in] Generator The SSDT Cpu Topology generator. + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + Protocol Interface. + @param [in] NodeToken Token of the CM_ARM_PROC_HIERARCHY_I= NFO + currently handled. + Cannot be CM_NULL_TOKEN. + @param [in] ParentNode Parent node to attach the created + node to. + @param [in,out] ProcContainerIndex Pointer to the current processor con= tainer + index to be used as UID. =20 @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER Invalid parameter. @@ -718,14 +720,14 @@ CreateAmlCpuTopologyTree ( IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CM_OBJECT_TOKEN NodeToken, - IN AML_NODE_HANDLE ParentNode + IN AML_NODE_HANDLE ParentNode, + IN OUT UINT32 *ProcContainerIn= dex ) { EFI_STATUS Status; UINT32 Index; UINT32 CpuIndex; - UINT32 ClusterIndex; - AML_OBJECT_NODE_HANDLE ClusterNode; + AML_OBJECT_NODE_HANDLE ProcContainerNode; =20 ASSERT (Generator !=3D NULL); ASSERT (Generator->ProcNodeList !=3D NULL); @@ -733,9 +735,9 @@ CreateAmlCpuTopologyTree ( ASSERT (CfgMgrProtocol !=3D NULL); ASSERT (NodeToken !=3D CM_NULL_TOKEN); ASSERT (ParentNode !=3D NULL); + ASSERT (ProcContainerIndex !=3D NULL); =20 - CpuIndex =3D 0; - ClusterIndex =3D 0; + CpuIndex =3D 0; =20 for (Index =3D 0; Index < Generator->ProcNodeCount; Index++) { // Find the children of the CM_ARM_PROC_HIERARCHY_INFO @@ -770,7 +772,7 @@ CreateAmlCpuTopologyTree ( =20 CpuIndex++; } else { - // If this is not a Cpu, then this is a cluster. + // If this is not a Cpu, then this is a processor container. =20 // Acpi processor Id for clusters is not handled. if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) != =3D @@ -785,13 +787,13 @@ CreateAmlCpuTopologyTree ( return EFI_INVALID_PARAMETER; } =20 - Status =3D CreateAmlCluster ( + Status =3D CreateAmlProcessorContainer ( Generator, CfgMgrProtocol, ParentNode, &Generator->ProcNodeList[Index], - ClusterIndex, - &ClusterNode + *ProcContainerIndex, + &ProcContainerNode ); if (EFI_ERROR (Status)) { ASSERT (0); @@ -799,8 +801,8 @@ CreateAmlCpuTopologyTree ( } =20 // Nodes must have a unique name in the ASL namespace. - // Reset the Cpu index whenever we create a new Cluster. - ClusterIndex++; + // Reset the Cpu index whenever we create a new processor containe= r. + (*ProcContainerIndex)++; CpuIndex =3D 0; =20 // Recursively continue creating an AML tree. @@ -808,7 +810,8 @@ CreateAmlCpuTopologyTree ( Generator, CfgMgrProtocol, Generator->ProcNodeList[Index].Token, - ClusterNode + ProcContainerNode, + ProcContainerIndex ); if (EFI_ERROR (Status)) { ASSERT (0); @@ -845,6 +848,7 @@ CreateTopologyFromProcHierarchy ( EFI_STATUS Status; UINT32 Index; UINT32 TopLevelProcNodeIndex; + UINT32 ProcContainerIndex; =20 ASSERT (Generator !=3D NULL); ASSERT (Generator->ProcNodeCount !=3D 0); @@ -853,6 +857,7 @@ CreateTopologyFromProcHierarchy ( ASSERT (ScopeNode !=3D NULL); =20 TopLevelProcNodeIndex =3D MAX_UINT32; + ProcContainerIndex =3D 0; =20 Status =3D TokenTableInitialize (Generator, Generator->ProcNodeCount); if (EFI_ERROR (Status)) { @@ -887,7 +892,8 @@ CreateTopologyFromProcHierarchy ( Generator, CfgMgrProtocol, Generator->ProcNodeList[TopLevelProcNodeIndex].Token, - ScopeNode + ScopeNode, + &ProcContainerIndex ); if (EFI_ERROR (Status)) { ASSERT (0); @@ -908,7 +914,7 @@ exit_handler: /** Create the processor hierarchy AML tree from CM_ARM_GICC_INFO CM objects. =20 - A cluster is by extension any non-leave device in the cpu topology. + A processor container is by extension any non-leave device in the cpu to= pology. =20 @param [in] Generator The SSDT Cpu Topology generator. @param [in] CfgMgrProtocol Pointer to the Configuration Manager --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#92554): https://edk2.groups.io/g/devel/message/92554 Mute This Topic: https://groups.io/mt/93107401/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-