From: Yinghai Lu <Yinghai.Lu@Sun.COM>
To: Ingo Molnar <mingo@elte.hu>
Cc: Dave Jones <davej@redhat.com>,
venkatesh.pallipadi@intel.com,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] X86: disable X86_PAT really
Date: Fri, 18 Jan 2008 23:56:14 -0800 [thread overview]
Message-ID: <200801182356.14843.yinghai.lu@sun.com> (raw)
In-Reply-To: <20080119032849.GA16757@redhat.com>
[PATCH] X86: disable X86_PAT really
when X86_PAT is not selected, we don't need to do anything in reserve_mattr and free_mattr
also need to bail out if cpu not support PAT.
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 1036134..b3cdee1 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -57,12 +57,9 @@ static int pat_known_cpu(void)
void pat_init(void)
{
+#ifdef CONFIG_X86_PAT
u64 pat;
-#ifndef CONFIG_X86_PAT
- nopat(NULL);
-#endif
-
if (!smp_processor_id() && !pat_known_cpu())
return;
@@ -90,6 +87,7 @@ void pat_init(void)
wrmsrl(MSR_IA32_CR_PAT, pat);
printk(KERN_INFO "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n",
smp_processor_id(), boot_pat_state, pat);
+#endif
}
#undef PAT
@@ -135,9 +133,13 @@ static DEFINE_SPINLOCK(mattr_lock); /* protects memattr list */
int reserve_mattr(u64 start, u64 end, unsigned long attr, unsigned long *fattr)
{
+#ifdef CONFIG_X86_PAT
struct memattr *ma = NULL, *ml;
int err = 0;
+ if (!pat_wc_enabled)
+ return 0;
+
if (fattr)
*fattr = attr;
@@ -191,13 +193,20 @@ int reserve_mattr(u64 start, u64 end, unsigned long attr, unsigned long *fattr)
spin_unlock(&mattr_lock);
return err;
+#else
+ return 0;
+#endif
}
int free_mattr(u64 start, u64 end, unsigned long attr)
{
+#ifdef CONFIG_X86_PAT
struct memattr *ml;
int err = attr ? -EBUSY : 0;
+ if (!pat_wc_enabled)
+ return 0;
+
if (is_memory_any_valid(start, end))
return 0;
@@ -221,6 +230,9 @@ int free_mattr(u64 start, u64 end, unsigned long attr)
current->comm, current->pid,
start, end, cattr_name(attr));
return err;
+#else
+ return 0;
+#endif
}
/* /dev/mem interface. Use the previous mapping */
next prev parent reply other threads:[~2008-01-19 7:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-18 3:50 [PATCH] X86: fix typo PAT to X86_PAT Yinghai Lu
2008-01-18 8:10 ` Ingo Molnar
2008-01-18 9:03 ` Yinghai Lu
2008-01-18 12:31 ` Ingo Molnar
2008-01-18 18:24 ` Dave Jones
2008-01-18 18:47 ` Pallipadi, Venkatesh
2008-01-18 18:56 ` Dave Jones
2008-01-18 21:03 ` Ingo Molnar
2008-01-18 21:02 ` Ingo Molnar
2008-01-19 3:28 ` Dave Jones
2008-01-19 7:56 ` Yinghai Lu [this message]
2008-01-19 7:58 ` Yinghai Lu
2008-01-22 18:26 ` Pallipadi, Venkatesh
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=200801182356.14843.yinghai.lu@sun.com \
--to=yinghai.lu@sun.com \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=venkatesh.pallipadi@intel.com \
/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