Attention is currently required from: Furquan Shaikh, Tim Wawrzynczak, Angel Pons, Arthur Heymans. Subrata Banik has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/56151 )
Change subject: cpu/x86/mtrr: Add check_var_mtrr_range_enabled() helper function ......................................................................
Patch Set 1:
(1 comment)
File src/cpu/x86/mtrr/earlymtrr.c:
https://review.coreboot.org/c/coreboot/+/56151/comment/52c7a78f_0bc1b7f8 PS1, Line 168: bool check_var_mtrr_range_enabled(uintptr_t base, size_t size)
This function relies on the caller to align base and size of the address range you want to check. […] It can also be the case that your input range spans multiple MTRRs.
Yes, you are right, as it can split into multiple MTRRs, hence searching could be difficult, i mean i can put something like this.
caller passing base <= MTRR base address and (base + size) <= (MTRR base + MTRR size) => this would help me to get if address range belongs to a single MTRR or nor.
but if (base + size) > (MTRR base + MTRR size) then finding the extra size and calculating a new base and recursively calling into next MTRR, won't that be little complicated?
You also don't want to make assumptions on the MTRR default caching type: read it out first
yes, i will add a check, i missed that and i realized it later, if this range itself is UC then no point running this loop.