]>
git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/blob - arch/sparc/include/asm/pgalloc_32.h
282be50a4adfcf8fc7a6bdb231cef62dad9c7bb3
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _SPARC_PGALLOC_H
3 #define _SPARC_PGALLOC_H
5 #include <linux/kernel.h>
6 #include <linux/sched.h>
8 #include <asm/pgtsrmmu.h>
9 #include <asm/pgtable.h>
10 #include <asm/vaddrs.h>
15 void *srmmu_get_nocache(int size
, int align
);
16 void srmmu_free_nocache(void *addr
, int size
);
18 extern struct resource sparc_iomap
;
20 #define check_pgt_cache() do { } while (0)
22 pgd_t
*get_pgd_fast(void);
23 static inline void free_pgd_fast(pgd_t
*pgd
)
25 srmmu_free_nocache(pgd
, SRMMU_PGD_TABLE_SIZE
);
28 #define pgd_free(mm, pgd) free_pgd_fast(pgd)
29 #define pgd_alloc(mm) get_pgd_fast()
31 static inline void pgd_set(pgd_t
* pgdp
, pmd_t
* pmdp
)
33 unsigned long pa
= __nocache_pa(pmdp
);
35 set_pte((pte_t
*)pgdp
, __pte((SRMMU_ET_PTD
| (pa
>> 4))));
38 #define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD)
40 static inline pmd_t
*pmd_alloc_one(struct mm_struct
*mm
,
41 unsigned long address
)
43 return srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE
,
44 SRMMU_PMD_TABLE_SIZE
);
47 static inline void free_pmd_fast(pmd_t
* pmd
)
49 srmmu_free_nocache(pmd
, SRMMU_PMD_TABLE_SIZE
);
52 #define pmd_free(mm, pmd) free_pmd_fast(pmd)
53 #define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd)
55 void pmd_populate(struct mm_struct
*mm
, pmd_t
*pmdp
, struct page
*ptep
);
56 #define pmd_pgtable(pmd) pmd_page(pmd)
58 void pmd_set(pmd_t
*pmdp
, pte_t
*ptep
);
59 #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
61 pgtable_t
pte_alloc_one(struct mm_struct
*mm
);
63 static inline pte_t
*pte_alloc_one_kernel(struct mm_struct
*mm
)
65 return srmmu_get_nocache(PTE_SIZE
, PTE_SIZE
);
69 static inline void free_pte_fast(pte_t
*pte
)
71 srmmu_free_nocache(pte
, PTE_SIZE
);
74 #define pte_free_kernel(mm, pte) free_pte_fast(pte)
76 void pte_free(struct mm_struct
* mm
, pgtable_t pte
);
77 #define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte)
79 #endif /* _SPARC_PGALLOC_H */