summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/soc/intel/common/block/cpu/Kconfig9
-rw-r--r--src/soc/intel/common/block/cpu/car/cache_as_ram.S11
2 files changed, 20 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/cpu/Kconfig b/src/soc/intel/common/block/cpu/Kconfig
index 814de73d31..0184452def 100644
--- a/src/soc/intel/common/block/cpu/Kconfig
+++ b/src/soc/intel/common/block/cpu/Kconfig
@@ -81,6 +81,15 @@ config INTEL_CAR_NEM_ENHANCED
ENHANCED NEM guarantees that modified data is always
kept in cache while clean data is replaced.
+config INTEL_CAR_ENEM_USE_EFFECTIVE_WAY_SIZE
+ bool
+ depends on INTEL_CAR_NEM_ENHANCED
+ help
+ On Alder Lake, Meteor Lake and Panther Lake platforms, the
+ way size to consider for NEM+ computation is the effective
+ way size. The effective way size is the biggest power of
+ two of the way size.
+
config CAR_HAS_SF_MASKS
bool
depends on INTEL_CAR_NEM_ENHANCED
diff --git a/src/soc/intel/common/block/cpu/car/cache_as_ram.S b/src/soc/intel/common/block/cpu/car/cache_as_ram.S
index c1af88299d..2c4beebf46 100644
--- a/src/soc/intel/common/block/cpu/car/cache_as_ram.S
+++ b/src/soc/intel/common/block/cpu/car/cache_as_ram.S
@@ -495,6 +495,17 @@ find_llc_subleaf:
div %ebx /* way size */
mov %eax, %ecx
+#if CONFIG(INTEL_CAR_ENEM_USE_EFFECTIVE_WAY_SIZE)
+ /*
+ * Limit the way size to the effective way size defined
+ * as the biggest power of two of the way size.
+ */
+ bsr %ecx, %ecx /* Find the most significant bit */
+ mov $1, %eax
+ shl %cl, %eax /* Shift 1 left to get the effective way size */
+ mov %eax, %ecx
+#endif
+
/*
* Check if way size if bigger than the cache ram size.
* Then we need to allocate just one way for non-eviction