Commit | Line | Data |
---|---|---|
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 | |
11 | static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; } | |
12 | static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; } | |
13 | static inline int set_memory_x(unsigned long addr, int numpages) { return 0; } | |
14 | static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; } | |
15 | #endif | |
16 | ||
d253ca0c RE |
17 | #ifndef CONFIG_ARCH_HAS_SET_DIRECT_MAP |
18 | static inline int set_direct_map_invalid_noflush(struct page *page) | |
19 | { | |
20 | return 0; | |
21 | } | |
22 | static inline int set_direct_map_default_noflush(struct page *page) | |
23 | { | |
24 | return 0; | |
25 | } | |
32a0de88 MR |
26 | |
27 | static inline bool kernel_page_present(struct page *page) | |
28 | { | |
29 | return true; | |
30 | } | |
6d47c23b MR |
31 | #else /* CONFIG_ARCH_HAS_SET_DIRECT_MAP */ |
32 | /* | |
33 | * Some architectures, e.g. ARM64 can disable direct map modifications at | |
34 | * boot time. Let them overrive this query. | |
35 | */ | |
36 | #ifndef can_set_direct_map | |
37 | static inline bool can_set_direct_map(void) | |
38 | { | |
39 | return true; | |
40 | } | |
41 | #define can_set_direct_map can_set_direct_map | |
d253ca0c | 42 | #endif |
6d47c23b | 43 | #endif /* CONFIG_ARCH_HAS_SET_DIRECT_MAP */ |
d253ca0c | 44 | |
b3fdf939 | 45 | #ifdef CONFIG_X86_64 |
5898b43a | 46 | int set_mce_nospec(unsigned long pfn); |
b3fdf939 JC |
47 | int clear_mce_nospec(unsigned long pfn); |
48 | #else | |
5898b43a | 49 | static inline int set_mce_nospec(unsigned long pfn) |
284ce401 DW |
50 | { |
51 | return 0; | |
52 | } | |
284ce401 DW |
53 | static inline int clear_mce_nospec(unsigned long pfn) |
54 | { | |
55 | return 0; | |
56 | } | |
57 | #endif | |
58 | ||
b7fa0746 CH |
59 | #ifndef CONFIG_ARCH_HAS_MEM_ENCRYPT |
60 | static inline int set_memory_encrypted(unsigned long addr, int numpages) | |
61 | { | |
62 | return 0; | |
63 | } | |
64 | ||
65 | static inline int set_memory_decrypted(unsigned long addr, int numpages) | |
66 | { | |
67 | return 0; | |
68 | } | |
69 | #endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */ | |
70 | ||
938f8464 | 71 | #endif /* _LINUX_SET_MEMORY_H_ */ |