UefiCpuPkg/Feature: Support different thread count per core

Today's code assumes every core contains the same number of threads.
It's not always TRUE for certain model.
Such assumption causes system hang when thread count per core
is different and there is core or package dependency between CPU
features (using CPU_FEATURE_CORE_BEFORE/AFTER,
CPU_FEATURE_PACKAGE_BEFORE/AFTER).

The change removes such assumption by calculating the actual thread
count per package and per core.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Cc: Yun Lou <yun.lou@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Ray Ni
2020-12-02 09:51:31 +08:00
committed by mergify[bot]
parent 126115a9fb
commit 6af76adbbf
3 changed files with 118 additions and 82 deletions

View File

@@ -1,7 +1,7 @@
/** @file
Definitions for CPU S3 data.
Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2013 - 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -60,14 +60,24 @@ typedef struct {
UINT32 MaxThreadCount;
//
// This field points to an array.
// This array saves valid core count (type UINT32) of each package.
// This array saves thread count (type UINT32) of each package.
// The array has PackageCount elements.
//
// If the platform does not support MSR setting at S3 resume, and
// therefore it doesn't need the dependency semaphores, it should set
// this field to 0.
//
EFI_PHYSICAL_ADDRESS ValidCoreCountPerPackage;
EFI_PHYSICAL_ADDRESS ThreadCountPerPackage;
//
// This field points to an array.
// This array saves thread count (type UINT8) of each core.
// The array has PackageCount * MaxCoreCount elements.
//
// If the platform does not support MSR setting at S3 resume, and
// therefore it doesn't need the dependency semaphores, it should set
// this field to 0.
//
EFI_PHYSICAL_ADDRESS ThreadCountPerCore;
} CPU_STATUS_INFORMATION;
//