[PATCH v2 13/18] x86: Return mtrr_add_request() to its old purpose
Simon Glass
sjg at chromium.org
Tue Apr 18 17:30:56 CEST 2023
This function used to be for adding a list of requests to be actioned on
relocation. Revert it back to this purpose, to avoid problems with boards
which need control of their MTRRs (i.e. those which don't use FSP).
The mtrr_set_next_var() function is available when the next free
variable-MTRR must be set, so this can be used instead.
Signed-off-by: Simon Glass <sjg at chromium.org>
Fixes: 3a5823978ff ("x86: mtrr: Skip MSRs that were already programmed..")
Fixes: 44aed2f0322 ("x86: mtrr: Do not clear the unused ones..")
---
(no changes since v1)
arch/x86/cpu/mtrr.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c
index e69dfb552b16..c174dd9b3ad2 100644
--- a/arch/x86/cpu/mtrr.c
+++ b/arch/x86/cpu/mtrr.c
@@ -156,8 +156,12 @@ int mtrr_commit(bool do_caches)
debug("open done\n");
qsort(req, gd->arch.mtrr_req_count, sizeof(*req), h_comp_mtrr);
for (i = 0; i < gd->arch.mtrr_req_count; i++, req++)
- mtrr_set_next_var(req->type, req->start, req->size);
+ set_var_mtrr(i, req->type, req->start, req->size);
+ /* Clear the ones that are unused */
+ debug("clear\n");
+ for (; i < mtrr_get_var_count(); i++)
+ wrmsrl(MTRR_PHYS_MASK_MSR(i), 0);
debug("close\n");
mtrr_close(&state, do_caches);
debug("mtrr done\n");
--
2.40.0.634.g4ca3ef3211-goog
More information about the U-Boot
mailing list