xref: /linux/arch/powerpc/include/asm/book3s/64/pkeys.h (revision beace86e61e465dba204a268ab3f3377153a4973)
1b9658f83SAneesh Kumar K.V /* SPDX-License-Identifier: GPL-2.0+ */
2b9658f83SAneesh Kumar K.V 
3b9658f83SAneesh Kumar K.V #ifndef _ASM_POWERPC_BOOK3S_64_PKEYS_H
4b9658f83SAneesh Kumar K.V #define _ASM_POWERPC_BOOK3S_64_PKEYS_H
5b9658f83SAneesh Kumar K.V 
6b9658f83SAneesh Kumar K.V #include <asm/book3s/64/hash-pkey.h>
7b9658f83SAneesh Kumar K.V 
vmflag_to_pte_pkey_bits(vm_flags_t vm_flags)8*78ddaa35SLorenzo Stoakes static inline u64 vmflag_to_pte_pkey_bits(vm_flags_t vm_flags)
9b9658f83SAneesh Kumar K.V {
10f7045a45SAneesh Kumar K.V 	if (!mmu_has_feature(MMU_FTR_PKEY))
11b9658f83SAneesh Kumar K.V 		return 0x0UL;
12b9658f83SAneesh Kumar K.V 
13b9658f83SAneesh Kumar K.V 	if (radix_enabled())
14b9658f83SAneesh Kumar K.V 		BUG();
15b9658f83SAneesh Kumar K.V 	return hash__vmflag_to_pte_pkey_bits(vm_flags);
16b9658f83SAneesh Kumar K.V }
17b9658f83SAneesh Kumar K.V 
pte_to_pkey_bits(u64 pteflags)18b9658f83SAneesh Kumar K.V static inline u16 pte_to_pkey_bits(u64 pteflags)
19b9658f83SAneesh Kumar K.V {
20b9658f83SAneesh Kumar K.V 	if (radix_enabled())
21b9658f83SAneesh Kumar K.V 		BUG();
22b9658f83SAneesh Kumar K.V 	return hash__pte_to_pkey_bits(pteflags);
23b9658f83SAneesh Kumar K.V }
24b9658f83SAneesh Kumar K.V 
25b9658f83SAneesh Kumar K.V #endif /*_ASM_POWERPC_KEYS_H */
26