0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __ASM_POWERPC_KFENCE_H
0009 #define __ASM_POWERPC_KFENCE_H
0010
0011 #include <linux/mm.h>
0012 #include <asm/pgtable.h>
0013
0014 static inline bool arch_kfence_init_pool(void)
0015 {
0016 return true;
0017 }
0018
0019 static inline bool kfence_protect_page(unsigned long addr, bool protect)
0020 {
0021 pte_t *kpte = virt_to_kpte(addr);
0022
0023 if (protect) {
0024 pte_update(&init_mm, addr, kpte, _PAGE_PRESENT, 0, 0);
0025 flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
0026 } else {
0027 pte_update(&init_mm, addr, kpte, 0, _PAGE_PRESENT, 0);
0028 }
0029
0030 return true;
0031 }
0032
0033 #endif