[PATCH v4 07/14] mm: abstract io_remap_pfn_range() based on PFN

Lorenzo Stoakes lorenzo.stoakes at oracle.com
Thu Sep 18 02:11:12 PDT 2025


Hi Andrew,

Could you apply the below fix-patch please?

Jason pointed out correctly that pgprot_decrypted() is a noop for the arches in
question so there's no need to do anything special with them.

Cheers, Lorenzo

----8<----
>From 9bd1cafa84108a06db8e2135f5e5b0d3e0bf3859 Mon Sep 17 00:00:00 2001
From: Lorenzo Stoakes <lorenzo.stoakes at oracle.com>
Date: Thu, 18 Sep 2025 07:41:37 +0100
Subject: [PATCH] io_remap_pfn_range_pfn fixup

Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes at oracle.com>
---
 arch/csky/include/asm/pgtable.h |  2 --
 include/linux/mm.h              | 15 ++-------------
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/arch/csky/include/asm/pgtable.h b/arch/csky/include/asm/pgtable.h
index 967c86b38f11..d606afbabce1 100644
--- a/arch/csky/include/asm/pgtable.h
+++ b/arch/csky/include/asm/pgtable.h
@@ -263,6 +263,4 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma,
 #define update_mmu_cache(vma, addr, ptep) \
 	update_mmu_cache_range(NULL, vma, addr, ptep, 1)

-#define io_remap_pfn_range_pfn(pfn, size) (pfn)
-
 #endif /* __ASM_CSKY_PGTABLE_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9b65c33bb31a..08261f2f6244 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3672,23 +3672,12 @@ static inline vm_fault_t vmf_insert_page(struct vm_area_struct *vma,
 	return VM_FAULT_NOPAGE;
 }

-#ifdef io_remap_pfn_range_pfn
-static inline unsigned long io_remap_pfn_range_prot(pgprot_t prot)
-{
-	/* We do not decrypt if arch customises PFN. */
-	return prot;
-}
-#else
+#ifndef io_remap_pfn_range_pfn
 static inline unsigned long io_remap_pfn_range_pfn(unsigned long pfn,
 		unsigned long size)
 {
 	return pfn;
 }
-
-static inline pgprot_t io_remap_pfn_range_prot(pgprot_t prot)
-{
-	return pgprot_decrypted(prot);
-}
 #endif

 static inline int io_remap_pfn_range(struct vm_area_struct *vma,
@@ -3696,7 +3685,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
 				    unsigned long size, pgprot_t orig_prot)
 {
 	const unsigned long pfn = io_remap_pfn_range_pfn(orig_pfn, size);
-	const pgprot_t prot = io_remap_pfn_range_prot(orig_prot);
+	const pgprot_t prot = pgprot_decrypted(orig_prot);

 	return remap_pfn_range(vma, addr, pfn, size, prot);
 }
--
2.51.0



More information about the kexec mailing list