Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/63492 )
Change subject: cpu/x86/mtrrlib: Use `need_restore_mtrr()` from set_var_mtrr function ......................................................................
cpu/x86/mtrrlib: Use `need_restore_mtrr()` from set_var_mtrr function
`fast_spi_cache_bios_region()` is calling `set_var_mtrr()` to set temporary MTRRs with commit def18c406 (soc/intel/common/block/fast_spi: Refactor ROM caching implementation).
Hence, this patch ensures the `put_back_original_solution` variable is also getting set by `need_restore_mtrr()` while calling from the `set_var_mtrr()`. Later `remove_temp_solution()` discard any temporary MTRRs prior to boot to payload.
Ensure `set_var_mtrr()` being called during ramstage only sets the `put_back_original_solution` variable.
BUG=b:225766934 TEST=Able to build and boot google/brya to verify that `remove_temp_solution()` is able to discard ROM caching temporary MTRRs before booting to payload.
Signed-off-by: Subrata Banik subratabanik@google.com Change-Id: I67fd36080b318ace53f3e34da53d747f9a3aa400 --- M src/cpu/x86/mtrr/mtrrlib.c 1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/92/63492/1
diff --git a/src/cpu/x86/mtrr/mtrrlib.c b/src/cpu/x86/mtrr/mtrrlib.c index 71921de..ca8a20d 100644 --- a/src/cpu/x86/mtrr/mtrrlib.c +++ b/src/cpu/x86/mtrr/mtrrlib.c @@ -48,6 +48,10 @@ maskm.lo = ~(size - 1) | MTRR_PHYS_MASK_VALID; maskm.hi = (1 << (cpu_phys_address_size() - 32)) - 1; wrmsr(MTRR_PHYS_MASK(reg), maskm); + + /* Need to restore mtrr later using remove_temp_solution. */ + if (ENV_RAMSTAGE) + need_restore_mtrr(); }
void clear_all_var_mtrr(void)