1 /* SPDX-License-Identifier: GPL-2.0 */
3 * PA-RISC KFENCE support.
5 * Copyright (C) 2021, Helge Deller <deller@gmx.de>
8 #ifndef _ASM_PARISC_KFENCE_H
9 #define _ASM_PARISC_KFENCE_H
11 #include <linux/kfence.h>
13 #include <asm/pgtable.h>
14 #include <asm/tlbflush.h>
16 static inline bool arch_kfence_init_pool(void)
21 /* Protect the given page and flush TLB. */
22 static inline bool kfence_protect_page(unsigned long addr, bool protect)
24 pte_t *pte = virt_to_kpte(addr);
30 * We need to avoid IPIs, as we may get KFENCE allocations or faults
31 * with interrupts disabled.
35 set_pte(pte, __pte(pte_val(*pte) & ~_PAGE_PRESENT));
37 set_pte(pte, __pte(pte_val(*pte) | _PAGE_PRESENT));
39 flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
44 #endif /* _ASM_PARISC_KFENCE_H */