Attention is currently required from: Furquan Shaikh, Subrata Banik, Nick Vaccaro, EricR Lai. Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/51374 )
Change subject: soc/intel/common/../car: Calculate SF Mask#1 based on MSR 0xc87 ......................................................................
Patch Set 8:
(2 comments)
File src/soc/intel/common/block/cpu/car/cache_as_ram.S:
https://review.coreboot.org/c/coreboot/+/51374/comment/8e925e5b_61b3c2e1 PS8, Line 527: 2. Set SF_MASK_1 = ((1 << SFWayCnt) - 1) - ((1 << data_ways) - 1) This can be simplified further to remove 1 subtraction: `((1 << (SFWayCnt - data_ways)) - 1) << data_ways)`
It's the same number of shifts, but 1 fewer subtraction, which IMO it's almost always good to reduce instruction count in CAR, see below for a sequence that should work; I've also worked it to remove the need to save `ebx`
https://review.coreboot.org/c/coreboot/+/51374/comment/83bee73e_8c4265a6 PS8, Line 532: mov %al, %cl : mov $0x01, %eax : shl %cl, %eax : subl $0x01, %eax /* contains ((1 << SFWayCnt) - 1) */ : mov %bl, %cl : mov $0x01, %ebx : shl %cl, %ebx : subl $0x01, %ebx /* contains ((1 << data_ways) - 1) */ : sub %ebx, %eax /* contains SF mask */ `edx` is also free at this point, so I think that could be used instead of backing of `ebx` and using it, combined with the above, does this work? I think this saves something like 4 instructions, including the restore on 549 ``` sequence: ebx == non-eviction mask ecx == number of ways /* save number of ways to edi because rdmsr has to use ecx */ mov %ecx, %edi /* edi == data_ways */ mov $IA32_SF_QOS_INFO, %ecx /* ecx == IA32_SF_QOS_INFO */ rdmsr and $0x3f, %eax /* eax == SFWayCnt */ mov %ecx, %edx /* ecx == SFWayCnt */ subl %ecx, %edi /* ecx == SFWayCnt - data_ways */ movl $0x01, %eax /* eax == 1 */ shl $cl, %eax /* eax == 1 << (SFWayCnt - data_ways) */ subl $0x01, %eax /* eax == (1 << (SFWayCnt - data_ways)) - 1) */ mov %edi, %ecx /* ecx == data_ways */ shl %cl, %eax /* eax == ((1 << (SFWayCnt - data_ways)) - 1)) << data_ways */ ```
and then the mask value we want is in eax ready to be used with `wrmsr` WDYT?