From d512bd31293c7f2aeef9b60fb6f112d0e90adff3 Mon Sep 17 00:00:00 2001 From: xieyuanh Date: Tue, 18 Jun 2024 19:59:56 +0800 Subject: UefiCpuPkg: Correct the count of different type of Cache. 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 Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Tom Lendacky Signed-off-by: xieyuanh --- 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 c797373..df07a10 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; -- cgit v1.1