Skip to contentSkip to conversation

revert-x86-mm-remove-unused-__set_memory_prot.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message May 21, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: Revert "x86/mm: Remove unused __set_memory_prot()"
has been removed from the -mm tree. Its filename was
revert-x86-mm-remove-unused-__set_memory_prot.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Coiby Xu <[email protected]>
Subject: Revert "x86/mm: Remove unused __set_memory_prot()"
Date: Fri, 2 May 2025 09:12:40 +0800

This reverts commit 693bbf2a50447353c6a47961e6a7240a823ace02 as kdump LUKS support (CONFIG_CRASH_DM_CRYPT) depends on __set_memory_prot.

[[email protected]: x86 set_memory.h needs pgtable_types.h]
Cc Baoquan He <[email protected]>
Cc "Daniel P. Berrange" <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Dave Young <[email protected]>
Cc Jan Pazdziora <[email protected]>
Cc Liu Pingfan <[email protected]>
Cc Milan Broz <[email protected]>
Cc Ondrej Kozina <[email protected]>
Cc Vitaly Kuznetsov <[email protected]>

---

 arch/x86/include/asm/set_memory.h |    2 ++
 arch/x86/mm/pat/set_memory.c      |   13 +++++++++++++
 2 files changed, 15 insertions(+)
arch/x86/include/asm/set_memory.h renamed from arch/x86/include/asm/set_memory.h~revert-x86-mm-remove-unused-__set_memory_prot +2 -0
@@ -4,6 +4,7 @@
 
 #include <asm/page.h>
 #include <asm-generic/set_memory.h>
+#include <asm/pgtable.h>
 
 #define set_memory_rox set_memory_rox
 int set_memory_rox(unsigned long addr, int numpages);
@@ -37,6 +38,7 @@ int set_memory_rox(unsigned long addr, i
  * The caller is required to take care of these.
  */
 
+int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot);
 int _set_memory_uc(unsigned long addr, int numpages);
 int _set_memory_wc(unsigned long addr, int numpages);
 int _set_memory_wt(unsigned long addr, int numpages);
arch/x86/mm/pat/set_memory.c renamed from arch/x86/mm/pat/set_memory.c~revert-x86-mm-remove-unused-__set_memory_prot +13 -0
@@ -2148,6 +2148,19 @@ static inline int cpa_clear_pages_array(
 		CPA_PAGES_ARRAY, pages);
 }
 
+/*
+ * __set_memory_prot is an internal helper for callers that have been passed
+ * a pgprot_t value from upper layers and a reservation has already been taken.
+ * If you want to set the pgprot to a specific page protocol, use the
+ * set_memory_xx() functions.
+ */
+int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot)
+{
+	return change_page_attr_set_clr(&addr, numpages, prot,
+					__pgprot(~pgprot_val(prot)), 0, 0,
+					NULL);
+}
+
 int _set_memory_uc(unsigned long addr, int numpages)
 {
 	/*

_

Patches currently in -mm which might be from [email protected] are