public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: Simon Glass <sjg@chromium.org>, u-boot@lists.denx.de
Cc: Bin Meng <bmeng.cn@gmail.com>
Subject: [PATCH 3/7] x86: mtrr: Skip MSRs that were already programmed in mtrr_commit()
Date: Sat, 31 Jul 2021 16:45:25 +0800	[thread overview]
Message-ID: <20210731084529.7524-4-bmeng.cn@gmail.com> (raw)
In-Reply-To: <20210731084529.7524-1-bmeng.cn@gmail.com>

At present mtrr_commit() programs the MTRR MSRs starting from
index 0, which may overwrite MSRs that were already programmed
by previous boot stage or FSP.

Switch to call mtrr_set_next_var() instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 arch/x86/cpu/mtrr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c
index 73cf7bb2be..14c644eb56 100644
--- a/arch/x86/cpu/mtrr.c
+++ b/arch/x86/cpu/mtrr.c
@@ -155,7 +155,7 @@ 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++)
-		set_var_mtrr(i, req->type, req->start, req->size);
+		mtrr_set_next_var(req->type, req->start, req->size);
 
 	debug("close\n");
 	mtrr_close(&state, do_caches);
-- 
2.25.1


  parent reply	other threads:[~2021-07-31  8:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-31  8:45 [PATCH 0/7] x86: Various fixes to MTRR and FSP codes Bin Meng
2021-07-31  8:45 ` [PATCH 1/7] x86: fsp: Don't program MTRR for DRAM Bin Meng
2021-08-01 19:19   ` Simon Glass
2021-08-02  2:53     ` Bin Meng
2021-07-31  8:45 ` [PATCH 2/7] x86: mtrr: Do not clear the unused ones in mtrr_commit() Bin Meng
2021-08-01 19:19   ` Simon Glass
2021-08-02  2:50     ` Bin Meng
2021-07-31  8:45 ` Bin Meng [this message]
2021-08-01 19:19   ` [PATCH 3/7] x86: mtrr: Skip MSRs that were already programmed " Simon Glass
2021-08-02  2:50     ` Bin Meng
2021-07-31  8:45 ` [PATCH 4/7] x86: mtrr: Abort if requested size is not power of 2 Bin Meng
2021-08-01 19:19   ` Simon Glass
2021-08-02  2:50     ` Bin Meng
2021-07-31  8:45 ` [PATCH 5/7] x86: cmd: hob: Fix the command usage and help messages Bin Meng
2021-08-01 19:19   ` Simon Glass
2021-08-02  2:50     ` Bin Meng
2021-07-31  8:45 ` [PATCH 6/7] x86: cmd: hob: Fix display of resource type for system memory Bin Meng
2021-08-01 19:19   ` Simon Glass
2021-08-02  2:50     ` Bin Meng
2021-07-31  8:45 ` [PATCH 7/7] x86: fsp: Only FSP2 has INIT_PHASE_END_FIRMWARE Bin Meng
2021-08-01 19:19   ` Simon Glass
2021-08-02  2:53     ` Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210731084529.7524-4-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox