[PATCH] X86: disable X86_PAT really

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ingo Molnar <mingo@...>
Cc: Dave Jones <davej@...>, <venkatesh.pallipadi@...>, LKML <linux-kernel@...>
Date: Saturday, January 19, 2008 - 3:56 am

[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 */
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] X86: fix typo PAT to X86_PAT, Yinghai Lu, (Thu Jan 17, 11:50 pm)
Re: [PATCH] X86: fix typo PAT to X86_PAT, Ingo Molnar, (Fri Jan 18, 4:10 am)
Re: [PATCH] X86: fix typo PAT to X86_PAT, Yinghai Lu, (Fri Jan 18, 5:03 am)
Re: [PATCH] X86: fix typo PAT to X86_PAT, Ingo Molnar, (Fri Jan 18, 8:31 am)
Re: [PATCH] X86: fix typo PAT to X86_PAT, Dave Jones, (Fri Jan 18, 2:24 pm)
Re: [PATCH] X86: fix typo PAT to X86_PAT, Ingo Molnar, (Fri Jan 18, 5:02 pm)
Re: [PATCH] X86: fix typo PAT to X86_PAT, Dave Jones, (Fri Jan 18, 11:28 pm)
RE: [PATCH] X86: fix typo PAT to X86_PAT, Pallipadi, Venkatesh, (Tue Jan 22, 2:26 pm)
Re: [PATCH] X86: fix typo PAT to X86_PAT, Yinghai Lu, (Sat Jan 19, 3:58 am)
[PATCH] X86: disable X86_PAT really, Yinghai Lu, (Sat Jan 19, 3:56 am)
RE: [PATCH] X86: fix typo PAT to X86_PAT, Pallipadi, Venkatesh, (Fri Jan 18, 2:47 pm)
Re: [PATCH] X86: fix typo PAT to X86_PAT, Ingo Molnar, (Fri Jan 18, 5:03 pm)
Re: [PATCH] X86: fix typo PAT to X86_PAT, Dave Jones, (Fri Jan 18, 2:56 pm)