Linux-mm Archive on
 help / color / Atom feed
* [patch 049/158] arm64: mm: add p?d_leaf() definitions
@ 2019-12-01  1:51 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2019-12-01  1:51 UTC (permalink / raw)
  To: akpm, alex, aou, ard.biesheuvel, arnd, aryabinin, benh,
	borntraeger, bp, catalin.marinas, dave.hansen, dave.jiang, davem,
	dvyukov, glider, gor, heiko.carstens, hpa, james.morse, jhogan,
	kan.liang, linux-mm, linux, luto, mark.rutland, mawilcox, mingo,
	mm-commits, mpe, n-horiguchi, palmer, paul.burton, paul.walmsley,
	paulus, peterz, ralf, shashim, steven.price, tglx, torvalds,
	vgupta, will,

From: Steven Price <>
Subject: arm64: mm: add p?d_leaf() definitions

walk_page_range() is going to be allowed to walk page tables other than
those of user space.  For this it needs to know when it has reached a
'leaf' entry in the page tables.  This information will be provided by the
p?d_leaf() functions/macros.

For arm64, we already have p?d_sect() macros which we can reuse for

pud_sect() is defined as a dummy function when CONFIG_PGTABLE_LEVELS < 3
or CONFIG_ARM64_64K_PAGES is defined.  However when the kernel is
configured this way then architecturally it isn't allowed to have a large
page at this level, and any code using these page walking macros is
implicitly relying on the page size/number of levels being the same as the
kernel.  So it is safe to reuse this for p?d_leaf() as it is an
architectural restriction.

Signed-off-by: Steven Price <>
Acked-by: Catalin Marinas <>
Cc: Will Deacon <>
Cc: Albert Ou <>
Cc: Alexander Potapenko <>
Cc: Alexandre Ghiti <>
Cc: Andrey Ryabinin <>
Cc: Andy Lutomirski <>
Cc: Ard Biesheuvel <>
Cc: Arnd Bergmann <>
Cc: Benjamin Herrenschmidt <>
Cc: Borislav Petkov <>
Cc: Christian Borntraeger <>
Cc: Dave Hansen <>
Cc: Dave Jiang <>
Cc: David S. Miller <>
Cc: Dmitry Vyukov <>
Cc: Heiko Carstens <>
Cc: "H. Peter Anvin" <>
Cc: Ingo Molnar <>
Cc: James Hogan <>
Cc: James Morse <>
Cc: "Liang, Kan" <>
Cc: Mark Rutland <>
Cc: Matthew Wilcox <>
Cc: Michael Ellerman <>
Cc: Naoya Horiguchi <>
Cc: Palmer Dabbelt <>
Cc: Paul Burton <>
Cc: Paul Mackerras <>
Cc: Paul Walmsley <>
Cc: Peter Zijlstra <>
Cc: Ralf Baechle <>
Cc: Russell King <>
Cc: Shiraz Hashim <>
Cc: Thomas Gleixner <>
Cc: Vasily Gorbik <>
Cc: Vineet Gupta <>
Cc: Zong Li <>
Signed-off-by: Andrew Morton <>

 arch/arm64/include/asm/pgtable.h |    2 ++
 1 file changed, 2 insertions(+)

--- a/arch/arm64/include/asm/pgtable.h~arm64-mm-add-pd_leaf-definitions
+++ a/arch/arm64/include/asm/pgtable.h
@@ -445,6 +445,7 @@ extern pgprot_t phys_mem_access_prot(str
 #define pmd_sect(pmd)		((pmd_val(pmd) & PMD_TYPE_MASK) == \
+#define pmd_leaf(pmd)		pmd_sect(pmd)
 static inline bool pud_sect(pud_t pud) { return false; }
@@ -529,6 +530,7 @@ static inline void pte_unmap(pte_t *pte)
 #define pud_none(pud)		(!pud_val(pud))
 #define pud_bad(pud)		(!(pud_val(pud) & PUD_TABLE_BIT))
 #define pud_present(pud)	pte_present(pud_pte(pud))
+#define pud_leaf(pud)		pud_sect(pud)
 #define pud_valid(pud)		pte_valid(pud_pte(pud))
 static inline void set_pud(pud_t *pudp, pud_t pud)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-01  1:51 [patch 049/158] arm64: mm: add p?d_leaf() definitions akpm

Linux-mm Archive on

Archives are clonable:
	git clone --mirror linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ \
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone