All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Avoid using hardcoded number of variable range MTRRs in mtrr_commit()
@ 2020-11-09  8:04 Bin Meng
  2020-11-09 16:05 ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Bin Meng @ 2020-11-09  8:04 UTC (permalink / raw)
  To: u-boot

Since commit 29d2d64ed55f ("x86: Add support for more than 8 MTRRs"),
the maximum number of variable range MTRRs was increased from 8 to 10,
which caused a #GP exception during VESA video driver probe.

On the BayTrail platform there are only 8 variable range MTRRs. In
mtrr_commit() it still uses MTRR_MAX_COUNT which should have been
updated to use dynamically probed number.

This fixes the boot failure seen on Intel Minnow Max board.

Fixes: 29d2d64ed55f ("x86: Add support for more than 8 MTRRs")
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 5180eb0..6f095c5 100644
--- a/arch/x86/cpu/mtrr.c
+++ b/arch/x86/cpu/mtrr.c
@@ -158,7 +158,7 @@ int mtrr_commit(bool do_caches)
 
 	/* Clear the ones that are unused */
 	debug("clear\n");
-	for (; i < MTRR_MAX_COUNT; i++)
+	for (; i < mtrr_get_var_count(); i++)
 		wrmsrl(MTRR_PHYS_MASK_MSR(i), 0);
 	debug("close\n");
 	mtrr_close(&state, do_caches);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] x86: Avoid using hardcoded number of variable range MTRRs in mtrr_commit()
  2020-11-09  8:04 [PATCH] x86: Avoid using hardcoded number of variable range MTRRs in mtrr_commit() Bin Meng
@ 2020-11-09 16:05 ` Simon Glass
  2020-11-10  1:14   ` Bin Meng
  2020-11-10  1:30   ` Bin Meng
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Glass @ 2020-11-09 16:05 UTC (permalink / raw)
  To: u-boot

Hi Bin,

On Mon, 9 Nov 2020 at 01:05, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Since commit 29d2d64ed55f ("x86: Add support for more than 8 MTRRs"),
> the maximum number of variable range MTRRs was increased from 8 to 10,
> which caused a #GP exception during VESA video driver probe.
>
> On the BayTrail platform there are only 8 variable range MTRRs. In
> mtrr_commit() it still uses MTRR_MAX_COUNT which should have been
> updated to use dynamically probed number.
>
> This fixes the boot failure seen on Intel Minnow Max board.
>
> Fixes: 29d2d64ed55f ("x86: Add support for more than 8 MTRRs")
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  arch/x86/cpu/mtrr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

I don't actually see the boot failure in my lab, but this looks right to me.

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] x86: Avoid using hardcoded number of variable range MTRRs in mtrr_commit()
  2020-11-09 16:05 ` Simon Glass
@ 2020-11-10  1:14   ` Bin Meng
  2020-11-10  1:30   ` Bin Meng
  1 sibling, 0 replies; 4+ messages in thread
From: Bin Meng @ 2020-11-10  1:14 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Tue, Nov 10, 2020 at 12:05 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Bin,
>
> On Mon, 9 Nov 2020 at 01:05, Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Since commit 29d2d64ed55f ("x86: Add support for more than 8 MTRRs"),
> > the maximum number of variable range MTRRs was increased from 8 to 10,
> > which caused a #GP exception during VESA video driver probe.
> >
> > On the BayTrail platform there are only 8 variable range MTRRs. In
> > mtrr_commit() it still uses MTRR_MAX_COUNT which should have been
> > updated to use dynamically probed number.
> >
> > This fixes the boot failure seen on Intel Minnow Max board.
> >
> > Fixes: 29d2d64ed55f ("x86: Add support for more than 8 MTRRs")
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
> >
> >  arch/x86/cpu/mtrr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> I don't actually see the boot failure in my lab, but this looks right to me.

That's weird :)

Regards,
Bin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] x86: Avoid using hardcoded number of variable range MTRRs in mtrr_commit()
  2020-11-09 16:05 ` Simon Glass
  2020-11-10  1:14   ` Bin Meng
@ 2020-11-10  1:30   ` Bin Meng
  1 sibling, 0 replies; 4+ messages in thread
From: Bin Meng @ 2020-11-10  1:30 UTC (permalink / raw)
  To: u-boot

On Tue, Nov 10, 2020 at 12:05 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Bin,
>
> On Mon, 9 Nov 2020 at 01:05, Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Since commit 29d2d64ed55f ("x86: Add support for more than 8 MTRRs"),
> > the maximum number of variable range MTRRs was increased from 8 to 10,
> > which caused a #GP exception during VESA video driver probe.
> >
> > On the BayTrail platform there are only 8 variable range MTRRs. In
> > mtrr_commit() it still uses MTRR_MAX_COUNT which should have been
> > updated to use dynamically probed number.
> >
> > This fixes the boot failure seen on Intel Minnow Max board.
> >
> > Fixes: 29d2d64ed55f ("x86: Add support for more than 8 MTRRs")
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
> >
> >  arch/x86/cpu/mtrr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

applied to u-boot-x86, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-10  1:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09  8:04 [PATCH] x86: Avoid using hardcoded number of variable range MTRRs in mtrr_commit() Bin Meng
2020-11-09 16:05 ` Simon Glass
2020-11-10  1:14   ` Bin Meng
2020-11-10  1:30   ` Bin Meng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.