2019-05-27 08:55:01 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2007-04-30 16:30:56 +10:00
|
|
|
#ifndef _ASM_POWERPC_PGALLOC_64_H
|
|
|
|
#define _ASM_POWERPC_PGALLOC_64_H
|
|
|
|
/*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/cpumask.h>
|
|
|
|
#include <linux/percpu.h>
|
|
|
|
|
2010-04-21 16:21:03 +00:00
|
|
|
struct vmemmap_backing {
|
|
|
|
struct vmemmap_backing *list;
|
|
|
|
unsigned long phys;
|
|
|
|
unsigned long virt_addr;
|
|
|
|
};
|
2013-11-15 23:01:32 +05:30
|
|
|
extern struct vmemmap_backing *vmemmap_list;
|
2010-04-21 16:21:03 +00:00
|
|
|
|
2022-06-23 10:56:57 +02:00
|
|
|
static inline void p4d_populate(struct mm_struct *mm, p4d_t *p4d, pud_t *pud)
|
|
|
|
{
|
|
|
|
p4d_set(p4d, (unsigned long)pud);
|
|
|
|
}
|
2007-04-30 16:30:56 +10:00
|
|
|
|
|
|
|
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
|
|
|
|
{
|
2017-05-02 15:17:04 +10:00
|
|
|
return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE),
|
|
|
|
pgtable_gfp_flags(mm, GFP_KERNEL));
|
2007-04-30 16:30:56 +10:00
|
|
|
}
|
|
|
|
|
2008-02-04 22:29:14 -08:00
|
|
|
static inline void pud_free(struct mm_struct *mm, pud_t *pud)
|
2007-04-30 16:30:56 +10:00
|
|
|
{
|
2009-10-28 16:27:18 +00:00
|
|
|
kmem_cache_free(PGT_CACHE(PUD_INDEX_SIZE), pud);
|
2007-04-30 16:30:56 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
|
|
|
|
{
|
2016-04-29 23:26:15 +10:00
|
|
|
pud_set(pud, (unsigned long)pmd);
|
2007-04-30 16:30:56 +10:00
|
|
|
}
|
|
|
|
|
2015-12-01 09:06:35 +05:30
|
|
|
static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
|
|
|
|
pte_t *pte)
|
|
|
|
{
|
2016-04-29 23:26:15 +10:00
|
|
|
pmd_set(pmd, (unsigned long)pte);
|
2015-12-01 09:06:35 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
|
|
|
|
pgtable_t pte_page)
|
|
|
|
{
|
2019-04-26 15:58:01 +00:00
|
|
|
pmd_set(pmd, (unsigned long)pte_page);
|
2015-12-01 09:06:35 +05:30
|
|
|
}
|
|
|
|
|
2018-04-16 16:57:19 +05:30
|
|
|
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
|
|
|
|
{
|
|
|
|
return kmem_cache_alloc(PGT_CACHE(PMD_CACHE_INDEX),
|
|
|
|
pgtable_gfp_flags(mm, GFP_KERNEL));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
|
|
|
|
{
|
|
|
|
kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd);
|
|
|
|
}
|
|
|
|
|
2009-10-28 16:27:18 +00:00
|
|
|
#define __pmd_free_tlb(tlb, pmd, addr) \
|
2013-06-20 14:30:14 +05:30
|
|
|
pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX)
|
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 15:44:28 +10:00
|
|
|
#define __pud_free_tlb(tlb, pud, addr) \
|
2009-10-28 16:27:18 +00:00
|
|
|
pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE)
|
|
|
|
|
2007-04-30 16:30:56 +10:00
|
|
|
#endif /* _ASM_POWERPC_PGALLOC_64_H */
|