This patch fixes an error in calculating cache sizes for cores from
different Dies. The original code incorrectly cleared cache sizes for
different core types during intermediate calculation steps, leading to
mistakes in counting duplicate entries. This patch adds a check for
cache size to distinguish between different cache types.

Cc: Gerd Hoffmann kra...@redhat.com
Cc: Eric Dong eric.d...@intel.com
Cc: Ray Ni ray...@intel.com
Cc: Rahul Kumar rahul1.ku...@intel.com
Cc: Tom Lendacky thomas.lenda...@amd.com
Signed-off-by: xieyuanh <yuanhao....@intel.com>
---
 UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c 
b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
index c7973735e1..df07a10a2a 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
@@ -348,7 +348,8 @@ CpuCacheInfoCollectCpuCacheInfoData (
       if ((LocalCacheInfo[CacheInfoIndex].Package    == ProcessorInfo[Index / 
MAX_NUM_OF_CACHE_PARAMS_LEAF].Package) &&
           (LocalCacheInfo[CacheInfoIndex].CoreType   == ProcessorInfo[Index / 
MAX_NUM_OF_CACHE_PARAMS_LEAF].CoreType) &&
           (LocalCacheInfo[CacheInfoIndex].CacheLevel == 
CacheData[Index].CacheLevel) &&
-          (LocalCacheInfo[CacheInfoIndex].CacheType  == 
CacheData[Index].CacheType))
+          (LocalCacheInfo[CacheInfoIndex].CacheType  == 
CacheData[Index].CacheType) &&
+          (LocalCacheInfo[CacheInfoIndex].CacheSizeinKB  == 
CacheData[Index].CacheSizeinKB))
       {
         LocalCacheInfo[CacheInfoIndex].CacheCount++;
         break;
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119609): https://edk2.groups.io/g/devel/message/119609
Mute This Topic: https://groups.io/mt/106740629/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to