diff options
author | Jeremy Compostella <jeremy.compostella@intel.com> | 2024-08-16 10:11:42 -0700 |
---|---|---|
committer | Jérémy Compostella <jeremy.compostella@intel.com> | 2024-10-21 16:59:58 +0000 |
commit | 89740558558020c575875fecb913d47904da7180 (patch) | |
tree | d0fc59a9dc3b7629bb0ecb133d3f949ca404d1a1 /src/soc/intel/common/block | |
parent | 0d7685e116f0ad4440390aed605c9f372b9b547a (diff) |
soc/intel/common/block/cpu: Add Kconfig for effective way size for NEM+
On Alder Lake, Meteor Lake and Panther Lake platforms the way size to
consider for NEM+ computation is the effective way size.
On Alder Lake, the External Design Specification #627270 "3.5.2
No-Eviction Mode (NEM) Sizes" provides a way to compute the effective
way size by reading the number of CBO. Unfortunately, reading the
number of CBO is not possible on Meteor Lake and Panther
Lake. Therefore, we instead compute the effective way size as the
biggest of power of two of the way size which works across all three
platforms.
The Kconfig `INTEL_CAR_ENEM_USE_EFFECTIVE_WAY_SIZE' is introduced to
control this behavior.
The issue addressed by this commit can be observed with the following
experiment: using a 18 MB LLC SKU, set `DCACHE_RAM_SIZE` to
0x400000 (4 MB).
The number of ways that used to be computed is round(0x400000 /
0x180000) = round(2.66) = 3. 3 ways were mapped to cover the 0x400000
NEM+ region. When the bootblock code accesses memory between 3 MB and
4 MB, the core would raise a page fault exception.
The right computation is: 0x400000 / eff_way_size(0x180000) = 4. 4
ways needs to be mapped to cover the entire 0x400000 NEM+ region.
BUG=b:360332771
TEST=Verified on PTL Intel reference platform
Change-Id: I5cb66da0aa977eecb64a0021268a6827747c521c
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83946
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Diffstat (limited to 'src/soc/intel/common/block')
-rw-r--r-- | src/soc/intel/common/block/cpu/Kconfig | 9 | ||||
-rw-r--r-- | src/soc/intel/common/block/cpu/car/cache_as_ram.S | 11 |
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 |