mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiaotian Feng <dfeng@redhat.com>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, Xiaotian Feng <dfeng@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Suresh Siddha <suresh.b.siddha@intel.com>,
	Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Subject: [RFC PATCH -tip] x86/pat: fix pat_x_mtrr_type to its essentials
Date: Thu, 26 Nov 2009 20:15:24 +0800	[thread overview]
Message-ID: <1259237724-21260-1-git-send-email-dfeng@redhat.com> (raw)

Due to the IA-32 SDM vol 3a "Effective Memory Type" tables, the PAT
and mtrr relations should be:
	|	UC	UC-	WC	WB	[PAT]
--------+--------------------------------------
UC	|	UC	UC(UC-)	WC	UC(UC-)
WC	|	UC	WC(UC-)	WC	WC(UC-)
WB	|	UC	UC(UC-)	WC	WB
[MTRR]
* In () is the current return value.

So, commit b6ff32, Fix pat_x_mtrr_type() to use UC_MINUS when the
mtrr type return UC. But it also made mtrr type WC use UC_MINUS.
This is not reasonable.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
---
 arch/x86/mm/pat.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index c37fd51..92e9627 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -228,10 +228,11 @@ static unsigned long pat_x_mtrr_type(u64 start, u64 end, unsigned long req_type)
 		u8 mtrr_type;
 
 		mtrr_type = mtrr_type_lookup(start, end);
-		if (mtrr_type != MTRR_TYPE_WRBACK)
-			return _PAGE_CACHE_UC_MINUS;
-
-		return _PAGE_CACHE_WB;
+		if (mtrr_type == MTRR_TYPE_WRBACK)
+			return _PAGE_CACHE_WB;
+		else if (mtrr_type == MTRR_TYPE_WRCOMB)
+			return _PAGE_CACHE_WC;
+		return _PAGE_CACHE_UC_MINUS;
 	}
 
 	return req_type;
-- 
1.6.5.2


             reply	other threads:[~2009-11-26 12:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26 12:15 Xiaotian Feng [this message]
2009-11-30 23:21 ` Suresh Siddha
2009-12-01  1:55   ` Xiaotian Feng

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=1259237724-21260-1-git-send-email-dfeng@redhat.com \
    --to=dfeng@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=venkatesh.pallipadi@intel.com \
    --cc=x86@kernel.org \
    /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

Powered by JetHome