![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 #ifndef _ASM_X86_SET_MEMORY_H 0003 #define _ASM_X86_SET_MEMORY_H 0004 0005 #include <linux/mm.h> 0006 #include <asm/page.h> 0007 #include <asm-generic/set_memory.h> 0008 0009 /* 0010 * The set_memory_* API can be used to change various attributes of a virtual 0011 * address range. The attributes include: 0012 * Cacheability : UnCached, WriteCombining, WriteThrough, WriteBack 0013 * Executability : eXecutable, NoteXecutable 0014 * Read/Write : ReadOnly, ReadWrite 0015 * Presence : NotPresent 0016 * Encryption : Encrypted, Decrypted 0017 * 0018 * Within a category, the attributes are mutually exclusive. 0019 * 0020 * The implementation of this API will take care of various aspects that 0021 * are associated with changing such attributes, such as: 0022 * - Flushing TLBs 0023 * - Flushing CPU caches 0024 * - Making sure aliases of the memory behind the mapping don't violate 0025 * coherency rules as defined by the CPU in the system. 0026 * 0027 * What this API does not do: 0028 * - Provide exclusion between various callers - including callers that 0029 * operation on other mappings of the same physical page 0030 * - Restore default attributes when a page is freed 0031 * - Guarantee that mappings other than the requested one are 0032 * in any state, other than that these do not violate rules for 0033 * the CPU you have. Do not depend on any effects on other mappings, 0034 * CPUs other than the one you have may have more relaxed rules. 0035 * The caller is required to take care of these. 0036 */ 0037 0038 int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot); 0039 int _set_memory_uc(unsigned long addr, int numpages); 0040 int _set_memory_wc(unsigned long addr, int numpages); 0041 int _set_memory_wt(unsigned long addr, int numpages); 0042 int _set_memory_wb(unsigned long addr, int numpages); 0043 int set_memory_uc(unsigned long addr, int numpages); 0044 int set_memory_wc(unsigned long addr, int numpages); 0045 int set_memory_wb(unsigned long addr, int numpages); 0046 int set_memory_np(unsigned long addr, int numpages); 0047 int set_memory_4k(unsigned long addr, int numpages); 0048 int set_memory_encrypted(unsigned long addr, int numpages); 0049 int set_memory_decrypted(unsigned long addr, int numpages); 0050 int set_memory_np_noalias(unsigned long addr, int numpages); 0051 int set_memory_nonglobal(unsigned long addr, int numpages); 0052 int set_memory_global(unsigned long addr, int numpages); 0053 0054 int set_pages_array_uc(struct page **pages, int addrinarray); 0055 int set_pages_array_wc(struct page **pages, int addrinarray); 0056 int set_pages_array_wb(struct page **pages, int addrinarray); 0057 0058 /* 0059 * For legacy compatibility with the old APIs, a few functions 0060 * are provided that work on a "struct page". 0061 * These functions operate ONLY on the 1:1 kernel mapping of the 0062 * memory that the struct page represents, and internally just 0063 * call the set_memory_* function. See the description of the 0064 * set_memory_* function for more details on conventions. 0065 * 0066 * These APIs should be considered *deprecated* and are likely going to 0067 * be removed in the future. 0068 * The reason for this is the implicit operation on the 1:1 mapping only, 0069 * making this not a generally useful API. 0070 * 0071 * Specifically, many users of the old APIs had a virtual address, 0072 * called virt_to_page() or vmalloc_to_page() on that address to 0073 * get a struct page* that the old API required. 0074 * To convert these cases, use set_memory_*() on the original 0075 * virtual address, do not use these functions. 0076 */ 0077 0078 int set_pages_uc(struct page *page, int numpages); 0079 int set_pages_wb(struct page *page, int numpages); 0080 int set_pages_ro(struct page *page, int numpages); 0081 int set_pages_rw(struct page *page, int numpages); 0082 0083 int set_direct_map_invalid_noflush(struct page *page); 0084 int set_direct_map_default_noflush(struct page *page); 0085 bool kernel_page_present(struct page *page); 0086 0087 extern int kernel_set_to_readonly; 0088 0089 #endif /* _ASM_X86_SET_MEMORY_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |