18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_PGTABLE_RADIX_H
38c2ecf20Sopenharmony_ci#define _ASM_POWERPC_PGTABLE_RADIX_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <asm/asm-const.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
88c2ecf20Sopenharmony_ci#include <asm/cmpxchg.h>
98c2ecf20Sopenharmony_ci#endif
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_64K_PAGES
128c2ecf20Sopenharmony_ci#include <asm/book3s/64/radix-64k.h>
138c2ecf20Sopenharmony_ci#else
148c2ecf20Sopenharmony_ci#include <asm/book3s/64/radix-4k.h>
158c2ecf20Sopenharmony_ci#endif
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
188c2ecf20Sopenharmony_ci#include <asm/book3s/64/tlbflush-radix.h>
198c2ecf20Sopenharmony_ci#include <asm/cpu_has_feature.h>
208c2ecf20Sopenharmony_ci#endif
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* An empty PTE can still have a R or C writeback */
238c2ecf20Sopenharmony_ci#define RADIX_PTE_NONE_MASK		(_PAGE_DIRTY | _PAGE_ACCESSED)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Bits to set in a RPMD/RPUD/RPGD */
268c2ecf20Sopenharmony_ci#define RADIX_PMD_VAL_BITS		(0x8000000000000000UL | RADIX_PTE_INDEX_SIZE)
278c2ecf20Sopenharmony_ci#define RADIX_PUD_VAL_BITS		(0x8000000000000000UL | RADIX_PMD_INDEX_SIZE)
288c2ecf20Sopenharmony_ci#define RADIX_PGD_VAL_BITS		(0x8000000000000000UL | RADIX_PUD_INDEX_SIZE)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* Don't have anything in the reserved bits and leaf bits */
318c2ecf20Sopenharmony_ci#define RADIX_PMD_BAD_BITS		0x60000000000000e0UL
328c2ecf20Sopenharmony_ci#define RADIX_PUD_BAD_BITS		0x60000000000000e0UL
338c2ecf20Sopenharmony_ci#define RADIX_P4D_BAD_BITS		0x60000000000000e0UL
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define RADIX_PMD_SHIFT		(PAGE_SHIFT + RADIX_PTE_INDEX_SIZE)
368c2ecf20Sopenharmony_ci#define RADIX_PUD_SHIFT		(RADIX_PMD_SHIFT + RADIX_PMD_INDEX_SIZE)
378c2ecf20Sopenharmony_ci#define RADIX_PGD_SHIFT		(RADIX_PUD_SHIFT + RADIX_PUD_INDEX_SIZE)
388c2ecf20Sopenharmony_ci/*
398c2ecf20Sopenharmony_ci * Size of EA range mapped by our pagetables.
408c2ecf20Sopenharmony_ci */
418c2ecf20Sopenharmony_ci#define RADIX_PGTABLE_EADDR_SIZE (RADIX_PTE_INDEX_SIZE + RADIX_PMD_INDEX_SIZE +	\
428c2ecf20Sopenharmony_ci			      RADIX_PUD_INDEX_SIZE + RADIX_PGD_INDEX_SIZE + PAGE_SHIFT)
438c2ecf20Sopenharmony_ci#define RADIX_PGTABLE_RANGE (ASM_CONST(1) << RADIX_PGTABLE_EADDR_SIZE)
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/*
468c2ecf20Sopenharmony_ci * We support 52 bit address space, Use top bit for kernel
478c2ecf20Sopenharmony_ci * virtual mapping. Also make sure kernel fit in the top
488c2ecf20Sopenharmony_ci * quadrant.
498c2ecf20Sopenharmony_ci *
508c2ecf20Sopenharmony_ci *           +------------------+
518c2ecf20Sopenharmony_ci *           +------------------+  Kernel virtual map (0xc008000000000000)
528c2ecf20Sopenharmony_ci *           |                  |
538c2ecf20Sopenharmony_ci *           |                  |
548c2ecf20Sopenharmony_ci *           |                  |
558c2ecf20Sopenharmony_ci * 0b11......+------------------+  Kernel linear map (0xc....)
568c2ecf20Sopenharmony_ci *           |                  |
578c2ecf20Sopenharmony_ci *           |     2 quadrant   |
588c2ecf20Sopenharmony_ci *           |                  |
598c2ecf20Sopenharmony_ci * 0b10......+------------------+
608c2ecf20Sopenharmony_ci *           |                  |
618c2ecf20Sopenharmony_ci *           |    1 quadrant    |
628c2ecf20Sopenharmony_ci *           |                  |
638c2ecf20Sopenharmony_ci * 0b01......+------------------+
648c2ecf20Sopenharmony_ci *           |                  |
658c2ecf20Sopenharmony_ci *           |    0 quadrant    |
668c2ecf20Sopenharmony_ci *           |                  |
678c2ecf20Sopenharmony_ci * 0b00......+------------------+
688c2ecf20Sopenharmony_ci *
698c2ecf20Sopenharmony_ci *
708c2ecf20Sopenharmony_ci * 3rd quadrant expanded:
718c2ecf20Sopenharmony_ci * +------------------------------+
728c2ecf20Sopenharmony_ci * |                              |
738c2ecf20Sopenharmony_ci * |                              |
748c2ecf20Sopenharmony_ci * |                              |
758c2ecf20Sopenharmony_ci * +------------------------------+  Kernel vmemmap end (0xc010000000000000)
768c2ecf20Sopenharmony_ci * |                              |
778c2ecf20Sopenharmony_ci * |           512TB		  |
788c2ecf20Sopenharmony_ci * |                              |
798c2ecf20Sopenharmony_ci * +------------------------------+  Kernel IO map end/vmemap start
808c2ecf20Sopenharmony_ci * |                              |
818c2ecf20Sopenharmony_ci * |           512TB		  |
828c2ecf20Sopenharmony_ci * |                              |
838c2ecf20Sopenharmony_ci * +------------------------------+  Kernel vmap end/ IO map start
848c2ecf20Sopenharmony_ci * |                              |
858c2ecf20Sopenharmony_ci * |           512TB		  |
868c2ecf20Sopenharmony_ci * |                              |
878c2ecf20Sopenharmony_ci * +------------------------------+  Kernel virt start (0xc008000000000000)
888c2ecf20Sopenharmony_ci * |                              |
898c2ecf20Sopenharmony_ci * |                              |
908c2ecf20Sopenharmony_ci * |                              |
918c2ecf20Sopenharmony_ci * +------------------------------+  Kernel linear (0xc.....)
928c2ecf20Sopenharmony_ci */
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/*
968c2ecf20Sopenharmony_ci * If we store section details in page->flags we can't increase the MAX_PHYSMEM_BITS
978c2ecf20Sopenharmony_ci * if we increase SECTIONS_WIDTH we will not store node details in page->flags and
988c2ecf20Sopenharmony_ci * page_to_nid does a page->section->node lookup
998c2ecf20Sopenharmony_ci * Hence only increase for VMEMMAP. Further depending on SPARSEMEM_EXTREME reduce
1008c2ecf20Sopenharmony_ci * memory requirements with large number of sections.
1018c2ecf20Sopenharmony_ci * 51 bits is the max physical real address on POWER9
1028c2ecf20Sopenharmony_ci */
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci#if defined(CONFIG_SPARSEMEM_VMEMMAP) && defined(CONFIG_SPARSEMEM_EXTREME)
1058c2ecf20Sopenharmony_ci#define R_MAX_PHYSMEM_BITS	51
1068c2ecf20Sopenharmony_ci#else
1078c2ecf20Sopenharmony_ci#define R_MAX_PHYSMEM_BITS	46
1088c2ecf20Sopenharmony_ci#endif
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define RADIX_KERN_VIRT_START	ASM_CONST(0xc008000000000000)
1118c2ecf20Sopenharmony_ci/*
1128c2ecf20Sopenharmony_ci * 49 =  MAX_EA_BITS_PER_CONTEXT (hash specific). To make sure we pick
1138c2ecf20Sopenharmony_ci * the same value as hash.
1148c2ecf20Sopenharmony_ci */
1158c2ecf20Sopenharmony_ci#define RADIX_KERN_MAP_SIZE	(1UL << 49)
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci#define RADIX_VMALLOC_START	RADIX_KERN_VIRT_START
1188c2ecf20Sopenharmony_ci#define RADIX_VMALLOC_SIZE	RADIX_KERN_MAP_SIZE
1198c2ecf20Sopenharmony_ci#define RADIX_VMALLOC_END	(RADIX_VMALLOC_START + RADIX_VMALLOC_SIZE)
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#define RADIX_KERN_IO_START	RADIX_VMALLOC_END
1228c2ecf20Sopenharmony_ci#define RADIX_KERN_IO_SIZE	RADIX_KERN_MAP_SIZE
1238c2ecf20Sopenharmony_ci#define RADIX_KERN_IO_END	(RADIX_KERN_IO_START + RADIX_KERN_IO_SIZE)
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci#define RADIX_VMEMMAP_START	RADIX_KERN_IO_END
1268c2ecf20Sopenharmony_ci#define RADIX_VMEMMAP_SIZE	RADIX_KERN_MAP_SIZE
1278c2ecf20Sopenharmony_ci#define RADIX_VMEMMAP_END	(RADIX_VMEMMAP_START + RADIX_VMEMMAP_SIZE)
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
1308c2ecf20Sopenharmony_ci#define RADIX_PTE_TABLE_SIZE	(sizeof(pte_t) << RADIX_PTE_INDEX_SIZE)
1318c2ecf20Sopenharmony_ci#define RADIX_PMD_TABLE_SIZE	(sizeof(pmd_t) << RADIX_PMD_INDEX_SIZE)
1328c2ecf20Sopenharmony_ci#define RADIX_PUD_TABLE_SIZE	(sizeof(pud_t) << RADIX_PUD_INDEX_SIZE)
1338c2ecf20Sopenharmony_ci#define RADIX_PGD_TABLE_SIZE	(sizeof(pgd_t) << RADIX_PGD_INDEX_SIZE)
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci#ifdef CONFIG_STRICT_KERNEL_RWX
1368c2ecf20Sopenharmony_ciextern void radix__mark_rodata_ro(void);
1378c2ecf20Sopenharmony_ciextern void radix__mark_initmem_nx(void);
1388c2ecf20Sopenharmony_ci#endif
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ciextern void radix__ptep_set_access_flags(struct vm_area_struct *vma, pte_t *ptep,
1418c2ecf20Sopenharmony_ci					 pte_t entry, unsigned long address,
1428c2ecf20Sopenharmony_ci					 int psize);
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ciextern void radix__ptep_modify_prot_commit(struct vm_area_struct *vma,
1458c2ecf20Sopenharmony_ci					   unsigned long addr, pte_t *ptep,
1468c2ecf20Sopenharmony_ci					   pte_t old_pte, pte_t pte);
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_cistatic inline unsigned long __radix_pte_update(pte_t *ptep, unsigned long clr,
1498c2ecf20Sopenharmony_ci					       unsigned long set)
1508c2ecf20Sopenharmony_ci{
1518c2ecf20Sopenharmony_ci	__be64 old_be, tmp_be;
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci	__asm__ __volatile__(
1548c2ecf20Sopenharmony_ci	"1:	ldarx	%0,0,%3		# pte_update\n"
1558c2ecf20Sopenharmony_ci	"	andc	%1,%0,%5	\n"
1568c2ecf20Sopenharmony_ci	"	or	%1,%1,%4	\n"
1578c2ecf20Sopenharmony_ci	"	stdcx.	%1,0,%3		\n"
1588c2ecf20Sopenharmony_ci	"	bne-	1b"
1598c2ecf20Sopenharmony_ci	: "=&r" (old_be), "=&r" (tmp_be), "=m" (*ptep)
1608c2ecf20Sopenharmony_ci	: "r" (ptep), "r" (cpu_to_be64(set)), "r" (cpu_to_be64(clr))
1618c2ecf20Sopenharmony_ci	: "cc" );
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci	return be64_to_cpu(old_be);
1648c2ecf20Sopenharmony_ci}
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_cistatic inline unsigned long radix__pte_update(struct mm_struct *mm,
1678c2ecf20Sopenharmony_ci					unsigned long addr,
1688c2ecf20Sopenharmony_ci					pte_t *ptep, unsigned long clr,
1698c2ecf20Sopenharmony_ci					unsigned long set,
1708c2ecf20Sopenharmony_ci					int huge)
1718c2ecf20Sopenharmony_ci{
1728c2ecf20Sopenharmony_ci	unsigned long old_pte;
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci	old_pte = __radix_pte_update(ptep, clr, set);
1758c2ecf20Sopenharmony_ci	if (!huge)
1768c2ecf20Sopenharmony_ci		assert_pte_locked(mm, addr);
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci	return old_pte;
1798c2ecf20Sopenharmony_ci}
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_cistatic inline pte_t radix__ptep_get_and_clear_full(struct mm_struct *mm,
1828c2ecf20Sopenharmony_ci						   unsigned long addr,
1838c2ecf20Sopenharmony_ci						   pte_t *ptep, int full)
1848c2ecf20Sopenharmony_ci{
1858c2ecf20Sopenharmony_ci	unsigned long old_pte;
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci	if (full) {
1888c2ecf20Sopenharmony_ci		old_pte = pte_val(*ptep);
1898c2ecf20Sopenharmony_ci		*ptep = __pte(0);
1908c2ecf20Sopenharmony_ci	} else
1918c2ecf20Sopenharmony_ci		old_pte = radix__pte_update(mm, addr, ptep, ~0ul, 0, 0);
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci	return __pte(old_pte);
1948c2ecf20Sopenharmony_ci}
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_cistatic inline int radix__pte_same(pte_t pte_a, pte_t pte_b)
1978c2ecf20Sopenharmony_ci{
1988c2ecf20Sopenharmony_ci	return ((pte_raw(pte_a) ^ pte_raw(pte_b)) == 0);
1998c2ecf20Sopenharmony_ci}
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_cistatic inline int radix__pte_none(pte_t pte)
2028c2ecf20Sopenharmony_ci{
2038c2ecf20Sopenharmony_ci	return (pte_val(pte) & ~RADIX_PTE_NONE_MASK) == 0;
2048c2ecf20Sopenharmony_ci}
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_cistatic inline void radix__set_pte_at(struct mm_struct *mm, unsigned long addr,
2078c2ecf20Sopenharmony_ci				 pte_t *ptep, pte_t pte, int percpu)
2088c2ecf20Sopenharmony_ci{
2098c2ecf20Sopenharmony_ci	*ptep = pte;
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci	/*
2128c2ecf20Sopenharmony_ci	 * The architecture suggests a ptesync after setting the pte, which
2138c2ecf20Sopenharmony_ci	 * orders the store that updates the pte with subsequent page table
2148c2ecf20Sopenharmony_ci	 * walk accesses which may load the pte. Without this it may be
2158c2ecf20Sopenharmony_ci	 * possible for a subsequent access to result in spurious fault.
2168c2ecf20Sopenharmony_ci	 *
2178c2ecf20Sopenharmony_ci	 * This is not necessary for correctness, because a spurious fault
2188c2ecf20Sopenharmony_ci	 * is tolerated by the page fault handler, and this store will
2198c2ecf20Sopenharmony_ci	 * eventually be seen. In testing, there was no noticable increase
2208c2ecf20Sopenharmony_ci	 * in user faults on POWER9. Avoiding ptesync here is a significant
2218c2ecf20Sopenharmony_ci	 * win for things like fork. If a future microarchitecture benefits
2228c2ecf20Sopenharmony_ci	 * from ptesync, it should probably go into update_mmu_cache, rather
2238c2ecf20Sopenharmony_ci	 * than set_pte_at (which is used to set ptes unrelated to faults).
2248c2ecf20Sopenharmony_ci	 *
2258c2ecf20Sopenharmony_ci	 * Spurious faults from the kernel memory are not tolerated, so there
2268c2ecf20Sopenharmony_ci	 * is a ptesync in flush_cache_vmap, and __map_kernel_page() follows
2278c2ecf20Sopenharmony_ci	 * the pte update sequence from ISA Book III 6.10 Translation Table
2288c2ecf20Sopenharmony_ci	 * Update Synchronization Requirements.
2298c2ecf20Sopenharmony_ci	 */
2308c2ecf20Sopenharmony_ci}
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_cistatic inline int radix__pmd_bad(pmd_t pmd)
2338c2ecf20Sopenharmony_ci{
2348c2ecf20Sopenharmony_ci	return !!(pmd_val(pmd) & RADIX_PMD_BAD_BITS);
2358c2ecf20Sopenharmony_ci}
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_cistatic inline int radix__pmd_same(pmd_t pmd_a, pmd_t pmd_b)
2388c2ecf20Sopenharmony_ci{
2398c2ecf20Sopenharmony_ci	return ((pmd_raw(pmd_a) ^ pmd_raw(pmd_b)) == 0);
2408c2ecf20Sopenharmony_ci}
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_cistatic inline int radix__pud_bad(pud_t pud)
2438c2ecf20Sopenharmony_ci{
2448c2ecf20Sopenharmony_ci	return !!(pud_val(pud) & RADIX_PUD_BAD_BITS);
2458c2ecf20Sopenharmony_ci}
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_cistatic inline int radix__p4d_bad(p4d_t p4d)
2498c2ecf20Sopenharmony_ci{
2508c2ecf20Sopenharmony_ci	return !!(p4d_val(p4d) & RADIX_P4D_BAD_BITS);
2518c2ecf20Sopenharmony_ci}
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci#ifdef CONFIG_TRANSPARENT_HUGEPAGE
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_cistatic inline int radix__pmd_trans_huge(pmd_t pmd)
2568c2ecf20Sopenharmony_ci{
2578c2ecf20Sopenharmony_ci	return (pmd_val(pmd) & (_PAGE_PTE | _PAGE_DEVMAP)) == _PAGE_PTE;
2588c2ecf20Sopenharmony_ci}
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_cistatic inline pmd_t radix__pmd_mkhuge(pmd_t pmd)
2618c2ecf20Sopenharmony_ci{
2628c2ecf20Sopenharmony_ci	return __pmd(pmd_val(pmd) | _PAGE_PTE);
2638c2ecf20Sopenharmony_ci}
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ciextern unsigned long radix__pmd_hugepage_update(struct mm_struct *mm, unsigned long addr,
2668c2ecf20Sopenharmony_ci					  pmd_t *pmdp, unsigned long clr,
2678c2ecf20Sopenharmony_ci					  unsigned long set);
2688c2ecf20Sopenharmony_ciextern pmd_t radix__pmdp_collapse_flush(struct vm_area_struct *vma,
2698c2ecf20Sopenharmony_ci				  unsigned long address, pmd_t *pmdp);
2708c2ecf20Sopenharmony_ciextern void radix__pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
2718c2ecf20Sopenharmony_ci					pgtable_t pgtable);
2728c2ecf20Sopenharmony_ciextern pgtable_t radix__pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
2738c2ecf20Sopenharmony_ciextern pmd_t radix__pmdp_huge_get_and_clear(struct mm_struct *mm,
2748c2ecf20Sopenharmony_ci				      unsigned long addr, pmd_t *pmdp);
2758c2ecf20Sopenharmony_cistatic inline int radix__has_transparent_hugepage(void)
2768c2ecf20Sopenharmony_ci{
2778c2ecf20Sopenharmony_ci	/* For radix 2M at PMD level means thp */
2788c2ecf20Sopenharmony_ci	if (mmu_psize_defs[MMU_PAGE_2M].shift == PMD_SHIFT)
2798c2ecf20Sopenharmony_ci		return 1;
2808c2ecf20Sopenharmony_ci	return 0;
2818c2ecf20Sopenharmony_ci}
2828c2ecf20Sopenharmony_ci#endif
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_cistatic inline pmd_t radix__pmd_mkdevmap(pmd_t pmd)
2858c2ecf20Sopenharmony_ci{
2868c2ecf20Sopenharmony_ci	return __pmd(pmd_val(pmd) | (_PAGE_PTE | _PAGE_DEVMAP));
2878c2ecf20Sopenharmony_ci}
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ciextern int __meminit radix__vmemmap_create_mapping(unsigned long start,
2908c2ecf20Sopenharmony_ci					     unsigned long page_size,
2918c2ecf20Sopenharmony_ci					     unsigned long phys);
2928c2ecf20Sopenharmony_ciextern void radix__vmemmap_remove_mapping(unsigned long start,
2938c2ecf20Sopenharmony_ci				    unsigned long page_size);
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ciextern int radix__map_kernel_page(unsigned long ea, unsigned long pa,
2968c2ecf20Sopenharmony_ci				 pgprot_t flags, unsigned int psz);
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_cistatic inline unsigned long radix__get_tree_size(void)
2998c2ecf20Sopenharmony_ci{
3008c2ecf20Sopenharmony_ci	unsigned long rts_field;
3018c2ecf20Sopenharmony_ci	/*
3028c2ecf20Sopenharmony_ci	 * We support 52 bits, hence:
3038c2ecf20Sopenharmony_ci	 * bits 52 - 31 = 21, 0b10101
3048c2ecf20Sopenharmony_ci	 * RTS encoding details
3058c2ecf20Sopenharmony_ci	 * bits 0 - 3 of rts -> bits 6 - 8 unsigned long
3068c2ecf20Sopenharmony_ci	 * bits 4 - 5 of rts -> bits 62 - 63 of unsigned long
3078c2ecf20Sopenharmony_ci	 */
3088c2ecf20Sopenharmony_ci	rts_field = (0x5UL << 5); /* 6 - 8 bits */
3098c2ecf20Sopenharmony_ci	rts_field |= (0x2UL << 61);
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	return rts_field;
3128c2ecf20Sopenharmony_ci}
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ci#ifdef CONFIG_MEMORY_HOTPLUG
3158c2ecf20Sopenharmony_ciint radix__create_section_mapping(unsigned long start, unsigned long end,
3168c2ecf20Sopenharmony_ci				  int nid, pgprot_t prot);
3178c2ecf20Sopenharmony_ciint radix__remove_section_mapping(unsigned long start, unsigned long end);
3188c2ecf20Sopenharmony_ci#endif /* CONFIG_MEMORY_HOTPLUG */
3198c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
3208c2ecf20Sopenharmony_ci#endif
321