From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=jnnGALiB; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.94.63, mailfrom: jbrasen@nvidia.com) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9chLKlYIPVroteZsvN5R10w406gOWCrS/kYNre1hpCw=; b=jnnGALiB4F3lZUbQc7Tov6V4Hfdr8pEVNszU1YZnJwP4sghP3uLX21ssr62GEwDR0QYNRAQES3pcH/z0UBxL3WbEAbX+zNxaN+eCq6foGaX22LICnbNHBbDZh9PXl5UwF/CP5mLxdt2fT3OiLOm+RjFA7uK255wy9/1f1LnFBArDpgqWS4rtuqhW3288It3z7JFIrCkynvpN/xfB7d5h22JbIqn7CLICQ4BiHl5QUS1eUksNw9jTMh3OWDcIb19X1Z8VZFD2xcH6CX4D5jcVaV+xOfRshicvqKG/xHr/Ed5FZO31SElvvQaXEJeckuMNDpV+KvHdIVgVMlFlQUQtAw== 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 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 (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 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 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 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 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" To: CC: , , , Jeff Brasen Subject: [PATCH v2] DynamicTablesPkg: Fix nested processor containers Date: Thu, 18 Aug 2022 10:47:55 -0600 Message-ID: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com 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: BCL: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-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(376002)(396003)(136003)(346002)(36840700001)(40470700004)(46966006)(41300700001)(107886003)(2906002)(4326008)(8676002)(70206006)(70586007)(8936002)(40460700003)(5660300002)(86362001)(40480700001)(36860700001)(186003)(478600001)(426003)(47076005)(83380400001)(2616005)(356005)(26005)(7696005)(336012)(81166007)(82310400005)(82740400003)(316002)(36756003)(54906003)(6916009)(36900700001);DIR:OUT;SFP:1101; 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Current code will generate duplicate UID if there are nested processor=0D containers in the topology. For example if there is a=0D socket/cluster/core layout.=0D =0D Change references to processor container from cluster to be more=0D accurate on what is being created.=0D =0D Signed-off-by: Jeff Brasen =0D ---=0D .../SsdtCpuTopologyGenerator.c | 94 ++++++++++---------=0D 1 file changed, 50 insertions(+), 44 deletions(-)=0D =0D diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/Ss= dtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTop= ologyLibArm/SsdtCpuTopologyGenerator.c=0D index 3266d8dd98..8561f48e1f 100644=0D --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c=0D +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c=0D @@ -587,10 +587,10 @@ CreateAmlCpuFromProcHierarchy (=0D return Status;=0D }=0D =0D -/** Create a Cluster in the AML namespace.=0D +/** Create a Processor Container in the AML namespace.=0D =0D Any CM_ARM_PROC_HIERARCHY_INFO object with the following flags is=0D - assumed to be a cluster:=0D + assumed to be a processor container:=0D - EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL=0D - EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID=0D - EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF=0D @@ -605,13 +605,13 @@ CreateAmlCpuFromProcHierarchy (=0D @param [in] Generator The SSDT Cpu Topology generator.=0D @param [in] CfgMgrProtocol Pointer to the Configuration Manager= =0D Protocol Interface.=0D - @param [in] ParentNode Parent node to attach the Cluster=0D - node to.=0D + @param [in] ParentNode Parent node to attach the processor= =0D + container node to.=0D @param [in] ProcHierarchyNodeInfo CM_ARM_PROC_HIERARCHY_INFO object us= ed=0D to create the node.=0D - @param [in] ClusterIndex Index used to generate the node name= .=0D - @param [out] ClusterNodePtr If success, contains the created Clu= ster=0D - node.=0D + @param [in] ProcContainerIndex Index used to generate the node name= .=0D + @param [out] ProcContainerNodePtr If success, contains the created pro= cessor=0D + container node.=0D =0D @retval EFI_SUCCESS Success.=0D @retval EFI_INVALID_PARAMETER Invalid parameter.=0D @@ -620,43 +620,43 @@ CreateAmlCpuFromProcHierarchy (=0D STATIC=0D EFI_STATUS=0D EFIAPI=0D -CreateAmlCluster (=0D +CreateAmlProcessorContainer (=0D IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,=0D IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,= =0D IN AML_NODE_HANDLE ParentNode,=0D IN CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyNo= deInfo,=0D - IN UINT32 ClusterIndex,=0D - OUT AML_OBJECT_NODE_HANDLE *ClusterNodePtr= =0D + IN UINT32 ProcContainerInd= ex,=0D + OUT AML_OBJECT_NODE_HANDLE *ProcContainerNo= dePtr=0D )=0D {=0D EFI_STATUS Status;=0D - AML_OBJECT_NODE_HANDLE ClusterNode;=0D - CHAR8 AslNameCluster[AML_NAME_SEG_SIZE + 1];=0D + AML_OBJECT_NODE_HANDLE ProcContainerNode;=0D + CHAR8 AslNameProcContainer[AML_NAME_SEG_SIZE + 1];=0D =0D ASSERT (Generator !=3D NULL);=0D ASSERT (CfgMgrProtocol !=3D NULL);=0D ASSERT (ParentNode !=3D NULL);=0D ASSERT (ProcHierarchyNodeInfo !=3D NULL);=0D - ASSERT (ClusterNodePtr !=3D NULL);=0D + ASSERT (ProcContainerNodePtr !=3D NULL);=0D =0D - Status =3D WriteAslName ('C', ClusterIndex, AslNameCluster);=0D + Status =3D WriteAslName ('C', ProcContainerIndex, AslNameProcContainer);= =0D if (EFI_ERROR (Status)) {=0D ASSERT (0);=0D return Status;=0D }=0D =0D - Status =3D AmlCodeGenDevice (AslNameCluster, ParentNode, &ClusterNode);= =0D + Status =3D AmlCodeGenDevice (AslNameProcContainer, ParentNode, &ProcCont= ainerNode);=0D if (EFI_ERROR (Status)) {=0D ASSERT (0);=0D return Status;=0D }=0D =0D - // Use the ClusterIndex for the _UID value as there is no AcpiProcessorU= id=0D + // Use the ProcContainerIndex for the _UID value as there is no AcpiProc= essorUid=0D // and EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID is set for non-Cpus.=0D Status =3D AmlCodeGenNameInteger (=0D "_UID",=0D - ClusterIndex,=0D - ClusterNode,=0D + ProcContainerIndex,=0D + ProcContainerNode,=0D NULL=0D );=0D if (EFI_ERROR (Status)) {=0D @@ -667,7 +667,7 @@ CreateAmlCluster (=0D Status =3D AmlCodeGenNameString (=0D "_HID",=0D ACPI_HID_PROCESSOR_CONTAINER_DEVICE,=0D - ClusterNode,=0D + ProcContainerNode,=0D NULL=0D );=0D if (EFI_ERROR (Status)) {=0D @@ -681,7 +681,7 @@ CreateAmlCluster (=0D Status =3D CreateAmlLpiMethod (=0D Generator,=0D ProcHierarchyNodeInfo,=0D - ClusterNode=0D + ProcContainerNode=0D );=0D if (EFI_ERROR (Status)) {=0D ASSERT (0);=0D @@ -689,23 +689,25 @@ CreateAmlCluster (=0D }=0D }=0D =0D - *ClusterNodePtr =3D ClusterNode;=0D + *ProcContainerNodePtr =3D ProcContainerNode;=0D =0D return Status;=0D }=0D =0D /** Create an AML representation of the Cpu topology.=0D =0D - A cluster is by extension any non-leave device in the cpu topology.=0D + A processor container is by extension any non-leave device in the cpu to= pology.=0D =0D - @param [in] Generator The SSDT Cpu Topology generator.=0D - @param [in] CfgMgrProtocol Pointer to the Configuration Manager=0D - Protocol Interface.=0D - @param [in] NodeToken Token of the CM_ARM_PROC_HIERARCHY_INFO=0D - currently handled.=0D - Cannot be CM_NULL_TOKEN.=0D - @param [in] ParentNode Parent node to attach the created=0D - node to.=0D + @param [in] Generator The SSDT Cpu Topology generator.=0D + @param [in] CfgMgrProtocol Pointer to the Configuration Manager= =0D + Protocol Interface.=0D + @param [in] NodeToken Token of the CM_ARM_PROC_HIERARCHY_I= NFO=0D + currently handled.=0D + Cannot be CM_NULL_TOKEN.=0D + @param [in] ParentNode Parent node to attach the created=0D + node to.=0D + @param [in,out] ProcContainerIndex Pointer to the current processor con= tainer=0D + index to be used as UID.=0D =0D @retval EFI_SUCCESS Success.=0D @retval EFI_INVALID_PARAMETER Invalid parameter.=0D @@ -718,14 +720,14 @@ CreateAmlCpuTopologyTree (=0D IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator,=0D IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,= =0D IN CM_OBJECT_TOKEN NodeToken,=0D - IN AML_NODE_HANDLE ParentNode=0D + IN AML_NODE_HANDLE ParentNode,=0D + IN OUT UINT32 *ProcContainerIn= dex=0D )=0D {=0D EFI_STATUS Status;=0D UINT32 Index;=0D UINT32 CpuIndex;=0D - UINT32 ClusterIndex;=0D - AML_OBJECT_NODE_HANDLE ClusterNode;=0D + AML_OBJECT_NODE_HANDLE ProcContainerNode;=0D =0D ASSERT (Generator !=3D NULL);=0D ASSERT (Generator->ProcNodeList !=3D NULL);=0D @@ -733,9 +735,9 @@ CreateAmlCpuTopologyTree (=0D ASSERT (CfgMgrProtocol !=3D NULL);=0D ASSERT (NodeToken !=3D CM_NULL_TOKEN);=0D ASSERT (ParentNode !=3D NULL);=0D + ASSERT (ProcContainerIndex !=3D NULL);=0D =0D - CpuIndex =3D 0;=0D - ClusterIndex =3D 0;=0D + CpuIndex =3D 0;=0D =0D for (Index =3D 0; Index < Generator->ProcNodeCount; Index++) {=0D // Find the children of the CM_ARM_PROC_HIERARCHY_INFO=0D @@ -770,7 +772,7 @@ CreateAmlCpuTopologyTree (=0D =0D CpuIndex++;=0D } else {=0D - // If this is not a Cpu, then this is a cluster.=0D + // If this is not a Cpu, then this is a processor container.=0D =0D // Acpi processor Id for clusters is not handled.=0D if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) != =3D=0D @@ -785,13 +787,13 @@ CreateAmlCpuTopologyTree (=0D return EFI_INVALID_PARAMETER;=0D }=0D =0D - Status =3D CreateAmlCluster (=0D + Status =3D CreateAmlProcessorContainer (=0D Generator,=0D CfgMgrProtocol,=0D ParentNode,=0D &Generator->ProcNodeList[Index],=0D - ClusterIndex,=0D - &ClusterNode=0D + *ProcContainerIndex,=0D + &ProcContainerNode=0D );=0D if (EFI_ERROR (Status)) {=0D ASSERT (0);=0D @@ -799,8 +801,8 @@ CreateAmlCpuTopologyTree (=0D }=0D =0D // Nodes must have a unique name in the ASL namespace.=0D - // Reset the Cpu index whenever we create a new Cluster.=0D - ClusterIndex++;=0D + // Reset the Cpu index whenever we create a new processor containe= r.=0D + (*ProcContainerIndex)++;=0D CpuIndex =3D 0;=0D =0D // Recursively continue creating an AML tree.=0D @@ -808,7 +810,8 @@ CreateAmlCpuTopologyTree (=0D Generator,=0D CfgMgrProtocol,=0D Generator->ProcNodeList[Index].Token,=0D - ClusterNode=0D + ProcContainerNode,=0D + ProcContainerIndex=0D );=0D if (EFI_ERROR (Status)) {=0D ASSERT (0);=0D @@ -845,6 +848,7 @@ CreateTopologyFromProcHierarchy (=0D EFI_STATUS Status;=0D UINT32 Index;=0D UINT32 TopLevelProcNodeIndex;=0D + UINT32 ProcContainerIndex;=0D =0D ASSERT (Generator !=3D NULL);=0D ASSERT (Generator->ProcNodeCount !=3D 0);=0D @@ -853,6 +857,7 @@ CreateTopologyFromProcHierarchy (=0D ASSERT (ScopeNode !=3D NULL);=0D =0D TopLevelProcNodeIndex =3D MAX_UINT32;=0D + ProcContainerIndex =3D 0;=0D =0D Status =3D TokenTableInitialize (Generator, Generator->ProcNodeCount);=0D if (EFI_ERROR (Status)) {=0D @@ -887,7 +892,8 @@ CreateTopologyFromProcHierarchy (=0D Generator,=0D CfgMgrProtocol,=0D Generator->ProcNodeList[TopLevelProcNodeIndex].Token,=0D - ScopeNode=0D + ScopeNode,=0D + &ProcContainerIndex=0D );=0D if (EFI_ERROR (Status)) {=0D ASSERT (0);=0D @@ -908,7 +914,7 @@ exit_handler:=0D /** Create the processor hierarchy AML tree from CM_ARM_GICC_INFO=0D CM objects.=0D =0D - A cluster is by extension any non-leave device in the cpu topology.=0D + A processor container is by extension any non-leave device in the cpu to= pology.=0D =0D @param [in] Generator The SSDT Cpu Topology generator.=0D @param [in] CfgMgrProtocol Pointer to the Configuration Manager=0D -- =0D 2.25.1=0D =0D