1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASMS390_SET_MEMORY_H
3 #define _ASMS390_SET_MEMORY_H
4
5 #include <linux/mutex.h>
6
7 extern struct mutex cpa_mutex;
8
9 #define SET_MEMORY_RO 1UL
10 #define SET_MEMORY_RW 2UL
11 #define SET_MEMORY_NX 4UL
12 #define SET_MEMORY_X 8UL
13
14 int __set_memory(unsigned long addr, int numpages, unsigned long flags);
15
set_memory_ro(unsigned long addr,int numpages)16 static inline int set_memory_ro(unsigned long addr, int numpages)
17 {
18 return __set_memory(addr, numpages, SET_MEMORY_RO);
19 }
20
set_memory_rw(unsigned long addr,int numpages)21 static inline int set_memory_rw(unsigned long addr, int numpages)
22 {
23 return __set_memory(addr, numpages, SET_MEMORY_RW);
24 }
25
set_memory_nx(unsigned long addr,int numpages)26 static inline int set_memory_nx(unsigned long addr, int numpages)
27 {
28 return __set_memory(addr, numpages, SET_MEMORY_NX);
29 }
30
set_memory_x(unsigned long addr,int numpages)31 static inline int set_memory_x(unsigned long addr, int numpages)
32 {
33 return __set_memory(addr, numpages, SET_MEMORY_X);
34 }
35
36 #endif
37