Skip to contentSkip to conversation

mm-always-have-io_remap_pfn_range-set-pgprot_decrypted.patch removed from -mm tree

merged [email protected] 1 participant 1 message Nov 3, 2020 Stable branch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm: always have io_remap_pfn_range() set pgprot_decrypted()
has been removed from the -mm tree. Its filename was
mm-always-have-io_remap_pfn_range-set-pgprot_decrypted.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Jason Gunthorpe <[email protected]>
Subject: mm: always have io_remap_pfn_range() set pgprot_decrypted()

The purpose of io_remap_pfn_range() is to map IO memory, such as a memory mapped IO exposed through a PCI BAR. IO devices do not understand encryption, so this memory must always be decrypted. Automatically call pgprot_decrypted() as part of the generic implementation.

This fixes a bug where enabling AMD SME causes subsystems, such as RDMA, using io_remap_pfn_range() to expose BAR pages to user space to fail. The CPU will encrypt access to those BAR pages instead of passing unencrypted IO directly to the device.

Places not mapping IO should use remap_pfn_range().

Fixes aca20d546214 ("x86/mm: Add support to make use of Secure Memory Encryption")
Cc Tom Lendacky <[email protected]>
Cc Thomas Gleixner <[email protected]>

CcK Arnd Bergmann <[email protected]>

Cc Andrey Ryabinin <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brijesh Singh <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc "Dave Young" <[email protected]>
Cc Alexander Potapenko <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Larry Woodman <[email protected]>
Cc Matt Fleming <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Toshimitsu Kani <[email protected]>

---

 include/linux/mm.h      |    9 +++++++++
 include/linux/pgtable.h |    4 ----
 2 files changed, 9 insertions(+), 4 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-always-have-io_remap_pfn_range-set-pgprot_decrypted +9 -0
@@ -2759,6 +2759,15 @@ static inline vm_fault_t vmf_insert_page
 	return VM_FAULT_NOPAGE;
 }
 
+#ifndef io_remap_pfn_range
+static inline int io_remap_pfn_range(struct vm_area_struct *vma,
+				     unsigned long addr, unsigned long pfn,
+				     unsigned long size, pgprot_t prot)
+{
+	return remap_pfn_range(vma, addr, pfn, size, pgprot_decrypted(prot));
+}
+#endif
+
 static inline vm_fault_t vmf_error(int err)
 {
 	if (err == -ENOMEM)
include/linux/pgtable.h renamed from include/linux/pgtable.h~mm-always-have-io_remap_pfn_range-set-pgprot_decrypted +0 -4
@@ -1427,10 +1427,6 @@ typedef unsigned int pgtbl_mod_mask;
 
 #endif /* !__ASSEMBLY__ */
 
-#ifndef io_remap_pfn_range
-#define io_remap_pfn_range remap_pfn_range
-#endif
-
 #ifndef has_transparent_hugepage
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 #define has_transparent_hugepage() 1

_

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

mm-gup-use-unpin_user_pages-in-check_and_migrate_cma_pages.patch