From: shijie.huang@arm.com (Huang Shijie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] arm64: add a new macro for the pgd table descriptor
Date: Mon, 30 May 2016 10:14:28 +0800 [thread overview]
Message-ID: <1464574468-22700-3-git-send-email-shijie.huang@arm.com> (raw)
In-Reply-To: <1464574468-22700-1-git-send-email-shijie.huang@arm.com>
Add a new macro for the pgd table descriptor to define the "Table"
type, and use it to replace the numerical constant in the pgd_bad().
This patch makes the code more legible.
Signed-off-by: Huang Shijie <shijie.huang@arm.com>
---
arch/arm64/include/asm/pgtable-hwdef.h | 5 +++++
arch/arm64/include/asm/pgtable.h | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
index 54e2fbf..f648c28 100644
--- a/arch/arm64/include/asm/pgtable-hwdef.h
+++ b/arch/arm64/include/asm/pgtable-hwdef.h
@@ -113,6 +113,11 @@
/*
* Hardware page table definitions.
*
+ * Level 0 descriptor (PGD).
+ */
+#define PGD_TABLE_BIT (_AT(pgdval_t, 1) << 1)
+
+/*
* Level 1 descriptor (PUD).
*/
#define PUD_TYPE_TABLE (_AT(pudval_t, 3) << 0)
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 46472a9..bfa0092 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -453,7 +453,7 @@ static inline phys_addr_t pud_page_paddr(pud_t pud)
#define pud_ERROR(pud) __pud_error(__FILE__, __LINE__, pud_val(pud))
#define pgd_none(pgd) (!pgd_val(pgd))
-#define pgd_bad(pgd) (!(pgd_val(pgd) & 2))
+#define pgd_bad(pgd) (!(pgd_val(pgd) & PGD_TABLE_BIT))
#define pgd_present(pgd) (pgd_val(pgd))
static inline void set_pgd(pgd_t *pgdp, pgd_t pgd)
--
2.5.5
next prev parent reply other threads:[~2016-05-30 2:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-30 2:14 [PATCH 1/3] arm64: move the PTE_VALID to pgtable-hwdef.h Huang Shijie
2016-05-30 2:14 ` [PATCH 2/3] arm64: fix the wrong type Huang Shijie
2016-05-30 2:14 ` Huang Shijie [this message]
2016-06-02 18:16 ` [PATCH 1/3] arm64: move the PTE_VALID to pgtable-hwdef.h Will Deacon
2016-06-03 2:32 ` Huang Shijie
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=1464574468-22700-3-git-send-email-shijie.huang@arm.com \
--to=shijie.huang@arm.com \
--cc=linux-arm-kernel@lists.infradead.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).