io_uring/cmd: add cmd lazy tw wake helper
[linux-block.git] / include / linux / set_memory.h
CommitLineData
d2912cb1 1/* SPDX-License-Identifier: GPL-2.0-only */
938f8464
ME
2/*
3 * Copyright 2017, Michael Ellerman, IBM Corporation.
938f8464
ME
4 */
5#ifndef _LINUX_SET_MEMORY_H_
6#define _LINUX_SET_MEMORY_H_
7
8#ifdef CONFIG_ARCH_HAS_SET_MEMORY
9#include <asm/set_memory.h>
10#else
11static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; }
12static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; }
13static inline int set_memory_x(unsigned long addr, int numpages) { return 0; }
14static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; }
15#endif
16
60463628 17#ifndef set_memory_rox
d48567c9
PZ
18static inline int set_memory_rox(unsigned long addr, int numpages)
19{
20 int ret = set_memory_ro(addr, numpages);
21 if (ret)
22 return ret;
23 return set_memory_x(addr, numpages);
24}
60463628 25#endif
d48567c9 26
d253ca0c
RE
27#ifndef CONFIG_ARCH_HAS_SET_DIRECT_MAP
28static inline int set_direct_map_invalid_noflush(struct page *page)
29{
30 return 0;
31}
32static inline int set_direct_map_default_noflush(struct page *page)
33{
34 return 0;
35}
32a0de88
MR
36
37static inline bool kernel_page_present(struct page *page)
38{
39 return true;
40}
6d47c23b
MR
41#else /* CONFIG_ARCH_HAS_SET_DIRECT_MAP */
42/*
43 * Some architectures, e.g. ARM64 can disable direct map modifications at
44 * boot time. Let them overrive this query.
45 */
46#ifndef can_set_direct_map
47static inline bool can_set_direct_map(void)
48{
49 return true;
50}
51#define can_set_direct_map can_set_direct_map
d253ca0c 52#endif
6d47c23b 53#endif /* CONFIG_ARCH_HAS_SET_DIRECT_MAP */
d253ca0c 54
b3fdf939 55#ifdef CONFIG_X86_64
5898b43a 56int set_mce_nospec(unsigned long pfn);
b3fdf939
JC
57int clear_mce_nospec(unsigned long pfn);
58#else
5898b43a 59static inline int set_mce_nospec(unsigned long pfn)
284ce401
DW
60{
61 return 0;
62}
284ce401
DW
63static inline int clear_mce_nospec(unsigned long pfn)
64{
65 return 0;
66}
67#endif
68
b7fa0746
CH
69#ifndef CONFIG_ARCH_HAS_MEM_ENCRYPT
70static inline int set_memory_encrypted(unsigned long addr, int numpages)
71{
72 return 0;
73}
74
75static inline int set_memory_decrypted(unsigned long addr, int numpages)
76{
77 return 0;
78}
79#endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */
80
938f8464 81#endif /* _LINUX_SET_MEMORY_H_ */