Add two new functions set_direct_map_default_noflush() and set_direct_map_invalid_noflush() for setting the direct map alias for the page to its default valid permissions and to an invalid state that cannot be cached in a TLB, respectively. These functions do not flush the TLB. Note, __kernel_map_pages() does something similar but flushes the TLB and doesn't reset the permission bits to default on all architectures. Also add an ARCH config ARCH_HAS_SET_DIRECT_MAP for specifying whether these have an actual implementation or a default empty one.
Showing the changes to include/linux (1 of 5 files). Show all
Unified · Split
| @@ -17,6 +17,17 @@ static inline int set_memory_x(unsigned long addr, int numpages) { return 0; } · 16 unmodified lines | ||
| 17 | 17 | static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; } |
| 18 | 18 | #endif |
| 19 | 19 | |
| 20 | +#ifndef CONFIG_ARCH_HAS_SET_DIRECT_MAP | |
| 21 | +static inline int set_direct_map_invalid_noflush(struct page *page) | |
| 22 | +{ | |
| 23 | + return 0; | |
| 24 | +} | |
| 25 | +static inline int set_direct_map_default_noflush(struct page *page) | |
| 26 | +{ | |
| 27 | + return 0; | |
| 28 | +} | |
| 29 | +#endif | |
| 30 | + | |
| 20 | 31 | #ifndef set_mce_nospec |
| 21 | 32 | static inline int set_mce_nospec(unsigned long pfn) |
| 22 | 33 | { |