18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_HUGETLB_H 38c2ecf20Sopenharmony_ci#define _ASM_POWERPC_HUGETLB_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#ifdef CONFIG_HUGETLB_PAGE 68c2ecf20Sopenharmony_ci#include <asm/page.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_BOOK3S_64 98c2ecf20Sopenharmony_ci#include <asm/book3s/64/hugetlb.h> 108c2ecf20Sopenharmony_ci#elif defined(CONFIG_PPC_FSL_BOOK3E) 118c2ecf20Sopenharmony_ci#include <asm/nohash/hugetlb-book3e.h> 128c2ecf20Sopenharmony_ci#elif defined(CONFIG_PPC_8xx) 138c2ecf20Sopenharmony_ci#include <asm/nohash/32/hugetlb-8xx.h> 148c2ecf20Sopenharmony_ci#endif /* CONFIG_PPC_BOOK3S_64 */ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciextern bool hugetlb_disabled; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_civoid hugetlbpage_init_default(void); 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_civoid flush_dcache_icache_hugepage(struct page *page); 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciint slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, 238c2ecf20Sopenharmony_ci unsigned long len); 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistatic inline int is_hugepage_only_range(struct mm_struct *mm, 268c2ecf20Sopenharmony_ci unsigned long addr, 278c2ecf20Sopenharmony_ci unsigned long len) 288c2ecf20Sopenharmony_ci{ 298c2ecf20Sopenharmony_ci if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !radix_enabled()) 308c2ecf20Sopenharmony_ci return slice_is_hugepage_only_range(mm, addr, len); 318c2ecf20Sopenharmony_ci return 0; 328c2ecf20Sopenharmony_ci} 338c2ecf20Sopenharmony_ci#define is_hugepage_only_range is_hugepage_only_range 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE 368c2ecf20Sopenharmony_civoid hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, 378c2ecf20Sopenharmony_ci unsigned long end, unsigned long floor, 388c2ecf20Sopenharmony_ci unsigned long ceiling); 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR 418c2ecf20Sopenharmony_cistatic inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, 428c2ecf20Sopenharmony_ci unsigned long addr, pte_t *ptep) 438c2ecf20Sopenharmony_ci{ 448c2ecf20Sopenharmony_ci return __pte(pte_update(mm, addr, ptep, ~0UL, 0, 1)); 458c2ecf20Sopenharmony_ci} 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH 488c2ecf20Sopenharmony_cistatic inline void huge_ptep_clear_flush(struct vm_area_struct *vma, 498c2ecf20Sopenharmony_ci unsigned long addr, pte_t *ptep) 508c2ecf20Sopenharmony_ci{ 518c2ecf20Sopenharmony_ci huge_ptep_get_and_clear(vma->vm_mm, addr, ptep); 528c2ecf20Sopenharmony_ci flush_hugetlb_page(vma, addr); 538c2ecf20Sopenharmony_ci} 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS 568c2ecf20Sopenharmony_ciint huge_ptep_set_access_flags(struct vm_area_struct *vma, 578c2ecf20Sopenharmony_ci unsigned long addr, pte_t *ptep, 588c2ecf20Sopenharmony_ci pte_t pte, int dirty); 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_civoid gigantic_hugetlb_cma_reserve(void) __init; 618c2ecf20Sopenharmony_ci#include <asm-generic/hugetlb.h> 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#else /* ! CONFIG_HUGETLB_PAGE */ 648c2ecf20Sopenharmony_cistatic inline void flush_hugetlb_page(struct vm_area_struct *vma, 658c2ecf20Sopenharmony_ci unsigned long vmaddr) 668c2ecf20Sopenharmony_ci{ 678c2ecf20Sopenharmony_ci} 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define hugepd_shift(x) 0 708c2ecf20Sopenharmony_cistatic inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr, 718c2ecf20Sopenharmony_ci unsigned pdshift) 728c2ecf20Sopenharmony_ci{ 738c2ecf20Sopenharmony_ci return NULL; 748c2ecf20Sopenharmony_ci} 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_cistatic inline void __init gigantic_hugetlb_cma_reserve(void) 788c2ecf20Sopenharmony_ci{ 798c2ecf20Sopenharmony_ci} 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#endif /* CONFIG_HUGETLB_PAGE */ 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#endif /* _ASM_POWERPC_HUGETLB_H */ 84