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.61]) by mx.groups.io with SMTP id smtpd.web11.28748.1675269776122243033 for ; Wed, 01 Feb 2023 08:42:56 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=VzjNHe8d; 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.61, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oFhz0nPnXxsre7Z6STVBSIKRcFdBPIBjdbso8kV53gF1sDQcdwjFfTeqmBY9KWmp6widRWK67QKERtwYybpdWsfMU2zyiSl7pc/BcAQ1Bj3AVcBJC7e1cYyGv7HLJPY9+3iRg2U8Z7uFlH/S15uFMvEbrzoGrPsep9b6ZPuTmju503r3WcfvbF91ZlgAWNaNdGddmXJlhX7TLclGNpc6mPYhZjSJPp2WDp504FkeNpn1tf/PkxvCa1Yq4iIIeNWj/s2PGya6fQqMfXJD6qhO+egxxHucN9G8caCvCoSYuYTI6k5ghZpoq8nblpUOSG9I962QtAVNIA1TKZzKfBTDiA== 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=8zV9WslQFMFtHexSbzvQN/c4NFJ9HmmNrBQeEFO4ErI=; b=c7DI47muCJA6sWktirkgeUBcpTxq6TMushOV3zBhmn5G5ymv+7DEkVfbD5alm25CS+NFaPP15kBhdAU09Fwdewt5sstWZm4UNKdZY3r3YDTv9tHvkA66Vspy4mE7AZAb8iW5tifGbjHH2vz4wwSka3+dYMaM/vO4vvMHHFGwCpgXJmk5jPVq6lnIhUNqW/uLPrZJpdxxZYrVki8AGJ/LCxhPpyhFWsD92M3AaRM+JRZcf+Z7xfppiateqbYojDQHc/Q6yaRKPC9aWeKlC967XQJ7X0d1Cw/8+EEhGX4QITXBTD5fh29ePz8CK42IVLf4ozmRxWtO2jHw6APGHiKppw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=edk2.groups.io 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=8zV9WslQFMFtHexSbzvQN/c4NFJ9HmmNrBQeEFO4ErI=; b=VzjNHe8dc3VI7mPidVRknE+yC7WVJf3cyDhpEC5J4CgdaIXMsDyqTDfCnIA7BW3A/9YlPwDXkxOop9JnsmpriRZRJL3GyEivJocR/gfosEmFkWRKj1Pm242Sw6jpfjZ0HI0AOPn9yxiCDvygETgteefBAwnveNI4PfUHpxX2y9kS+0eON98BuNozkNBGDpeKEEMSFXSw7ZvQRzv7voWB8w1d9+D9edCoRkCB8wQ1oCGof0qcHy5CIPuJkICpBqpraSUGGDF/emjA5NSz6rOfma3skFe0t4lwegLdMmpoyGpnAdlPO8JLCN82DgD/IsPXURgrqxWuaHAf5FKH2cGgyA== Received: from CY5P221CA0097.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:9::37) by MW6PR12MB7072.namprd12.prod.outlook.com (2603:10b6:303:238::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 16:42:53 +0000 Received: from CY4PEPF0000B8EE.namprd05.prod.outlook.com (2603:10b6:930:9:cafe::54) by CY5P221CA0097.outlook.office365.com (2603:10b6:930:9::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.25 via Frontend Transport; Wed, 1 Feb 2023 16:42:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CY4PEPF0000B8EE.mail.protection.outlook.com (10.167.241.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.4 via Frontend Transport; Wed, 1 Feb 2023 16:42:53 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 1 Feb 2023 08:42:42 -0800 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 1 Feb 2023 08:42:41 -0800 Received: from f9050a1d9579.nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.36 via Frontend Transport; Wed, 1 Feb 2023 08:42:41 -0800 From: "Jeff Brasen" To: CC: , , , , , Jeff Brasen Subject: [PATCH] DynamicTablesPkg: Allow multiple top level physical nodes Date: Wed, 1 Feb 2023 09:42:37 -0700 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-TrafficTypeDiagnostic: CY4PEPF0000B8EE:EE_|MW6PR12MB7072:EE_ X-MS-Office365-Filtering-Correlation-Id: f8c35fb3-dee2-48ec-51db-08db04735d4f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M2uen9PaKHuBqhOwHnaXYFcw5rt/NiNQowRNWaAOSUYuZAyaRx9cQWO9D52IVfZ1pnC3G+7ZQspp1cOeLcpud5uEYF76NePw9xPiXqIi5SRlOefGA4fyFqGcX4oFcyUZzaurnegnMh48lN3faTdzqPStUYrhxhETdwqxL3tKwg0ib4+qEbboFqKNkEZiD+gQeHfuC6PtdTLblKKKQLI3w5q4sMT7MJS52K1P7gnRcStPvvniifaT35DsvuSH3igfI1tZkBvzMmVMGRxyT5F1m6ym5Irh4TUmbQNGjSfVTf1r5Y0LggS1woGOCiXbm9+1/90SXxxJXpKJwOeyD5xBj7V8rtfaXVzodVmgE4LhsWavqF9aXKfNvj8JqTT0gS4WQFn5/bv/WQye/r28ySI92ZDTIGwP14GFBTM9iJJpeKKuTSSVEbJNXqAZiD6SlUDc3spWPYvZTo3IjDfDbUoey/hNwWd5qLe/E7QY7B57pUCFgaLKXg+klh1cKVFg5RrSCf+VWYcAxcGgRI5Yk17+qoPkWh1JV8FKQ6tJ3lspjXq2MtA6Xf0JPs6CY6cv6wuoNXx5fgxO2MSWcd124ME9jKxtIwG3GwsyN5KtW9+XQapsiZxUGMDPtUn+XxPNrOHBzAUQd5bme+GoNBPl1cCGqiQ5Qj8nhnfDTLFhro0m5z5w5UI0H0ljBtSI41Zk95CYEvmsSYw9NAI3DNH8LkssRA== X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199018)(36840700001)(40470700004)(46966006)(40460700003)(36756003)(86362001)(47076005)(426003)(336012)(83380400001)(82310400005)(107886003)(82740400003)(316002)(6666004)(54906003)(478600001)(26005)(8936002)(5660300002)(2616005)(186003)(40480700001)(356005)(4326008)(70206006)(6916009)(36860700001)(8676002)(70586007)(7696005)(7636003)(2906002)(41300700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 16:42:53.5193 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f8c35fb3-dee2-48ec-51db-08db04735d4f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000B8EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7072 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain In SSDT CPU topology generator allow for multiple top level physical=0D nodes as would be seen with a multi-socket system. This will be auto=0D detected if there are more then one physical device and there is a=0D new PCD to enable forcing of a top level processor container to allow=0D for consistency for systems that can be either single or multi socket.=0D =0D Signed-off-by: Jeff Brasen =0D ---=0D DynamicTablesPkg/DynamicTablesPkg.dec | 3 +=0D .../SsdtCpuTopologyGenerator.c | 66 ++++++++++---------=0D .../SsdtCpuTopologyLibArm.inf | 4 ++=0D 3 files changed, 41 insertions(+), 32 deletions(-)=0D =0D diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/Dynam= icTablesPkg.dec=0D index adc2e67cbf..a061b70322 100644=0D --- a/DynamicTablesPkg/DynamicTablesPkg.dec=0D +++ b/DynamicTablesPkg/DynamicTablesPkg.dec=0D @@ -63,5 +63,8 @@=0D # Use PCI segment numbers as UID=0D gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid|FALSE|BOOLEAN= |0x40000009=0D =0D + # Force top level container for single socket devices=0D + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdForceTopLevelProcessorContainer|= FALSE|BOOLEAN|0x4000000A=0D +=0D [Guids]=0D gEdkiiDynamicTablesPkgTokenSpaceGuid =3D { 0xab226e66, 0x31d8, 0x4613, {= 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } }=0D diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/Ss= dtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTop= ologyLibArm/SsdtCpuTopologyGenerator.c=0D index c24da8ec71..58f86ff508 100644=0D --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c=0D +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c=0D @@ -22,6 +22,7 @@=0D #include =0D #include =0D #include =0D +#include =0D #include =0D =0D #include "SsdtCpuTopologyGenerator.h"=0D @@ -814,7 +815,8 @@ CreateAmlProcessorContainer (=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 + CM_NULL_TOKEN if top level container= =0D + should be created.=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 @@ -841,12 +843,12 @@ CreateAmlCpuTopologyTree (=0D AML_OBJECT_NODE_HANDLE ProcContainerNode;=0D UINT32 Uid;=0D UINT16 Name;=0D + UINT32 NodeFlags;=0D =0D ASSERT (Generator !=3D NULL);=0D ASSERT (Generator->ProcNodeList !=3D NULL);=0D ASSERT (Generator->ProcNodeCount !=3D 0);=0D ASSERT (CfgMgrProtocol !=3D NULL);=0D - ASSERT (NodeToken !=3D CM_NULL_TOKEN);=0D ASSERT (ParentNode !=3D NULL);=0D ASSERT (ProcContainerIndex !=3D NULL);=0D =0D @@ -893,8 +895,14 @@ CreateAmlCpuTopologyTree (=0D } else {=0D // If this is not a Cpu, then this is a processor container.=0D =0D + NodeFlags =3D Generator->ProcNodeList[Index].Flags;=0D + // Allow physical property for top level nodes=0D + if (NodeToken =3D=3D CM_NULL_TOKEN) {=0D + NodeFlags &=3D ~EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL;=0D + }=0D +=0D // Acpi processor Id for clusters is not handled.=0D - if ((Generator->ProcNodeList[Index].Flags & PPTT_PROCESSOR_MASK) != =3D=0D + if ((NodeFlags & PPTT_PROCESSOR_MASK) !=3D=0D PPTT_CLUSTER_PROCESSOR_MASK)=0D {=0D DEBUG ((=0D @@ -973,10 +981,10 @@ CreateTopologyFromProcHierarchy (=0D IN AML_OBJECT_NODE_HANDLE ScopeNode=0D )=0D {=0D - EFI_STATUS Status;=0D - UINT32 Index;=0D - UINT32 TopLevelProcNodeIndex;=0D - UINT32 ProcContainerIndex;=0D + EFI_STATUS Status;=0D + UINT32 Index;=0D + CM_OBJECT_TOKEN TopLevelToken;=0D + UINT32 ProcContainerIndex;=0D =0D ASSERT (Generator !=3D NULL);=0D ASSERT (Generator->ProcNodeCount !=3D 0);=0D @@ -984,8 +992,8 @@ CreateTopologyFromProcHierarchy (=0D ASSERT (CfgMgrProtocol !=3D NULL);=0D ASSERT (ScopeNode !=3D NULL);=0D =0D - TopLevelProcNodeIndex =3D MAX_UINT32;=0D - ProcContainerIndex =3D 0;=0D + TopLevelToken =3D CM_NULL_TOKEN;=0D + ProcContainerIndex =3D 0;=0D =0D Status =3D TokenTableInitialize (Generator, Generator->ProcNodeCount);=0D if (EFI_ERROR (Status)) {=0D @@ -993,33 +1001,27 @@ CreateTopologyFromProcHierarchy (=0D return Status;=0D }=0D =0D - // It is assumed that there is one unique CM_ARM_PROC_HIERARCHY_INFO=0D - // structure with no ParentToken and the EFI_ACPI_6_3_PPTT_PACKAGE_PHYSI= CAL=0D - // flag set. All other CM_ARM_PROC_HIERARCHY_INFO are non-physical and=0D - // have a ParentToken.=0D - for (Index =3D 0; Index < Generator->ProcNodeCount; Index++) {=0D - if ((Generator->ProcNodeList[Index].ParentToken =3D=3D CM_NULL_TOKEN) = &&=0D - (Generator->ProcNodeList[Index].Flags &=0D - EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL))=0D - {=0D - if (TopLevelProcNodeIndex !=3D MAX_UINT32) {=0D - DEBUG ((=0D - DEBUG_ERROR,=0D - "ERROR: SSDT-CPU-TOPOLOGY: Top level CM_ARM_PROC_HIERARCHY_INFO = "=0D - "must be unique\n"=0D - ));=0D - ASSERT (0);=0D - goto exit_handler;=0D - }=0D + if (!PcdGetBool (PcdForceTopLevelProcessorContainer)) {=0D + for (Index =3D 0; Index < Generator->ProcNodeCount; Index++) {=0D + if ((Generator->ProcNodeList[Index].ParentToken =3D=3D CM_NULL_TOKEN= ) &&=0D + (Generator->ProcNodeList[Index].Flags &=0D + EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL))=0D + {=0D + // Multi-socket detected, using top level containers=0D + if (TopLevelToken !=3D CM_NULL_TOKEN) {=0D + TopLevelToken =3D CM_NULL_TOKEN;=0D + break;=0D + }=0D =0D - TopLevelProcNodeIndex =3D Index;=0D - }=0D - } // for=0D + TopLevelToken =3D Generator->ProcNodeList[Index].Token;=0D + }=0D + } // for=0D + }=0D =0D Status =3D CreateAmlCpuTopologyTree (=0D Generator,=0D CfgMgrProtocol,=0D - Generator->ProcNodeList[TopLevelProcNodeIndex].Token,=0D + TopLevelToken,=0D ScopeNode,=0D &ProcContainerIndex=0D );=0D @@ -1106,7 +1108,7 @@ CreateTopologyFromGicC (=0D break;=0D }=0D }=0D - } // for=0D + } // for=0D =0D return Status;=0D }=0D diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/Ss= dtCpuTopologyLibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopo= logyLibArm/SsdtCpuTopologyLibArm.inf=0D index 3e2d154749..00adfe986f 100644=0D --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyLibArm.inf=0D +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyLibArm.inf=0D @@ -31,3 +31,7 @@=0D AcpiHelperLib=0D AmlLib=0D BaseLib=0D + PcdLib=0D +=0D +[Pcd]=0D + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdForceTopLevelProcessorContainer= =0D -- =0D 2.25.1=0D =0D