2005-04-17 06:20:36 +08:00
|
|
|
#ifndef _PGTABLE_NOPUD_H
|
|
|
|
#define _PGTABLE_NOPUD_H
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2017-03-09 22:24:04 +08:00
|
|
|
#ifdef __ARCH_USE_5LEVEL_HACK
|
|
|
|
#include <asm-generic/pgtable-nop4d-hack.h>
|
|
|
|
#else
|
2017-03-09 22:24:06 +08:00
|
|
|
#include <asm-generic/pgtable-nop4d.h>
|
2017-03-09 22:24:04 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#define __PAGETABLE_PUD_FOLDED
|
|
|
|
|
|
|
|
/*
|
2017-03-09 22:24:06 +08:00
|
|
|
* Having the pud type consist of a p4d gets the size right, and allows
|
|
|
|
* us to conceptually access the p4d entry that this pud is folded into
|
2005-04-17 06:20:36 +08:00
|
|
|
* without casting.
|
|
|
|
*/
|
2017-03-09 22:24:06 +08:00
|
|
|
typedef struct { p4d_t p4d; } pud_t;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2017-03-09 22:24:06 +08:00
|
|
|
#define PUD_SHIFT P4D_SHIFT
|
2005-04-17 06:20:36 +08:00
|
|
|
#define PTRS_PER_PUD 1
|
|
|
|
#define PUD_SIZE (1UL << PUD_SHIFT)
|
|
|
|
#define PUD_MASK (~(PUD_SIZE-1))
|
|
|
|
|
|
|
|
/*
|
2017-03-09 22:24:06 +08:00
|
|
|
* The "p4d_xxx()" functions here are trivial for a folded two-level
|
2005-04-17 06:20:36 +08:00
|
|
|
* setup: the pud is never bad, and a pud always exists (as it's folded
|
2017-03-09 22:24:06 +08:00
|
|
|
* into the p4d entry)
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2017-03-09 22:24:06 +08:00
|
|
|
static inline int p4d_none(p4d_t p4d) { return 0; }
|
|
|
|
static inline int p4d_bad(p4d_t p4d) { return 0; }
|
|
|
|
static inline int p4d_present(p4d_t p4d) { return 1; }
|
|
|
|
static inline void p4d_clear(p4d_t *p4d) { }
|
|
|
|
#define pud_ERROR(pud) (p4d_ERROR((pud).p4d))
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2017-03-09 22:24:06 +08:00
|
|
|
#define p4d_populate(mm, p4d, pud) do { } while (0)
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2017-03-09 22:24:06 +08:00
|
|
|
* (puds are folded into p4ds so this doesn't get actually called,
|
2005-04-17 06:20:36 +08:00
|
|
|
* but the define is needed for a generic inline function.)
|
|
|
|
*/
|
2017-03-09 22:24:06 +08:00
|
|
|
#define set_p4d(p4dptr, p4dval) set_pud((pud_t *)(p4dptr), (pud_t) { p4dval })
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2017-03-09 22:24:06 +08:00
|
|
|
static inline pud_t *pud_offset(p4d_t *p4d, unsigned long address)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2017-03-09 22:24:06 +08:00
|
|
|
return (pud_t *)p4d;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2017-03-09 22:24:06 +08:00
|
|
|
#define pud_val(x) (p4d_val((x).p4d))
|
|
|
|
#define __pud(x) ((pud_t) { __p4d(x) })
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2017-03-09 22:24:06 +08:00
|
|
|
#define p4d_page(p4d) (pud_page((pud_t){ p4d }))
|
|
|
|
#define p4d_page_vaddr(p4d) (pud_page_vaddr((pud_t){ p4d }))
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* allocating and freeing a pud is trivial: the 1-entry pud is
|
2017-03-09 22:24:06 +08:00
|
|
|
* inside the p4d, so has no extra memory associated with it.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
#define pud_alloc_one(mm, address) NULL
|
2008-02-05 14:29:14 +08:00
|
|
|
#define pud_free(mm, x) do { } while (0)
|
mm: Pass virtual address to [__]p{te,ud,md}_free_tlb()
mm: Pass virtual address to [__]p{te,ud,md}_free_tlb()
Upcoming paches to support the new 64-bit "BookE" powerpc architecture
will need to have the virtual address corresponding to PTE page when
freeing it, due to the way the HW table walker works.
Basically, the TLB can be loaded with "large" pages that cover the whole
virtual space (well, sort-of, half of it actually) represented by a PTE
page, and which contain an "indirect" bit indicating that this TLB entry
RPN points to an array of PTEs from which the TLB can then create direct
entries. Thus, in order to invalidate those when PTE pages are deleted,
we need the virtual address to pass to tlbilx or tlbivax instructions.
The old trick of sticking it somewhere in the PTE page struct page sucks
too much, the address is almost readily available in all call sites and
almost everybody implemets these as macros, so we may as well add the
argument everywhere. I added it to the pmd and pud variants for consistency.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: David Howells <dhowells@redhat.com> [MN10300 & FRV]
Acked-by: Nick Piggin <npiggin@suse.de>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> [s390]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-22 13:44:28 +08:00
|
|
|
#define __pud_free_tlb(tlb, x, a) do { } while (0)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#undef pud_addr_end
|
|
|
|
#define pud_addr_end(addr, end) (end)
|
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
2017-03-09 22:24:04 +08:00
|
|
|
#endif /* !__ARCH_USE_5LEVEL_HACK */
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* _PGTABLE_NOPUD_H */
|