From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>, Andi Kleen <ak@suse.de>,
Glauber de Oliveira Costa <glommer@gmail.com>,
Jan Beulich <jbeulich@novell.com>
Subject: [PATCH 2 of 2] x86: use common _PAGE_NOCACHE
Date: Thu, 10 Jan 2008 14:36:11 -0800 [thread overview]
Message-ID: <232ab35d54b0240c2f53.1200004571@localhost> (raw)
In-Reply-To: <patchbomb.1200004569@localhost>
Since it seems that every use of _PAGE_PCD also sets _PAGE_PWT, define
_PAGE_NOCACHE with this combination.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
---
arch/x86/mm/ioremap_32.c | 2 +-
arch/x86/mm/ioremap_64.c | 2 +-
arch/x86/pci/i386.c | 2 +-
arch/x86/xen/mmu.c | 4 ++--
include/asm-x86/pgtable.h | 6 ++++--
include/asm-x86/pgtable_32.h | 2 +-
include/asm-x86/pgtable_64.h | 2 +-
7 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/arch/x86/mm/ioremap_32.c b/arch/x86/mm/ioremap_32.c
--- a/arch/x86/mm/ioremap_32.c
+++ b/arch/x86/mm/ioremap_32.c
@@ -119,7 +119,7 @@ void __iomem *ioremap_nocache (unsigned
void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size)
{
unsigned long last_addr;
- void __iomem *p = __ioremap(phys_addr, size, _PAGE_PCD | _PAGE_PWT);
+ void __iomem *p = __ioremap(phys_addr, size, _PAGE_NOCACHE);
if (!p)
return p;
diff --git a/arch/x86/mm/ioremap_64.c b/arch/x86/mm/ioremap_64.c
--- a/arch/x86/mm/ioremap_64.c
+++ b/arch/x86/mm/ioremap_64.c
@@ -142,7 +142,7 @@ EXPORT_SYMBOL(__ioremap);
void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size)
{
- return __ioremap(phys_addr, size, _PAGE_PCD | _PAGE_PWT);
+ return __ioremap(phys_addr, size, _PAGE_NOCACHE);
}
EXPORT_SYMBOL(ioremap_nocache);
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -313,7 +313,7 @@ int pci_mmap_page_range(struct pci_dev *
*/
prot = pgprot_val(vma->vm_page_prot);
if (boot_cpu_data.x86 > 3)
- prot |= _PAGE_PCD | _PAGE_PWT;
+ prot |= _PAGE_NOCACHE;
vma->vm_page_prot = __pgprot(prot);
/* Write-combine setting is ignored, it is changed via the mtrr
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -244,7 +244,7 @@ pte_t xen_make_pte(unsigned long long pt
if (pte & 1)
pte = phys_to_machine(XPADDR(pte)).maddr;
- pte &= ~(_PAGE_PCD | _PAGE_PWT);
+ pte &= ~_PAGE_NOCACHE;
return (pte_t){ .pte = pte };
}
@@ -293,7 +293,7 @@ pte_t xen_make_pte(unsigned long pte)
if (pte & _PAGE_PRESENT)
pte = phys_to_machine(XPADDR(pte)).maddr;
- pte &= ~(_PAGE_PCD | _PAGE_PWT);
+ pte &= ~_PAGE_NOCACHE;
return (pte_t){ pte };
}
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -31,6 +31,8 @@
#define _PAGE_UNUSED1 (_AC(1, UL)<<_PAGE_BIT_UNUSED1)
#define _PAGE_UNUSED2 (_AC(1, UL)<<_PAGE_BIT_UNUSED2)
#define _PAGE_UNUSED3 (_AC(1, UL)<<_PAGE_BIT_UNUSED3)
+
+#define _PAGE_NOCACHE (_PAGE_PCD | _PAGE_PWT)
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
#define _PAGE_NX (_AC(1, ULL) << _PAGE_BIT_NX)
@@ -74,9 +76,9 @@ extern unsigned long long __PAGE_KERNEL,
#define __PAGE_KERNEL_RO (__PAGE_KERNEL & ~_PAGE_RW)
#define __PAGE_KERNEL_RX (__PAGE_KERNEL_EXEC & ~_PAGE_RW)
-#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD | _PAGE_PWT)
+#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_NOCACHE)
#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RX | _PAGE_USER)
-#define __PAGE_KERNEL_VSYSCALL_NOCACHE (__PAGE_KERNEL_VSYSCALL | _PAGE_PCD | _PAGE_PWT)
+#define __PAGE_KERNEL_VSYSCALL_NOCACHE (__PAGE_KERNEL_VSYSCALL | _PAGE_NOCACHE)
#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE)
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -121,7 +121,7 @@ static inline void clone_pgd_range(pgd_t
* it, this is a no-op.
*/
#define pgprot_noncached(prot) ((boot_cpu_data.x86 > 3) \
- ? (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)) : (prot))
+ ? (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE)) : (prot))
/*
* Conversion functions: convert a page and protection to a page entry,
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -167,7 +167,7 @@ static inline unsigned long pmd_bad(pmd_
/*
* Macro to mark a page protection value as "uncacheable".
*/
-#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT))
+#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE))
/*
next prev parent reply other threads:[~2008-01-10 23:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-10 22:36 [PATCH 0 of 2] x86: a couple of misc patches Jeremy Fitzhardinge
2008-01-10 22:36 ` [PATCH 1 of 2] x86: fold _PAGE_GLOBAL into __PAGE_KERNEL Jeremy Fitzhardinge
2008-01-10 22:36 ` Jeremy Fitzhardinge [this message]
2008-01-11 8:13 ` [PATCH 0 of 2] x86: a couple of misc patches Jan Beulich
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=232ab35d54b0240c2f53.1200004571@localhost \
--to=jeremy@goop.org \
--cc=ak@suse.de \
--cc=glommer@gmail.com \
--cc=jbeulich@novell.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