soc/intel/common: Calculate and configure SF Mask 2
As per TGL EDS, two ways will be controlled with one bit of SF QoS register hence, this patch introduces SF_MASK_2WAYS_PER_BIT Kconfig to allow SoC users to select SF_MASK_2WAYS_PER_BIT to follow the EDS recommendation. Calculate SF masks 2: 1. if CONFIG_SF_MASK_2WAYS_PER_BIT: a. data_ways = data_ways / 2 Also, program SF Mask#2 using below logic: 2. Set SF_MASK_2 = (1 << data_ways) - 1 Change-Id: I442bed75f13d26f357cfb32c54c5fe9efa4b474b Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56717 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
parent
83c9b3a599
commit
16ab9bdcd5
|
@ -88,6 +88,8 @@
|
||||||
#define IA32_HWP_CAPABILITIES 0x771
|
#define IA32_HWP_CAPABILITIES 0x771
|
||||||
#define IA32_HWP_REQUEST 0x774
|
#define IA32_HWP_REQUEST 0x774
|
||||||
#define IA32_HWP_STATUS 0x777
|
#define IA32_HWP_STATUS 0x777
|
||||||
|
#define IA32_SF_QOS_INFO 0xc87
|
||||||
|
#define IA32_SF_WAY_COUNT_MASK 0x3f
|
||||||
#define IA32_PQR_ASSOC 0xc8f
|
#define IA32_PQR_ASSOC 0xc8f
|
||||||
/* MSR bits 33:32 encode slot number 0-3 */
|
/* MSR bits 33:32 encode slot number 0-3 */
|
||||||
#define IA32_PQR_ASSOC_MASK (1 << 0 | 1 << 1)
|
#define IA32_PQR_ASSOC_MASK (1 << 0 | 1 << 1)
|
||||||
|
|
|
@ -63,6 +63,14 @@ config CAR_HAS_SF_MASKS
|
||||||
IA32_L3_SF_MASK_x programming is required along with the data ways.
|
IA32_L3_SF_MASK_x programming is required along with the data ways.
|
||||||
This is applicable for TGL and beyond.
|
This is applicable for TGL and beyond.
|
||||||
|
|
||||||
|
config SF_MASK_2WAYS_PER_BIT
|
||||||
|
bool
|
||||||
|
depends on INTEL_CAR_NEM_ENHANCED
|
||||||
|
help
|
||||||
|
In the case of non-inclusive cache architecture when two ways in
|
||||||
|
the SF mask are controlled by one bit of the SF QoS register.
|
||||||
|
This is applicable for TGL alone.
|
||||||
|
|
||||||
config COS_MAPPED_TO_MSB
|
config COS_MAPPED_TO_MSB
|
||||||
bool
|
bool
|
||||||
depends on INTEL_CAR_NEM_ENHANCED
|
depends on INTEL_CAR_NEM_ENHANCED
|
||||||
|
|
|
@ -499,6 +499,7 @@ find_llc_subleaf:
|
||||||
* of RW data.
|
* of RW data.
|
||||||
*/
|
*/
|
||||||
movl $0x01, %eax
|
movl $0x01, %eax
|
||||||
|
mov %eax, %edx /* back up data_ways in edx */
|
||||||
cmp $CONFIG_DCACHE_RAM_SIZE, %ecx
|
cmp $CONFIG_DCACHE_RAM_SIZE, %ecx
|
||||||
jnc set_eviction_mask
|
jnc set_eviction_mask
|
||||||
|
|
||||||
|
@ -508,6 +509,7 @@ find_llc_subleaf:
|
||||||
*/
|
*/
|
||||||
mov $CONFIG_DCACHE_RAM_SIZE, %eax
|
mov $CONFIG_DCACHE_RAM_SIZE, %eax
|
||||||
div %ecx
|
div %ecx
|
||||||
|
mov %eax, %edx /* back up data_ways in edx */
|
||||||
mov %eax, %ecx
|
mov %eax, %ecx
|
||||||
movl $0x01, %eax
|
movl $0x01, %eax
|
||||||
shl %cl, %eax
|
shl %cl, %eax
|
||||||
|
@ -517,6 +519,29 @@ set_eviction_mask:
|
||||||
mov %ebx, %edi /* back up number of ways */
|
mov %ebx, %edi /* back up number of ways */
|
||||||
mov %eax, %esi /* back up the non-eviction mask */
|
mov %eax, %esi /* back up the non-eviction mask */
|
||||||
#if CONFIG(CAR_HAS_SF_MASKS)
|
#if CONFIG(CAR_HAS_SF_MASKS)
|
||||||
|
mov %edx, %eax /* restore data_ways in eax */
|
||||||
|
/*
|
||||||
|
* Calculate SF masks 2:
|
||||||
|
* 1. if CONFIG_SF_MASK_2WAYS_PER_BIT: data_ways = data_ways / 2
|
||||||
|
* 2. Program MSR 0x1892 Non-Eviction Mask #2
|
||||||
|
* IA32_CR_SF_QOS_MASK_2 = ((1 << data_ways) - 1)
|
||||||
|
*/
|
||||||
|
#if CONFIG(SF_MASK_2WAYS_PER_BIT)
|
||||||
|
cmp $0x01, %eax /* Skip Step 1 if data_ways = 1 */
|
||||||
|
jz program_sf2
|
||||||
|
movl $0x01, %ecx /* Step 1 */
|
||||||
|
shr %cl, %eax
|
||||||
|
#endif
|
||||||
|
/* Step 2 */
|
||||||
|
mov %eax, %ecx
|
||||||
|
movl $0x01, %eax
|
||||||
|
shl %cl, %eax
|
||||||
|
subl $0x01, %eax
|
||||||
|
program_sf2:
|
||||||
|
xorl %edx, %edx
|
||||||
|
mov $IA32_CR_SF_QOS_MASK_2, %ecx
|
||||||
|
wrmsr
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SF mask is programmed with the double number of bits than
|
* SF mask is programmed with the double number of bits than
|
||||||
* the number of ways
|
* the number of ways
|
||||||
|
|
Loading…
Reference in New Issue