162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _ASM_POWERPC_MMU_BOOK3E_H_
362306a36Sopenharmony_ci#define _ASM_POWERPC_MMU_BOOK3E_H_
462306a36Sopenharmony_ci/*
562306a36Sopenharmony_ci * Freescale Book-E/Book-3e (ISA 2.06+) MMU support
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci/* Book-3e defined page sizes */
962306a36Sopenharmony_ci#define BOOK3E_PAGESZ_1K	0
1062306a36Sopenharmony_ci#define BOOK3E_PAGESZ_2K	1
1162306a36Sopenharmony_ci#define BOOK3E_PAGESZ_4K	2
1262306a36Sopenharmony_ci#define BOOK3E_PAGESZ_8K	3
1362306a36Sopenharmony_ci#define BOOK3E_PAGESZ_16K	4
1462306a36Sopenharmony_ci#define BOOK3E_PAGESZ_32K	5
1562306a36Sopenharmony_ci#define BOOK3E_PAGESZ_64K	6
1662306a36Sopenharmony_ci#define BOOK3E_PAGESZ_128K	7
1762306a36Sopenharmony_ci#define BOOK3E_PAGESZ_256K	8
1862306a36Sopenharmony_ci#define BOOK3E_PAGESZ_512K	9
1962306a36Sopenharmony_ci#define BOOK3E_PAGESZ_1M	10
2062306a36Sopenharmony_ci#define BOOK3E_PAGESZ_2M	11
2162306a36Sopenharmony_ci#define BOOK3E_PAGESZ_4M	12
2262306a36Sopenharmony_ci#define BOOK3E_PAGESZ_8M	13
2362306a36Sopenharmony_ci#define BOOK3E_PAGESZ_16M	14
2462306a36Sopenharmony_ci#define BOOK3E_PAGESZ_32M	15
2562306a36Sopenharmony_ci#define BOOK3E_PAGESZ_64M	16
2662306a36Sopenharmony_ci#define BOOK3E_PAGESZ_128M	17
2762306a36Sopenharmony_ci#define BOOK3E_PAGESZ_256M	18
2862306a36Sopenharmony_ci#define BOOK3E_PAGESZ_512M	19
2962306a36Sopenharmony_ci#define BOOK3E_PAGESZ_1GB	20
3062306a36Sopenharmony_ci#define BOOK3E_PAGESZ_2GB	21
3162306a36Sopenharmony_ci#define BOOK3E_PAGESZ_4GB	22
3262306a36Sopenharmony_ci#define BOOK3E_PAGESZ_8GB	23
3362306a36Sopenharmony_ci#define BOOK3E_PAGESZ_16GB	24
3462306a36Sopenharmony_ci#define BOOK3E_PAGESZ_32GB	25
3562306a36Sopenharmony_ci#define BOOK3E_PAGESZ_64GB	26
3662306a36Sopenharmony_ci#define BOOK3E_PAGESZ_128GB	27
3762306a36Sopenharmony_ci#define BOOK3E_PAGESZ_256GB	28
3862306a36Sopenharmony_ci#define BOOK3E_PAGESZ_512GB	29
3962306a36Sopenharmony_ci#define BOOK3E_PAGESZ_1TB	30
4062306a36Sopenharmony_ci#define BOOK3E_PAGESZ_2TB	31
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci/* MAS registers bit definitions */
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define MAS0_TLBSEL_MASK	0x30000000
4562306a36Sopenharmony_ci#define MAS0_TLBSEL_SHIFT	28
4662306a36Sopenharmony_ci#define MAS0_TLBSEL(x)		(((x) << MAS0_TLBSEL_SHIFT) & MAS0_TLBSEL_MASK)
4762306a36Sopenharmony_ci#define MAS0_GET_TLBSEL(mas0)	(((mas0) & MAS0_TLBSEL_MASK) >> \
4862306a36Sopenharmony_ci			MAS0_TLBSEL_SHIFT)
4962306a36Sopenharmony_ci#define MAS0_ESEL_MASK		0x0FFF0000
5062306a36Sopenharmony_ci#define MAS0_ESEL_SHIFT		16
5162306a36Sopenharmony_ci#define MAS0_ESEL(x)		(((x) << MAS0_ESEL_SHIFT) & MAS0_ESEL_MASK)
5262306a36Sopenharmony_ci#define MAS0_NV(x)		((x) & 0x00000FFF)
5362306a36Sopenharmony_ci#define MAS0_HES		0x00004000
5462306a36Sopenharmony_ci#define MAS0_WQ_ALLWAYS		0x00000000
5562306a36Sopenharmony_ci#define MAS0_WQ_COND		0x00001000
5662306a36Sopenharmony_ci#define MAS0_WQ_CLR_RSRV       	0x00002000
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#define MAS1_VALID		0x80000000
5962306a36Sopenharmony_ci#define MAS1_IPROT		0x40000000
6062306a36Sopenharmony_ci#define MAS1_TID(x)		(((x) << 16) & 0x3FFF0000)
6162306a36Sopenharmony_ci#define MAS1_IND		0x00002000
6262306a36Sopenharmony_ci#define MAS1_TS			0x00001000
6362306a36Sopenharmony_ci#define MAS1_TSIZE_MASK		0x00000f80
6462306a36Sopenharmony_ci#define MAS1_TSIZE_SHIFT	7
6562306a36Sopenharmony_ci#define MAS1_TSIZE(x)		(((x) << MAS1_TSIZE_SHIFT) & MAS1_TSIZE_MASK)
6662306a36Sopenharmony_ci#define MAS1_GET_TSIZE(mas1)	(((mas1) & MAS1_TSIZE_MASK) >> MAS1_TSIZE_SHIFT)
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define MAS2_EPN		(~0xFFFUL)
6962306a36Sopenharmony_ci#define MAS2_X0			0x00000040
7062306a36Sopenharmony_ci#define MAS2_X1			0x00000020
7162306a36Sopenharmony_ci#define MAS2_W			0x00000010
7262306a36Sopenharmony_ci#define MAS2_I			0x00000008
7362306a36Sopenharmony_ci#define MAS2_M			0x00000004
7462306a36Sopenharmony_ci#define MAS2_G			0x00000002
7562306a36Sopenharmony_ci#define MAS2_E			0x00000001
7662306a36Sopenharmony_ci#define MAS2_WIMGE_MASK		0x0000001f
7762306a36Sopenharmony_ci#define MAS2_EPN_MASK(size)		(~0 << (size + 10))
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci#define MAS3_RPN		0xFFFFF000
8062306a36Sopenharmony_ci#define MAS3_U0			0x00000200
8162306a36Sopenharmony_ci#define MAS3_U1			0x00000100
8262306a36Sopenharmony_ci#define MAS3_U2			0x00000080
8362306a36Sopenharmony_ci#define MAS3_U3			0x00000040
8462306a36Sopenharmony_ci#define MAS3_UX			0x00000020
8562306a36Sopenharmony_ci#define MAS3_SX			0x00000010
8662306a36Sopenharmony_ci#define MAS3_UW			0x00000008
8762306a36Sopenharmony_ci#define MAS3_SW			0x00000004
8862306a36Sopenharmony_ci#define MAS3_UR			0x00000002
8962306a36Sopenharmony_ci#define MAS3_SR			0x00000001
9062306a36Sopenharmony_ci#define MAS3_BAP_MASK		0x0000003f
9162306a36Sopenharmony_ci#define MAS3_SPSIZE		0x0000003e
9262306a36Sopenharmony_ci#define MAS3_SPSIZE_SHIFT	1
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci#define MAS4_TLBSEL_MASK	MAS0_TLBSEL_MASK
9562306a36Sopenharmony_ci#define MAS4_TLBSELD(x) 	MAS0_TLBSEL(x)
9662306a36Sopenharmony_ci#define MAS4_INDD		0x00008000	/* Default IND */
9762306a36Sopenharmony_ci#define MAS4_TSIZED(x)		MAS1_TSIZE(x)
9862306a36Sopenharmony_ci#define MAS4_X0D		0x00000040
9962306a36Sopenharmony_ci#define MAS4_X1D		0x00000020
10062306a36Sopenharmony_ci#define MAS4_WD			0x00000010
10162306a36Sopenharmony_ci#define MAS4_ID			0x00000008
10262306a36Sopenharmony_ci#define MAS4_MD			0x00000004
10362306a36Sopenharmony_ci#define MAS4_GD			0x00000002
10462306a36Sopenharmony_ci#define MAS4_ED			0x00000001
10562306a36Sopenharmony_ci#define MAS4_WIMGED_MASK	0x0000001f	/* Default WIMGE */
10662306a36Sopenharmony_ci#define MAS4_WIMGED_SHIFT	0
10762306a36Sopenharmony_ci#define MAS4_VLED		MAS4_X1D	/* Default VLE */
10862306a36Sopenharmony_ci#define MAS4_ACMD		0x000000c0	/* Default ACM */
10962306a36Sopenharmony_ci#define MAS4_ACMD_SHIFT		6
11062306a36Sopenharmony_ci#define MAS4_TSIZED_MASK	0x00000f80	/* Default TSIZE */
11162306a36Sopenharmony_ci#define MAS4_TSIZED_SHIFT	7
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci#define MAS5_SGS		0x80000000
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define MAS6_SPID0		0x3FFF0000
11662306a36Sopenharmony_ci#define MAS6_SPID1		0x00007FFE
11762306a36Sopenharmony_ci#define MAS6_ISIZE(x)		MAS1_TSIZE(x)
11862306a36Sopenharmony_ci#define MAS6_SAS		0x00000001
11962306a36Sopenharmony_ci#define MAS6_SPID		MAS6_SPID0
12062306a36Sopenharmony_ci#define MAS6_SIND 		0x00000002	/* Indirect page */
12162306a36Sopenharmony_ci#define MAS6_SIND_SHIFT		1
12262306a36Sopenharmony_ci#define MAS6_SPID_MASK		0x3fff0000
12362306a36Sopenharmony_ci#define MAS6_SPID_SHIFT		16
12462306a36Sopenharmony_ci#define MAS6_ISIZE_MASK		0x00000f80
12562306a36Sopenharmony_ci#define MAS6_ISIZE_SHIFT	7
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci#define MAS7_RPN		0xFFFFFFFF
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci#define MAS8_TGS		0x80000000 /* Guest space */
13062306a36Sopenharmony_ci#define MAS8_VF			0x40000000 /* Virtualization Fault */
13162306a36Sopenharmony_ci#define MAS8_TLPID		0x000000ff
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci/* Bit definitions for MMUCFG */
13462306a36Sopenharmony_ci#define MMUCFG_MAVN	0x00000003	/* MMU Architecture Version Number */
13562306a36Sopenharmony_ci#define MMUCFG_MAVN_V1	0x00000000	/* v1.0 */
13662306a36Sopenharmony_ci#define MMUCFG_MAVN_V2	0x00000001	/* v2.0 */
13762306a36Sopenharmony_ci#define MMUCFG_NTLBS	0x0000000c	/* Number of TLBs */
13862306a36Sopenharmony_ci#define MMUCFG_PIDSIZE	0x000007c0	/* PID Reg Size */
13962306a36Sopenharmony_ci#define MMUCFG_TWC	0x00008000	/* TLB Write Conditional (v2.0) */
14062306a36Sopenharmony_ci#define MMUCFG_LRAT	0x00010000	/* LRAT Supported (v2.0) */
14162306a36Sopenharmony_ci#define MMUCFG_RASIZE	0x00fe0000	/* Real Addr Size */
14262306a36Sopenharmony_ci#define MMUCFG_LPIDSIZE	0x0f000000	/* LPID Reg Size */
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci/* Bit definitions for MMUCSR0 */
14562306a36Sopenharmony_ci#define MMUCSR0_TLB1FI	0x00000002	/* TLB1 Flash invalidate */
14662306a36Sopenharmony_ci#define MMUCSR0_TLB0FI	0x00000004	/* TLB0 Flash invalidate */
14762306a36Sopenharmony_ci#define MMUCSR0_TLB2FI	0x00000040	/* TLB2 Flash invalidate */
14862306a36Sopenharmony_ci#define MMUCSR0_TLB3FI	0x00000020	/* TLB3 Flash invalidate */
14962306a36Sopenharmony_ci#define MMUCSR0_TLBFI	(MMUCSR0_TLB0FI | MMUCSR0_TLB1FI | \
15062306a36Sopenharmony_ci			 MMUCSR0_TLB2FI | MMUCSR0_TLB3FI)
15162306a36Sopenharmony_ci#define MMUCSR0_TLB0PS	0x00000780	/* TLB0 Page Size */
15262306a36Sopenharmony_ci#define MMUCSR0_TLB1PS	0x00007800	/* TLB1 Page Size */
15362306a36Sopenharmony_ci#define MMUCSR0_TLB2PS	0x00078000	/* TLB2 Page Size */
15462306a36Sopenharmony_ci#define MMUCSR0_TLB3PS	0x00780000	/* TLB3 Page Size */
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci/* MMUCFG bits */
15762306a36Sopenharmony_ci#define MMUCFG_MAVN_NASK	0x00000003
15862306a36Sopenharmony_ci#define MMUCFG_MAVN_V1_0	0x00000000
15962306a36Sopenharmony_ci#define MMUCFG_MAVN_V2_0	0x00000001
16062306a36Sopenharmony_ci#define MMUCFG_NTLB_MASK	0x0000000c
16162306a36Sopenharmony_ci#define MMUCFG_NTLB_SHIFT	2
16262306a36Sopenharmony_ci#define MMUCFG_PIDSIZE_MASK	0x000007c0
16362306a36Sopenharmony_ci#define MMUCFG_PIDSIZE_SHIFT	6
16462306a36Sopenharmony_ci#define MMUCFG_TWC		0x00008000
16562306a36Sopenharmony_ci#define MMUCFG_LRAT		0x00010000
16662306a36Sopenharmony_ci#define MMUCFG_RASIZE_MASK	0x00fe0000
16762306a36Sopenharmony_ci#define MMUCFG_RASIZE_SHIFT	17
16862306a36Sopenharmony_ci#define MMUCFG_LPIDSIZE_MASK	0x0f000000
16962306a36Sopenharmony_ci#define MMUCFG_LPIDSIZE_SHIFT	24
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci/* TLBnCFG encoding */
17262306a36Sopenharmony_ci#define TLBnCFG_N_ENTRY		0x00000fff	/* number of entries */
17362306a36Sopenharmony_ci#define TLBnCFG_HES		0x00002000	/* HW select supported */
17462306a36Sopenharmony_ci#define TLBnCFG_IPROT		0x00008000	/* IPROT supported */
17562306a36Sopenharmony_ci#define TLBnCFG_GTWE		0x00010000	/* Guest can write */
17662306a36Sopenharmony_ci#define TLBnCFG_IND		0x00020000	/* IND entries supported */
17762306a36Sopenharmony_ci#define TLBnCFG_PT		0x00040000	/* Can load from page table */
17862306a36Sopenharmony_ci#define TLBnCFG_MINSIZE		0x00f00000	/* Minimum Page Size (v1.0) */
17962306a36Sopenharmony_ci#define TLBnCFG_MINSIZE_SHIFT	20
18062306a36Sopenharmony_ci#define TLBnCFG_MAXSIZE		0x000f0000	/* Maximum Page Size (v1.0) */
18162306a36Sopenharmony_ci#define TLBnCFG_MAXSIZE_SHIFT	16
18262306a36Sopenharmony_ci#define TLBnCFG_ASSOC		0xff000000	/* Associativity */
18362306a36Sopenharmony_ci#define TLBnCFG_ASSOC_SHIFT	24
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci/* TLBnPS encoding */
18662306a36Sopenharmony_ci#define TLBnPS_4K		0x00000004
18762306a36Sopenharmony_ci#define TLBnPS_8K		0x00000008
18862306a36Sopenharmony_ci#define TLBnPS_16K		0x00000010
18962306a36Sopenharmony_ci#define TLBnPS_32K		0x00000020
19062306a36Sopenharmony_ci#define TLBnPS_64K		0x00000040
19162306a36Sopenharmony_ci#define TLBnPS_128K		0x00000080
19262306a36Sopenharmony_ci#define TLBnPS_256K		0x00000100
19362306a36Sopenharmony_ci#define TLBnPS_512K		0x00000200
19462306a36Sopenharmony_ci#define TLBnPS_1M 		0x00000400
19562306a36Sopenharmony_ci#define TLBnPS_2M 		0x00000800
19662306a36Sopenharmony_ci#define TLBnPS_4M 		0x00001000
19762306a36Sopenharmony_ci#define TLBnPS_8M 		0x00002000
19862306a36Sopenharmony_ci#define TLBnPS_16M		0x00004000
19962306a36Sopenharmony_ci#define TLBnPS_32M		0x00008000
20062306a36Sopenharmony_ci#define TLBnPS_64M		0x00010000
20162306a36Sopenharmony_ci#define TLBnPS_128M		0x00020000
20262306a36Sopenharmony_ci#define TLBnPS_256M		0x00040000
20362306a36Sopenharmony_ci#define TLBnPS_512M		0x00080000
20462306a36Sopenharmony_ci#define TLBnPS_1G		0x00100000
20562306a36Sopenharmony_ci#define TLBnPS_2G		0x00200000
20662306a36Sopenharmony_ci#define TLBnPS_4G		0x00400000
20762306a36Sopenharmony_ci#define TLBnPS_8G		0x00800000
20862306a36Sopenharmony_ci#define TLBnPS_16G		0x01000000
20962306a36Sopenharmony_ci#define TLBnPS_32G		0x02000000
21062306a36Sopenharmony_ci#define TLBnPS_64G		0x04000000
21162306a36Sopenharmony_ci#define TLBnPS_128G		0x08000000
21262306a36Sopenharmony_ci#define TLBnPS_256G		0x10000000
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci/* tlbilx action encoding */
21562306a36Sopenharmony_ci#define TLBILX_T_ALL			0
21662306a36Sopenharmony_ci#define TLBILX_T_TID			1
21762306a36Sopenharmony_ci#define TLBILX_T_FULLMATCH		3
21862306a36Sopenharmony_ci#define TLBILX_T_CLASS0			4
21962306a36Sopenharmony_ci#define TLBILX_T_CLASS1			5
22062306a36Sopenharmony_ci#define TLBILX_T_CLASS2			6
22162306a36Sopenharmony_ci#define TLBILX_T_CLASS3			7
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci/*
22462306a36Sopenharmony_ci * The mapping only needs to be cache-coherent on SMP, except on
22562306a36Sopenharmony_ci * Freescale e500mc derivatives where it's also needed for coherent DMA.
22662306a36Sopenharmony_ci */
22762306a36Sopenharmony_ci#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
22862306a36Sopenharmony_ci#define MAS2_M_IF_NEEDED	MAS2_M
22962306a36Sopenharmony_ci#else
23062306a36Sopenharmony_ci#define MAS2_M_IF_NEEDED	0
23162306a36Sopenharmony_ci#endif
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci#ifndef __ASSEMBLY__
23462306a36Sopenharmony_ci#include <asm/bug.h>
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ciextern unsigned int tlbcam_index;
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_citypedef struct {
23962306a36Sopenharmony_ci	unsigned int	id;
24062306a36Sopenharmony_ci	unsigned int	active;
24162306a36Sopenharmony_ci	void __user	*vdso;
24262306a36Sopenharmony_ci} mm_context_t;
24362306a36Sopenharmony_ci
24462306a36Sopenharmony_ci/* Page size definitions, common between 32 and 64-bit
24562306a36Sopenharmony_ci *
24662306a36Sopenharmony_ci *    shift : is the "PAGE_SHIFT" value for that page size
24762306a36Sopenharmony_ci *    penc  : is the pte encoding mask
24862306a36Sopenharmony_ci *
24962306a36Sopenharmony_ci */
25062306a36Sopenharmony_cistruct mmu_psize_def
25162306a36Sopenharmony_ci{
25262306a36Sopenharmony_ci	unsigned int	shift;	/* number of bits */
25362306a36Sopenharmony_ci	unsigned int	enc;	/* PTE encoding */
25462306a36Sopenharmony_ci	unsigned int    ind;    /* Corresponding indirect page size shift */
25562306a36Sopenharmony_ci	unsigned int	flags;
25662306a36Sopenharmony_ci#define MMU_PAGE_SIZE_DIRECT	0x1	/* Supported as a direct size */
25762306a36Sopenharmony_ci#define MMU_PAGE_SIZE_INDIRECT	0x2	/* Supported as an indirect size */
25862306a36Sopenharmony_ci};
25962306a36Sopenharmony_ciextern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_cistatic inline int shift_to_mmu_psize(unsigned int shift)
26262306a36Sopenharmony_ci{
26362306a36Sopenharmony_ci	int psize;
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci	for (psize = 0; psize < MMU_PAGE_COUNT; ++psize)
26662306a36Sopenharmony_ci		if (mmu_psize_defs[psize].shift == shift)
26762306a36Sopenharmony_ci			return psize;
26862306a36Sopenharmony_ci	return -1;
26962306a36Sopenharmony_ci}
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_cistatic inline unsigned int mmu_psize_to_shift(unsigned int mmu_psize)
27262306a36Sopenharmony_ci{
27362306a36Sopenharmony_ci	if (mmu_psize_defs[mmu_psize].shift)
27462306a36Sopenharmony_ci		return mmu_psize_defs[mmu_psize].shift;
27562306a36Sopenharmony_ci	BUG();
27662306a36Sopenharmony_ci}
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci/* The page sizes use the same names as 64-bit hash but are
27962306a36Sopenharmony_ci * constants
28062306a36Sopenharmony_ci */
28162306a36Sopenharmony_ci#if defined(CONFIG_PPC_4K_PAGES)
28262306a36Sopenharmony_ci#define mmu_virtual_psize	MMU_PAGE_4K
28362306a36Sopenharmony_ci#else
28462306a36Sopenharmony_ci#error Unsupported page size
28562306a36Sopenharmony_ci#endif
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ciextern int mmu_linear_psize;
28862306a36Sopenharmony_ciextern int mmu_vmemmap_psize;
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_cistruct tlb_core_data {
29162306a36Sopenharmony_ci	/*
29262306a36Sopenharmony_ci	 * Per-core spinlock for e6500 TLB handlers (no tlbsrx.)
29362306a36Sopenharmony_ci	 * Must be the first struct element.
29462306a36Sopenharmony_ci	 */
29562306a36Sopenharmony_ci	u8 lock;
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci	/* For software way selection, as on Freescale TLB1 */
29862306a36Sopenharmony_ci	u8 esel_next, esel_max, esel_first;
29962306a36Sopenharmony_ci};
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci#ifdef CONFIG_PPC64
30262306a36Sopenharmony_ciextern unsigned long linear_map_top;
30362306a36Sopenharmony_ciextern int book3e_htw_mode;
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci#define PPC_HTW_NONE	0
30662306a36Sopenharmony_ci#define PPC_HTW_IBM	1
30762306a36Sopenharmony_ci#define PPC_HTW_E6500	2
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci/*
31062306a36Sopenharmony_ci * 64-bit booke platforms don't load the tlb in the tlb miss handler code.
31162306a36Sopenharmony_ci * HUGETLB_NEED_PRELOAD handles this - it causes huge_ptep_set_access_flags to
31262306a36Sopenharmony_ci * return 1, indicating that the tlb requires preloading.
31362306a36Sopenharmony_ci */
31462306a36Sopenharmony_ci#define HUGETLB_NEED_PRELOAD
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci#define mmu_cleanup_all NULL
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci#define MAX_PHYSMEM_BITS        44
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_ci#endif
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci#include <asm/percpu.h>
32362306a36Sopenharmony_ciDECLARE_PER_CPU(int, next_tlbcam_idx);
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ci#endif /* !__ASSEMBLY__ */
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci#endif /* _ASM_POWERPC_MMU_BOOK3E_H_ */
328