From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, the arch/x86 maintainers <x86@kernel.org>
Subject: [PATCH 34 of 36] x86: add and use pgd/pud/pmd_flags
Date: Thu, 05 Feb 2009 11:31:16 -0800 [thread overview]
Message-ID: <f30a907410659b663f96.1233862276@abulafia.goop.org> (raw)
In-Reply-To: <patchbomb.1233862242@abulafia.goop.org>
Add pgd/pud/pmd_flags which are analogous to pte_flags, and use them
where-ever we only care about testing the flags portions of the
respective entries.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
arch/x86/include/asm/page.h | 15 +++++++++++++++
arch/x86/include/asm/pgtable.h | 16 ++++++++--------
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h
--- a/arch/x86/include/asm/page.h
+++ b/arch/x86/include/asm/page.h
@@ -95,6 +95,11 @@
return pgd.pgd;
}
+static inline pgdval_t pgd_flags(pgd_t pgd)
+{
+ return native_pgd_val(pgd) & PTE_FLAGS_MASK;
+}
+
#if PAGETABLE_LEVELS >= 3
#if PAGETABLE_LEVELS == 4
typedef struct { pudval_t pud; } pud_t;
@@ -117,6 +122,11 @@
}
#endif /* PAGETABLE_LEVELS == 4 */
+static inline pudval_t pud_flags(pud_t pud)
+{
+ return native_pud_val(pud) & PTE_FLAGS_MASK;
+}
+
typedef struct { pmdval_t pmd; } pmd_t;
static inline pmd_t native_make_pmd(pmdval_t val)
@@ -128,6 +138,11 @@
{
return pmd.pmd;
}
+
+static inline pmdval_t pmd_flags(pmd_t pmd)
+{
+ return native_pmd_val(pmd) & PTE_FLAGS_MASK;
+}
#else /* PAGETABLE_LEVELS == 2 */
#include <asm-generic/pgtable-nopmd.h>
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -241,7 +241,7 @@
static inline int pmd_large(pmd_t pte)
{
- return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
+ return (pmd_flags(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
(_PAGE_PSE | _PAGE_PRESENT);
}
@@ -496,7 +496,7 @@
static inline int pmd_present(pmd_t pmd)
{
- return pmd_val(pmd) & _PAGE_PRESENT;
+ return pmd_flags(pmd) & _PAGE_PRESENT;
}
static inline int pmd_none(pmd_t pmd)
@@ -554,7 +554,7 @@
static inline int pmd_bad(pmd_t pmd)
{
- return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
+ return (pmd_flags(pmd) & ~_PAGE_USER) != _KERNPG_TABLE;
}
static inline unsigned long pages_to_mb(unsigned long npg)
@@ -573,7 +573,7 @@
static inline int pud_present(pud_t pud)
{
- return pud_val(pud) & _PAGE_PRESENT;
+ return pud_flags(pud) & _PAGE_PRESENT;
}
static inline unsigned long pud_page_vaddr(pud_t pud)
@@ -599,20 +599,20 @@
static inline int pud_large(pud_t pud)
{
- return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
+ return (pud_flags(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
(_PAGE_PSE | _PAGE_PRESENT);
}
static inline int pud_bad(pud_t pud)
{
- return (pud_val(pud) & ~(PTE_PFN_MASK | _KERNPG_TABLE | _PAGE_USER)) != 0;
+ return (pud_flags(pud) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0;
}
#endif /* PAGETABLE_LEVELS > 2 */
#if PAGETABLE_LEVELS > 3
static inline int pgd_present(pgd_t pgd)
{
- return pgd_val(pgd) & _PAGE_PRESENT;
+ return pgd_flags(pgd) & _PAGE_PRESENT;
}
static inline unsigned long pgd_page_vaddr(pgd_t pgd)
@@ -638,7 +638,7 @@
static inline int pgd_bad(pgd_t pgd)
{
- return (pgd_val(pgd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
+ return (pgd_flags(pgd) & ~_PAGE_USER) != _KERNPG_TABLE;
}
static inline int pgd_none(pgd_t pgd)
next prev parent reply other threads:[~2009-02-05 19:40 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 19:30 [PATCH 00 of 36] x86: clean up pte functions in pgtable*.h Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 01 of 36] x86: unify pte_none Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 02 of 36] x86: unify pte_same Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 03 of 36] x86: unify pte_present Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 04 of 36] x86: make _PAGE_HIDDEN conditional Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 05 of 36] x86: unify pte_hidden Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 06 of 36] x86: unify pud_present Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 07 of 36] x86: unify pgd_present Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 08 of 36] x86: unify pmd_present Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 09 of 36] x86: unify pmd_none Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 10 of 36] x86: unify pgd_page_vaddr Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 11 of 36] x86: unify pud_page_vaddr Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 12 of 36] x86: include pgtable_SIZE.h earlier Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 13 of 36] x86: unify pud_page Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 14 of 36] x86: unify pgd_page Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 15 of 36] x86: unify pud_index Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 16 of 36] x86: unify pud_offset Jeremy Fitzhardinge
2009-02-05 19:30 ` [PATCH 17 of 36] x86: unify pmd_page_vaddr Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 18 of 36] x86: unify pmd_page Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 19 of 36] x86: unify pmd_index Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 20 of 36] x86: unify pmd_offset Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 21 of 36] x86: remove redundant pfn_pmd definition Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 22 of 36] x86: unify pmd_pfn Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 23 " Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 24 of 36] x86: unify pte_index Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 25 of 36] x86: unify pte_offset_kernel Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 26 of 36] x86: unify pud_large Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 27 of 36] x86: unify pgd_bad Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 28 " Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 29 of 36] x86: unify pmd_bad Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 30 of 36] x86: unify pages_to_mb Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 31 of 36] x86: unify pud_none Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 32 of 36] x86: unify pgd_none Jeremy Fitzhardinge
2009-02-05 19:31 ` [PATCH 33 of 36] x86: unify io_remap_pfn_range Jeremy Fitzhardinge
2009-02-05 19:31 ` Jeremy Fitzhardinge [this message]
2009-02-05 19:31 ` [PATCH 35 of 36] x86: make pgd/pud/pmd/pte_none consistent Jeremy Fitzhardinge
2009-02-06 15:29 ` Ian Campbell
2009-02-06 15:45 ` Ian Campbell
2009-02-06 17:43 ` Ian Campbell
2009-02-05 19:31 ` [PATCH 36 of 36] x86: make the X_bad functions consistent Jeremy Fitzhardinge
2009-02-05 20:25 ` Hugh Dickins
2009-02-05 20:39 ` Jeremy Fitzhardinge
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=f30a907410659b663f96.1233862276@abulafia.goop.org \
--to=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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;
as well as URLs for NNTP newsgroup(s).