x86/mm: Regularize set_memory_p() parameters and make non-static
authorMichael Kelley <mhklinux@outlook.com>
Tue, 16 Jan 2024 02:20:07 +0000 (18:20 -0800)
committerWei Liu <wei.liu@kernel.org>
Fri, 1 Mar 2024 08:31:41 +0000 (08:31 +0000)
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>

arch/x86/include/asm/set_memory.h
arch/x86/mm/pat/set_memory.c

index a5e89641bd2dac7e9fa5e1ab548369836640908a..9aee31862b4a8b8cbf2242db991a5cbeb3d41e21 100644 (file)
@@ -47,6 +47,7 @@ int set_memory_uc(unsigned long addr, int numpages);
 int set_memory_wc(unsigned long addr, int numpages);
 int set_memory_wb(unsigned long addr, int numpages);
 int set_memory_np(unsigned long addr, int numpages);
+int set_memory_p(unsigned long addr, int numpages);
 int set_memory_4k(unsigned long addr, int numpages);
 int set_memory_encrypted(unsigned long addr, int numpages);
 int set_memory_decrypted(unsigned long addr, int numpages);
index b28b6f8afb0e9f6004a8ac6603086931bdd11b63..10288040404635743bac78ee8bb0fd721b370b88 100644 (file)
@@ -2045,17 +2045,12 @@ int set_mce_nospec(unsigned long pfn)
        return rc;
 }
 
-static int set_memory_p(unsigned long *addr, int numpages)
-{
-       return change_page_attr_set(addr, numpages, __pgprot(_PAGE_PRESENT), 0);
-}
-
 /* Restore full speculative operation to the pfn. */
 int clear_mce_nospec(unsigned long pfn)
 {
        unsigned long addr = (unsigned long) pfn_to_kaddr(pfn);
 
-       return set_memory_p(&addr, 1);
+       return set_memory_p(addr, 1);
 }
 EXPORT_SYMBOL_GPL(clear_mce_nospec);
 #endif /* CONFIG_X86_64 */
@@ -2108,6 +2103,11 @@ int set_memory_np_noalias(unsigned long addr, int numpages)
                                        CPA_NO_CHECK_ALIAS, NULL);
 }
 
+int set_memory_p(unsigned long addr, int numpages)
+{
+       return change_page_attr_set(&addr, numpages, __pgprot(_PAGE_PRESENT), 0);
+}
+
 int set_memory_4k(unsigned long addr, int numpages)
 {
        return change_page_attr_set_clr(&addr, numpages, __pgprot(0),