Commit 642ea3ed authored by Sam Ravnborg's avatar Sam Ravnborg Committed by David S. Miller

sparc32: drop btfixup in pgalloc_32.h

Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5471fa62
...@@ -4,8 +4,11 @@ ...@@ -4,8 +4,11 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <asm/page.h> #include <asm/pgtsrmmu.h>
#include <asm/btfixup.h> #include <asm/btfixup.h>
#include <asm/pgtable.h>
#include <asm/vaddrs.h>
#include <asm/page.h>
struct page; struct page;
...@@ -15,6 +18,10 @@ extern struct pgtable_cache_struct { ...@@ -15,6 +18,10 @@ extern struct pgtable_cache_struct {
unsigned long pgtable_cache_sz; unsigned long pgtable_cache_sz;
unsigned long pgd_cache_sz; unsigned long pgd_cache_sz;
} pgt_quicklists; } pgt_quicklists;
unsigned long srmmu_get_nocache(int size, int align);
void srmmu_free_nocache(unsigned long vaddr, int size);
#define pgd_quicklist (pgt_quicklists.pgd_cache) #define pgd_quicklist (pgt_quicklists.pgd_cache)
#define pmd_quicklist ((unsigned long *)0) #define pmd_quicklist ((unsigned long *)0)
#define pte_quicklist (pgt_quicklists.pte_cache) #define pte_quicklist (pgt_quicklists.pte_cache)
...@@ -23,44 +30,62 @@ extern struct pgtable_cache_struct { ...@@ -23,44 +30,62 @@ extern struct pgtable_cache_struct {
#define check_pgt_cache() do { } while (0) #define check_pgt_cache() do { } while (0)
BTFIXUPDEF_CALL(pgd_t *, get_pgd_fast, void) pgd_t *get_pgd_fast(void);
#define get_pgd_fast() BTFIXUP_CALL(get_pgd_fast)() static inline void free_pgd_fast(pgd_t *pgd)
{
BTFIXUPDEF_CALL(void, free_pgd_fast, pgd_t *) srmmu_free_nocache((unsigned long)pgd, SRMMU_PGD_TABLE_SIZE);
#define free_pgd_fast(pgd) BTFIXUP_CALL(free_pgd_fast)(pgd) }
#define pgd_free(mm, pgd) free_pgd_fast(pgd) #define pgd_free(mm, pgd) free_pgd_fast(pgd)
#define pgd_alloc(mm) get_pgd_fast() #define pgd_alloc(mm) get_pgd_fast()
BTFIXUPDEF_CALL(void, pgd_set, pgd_t *, pmd_t *) static inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp)
#define pgd_set(pgdp,pmdp) BTFIXUP_CALL(pgd_set)(pgdp,pmdp) {
unsigned long pa = __nocache_pa((unsigned long)pmdp);
set_pte((pte_t *)pgdp, (SRMMU_ET_PTD | (pa >> 4)));
}
#define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD) #define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD)
BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_one, struct mm_struct *, unsigned long) static inline pmd_t *pmd_alloc_one(struct mm_struct *mm,
#define pmd_alloc_one(mm, address) BTFIXUP_CALL(pmd_alloc_one)(mm, address) unsigned long address)
{
return (pmd_t *)srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE,
SRMMU_PMD_TABLE_SIZE);
}
BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *) static inline void free_pmd_fast(pmd_t * pmd)
#define free_pmd_fast(pmd) BTFIXUP_CALL(free_pmd_fast)(pmd) {
srmmu_free_nocache((unsigned long)pmd, SRMMU_PMD_TABLE_SIZE);
}
#define pmd_free(mm, pmd) free_pmd_fast(pmd) #define pmd_free(mm, pmd) free_pmd_fast(pmd)
#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd) #define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd)
BTFIXUPDEF_CALL(void, pmd_populate, pmd_t *, struct page *) void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep);
#define pmd_populate(MM, PMD, PTE) BTFIXUP_CALL(pmd_populate)(PMD, PTE)
#define pmd_pgtable(pmd) pmd_page(pmd) #define pmd_pgtable(pmd) pmd_page(pmd)
BTFIXUPDEF_CALL(void, pmd_set, pmd_t *, pte_t *)
#define pmd_populate_kernel(MM, PMD, PTE) BTFIXUP_CALL(pmd_set)(PMD, PTE)
BTFIXUPDEF_CALL(pgtable_t , pte_alloc_one, struct mm_struct *, unsigned long) void pmd_set(pmd_t *pmdp, pte_t *ptep);
#define pte_alloc_one(mm, address) BTFIXUP_CALL(pte_alloc_one)(mm, address) #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
BTFIXUPDEF_CALL(pte_t *, pte_alloc_one_kernel, struct mm_struct *, unsigned long)
#define pte_alloc_one_kernel(mm, addr) BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr) 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)
{
return (pte_t *)srmmu_get_nocache(PTE_SIZE, PTE_SIZE);
}
static inline void free_pte_fast(pte_t *pte)
{
srmmu_free_nocache((unsigned long)pte, PTE_SIZE);
}
BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *) #define pte_free_kernel(mm, pte) free_pte_fast(pte)
#define pte_free_kernel(mm, pte) BTFIXUP_CALL(free_pte_fast)(pte)
BTFIXUPDEF_CALL(void, pte_free, pgtable_t ) void pte_free(struct mm_struct * mm, pgtable_t pte);
#define pte_free(mm, pte) BTFIXUP_CALL(pte_free)(pte)
#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte) #define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte)
#endif /* _SPARC_PGALLOC_H */ #endif /* _SPARC_PGALLOC_H */
...@@ -132,10 +132,7 @@ static inline pte_t srmmu_pte_mkold(pte_t pte) ...@@ -132,10 +132,7 @@ static inline pte_t srmmu_pte_mkold(pte_t pte)
static inline void srmmu_ctxd_set(ctxd_t *ctxp, pgd_t *pgdp) static inline void srmmu_ctxd_set(ctxd_t *ctxp, pgd_t *pgdp)
{ set_pte((pte_t *)ctxp, (SRMMU_ET_PTD | (__nocache_pa((unsigned long) pgdp) >> 4))); } { set_pte((pte_t *)ctxp, (SRMMU_ET_PTD | (__nocache_pa((unsigned long) pgdp) >> 4))); }
static inline void srmmu_pgd_set(pgd_t * pgdp, pmd_t * pmdp) void pmd_set(pmd_t *pmdp, pte_t *ptep)
{ set_pte((pte_t *)pgdp, (SRMMU_ET_PTD | (__nocache_pa((unsigned long) pmdp) >> 4))); }
static void srmmu_pmd_set(pmd_t *pmdp, pte_t *ptep)
{ {
unsigned long ptp; /* Physical address, shifted right by 4 */ unsigned long ptp; /* Physical address, shifted right by 4 */
int i; int i;
...@@ -147,7 +144,7 @@ static void srmmu_pmd_set(pmd_t *pmdp, pte_t *ptep) ...@@ -147,7 +144,7 @@ static void srmmu_pmd_set(pmd_t *pmdp, pte_t *ptep)
} }
} }
static void srmmu_pmd_populate(pmd_t *pmdp, struct page *ptep) void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep)
{ {
unsigned long ptp; /* Physical address, shifted right by 4 */ unsigned long ptp; /* Physical address, shifted right by 4 */
int i; int i;
...@@ -232,7 +229,7 @@ static unsigned long __srmmu_get_nocache(int size, int align) ...@@ -232,7 +229,7 @@ static unsigned long __srmmu_get_nocache(int size, int align)
return (SRMMU_NOCACHE_VADDR + (offset << SRMMU_NOCACHE_BITMAP_SHIFT)); return (SRMMU_NOCACHE_VADDR + (offset << SRMMU_NOCACHE_BITMAP_SHIFT));
} }
static unsigned long srmmu_get_nocache(int size, int align) unsigned long srmmu_get_nocache(int size, int align)
{ {
unsigned long tmp; unsigned long tmp;
...@@ -244,7 +241,7 @@ static unsigned long srmmu_get_nocache(int size, int align) ...@@ -244,7 +241,7 @@ static unsigned long srmmu_get_nocache(int size, int align)
return tmp; return tmp;
} }
static void srmmu_free_nocache(unsigned long vaddr, int size) void srmmu_free_nocache(unsigned long vaddr, int size)
{ {
int offset; int offset;
...@@ -354,7 +351,7 @@ static void __init srmmu_nocache_init(void) ...@@ -354,7 +351,7 @@ static void __init srmmu_nocache_init(void)
flush_tlb_all(); flush_tlb_all();
} }
static inline pgd_t *srmmu_get_pgd_fast(void) pgd_t *get_pgd_fast(void)
{ {
pgd_t *pgd = NULL; pgd_t *pgd = NULL;
...@@ -369,21 +366,6 @@ static inline pgd_t *srmmu_get_pgd_fast(void) ...@@ -369,21 +366,6 @@ static inline pgd_t *srmmu_get_pgd_fast(void)
return pgd; return pgd;
} }
static void srmmu_free_pgd_fast(pgd_t *pgd)
{
srmmu_free_nocache((unsigned long)pgd, SRMMU_PGD_TABLE_SIZE);
}
static pmd_t *srmmu_pmd_alloc_one(struct mm_struct *mm, unsigned long address)
{
return (pmd_t *)srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE);
}
static void srmmu_pmd_free(pmd_t * pmd)
{
srmmu_free_nocache((unsigned long)pmd, SRMMU_PMD_TABLE_SIZE);
}
/* /*
* Hardware needs alignment to 256 only, but we align to whole page size * Hardware needs alignment to 256 only, but we align to whole page size
* to reduce fragmentation problems due to the buddy principle. * to reduce fragmentation problems due to the buddy principle.
...@@ -392,31 +374,19 @@ static void srmmu_pmd_free(pmd_t * pmd) ...@@ -392,31 +374,19 @@ static void srmmu_pmd_free(pmd_t * pmd)
* Alignments up to the page size are the same for physical and virtual * Alignments up to the page size are the same for physical and virtual
* addresses of the nocache area. * addresses of the nocache area.
*/ */
static pte_t * pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
srmmu_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
{
return (pte_t *)srmmu_get_nocache(PTE_SIZE, PTE_SIZE);
}
static pgtable_t
srmmu_pte_alloc_one(struct mm_struct *mm, unsigned long address)
{ {
unsigned long pte; unsigned long pte;
struct page *page; struct page *page;
if ((pte = (unsigned long)srmmu_pte_alloc_one_kernel(mm, address)) == 0) if ((pte = (unsigned long)pte_alloc_one_kernel(mm, address)) == 0)
return NULL; return NULL;
page = pfn_to_page( __nocache_pa(pte) >> PAGE_SHIFT ); page = pfn_to_page( __nocache_pa(pte) >> PAGE_SHIFT );
pgtable_page_ctor(page); pgtable_page_ctor(page);
return page; return page;
} }
static void srmmu_free_pte_fast(pte_t *pte) void pte_free(struct mm_struct *mm, pgtable_t pte)
{
srmmu_free_nocache((unsigned long)pte, PTE_SIZE);
}
static void srmmu_pte_free(pgtable_t pte)
{ {
unsigned long p; unsigned long p;
...@@ -977,7 +947,7 @@ static void __init srmmu_early_allocate_ptable_skeleton(unsigned long start, ...@@ -977,7 +947,7 @@ static void __init srmmu_early_allocate_ptable_skeleton(unsigned long start,
if (pmdp == NULL) if (pmdp == NULL)
early_pgtable_allocfail("pmd"); early_pgtable_allocfail("pmd");
memset(__nocache_fix(pmdp), 0, SRMMU_PMD_TABLE_SIZE); memset(__nocache_fix(pmdp), 0, SRMMU_PMD_TABLE_SIZE);
srmmu_pgd_set(__nocache_fix(pgdp), pmdp); pgd_set(__nocache_fix(pgdp), pmdp);
} }
pmdp = srmmu_pmd_offset(__nocache_fix(pgdp), start); pmdp = srmmu_pmd_offset(__nocache_fix(pgdp), start);
if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) { if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) {
...@@ -985,7 +955,7 @@ static void __init srmmu_early_allocate_ptable_skeleton(unsigned long start, ...@@ -985,7 +955,7 @@ static void __init srmmu_early_allocate_ptable_skeleton(unsigned long start,
if (ptep == NULL) if (ptep == NULL)
early_pgtable_allocfail("pte"); early_pgtable_allocfail("pte");
memset(__nocache_fix(ptep), 0, PTE_SIZE); memset(__nocache_fix(ptep), 0, PTE_SIZE);
srmmu_pmd_set(__nocache_fix(pmdp), ptep); pmd_set(__nocache_fix(pmdp), ptep);
} }
if (start > (0xffffffffUL - PMD_SIZE)) if (start > (0xffffffffUL - PMD_SIZE))
break; break;
...@@ -1007,7 +977,7 @@ static void __init srmmu_allocate_ptable_skeleton(unsigned long start, ...@@ -1007,7 +977,7 @@ static void __init srmmu_allocate_ptable_skeleton(unsigned long start,
if (pmdp == NULL) if (pmdp == NULL)
early_pgtable_allocfail("pmd"); early_pgtable_allocfail("pmd");
memset(pmdp, 0, SRMMU_PMD_TABLE_SIZE); memset(pmdp, 0, SRMMU_PMD_TABLE_SIZE);
srmmu_pgd_set(pgdp, pmdp); pgd_set(pgdp, pmdp);
} }
pmdp = srmmu_pmd_offset(pgdp, start); pmdp = srmmu_pmd_offset(pgdp, start);
if(srmmu_pmd_none(*pmdp)) { if(srmmu_pmd_none(*pmdp)) {
...@@ -1016,7 +986,7 @@ static void __init srmmu_allocate_ptable_skeleton(unsigned long start, ...@@ -1016,7 +986,7 @@ static void __init srmmu_allocate_ptable_skeleton(unsigned long start,
if (ptep == NULL) if (ptep == NULL)
early_pgtable_allocfail("pte"); early_pgtable_allocfail("pte");
memset(ptep, 0, PTE_SIZE); memset(ptep, 0, PTE_SIZE);
srmmu_pmd_set(pmdp, ptep); pmd_set(pmdp, ptep);
} }
if (start > (0xffffffffUL - PMD_SIZE)) if (start > (0xffffffffUL - PMD_SIZE))
break; break;
...@@ -1073,7 +1043,7 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start, ...@@ -1073,7 +1043,7 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start,
if (pmdp == NULL) if (pmdp == NULL)
early_pgtable_allocfail("pmd"); early_pgtable_allocfail("pmd");
memset(__nocache_fix(pmdp), 0, SRMMU_PMD_TABLE_SIZE); memset(__nocache_fix(pmdp), 0, SRMMU_PMD_TABLE_SIZE);
srmmu_pgd_set(__nocache_fix(pgdp), pmdp); pgd_set(__nocache_fix(pgdp), pmdp);
} }
pmdp = srmmu_pmd_offset(__nocache_fix(pgdp), start); pmdp = srmmu_pmd_offset(__nocache_fix(pgdp), start);
if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) { if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) {
...@@ -1082,7 +1052,7 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start, ...@@ -1082,7 +1052,7 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start,
if (ptep == NULL) if (ptep == NULL)
early_pgtable_allocfail("pte"); early_pgtable_allocfail("pte");
memset(__nocache_fix(ptep), 0, PTE_SIZE); memset(__nocache_fix(ptep), 0, PTE_SIZE);
srmmu_pmd_set(__nocache_fix(pmdp), ptep); pmd_set(__nocache_fix(pmdp), ptep);
} }
if(what == 1) { if(what == 1) {
/* /*
...@@ -2047,23 +2017,10 @@ void __init load_mmu(void) ...@@ -2047,23 +2017,10 @@ void __init load_mmu(void)
BTFIXUPSET_CALL(pgd_page_vaddr, srmmu_pgd_page, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(pgd_page_vaddr, srmmu_pgd_page, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pgd_set, srmmu_pgd_set, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pmd_set, srmmu_pmd_set, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pmd_populate, srmmu_pmd_populate, BTFIXUPCALL_NORM);
BTFIXUPSET_INT(pte_modify_mask, SRMMU_CHG_MASK); BTFIXUPSET_INT(pte_modify_mask, SRMMU_CHG_MASK);
BTFIXUPSET_CALL(pmd_offset, srmmu_pmd_offset, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(pmd_offset, srmmu_pmd_offset, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pte_offset_kernel, srmmu_pte_offset, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(pte_offset_kernel, srmmu_pte_offset, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(free_pte_fast, srmmu_free_pte_fast, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pte_free, srmmu_pte_free, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pte_alloc_one_kernel, srmmu_pte_alloc_one_kernel, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pte_alloc_one, srmmu_pte_alloc_one, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(free_pmd_fast, srmmu_pmd_free, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pmd_alloc_one, srmmu_pmd_alloc_one, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(free_pgd_fast, srmmu_free_pgd_fast, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(get_pgd_fast, srmmu_get_pgd_fast, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(update_mmu_cache, srmmu_update_mmu_cache, BTFIXUPCALL_NOP); BTFIXUPSET_CALL(update_mmu_cache, srmmu_update_mmu_cache, BTFIXUPCALL_NOP);
BTFIXUPSET_CALL(destroy_context, srmmu_destroy_context, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(destroy_context, srmmu_destroy_context, BTFIXUPCALL_NORM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment