2008-07-18 11:55:51 +07:00
|
|
|
#ifndef _SPARC_PGALLOC_H
|
|
|
|
#define _SPARC_PGALLOC_H
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
|
2012-05-13 13:40:27 +07:00
|
|
|
#include <asm/pgtsrmmu.h>
|
|
|
|
#include <asm/pgtable.h>
|
|
|
|
#include <asm/vaddrs.h>
|
|
|
|
#include <asm/page.h>
|
2008-07-18 11:55:51 +07:00
|
|
|
|
|
|
|
struct page;
|
|
|
|
|
2012-07-26 18:02:14 +07:00
|
|
|
void *srmmu_get_nocache(int size, int align);
|
|
|
|
void srmmu_free_nocache(void *addr, int size);
|
2012-05-13 13:40:27 +07:00
|
|
|
|
2014-04-22 02:39:27 +07:00
|
|
|
extern struct resource sparc_iomap;
|
|
|
|
|
2012-05-12 15:04:12 +07:00
|
|
|
#define check_pgt_cache() do { } while (0)
|
2008-07-18 11:55:51 +07:00
|
|
|
|
2012-05-13 13:40:27 +07:00
|
|
|
pgd_t *get_pgd_fast(void);
|
|
|
|
static inline void free_pgd_fast(pgd_t *pgd)
|
|
|
|
{
|
2012-07-26 18:02:14 +07:00
|
|
|
srmmu_free_nocache(pgd, SRMMU_PGD_TABLE_SIZE);
|
2012-05-13 13:40:27 +07:00
|
|
|
}
|
2008-07-18 11:55:51 +07:00
|
|
|
|
|
|
|
#define pgd_free(mm, pgd) free_pgd_fast(pgd)
|
|
|
|
#define pgd_alloc(mm) get_pgd_fast()
|
|
|
|
|
2012-05-13 13:40:27 +07:00
|
|
|
static inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp)
|
|
|
|
{
|
2016-04-23 00:41:07 +07:00
|
|
|
unsigned long pa = __nocache_pa(pmdp);
|
2012-05-13 13:40:27 +07:00
|
|
|
|
2016-04-23 00:41:06 +07:00
|
|
|
set_pte((pte_t *)pgdp, __pte((SRMMU_ET_PTD | (pa >> 4))));
|
2012-05-13 13:40:27 +07:00
|
|
|
}
|
|
|
|
|
2008-07-18 11:55:51 +07:00
|
|
|
#define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD)
|
|
|
|
|
2012-05-13 13:40:27 +07:00
|
|
|
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm,
|
|
|
|
unsigned long address)
|
|
|
|
{
|
2012-07-26 18:02:14 +07:00
|
|
|
return srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE,
|
|
|
|
SRMMU_PMD_TABLE_SIZE);
|
2012-05-13 13:40:27 +07:00
|
|
|
}
|
2008-07-18 11:55:51 +07:00
|
|
|
|
2012-05-13 13:40:27 +07:00
|
|
|
static inline void free_pmd_fast(pmd_t * pmd)
|
|
|
|
{
|
2012-07-26 18:02:14 +07:00
|
|
|
srmmu_free_nocache(pmd, SRMMU_PMD_TABLE_SIZE);
|
2012-05-13 13:40:27 +07:00
|
|
|
}
|
2008-07-18 11:55:51 +07:00
|
|
|
|
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 12:44:28 +07:00
|
|
|
#define pmd_free(mm, pmd) free_pmd_fast(pmd)
|
|
|
|
#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd)
|
2008-07-18 11:55:51 +07:00
|
|
|
|
2012-05-13 13:40:27 +07:00
|
|
|
void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep);
|
2008-07-18 11:55:51 +07:00
|
|
|
#define pmd_pgtable(pmd) pmd_page(pmd)
|
|
|
|
|
2012-05-13 13:40:27 +07:00
|
|
|
void pmd_set(pmd_t *pmdp, pte_t *ptep);
|
|
|
|
#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
|
|
|
|
|
|
|
|
pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address);
|
|
|
|
|
|
|
|
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
|
|
|
|
unsigned long address)
|
|
|
|
{
|
2012-07-26 18:02:14 +07:00
|
|
|
return srmmu_get_nocache(PTE_SIZE, PTE_SIZE);
|
2012-05-13 13:40:27 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void free_pte_fast(pte_t *pte)
|
|
|
|
{
|
2012-07-26 18:02:14 +07:00
|
|
|
srmmu_free_nocache(pte, PTE_SIZE);
|
2012-05-13 13:40:27 +07:00
|
|
|
}
|
2008-07-18 11:55:51 +07:00
|
|
|
|
2012-05-13 13:40:27 +07:00
|
|
|
#define pte_free_kernel(mm, pte) free_pte_fast(pte)
|
2008-07-18 11:55:51 +07:00
|
|
|
|
2012-05-13 13:40:27 +07:00
|
|
|
void pte_free(struct mm_struct * mm, pgtable_t pte);
|
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 12:44:28 +07:00
|
|
|
#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte)
|
2008-07-18 11:55:51 +07:00
|
|
|
|
|
|
|
#endif /* _SPARC_PGALLOC_H */
|