From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web09.26276.1660719696532489119 for ; Wed, 17 Aug 2022 00:01:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BH0RCyH+; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A81261138 for ; Wed, 17 Aug 2022 07:01:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B80B1C433B5 for ; Wed, 17 Aug 2022 07:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660719694; bh=abzqfYWk4uka19b+lkRUrVqlnirQxQyviwWGGPUF4nE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=BH0RCyH+UVZSzzbbI9IpNPMdlICf3JPHw8xkzrAUOK7qZzigSvtwWLrwmq0JIkqAu h8vxbs4yTCBumyAK5AZnhib9jWaTHc43+eow7Be8+FFZwwz21o1H3L/A/W6xefTr/Z SNR7aswGYiivB2lOzlj76JlMj4Ay23NfAPhV+pGa3htCvXk5KValh1eCZ1Zjl6Iqua uk+RV096+fcfOsCOToxbciEhrCzg4BXu9tdDl0QEViQYMh8R2vKTSLEUllzBSs0fKh pNI/sGQac1uZi08x8bKjA07AtXNoVe1DXw+GWmLVTuysiiHMVt/xUepj1fjd0HelGO ifRi0zSS16JTQ== Received: by mail-wr1-f50.google.com with SMTP id bs25so15149680wrb.2 for ; Wed, 17 Aug 2022 00:01:34 -0700 (PDT) X-Gm-Message-State: ACgBeo0lKQb6Ai3vEQ6gqWVkmHrjryTvCPBL8nhEOY6BplCd8r937d8V eKukLVoOahNH7TvXjoWhKuy8/ty7Wzim4bn8/DA= X-Google-Smtp-Source: AA6agR6b93YyKvbnTFfMF1+vJ79wbEhZ/0Bu9+EnIvppJwtx7Ove8uZnFXhTGuFskYo6ijiHdgvOxY/7OcnXn20lHcU= X-Received: by 2002:a05:6000:186f:b0:222:c091:9c59 with SMTP id d15-20020a056000186f00b00222c0919c59mr13842110wri.78.1660719692984; Wed, 17 Aug 2022 00:01:32 -0700 (PDT) MIME-Version: 1.0 References: <81913483228a6d636f164831d41424717d46fbb4.1660682661.git.jbrasen@nvidia.com> In-Reply-To: <81913483228a6d636f164831d41424717d46fbb4.1660682661.git.jbrasen@nvidia.com> From: "Ard Biesheuvel" Date: Wed, 17 Aug 2022 09:01:21 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] DynamicTablesPkg: Correct cluster index To: Jeff Brasen Cc: devel@edk2.groups.io, quic_llindhol@quicinc.com, ardb+tianocore@kernel.org, Sami.Mujawar@arm.com, Alexei.Fedorov@arm.com Content-Type: text/plain; charset="UTF-8" On Tue, 16 Aug 2022 at 22:46, Jeff Brasen wrote: > > Current code will generate duplicate UID if there are nested clusters > in the topology. > What is a nested cluster? > Signed-off-by: Jeff Brasen > --- > .../SsdtCpuTopologyGenerator.c | 22 ++++++++++++------- > 1 file changed, 14 insertions(+), 8 deletions(-) > > diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c > index 3266d8dd98..9295117f1f 100644 > --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c > +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c > @@ -706,6 +706,8 @@ CreateAmlCluster ( > Cannot be CM_NULL_TOKEN. > @param [in] ParentNode Parent node to attach the created > node to. > + @param [in,out] ClusterIndex Pointer to the current cluster index > + to be used as UID. > > @retval EFI_SUCCESS Success. > @retval EFI_INVALID_PARAMETER Invalid parameter. > @@ -718,13 +720,13 @@ 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 *ClusterIndex > ) > { > EFI_STATUS Status; > UINT32 Index; > UINT32 CpuIndex; > - UINT32 ClusterIndex; > AML_OBJECT_NODE_HANDLE ClusterNode; > > ASSERT (Generator != NULL); > @@ -733,9 +735,9 @@ CreateAmlCpuTopologyTree ( > ASSERT (CfgMgrProtocol != NULL); > ASSERT (NodeToken != CM_NULL_TOKEN); > ASSERT (ParentNode != NULL); > + ASSERT (ClusterIndex != NULL); > > - CpuIndex = 0; > - ClusterIndex = 0; > + CpuIndex = 0; > > for (Index = 0; Index < Generator->ProcNodeCount; Index++) { > // Find the children of the CM_ARM_PROC_HIERARCHY_INFO > @@ -790,7 +792,7 @@ CreateAmlCpuTopologyTree ( > CfgMgrProtocol, > ParentNode, > &Generator->ProcNodeList[Index], > - ClusterIndex, > + *ClusterIndex, > &ClusterNode > ); > if (EFI_ERROR (Status)) { > @@ -800,7 +802,7 @@ CreateAmlCpuTopologyTree ( > > // Nodes must have a unique name in the ASL namespace. > // Reset the Cpu index whenever we create a new Cluster. > - ClusterIndex++; > + (*ClusterIndex)++; > CpuIndex = 0; > > // Recursively continue creating an AML tree. > @@ -808,7 +810,8 @@ CreateAmlCpuTopologyTree ( > Generator, > CfgMgrProtocol, > Generator->ProcNodeList[Index].Token, > - ClusterNode > + ClusterNode, > + ClusterIndex > ); > if (EFI_ERROR (Status)) { > ASSERT (0); > @@ -845,6 +848,7 @@ CreateTopologyFromProcHierarchy ( > EFI_STATUS Status; > UINT32 Index; > UINT32 TopLevelProcNodeIndex; > + UINT32 ClusterIndex; > > ASSERT (Generator != NULL); > ASSERT (Generator->ProcNodeCount != 0); > @@ -853,6 +857,7 @@ CreateTopologyFromProcHierarchy ( > ASSERT (ScopeNode != NULL); > > TopLevelProcNodeIndex = MAX_UINT32; > + ClusterIndex = 0; > > Status = TokenTableInitialize (Generator, Generator->ProcNodeCount); > if (EFI_ERROR (Status)) { > @@ -887,7 +892,8 @@ CreateTopologyFromProcHierarchy ( > Generator, > CfgMgrProtocol, > Generator->ProcNodeList[TopLevelProcNodeIndex].Token, > - ScopeNode > + ScopeNode, > + &ClusterIndex > ); > if (EFI_ERROR (Status)) { > ASSERT (0); > -- > 2.25.1 >