1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef _ASM_S390_KFENCE_H
4 #define _ASM_S390_KFENCE_H
7 #include <linux/kfence.h>
8 #include <asm/set_memory.h>
11 void __kernel_map_pages(struct page *page, int numpages, int enable);
13 static __always_inline bool arch_kfence_init_pool(void)
18 #define arch_kfence_test_address(addr) ((addr) & PAGE_MASK)
21 * Do not split kfence pool to 4k mapping with arch_kfence_init_pool(),
22 * but earlier where page table allocations still happen with memblock.
23 * Reason is that arch_kfence_init_pool() gets called when the system
24 * is still in a limbo state - disabling and enabling bottom halves is
25 * not yet allowed, but that is what our page_table_alloc() would do.
27 static __always_inline void kfence_split_mapping(void)
30 unsigned long pool_pages = KFENCE_POOL_SIZE >> PAGE_SHIFT;
32 set_memory_4k((unsigned long)__kfence_pool, pool_pages);
36 static inline bool kfence_protect_page(unsigned long addr, bool protect)
38 __kernel_map_pages(virt_to_page(addr), 1, !protect);
42 #endif /* _ASM_S390_KFENCE_H */