diff options
author | Peter Zijlstra <peterz@infradead.org> | 2018-12-03 12:03:53 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-12-17 12:54:30 -0500 |
commit | 3c567356dbe0da4fc310cfcffafc39526e1ca43a (patch) | |
tree | c2b94ab25c5e0b5742731f0f1bc7b9e1c4392005 | |
parent | c38116bb940ae37f51fccd315b420ee5961dcb76 (diff) |
x86/mm/cpa: Rename @addrinarray to @numpages
The CPA_ARRAY interface works in single pages, and everything, except
in these 'few' locations is this variable called 'numpages'.
Remove this 'addrinarray' abberation and use 'numpages' consistently.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tom.StDenis@amd.com
Cc: dave.hansen@intel.com
Link: http://lkml.kernel.org/r/20181203171043.695039210@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/mm/pageattr.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 7d05149995dc..df4340c8e293 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -1808,14 +1808,14 @@ out_err: | |||
1808 | } | 1808 | } |
1809 | EXPORT_SYMBOL(set_memory_uc); | 1809 | EXPORT_SYMBOL(set_memory_uc); |
1810 | 1810 | ||
1811 | static int _set_memory_array(unsigned long *addr, int addrinarray, | 1811 | static int _set_memory_array(unsigned long *addr, int numpages, |
1812 | enum page_cache_mode new_type) | 1812 | enum page_cache_mode new_type) |
1813 | { | 1813 | { |
1814 | enum page_cache_mode set_type; | 1814 | enum page_cache_mode set_type; |
1815 | int i, j; | 1815 | int i, j; |
1816 | int ret; | 1816 | int ret; |
1817 | 1817 | ||
1818 | for (i = 0; i < addrinarray; i++) { | 1818 | for (i = 0; i < numpages; i++) { |
1819 | ret = reserve_memtype(__pa(addr[i]), __pa(addr[i]) + PAGE_SIZE, | 1819 | ret = reserve_memtype(__pa(addr[i]), __pa(addr[i]) + PAGE_SIZE, |
1820 | new_type, NULL); | 1820 | new_type, NULL); |
1821 | if (ret) | 1821 | if (ret) |
@@ -1826,11 +1826,11 @@ static int _set_memory_array(unsigned long *addr, int addrinarray, | |||
1826 | set_type = (new_type == _PAGE_CACHE_MODE_WC) ? | 1826 | set_type = (new_type == _PAGE_CACHE_MODE_WC) ? |
1827 | _PAGE_CACHE_MODE_UC_MINUS : new_type; | 1827 | _PAGE_CACHE_MODE_UC_MINUS : new_type; |
1828 | 1828 | ||
1829 | ret = change_page_attr_set(addr, addrinarray, | 1829 | ret = change_page_attr_set(addr, numpages, |
1830 | cachemode2pgprot(set_type), 1); | 1830 | cachemode2pgprot(set_type), 1); |
1831 | 1831 | ||
1832 | if (!ret && new_type == _PAGE_CACHE_MODE_WC) | 1832 | if (!ret && new_type == _PAGE_CACHE_MODE_WC) |
1833 | ret = change_page_attr_set_clr(addr, addrinarray, | 1833 | ret = change_page_attr_set_clr(addr, numpages, |
1834 | cachemode2pgprot( | 1834 | cachemode2pgprot( |
1835 | _PAGE_CACHE_MODE_WC), | 1835 | _PAGE_CACHE_MODE_WC), |
1836 | __pgprot(_PAGE_CACHE_MASK), | 1836 | __pgprot(_PAGE_CACHE_MASK), |
@@ -1847,21 +1847,21 @@ out_free: | |||
1847 | return ret; | 1847 | return ret; |
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | int set_memory_array_uc(unsigned long *addr, int addrinarray) | 1850 | int set_memory_array_uc(unsigned long *addr, int numpages) |
1851 | { | 1851 | { |
1852 | return _set_memory_array(addr, addrinarray, _PAGE_CACHE_MODE_UC_MINUS); | 1852 | return _set_memory_array(addr, numpages, _PAGE_CACHE_MODE_UC_MINUS); |
1853 | } | 1853 | } |
1854 | EXPORT_SYMBOL(set_memory_array_uc); | 1854 | EXPORT_SYMBOL(set_memory_array_uc); |
1855 | 1855 | ||
1856 | int set_memory_array_wc(unsigned long *addr, int addrinarray) | 1856 | int set_memory_array_wc(unsigned long *addr, int numpages) |
1857 | { | 1857 | { |
1858 | return _set_memory_array(addr, addrinarray, _PAGE_CACHE_MODE_WC); | 1858 | return _set_memory_array(addr, numpages, _PAGE_CACHE_MODE_WC); |
1859 | } | 1859 | } |
1860 | EXPORT_SYMBOL(set_memory_array_wc); | 1860 | EXPORT_SYMBOL(set_memory_array_wc); |
1861 | 1861 | ||
1862 | int set_memory_array_wt(unsigned long *addr, int addrinarray) | 1862 | int set_memory_array_wt(unsigned long *addr, int numpages) |
1863 | { | 1863 | { |
1864 | return _set_memory_array(addr, addrinarray, _PAGE_CACHE_MODE_WT); | 1864 | return _set_memory_array(addr, numpages, _PAGE_CACHE_MODE_WT); |
1865 | } | 1865 | } |
1866 | EXPORT_SYMBOL_GPL(set_memory_array_wt); | 1866 | EXPORT_SYMBOL_GPL(set_memory_array_wt); |
1867 | 1867 | ||
@@ -1941,18 +1941,18 @@ int set_memory_wb(unsigned long addr, int numpages) | |||
1941 | } | 1941 | } |
1942 | EXPORT_SYMBOL(set_memory_wb); | 1942 | EXPORT_SYMBOL(set_memory_wb); |
1943 | 1943 | ||
1944 | int set_memory_array_wb(unsigned long *addr, int addrinarray) | 1944 | int set_memory_array_wb(unsigned long *addr, int numpages) |
1945 | { | 1945 | { |
1946 | int i; | 1946 | int i; |
1947 | int ret; | 1947 | int ret; |
1948 | 1948 | ||
1949 | /* WB cache mode is hard wired to all cache attribute bits being 0 */ | 1949 | /* WB cache mode is hard wired to all cache attribute bits being 0 */ |
1950 | ret = change_page_attr_clear(addr, addrinarray, | 1950 | ret = change_page_attr_clear(addr, numpages, |
1951 | __pgprot(_PAGE_CACHE_MASK), 1); | 1951 | __pgprot(_PAGE_CACHE_MASK), 1); |
1952 | if (ret) | 1952 | if (ret) |
1953 | return ret; | 1953 | return ret; |
1954 | 1954 | ||
1955 | for (i = 0; i < addrinarray; i++) | 1955 | for (i = 0; i < numpages; i++) |
1956 | free_memtype(__pa(addr[i]), __pa(addr[i]) + PAGE_SIZE); | 1956 | free_memtype(__pa(addr[i]), __pa(addr[i]) + PAGE_SIZE); |
1957 | 1957 | ||
1958 | return 0; | 1958 | return 0; |
@@ -2082,7 +2082,7 @@ int set_pages_uc(struct page *page, int numpages) | |||
2082 | } | 2082 | } |
2083 | EXPORT_SYMBOL(set_pages_uc); | 2083 | EXPORT_SYMBOL(set_pages_uc); |
2084 | 2084 | ||
2085 | static int _set_pages_array(struct page **pages, int addrinarray, | 2085 | static int _set_pages_array(struct page **pages, int numpages, |
2086 | enum page_cache_mode new_type) | 2086 | enum page_cache_mode new_type) |
2087 | { | 2087 | { |
2088 | unsigned long start; | 2088 | unsigned long start; |
@@ -2092,7 +2092,7 @@ static int _set_pages_array(struct page **pages, int addrinarray, | |||
2092 | int free_idx; | 2092 | int free_idx; |
2093 | int ret; | 2093 | int ret; |
2094 | 2094 | ||
2095 | for (i = 0; i < addrinarray; i++) { | 2095 | for (i = 0; i < numpages; i++) { |
2096 | if (PageHighMem(pages[i])) | 2096 | if (PageHighMem(pages[i])) |
2097 | continue; | 2097 | continue; |
2098 | start = page_to_pfn(pages[i]) << PAGE_SHIFT; | 2098 | start = page_to_pfn(pages[i]) << PAGE_SHIFT; |
@@ -2105,10 +2105,10 @@ static int _set_pages_array(struct page **pages, int addrinarray, | |||
2105 | set_type = (new_type == _PAGE_CACHE_MODE_WC) ? | 2105 | set_type = (new_type == _PAGE_CACHE_MODE_WC) ? |
2106 | _PAGE_CACHE_MODE_UC_MINUS : new_type; | 2106 | _PAGE_CACHE_MODE_UC_MINUS : new_type; |
2107 | 2107 | ||
2108 | ret = cpa_set_pages_array(pages, addrinarray, | 2108 | ret = cpa_set_pages_array(pages, numpages, |
2109 | cachemode2pgprot(set_type)); | 2109 | cachemode2pgprot(set_type)); |
2110 | if (!ret && new_type == _PAGE_CACHE_MODE_WC) | 2110 | if (!ret && new_type == _PAGE_CACHE_MODE_WC) |
2111 | ret = change_page_attr_set_clr(NULL, addrinarray, | 2111 | ret = change_page_attr_set_clr(NULL, numpages, |
2112 | cachemode2pgprot( | 2112 | cachemode2pgprot( |
2113 | _PAGE_CACHE_MODE_WC), | 2113 | _PAGE_CACHE_MODE_WC), |
2114 | __pgprot(_PAGE_CACHE_MASK), | 2114 | __pgprot(_PAGE_CACHE_MASK), |
@@ -2128,21 +2128,21 @@ err_out: | |||
2128 | return -EINVAL; | 2128 | return -EINVAL; |
2129 | } | 2129 | } |
2130 | 2130 | ||
2131 | int set_pages_array_uc(struct page **pages, int addrinarray) | 2131 | int set_pages_array_uc(struct page **pages, int numpages) |
2132 | { | 2132 | { |
2133 | return _set_pages_array(pages, addrinarray, _PAGE_CACHE_MODE_UC_MINUS); | 2133 | return _set_pages_array(pages, numpages, _PAGE_CACHE_MODE_UC_MINUS); |
2134 | } | 2134 | } |
2135 | EXPORT_SYMBOL(set_pages_array_uc); | 2135 | EXPORT_SYMBOL(set_pages_array_uc); |
2136 | 2136 | ||
2137 | int set_pages_array_wc(struct page **pages, int addrinarray) | 2137 | int set_pages_array_wc(struct page **pages, int numpages) |
2138 | { | 2138 | { |
2139 | return _set_pages_array(pages, addrinarray, _PAGE_CACHE_MODE_WC); | 2139 | return _set_pages_array(pages, numpages, _PAGE_CACHE_MODE_WC); |
2140 | } | 2140 | } |
2141 | EXPORT_SYMBOL(set_pages_array_wc); | 2141 | EXPORT_SYMBOL(set_pages_array_wc); |
2142 | 2142 | ||
2143 | int set_pages_array_wt(struct page **pages, int addrinarray) | 2143 | int set_pages_array_wt(struct page **pages, int numpages) |
2144 | { | 2144 | { |
2145 | return _set_pages_array(pages, addrinarray, _PAGE_CACHE_MODE_WT); | 2145 | return _set_pages_array(pages, numpages, _PAGE_CACHE_MODE_WT); |
2146 | } | 2146 | } |
2147 | EXPORT_SYMBOL_GPL(set_pages_array_wt); | 2147 | EXPORT_SYMBOL_GPL(set_pages_array_wt); |
2148 | 2148 | ||
@@ -2154,7 +2154,7 @@ int set_pages_wb(struct page *page, int numpages) | |||
2154 | } | 2154 | } |
2155 | EXPORT_SYMBOL(set_pages_wb); | 2155 | EXPORT_SYMBOL(set_pages_wb); |
2156 | 2156 | ||
2157 | int set_pages_array_wb(struct page **pages, int addrinarray) | 2157 | int set_pages_array_wb(struct page **pages, int numpages) |
2158 | { | 2158 | { |
2159 | int retval; | 2159 | int retval; |
2160 | unsigned long start; | 2160 | unsigned long start; |
@@ -2162,12 +2162,12 @@ int set_pages_array_wb(struct page **pages, int addrinarray) | |||
2162 | int i; | 2162 | int i; |
2163 | 2163 | ||
2164 | /* WB cache mode is hard wired to all cache attribute bits being 0 */ | 2164 | /* WB cache mode is hard wired to all cache attribute bits being 0 */ |
2165 | retval = cpa_clear_pages_array(pages, addrinarray, | 2165 | retval = cpa_clear_pages_array(pages, numpages, |
2166 | __pgprot(_PAGE_CACHE_MASK)); | 2166 | __pgprot(_PAGE_CACHE_MASK)); |
2167 | if (retval) | 2167 | if (retval) |
2168 | return retval; | 2168 | return retval; |
2169 | 2169 | ||
2170 | for (i = 0; i < addrinarray; i++) { | 2170 | for (i = 0; i < numpages; i++) { |
2171 | if (PageHighMem(pages[i])) | 2171 | if (PageHighMem(pages[i])) |
2172 | continue; | 2172 | continue; |
2173 | start = page_to_pfn(pages[i]) << PAGE_SHIFT; | 2173 | start = page_to_pfn(pages[i]) << PAGE_SHIFT; |