* [edk2-devel] [PATCH] DynamicTablesPkg/SSDT: Require Package node in hierarchy
@ 2024-02-02 19:19 Jeshua Smith via groups.io
2024-02-05 9:38 ` PierreGondois
0 siblings, 1 reply; 2+ messages in thread
From: Jeshua Smith via groups.io @ 2024-02-02 19:19 UTC (permalink / raw)
To: devel
Cc: ardb+tianocore, quic_llindhol, pierre.gondois, Sami.Mujawar,
Jeshua Smith
The code was incorrectly assuming that root nodes had to be physical
package nodes and vice versa. This is not always true, so update the
check to simply require exactly one package node somewhere in the
hierarchy.
Signed-off-by: Jeshua Smith <jeshuas@nvidia.com>
---
Note: This is a complete replacement for [PATCH] DynamicTablesPkg/SSDT: Remove incorrect root node check
.../SsdtCpuTopologyGenerator.c | 30 ++++++++++++-------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
index 9e3efb49e6..e400ac4ae5 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
@@ -1083,23 +1083,24 @@ CheckProcNode (
UINT32 NodeFlags,
BOOLEAN IsLeaf,
CM_OBJECT_TOKEN NodeToken,
- CM_OBJECT_TOKEN ParentNodeToken
+ CM_OBJECT_TOKEN ParentNodeToken,
+ BOOLEAN PackageNodeSeen
)
{
BOOLEAN InvalidFlags;
BOOLEAN HasPhysicalPackageBit;
- BOOLEAN IsTopLevelNode;
HasPhysicalPackageBit = (NodeFlags & EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) ==
EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL;
- IsTopLevelNode = (ParentNodeToken == CM_NULL_TOKEN);
- // A top-level node is a Physical Package and conversely.
- InvalidFlags = HasPhysicalPackageBit ^ IsTopLevelNode;
+ // Only one Physical Package flag is allowed in the hierarchy
+ InvalidFlags = HasPhysicalPackageBit && PackageNodeSeen;
// Check Leaf specific flags.
if (IsLeaf) {
InvalidFlags |= ((NodeFlags & PPTT_LEAF_MASK) != PPTT_LEAF_MASK);
+ // Must have Physical Package flag somewhere in the hierarchy
+ InvalidFlags |= !(HasPhysicalPackageBit || PackageNodeSeen);
} else {
InvalidFlags |= ((NodeFlags & PPTT_LEAF_MASK) != 0);
}
@@ -1143,7 +1144,8 @@ CreateAmlCpuTopologyTree (
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,
IN CM_OBJECT_TOKEN NodeToken,
IN AML_NODE_HANDLE ParentNode,
- IN OUT UINT32 *ProcContainerIndex
+ IN OUT UINT32 *ProcContainerIndex,
+ IN BOOLEAN PackageNodeSeen
)
{
EFI_STATUS Status;
@@ -1153,6 +1155,7 @@ CreateAmlCpuTopologyTree (
AML_OBJECT_NODE_HANDLE ProcContainerNode;
UINT32 Uid;
UINT16 Name;
+ BOOLEAN HasPhysicalPackageBit;
ASSERT (Generator != NULL);
ASSERT (Generator->ProcNodeList != NULL);
@@ -1175,7 +1178,8 @@ CreateAmlCpuTopologyTree (
Generator->ProcNodeList[Index].Flags,
TRUE,
Generator->ProcNodeList[Index].Token,
- NodeToken
+ NodeToken,
+ PackageNodeSeen
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -1208,7 +1212,8 @@ CreateAmlCpuTopologyTree (
Generator->ProcNodeList[Index].Flags,
FALSE,
Generator->ProcNodeList[Index].Token,
- NodeToken
+ NodeToken,
+ PackageNodeSeen
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -1249,13 +1254,17 @@ CreateAmlCpuTopologyTree (
ProcContainerName++;
}
+ HasPhysicalPackageBit = (Generator->ProcNodeList[Index].Flags & EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) ==
+ EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL;
+
// Recursively continue creating an AML tree.
Status = CreateAmlCpuTopologyTree (
Generator,
CfgMgrProtocol,
Generator->ProcNodeList[Index].Token,
ProcContainerNode,
- ProcContainerIndex
+ ProcContainerIndex,
+ (PackageNodeSeen || HasPhysicalPackageBit)
);
if (EFI_ERROR (Status)) {
ASSERT (0);
@@ -1311,7 +1320,8 @@ CreateTopologyFromProcHierarchy (
CfgMgrProtocol,
CM_NULL_TOKEN,
ScopeNode,
- &ProcContainerIndex
+ &ProcContainerIndex,
+ FALSE
);
if (EFI_ERROR (Status)) {
ASSERT (0);
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115067): https://edk2.groups.io/g/devel/message/115067
Mute This Topic: https://groups.io/mt/104126146/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2-devel] [PATCH] DynamicTablesPkg/SSDT: Require Package node in hierarchy
2024-02-02 19:19 [edk2-devel] [PATCH] DynamicTablesPkg/SSDT: Require Package node in hierarchy Jeshua Smith via groups.io
@ 2024-02-05 9:38 ` PierreGondois
0 siblings, 0 replies; 2+ messages in thread
From: PierreGondois @ 2024-02-05 9:38 UTC (permalink / raw)
To: Jeshua Smith, devel; +Cc: ardb+tianocore, quic_llindhol, Sami.Mujawar
Hello Jeshua,
On 2/2/24 20:19, Jeshua Smith wrote:
> The code was incorrectly assuming that root nodes had to be physical
> package nodes and vice versa. This is not always true, so update the
> check to simply require exactly one package node somewhere in the
> hierarchy.
>
> Signed-off-by: Jeshua Smith <jeshuas@nvidia.com>
> ---
> Note: This is a complete replacement for [PATCH] DynamicTablesPkg/SSDT: Remove incorrect root node check
>
> .../SsdtCpuTopologyGenerator.c | 30 ++++++++++++-------
> 1 file changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
> index 9e3efb49e6..e400ac4ae5 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c
> @@ -1083,23 +1083,24 @@ CheckProcNode (
> UINT32 NodeFlags,
> BOOLEAN IsLeaf,
> CM_OBJECT_TOKEN NodeToken,
> - CM_OBJECT_TOKEN ParentNodeToken
> + CM_OBJECT_TOKEN ParentNodeToken,
> + BOOLEAN PackageNodeSeen
> )
NIT: I think 'PackageNodeSeen' must be added to the function's documentation.
Otherwise:
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Regards,
Pierre
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115111): https://edk2.groups.io/g/devel/message/115111
Mute This Topic: https://groups.io/mt/104126146/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-05 9:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-02 19:19 [edk2-devel] [PATCH] DynamicTablesPkg/SSDT: Require Package node in hierarchy Jeshua Smith via groups.io
2024-02-05 9:38 ` PierreGondois
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox