aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/mm/dump_pagetables.c6
-rw-r--r--arch/x86/xen/mmu.c4
-rw-r--r--include/asm-x86/page.h5
-rw-r--r--include/asm-x86/pgtable.h2
-rw-r--r--include/asm-x86/pgtable_32.h2
5 files changed, 11 insertions, 8 deletions
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index cc174fc412bc..a20d1fa64b4e 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -221,7 +221,7 @@ static void walk_pmd_level(struct seq_file *m, struct pg_state *st, pud_t addr,
221 for (i = 0; i < PTRS_PER_PMD; i++) { 221 for (i = 0; i < PTRS_PER_PMD; i++) {
222 st->current_address = normalize_addr(P + i * PMD_LEVEL_MULT); 222 st->current_address = normalize_addr(P + i * PMD_LEVEL_MULT);
223 if (!pmd_none(*start)) { 223 if (!pmd_none(*start)) {
224 pgprotval_t prot = pmd_val(*start) & ~PTE_PFN_MASK; 224 pgprotval_t prot = pmd_val(*start) & PTE_FLAGS_MASK;
225 225
226 if (pmd_large(*start) || !pmd_present(*start)) 226 if (pmd_large(*start) || !pmd_present(*start))
227 note_page(m, st, __pgprot(prot), 3); 227 note_page(m, st, __pgprot(prot), 3);
@@ -253,7 +253,7 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st, pgd_t addr,
253 for (i = 0; i < PTRS_PER_PUD; i++) { 253 for (i = 0; i < PTRS_PER_PUD; i++) {
254 st->current_address = normalize_addr(P + i * PUD_LEVEL_MULT); 254 st->current_address = normalize_addr(P + i * PUD_LEVEL_MULT);
255 if (!pud_none(*start)) { 255 if (!pud_none(*start)) {
256 pgprotval_t prot = pud_val(*start) & ~PTE_PFN_MASK; 256 pgprotval_t prot = pud_val(*start) & PTE_FLAGS_MASK;
257 257
258 if (pud_large(*start) || !pud_present(*start)) 258 if (pud_large(*start) || !pud_present(*start))
259 note_page(m, st, __pgprot(prot), 2); 259 note_page(m, st, __pgprot(prot), 2);
@@ -288,7 +288,7 @@ static void walk_pgd_level(struct seq_file *m)
288 for (i = 0; i < PTRS_PER_PGD; i++) { 288 for (i = 0; i < PTRS_PER_PGD; i++) {
289 st.current_address = normalize_addr(i * PGD_LEVEL_MULT); 289 st.current_address = normalize_addr(i * PGD_LEVEL_MULT);
290 if (!pgd_none(*start)) { 290 if (!pgd_none(*start)) {
291 pgprotval_t prot = pgd_val(*start) & ~PTE_PFN_MASK; 291 pgprotval_t prot = pgd_val(*start) & PTE_FLAGS_MASK;
292 292
293 if (pgd_large(*start) || !pgd_present(*start)) 293 if (pgd_large(*start) || !pgd_present(*start))
294 note_page(m, &st, __pgprot(prot), 1); 294 note_page(m, &st, __pgprot(prot), 1);
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 0db6912395ed..aa37469da696 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -344,7 +344,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
344{ 344{
345 if (val & _PAGE_PRESENT) { 345 if (val & _PAGE_PRESENT) {
346 unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; 346 unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
347 pteval_t flags = val & ~PTE_PFN_MASK; 347 pteval_t flags = val & PTE_FLAGS_MASK;
348 val = ((pteval_t)mfn_to_pfn(mfn) << PAGE_SHIFT) | flags; 348 val = ((pteval_t)mfn_to_pfn(mfn) << PAGE_SHIFT) | flags;
349 } 349 }
350 350
@@ -355,7 +355,7 @@ static pteval_t pte_pfn_to_mfn(pteval_t val)
355{ 355{
356 if (val & _PAGE_PRESENT) { 356 if (val & _PAGE_PRESENT) {
357 unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; 357 unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
358 pteval_t flags = val & ~PTE_PFN_MASK; 358 pteval_t flags = val & PTE_FLAGS_MASK;
359 val = ((pteval_t)pfn_to_mfn(pfn) << PAGE_SHIFT) | flags; 359 val = ((pteval_t)pfn_to_mfn(pfn) << PAGE_SHIFT) | flags;
360 } 360 }
361 361
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index e99fb9fe6f8a..6c846228948d 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -21,6 +21,9 @@
21/* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */ 21/* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */
22#define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK) 22#define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK)
23 23
24/* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */
25#define PTE_FLAGS_MASK (~PTE_PFN_MASK)
26
24#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT) 27#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
25#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1)) 28#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
26 29
@@ -146,7 +149,7 @@ static inline pteval_t native_pte_val(pte_t pte)
146 149
147static inline pteval_t native_pte_flags(pte_t pte) 150static inline pteval_t native_pte_flags(pte_t pte)
148{ 151{
149 return native_pte_val(pte) & ~PTE_PFN_MASK; 152 return native_pte_val(pte) & PTE_FLAGS_MASK;
150} 153}
151 154
152#define pgprot_val(x) ((x).pgprot) 155#define pgprot_val(x) ((x).pgprot)
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index 2b1746c92370..3e5dbc4195f4 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -286,7 +286,7 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
286 return __pgprot(preservebits | addbits); 286 return __pgprot(preservebits | addbits);
287} 287}
288 288
289#define pte_pgprot(x) __pgprot(pte_flags(x) & ~PTE_PFN_MASK) 289#define pte_pgprot(x) __pgprot(pte_flags(x) & PTE_FLAGS_MASK)
290 290
291#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) 291#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask)
292 292
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index 525b53e65b44..5c3b26567a95 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -88,7 +88,7 @@ extern unsigned long pg0[];
88/* To avoid harmful races, pmd_none(x) should check only the lower when PAE */ 88/* To avoid harmful races, pmd_none(x) should check only the lower when PAE */
89#define pmd_none(x) (!(unsigned long)pmd_val((x))) 89#define pmd_none(x) (!(unsigned long)pmd_val((x)))
90#define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT) 90#define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT)
91#define pmd_bad(x) ((pmd_val(x) & (~PTE_PFN_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) 91#define pmd_bad(x) ((pmd_val(x) & (PTE_FLAGS_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
92 92
93#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) 93#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
94 94