mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yinghai Lu" <yhlu.kernel@gmail.com>
To: "Joshua Hoblitt" <josh@hoblitt.com>, "Ingo Molnar" <mingo@elte.hu>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	bugme-daemon@bugzilla.kernel.org, linux-kernel@vger.kernel.org,
	j_kernel@hoblitt.com
Subject: Re: [Bug 11388] New: 2.6.27-rc3 warns about MTRR range; only 3 of 16gb of memory is usable
Date: Thu, 21 Aug 2008 20:24:24 -0700	[thread overview]
Message-ID: <86802c440808212024v3ccd2a7ey6517c180464275f0@mail.gmail.com> (raw)
In-Reply-To: <86802c440808211926k1ec5b2a2g2bec1b7faee7ebbb@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]

On Thu, Aug 21, 2008 at 7:26 PM, Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> On Thu, Aug 21, 2008 at 7:15 PM, Joshua Hoblitt <josh@hoblitt.com> wrote:
>> On Thu, Aug 21, 2008 at 06:55:58PM -0700, Yinghai Lu wrote:
>> address sizes   : 38 bits physical, 48 bits virtual
>
> good, the root cause is your bios not set mask correctly...
>
> it should set var mtrr like
>
> [    0.429971]  MSR00000200: 00000000d0000000
> [    0.433305]  MSR00000201: 0000000ff0000800
> ==> [    0.433305]  MSR00000201: 0000003ff0000800
>
> [    0.436638]  MSR00000202: 00000000e0000000
> [    0.439971]  MSR00000203: 0000000fe0000800
> ==> [    0.439971]  MSR00000203: 0000003fe0000800
>
> [    0.443304]  MSR00000204: 0000000000000006
> [    0.446637]  MSR00000205: 0000000c00000800
> ==> [    0.446637]  MSR00000205: 0000003c00000800
>
> [    0.449970]  MSR00000206: 0000000400000006
> [    0.453303]  MSR00000207: 0000000fe0000800
> ==>[    0.453303]  MSR00000207: 0000003fe0000800
>
> [    0.456636]  MSR00000208: 0000000420000006
> [    0.459970]  MSR00000209: 0000000ff0000800
> ==> [    0.459970]  MSR00000209: 0000003ff0000800
>
> you may talk to your BIOS vendor or system vendor to request one new
> updated BIOS.
>

or please try attached workaround patch. hope it works.

Ingo,
if it works, we need to push it for 2.6.27

YH

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: work_aroun_mask.patch --]
[-- Type: text/x-patch; name=work_aroun_mask.patch, Size: 1340 bytes --]

[PATCH] x86: workaroun mtrr mask setting

Some BIOS doesn't set mtrr mask correctly, workaround it be prefix 111

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 509bd3d..a17d5ba 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -379,6 +379,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
 			     unsigned long *size, mtrr_type *type)
 {
 	unsigned int mask_lo, mask_hi, base_lo, base_hi;
+	unsigned int tmp, hi;
 
 	rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi);
 	if ((mask_lo & 0x800) == 0) {
@@ -392,8 +393,18 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
 	rdmsr(MTRRphysBase_MSR(reg), base_lo, base_hi);
 
 	/* Work out the shifted address mask. */
-	mask_lo = size_or_mask | mask_hi << (32 - PAGE_SHIFT)
-	    | mask_lo >> PAGE_SHIFT;
+	tmp = mask_hi << (32 - PAGE_SHIFT) | mask_lo >> PAGE_SHIFT;
+	mask_lo = size_or_mask | tmp;
+	/* expend tmp with high bits to all 1s*/
+	hi = fls(tmp);
+	if (hi > 0) {
+		tmp |= ~((1<<(hi - 1)) - 1);
+
+		if (tmp != mask_lo) {
+			WARN_ON("You BIOS mask set is wrong, complain to vendor\n");
+			mask_lo = tmp;
+		}
+	}
 
 	/* This works correctly if size is a power of two, i.e. a
 	   contiguous range. */

  reply	other threads:[~2008-08-22  3:24 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-11388-27@http.bugzilla.kernel.org/>
2008-08-21  1:04 ` Andrew Morton
2008-08-21  1:20   ` Yinghai Lu
2008-08-21  1:49     ` Yinghai Lu
2008-08-21 11:44       ` Ingo Molnar
2008-08-21 11:56         ` Ingo Molnar
2008-08-21 15:39           ` Yinghai Lu
2008-08-22  3:51             ` Ingo Molnar
2008-08-22  4:45               ` Yinghai Lu
2008-08-21 20:55       ` Joshua Hoblitt
2008-08-21 21:51         ` Yinghai Lu
2008-08-21 23:33           ` Joshua Hoblitt
2008-08-22  0:10             ` Joshua Hoblitt
2008-08-22  0:28               ` Yinghai Lu
2008-08-22  0:29                 ` Joshua Hoblitt
2008-08-22  1:00                   ` Joshua Hoblitt
2008-08-22  1:10                     ` Joshua Hoblitt
2008-08-22  1:55                       ` Yinghai Lu
2008-08-22  2:15                         ` Joshua Hoblitt
2008-08-22  2:26                           ` Yinghai Lu
2008-08-22  3:24                             ` Yinghai Lu [this message]
2008-08-22  3:50                               ` Ingo Molnar
2008-08-22  3:56                                 ` Ingo Molnar
2008-08-22  4:48                                   ` Yinghai Lu
2008-08-23  0:22                                     ` Joshua Hoblitt
2008-08-23  5:52                                       ` Yinghai Lu
2008-08-23 10:43                                         ` Ingo Molnar
2008-08-26  8:35                                           ` Joshua Hoblitt
2008-08-26  8:42                                             ` Ingo Molnar
2008-08-25 21:43                                   ` Joshua Hoblitt
2008-08-22  6:16                                 ` Yinghai Lu
2008-08-22  6:24                                   ` Ingo Molnar
2008-08-23 23:53                                     ` Arjan van de Ven
2008-08-25  9:17                                       ` Ingo Molnar
2008-08-22  3:26                             ` Joshua Hoblitt

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=86802c440808212024v3ccd2a7ey6517c180464275f0@mail.gmail.com \
    --to=yhlu.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bugme-daemon@bugzilla.kernel.org \
    --cc=j_kernel@hoblitt.com \
    --cc=josh@hoblitt.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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

all inboxes | Powered by JetHome®