Skip to content

Commit 030ad7a

Browse files
mhklinuxliuw
authored andcommitted
x86/mm: Regularize set_memory_p() parameters and make non-static
set_memory_p() is currently static. It has parameters that don't match set_memory_p() under arch/powerpc and that aren't congruent with the other set_memory_* functions. There's no good reason for the difference. Fix this by making the parameters consistent, and update the one existing call site. Make the function non-static and add it to include/asm/set_memory.h so that it is completely parallel to set_memory_np() and is usable in other modules. No functional change. Signed-off-by: Michael Kelley <mhklinux@outlook.com> Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Link: https://lore.kernel.org/r/20240116022008.1023398-3-mhklinux@outlook.com Signed-off-by: Wei Liu <wei.liu@kernel.org> Message-ID: <20240116022008.1023398-3-mhklinux@outlook.com>
1 parent 9fef276 commit 030ad7a

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

arch/x86/include/asm/set_memory.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ int set_memory_uc(unsigned long addr, int numpages);
4747
int set_memory_wc(unsigned long addr, int numpages);
4848
int set_memory_wb(unsigned long addr, int numpages);
4949
int set_memory_np(unsigned long addr, int numpages);
50+
int set_memory_p(unsigned long addr, int numpages);
5051
int set_memory_4k(unsigned long addr, int numpages);
5152
int set_memory_encrypted(unsigned long addr, int numpages);
5253
int set_memory_decrypted(unsigned long addr, int numpages);

arch/x86/mm/pat/set_memory.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,17 +2045,12 @@ int set_mce_nospec(unsigned long pfn)
20452045
return rc;
20462046
}
20472047

2048-
static int set_memory_p(unsigned long *addr, int numpages)
2049-
{
2050-
return change_page_attr_set(addr, numpages, __pgprot(_PAGE_PRESENT), 0);
2051-
}
2052-
20532048
/* Restore full speculative operation to the pfn. */
20542049
int clear_mce_nospec(unsigned long pfn)
20552050
{
20562051
unsigned long addr = (unsigned long) pfn_to_kaddr(pfn);
20572052

2058-
return set_memory_p(&addr, 1);
2053+
return set_memory_p(addr, 1);
20592054
}
20602055
EXPORT_SYMBOL_GPL(clear_mce_nospec);
20612056
#endif /* CONFIG_X86_64 */
@@ -2108,6 +2103,11 @@ int set_memory_np_noalias(unsigned long addr, int numpages)
21082103
CPA_NO_CHECK_ALIAS, NULL);
21092104
}
21102105

2106+
int set_memory_p(unsigned long addr, int numpages)
2107+
{
2108+
return change_page_attr_set(&addr, numpages, __pgprot(_PAGE_PRESENT), 0);
2109+
}
2110+
21112111
int set_memory_4k(unsigned long addr, int numpages)
21122112
{
21132113
return change_page_attr_set_clr(&addr, numpages, __pgprot(0),

0 commit comments

Comments
 (0)