1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASMS390_SET_MEMORY_H
3 #define _ASMS390_SET_MEMORY_H
5 #include <linux/mutex.h>
7 extern struct mutex cpa_mutex;
19 #define SET_MEMORY_RO BIT(_SET_MEMORY_RO_BIT)
20 #define SET_MEMORY_RW BIT(_SET_MEMORY_RW_BIT)
21 #define SET_MEMORY_NX BIT(_SET_MEMORY_NX_BIT)
22 #define SET_MEMORY_X BIT(_SET_MEMORY_X_BIT)
23 #define SET_MEMORY_4K BIT(_SET_MEMORY_4K_BIT)
24 #define SET_MEMORY_INV BIT(_SET_MEMORY_INV_BIT)
25 #define SET_MEMORY_DEF BIT(_SET_MEMORY_DEF_BIT)
27 int __set_memory(unsigned long addr, int numpages, unsigned long flags);
29 static inline int set_memory_ro(unsigned long addr, int numpages)
31 return __set_memory(addr, numpages, SET_MEMORY_RO);
34 static inline int set_memory_rw(unsigned long addr, int numpages)
36 return __set_memory(addr, numpages, SET_MEMORY_RW);
39 static inline int set_memory_nx(unsigned long addr, int numpages)
41 return __set_memory(addr, numpages, SET_MEMORY_NX);
44 static inline int set_memory_x(unsigned long addr, int numpages)
46 return __set_memory(addr, numpages, SET_MEMORY_X);
49 #define set_memory_rox set_memory_rox
50 static inline int set_memory_rox(unsigned long addr, int numpages)
52 return __set_memory(addr, numpages, SET_MEMORY_RO | SET_MEMORY_X);
55 static inline int set_memory_rwnx(unsigned long addr, int numpages)
57 return __set_memory(addr, numpages, SET_MEMORY_RW | SET_MEMORY_NX);
60 static inline int set_memory_4k(unsigned long addr, int numpages)
62 return __set_memory(addr, numpages, SET_MEMORY_4K);
65 int set_direct_map_invalid_noflush(struct page *page);
66 int set_direct_map_default_noflush(struct page *page);