From: "tip-bot2 for Joerg Roedel" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Joerg Roedel <jroedel@suse.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/mm] x86/mm: Fix PAGE_KERNEL_IO removal breakage
Date: Thu, 02 Dec 2021 18:15:07 -0000 [thread overview]
Message-ID: <163846890716.11128.7464150139974319110.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20211202144646.23186-1-joro@8bytes.org>
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: 9a951429b2e1670a76b68c90880b01430fe509e4
Gitweb: https://git.kernel.org/tip/9a951429b2e1670a76b68c90880b01430fe509e4
Author: Joerg Roedel <jroedel@suse.de>
AuthorDate: Thu, 02 Dec 2021 15:46:46 +01:00
Committer: Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Thu, 02 Dec 2021 09:41:24 -08:00
x86/mm: Fix PAGE_KERNEL_IO removal breakage
The removal of PAGE_KERNEL_IO broke SEV-ES because it changed the
mapping of ioremap and some fixmap areas (like the local APIC page)
from unencrypted to encrypted. Change those mappings back to
be unencrypted.
Fixes: 27dff0f58bde ("x86/mm: Nuke PAGE_KERNEL_IO")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lkml.kernel.org/r/20211202144646.23186-1-joro@8bytes.org
---
arch/x86/include/asm/fixmap.h | 2 +-
arch/x86/include/asm/pgtable_types.h | 21 +++++++++++----------
arch/x86/mm/ioremap.c | 2 +-
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index 5e186a6..a2eaf26 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -173,7 +173,7 @@ static inline void __set_fixmap(enum fixed_addresses idx,
* supported for MMIO addresses, so make sure that the memory encryption
* mask is not part of the page attributes.
*/
-#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE
+#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE_NOENC
/*
* Early memremap routines used for in-place encryption. The mappings created
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index a872247..fc9b699 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -208,16 +208,17 @@ enum page_cache_mode {
#define __pgprot_mask(x) __pgprot((x) & __default_kernel_pte_mask)
-#define PAGE_KERNEL __pgprot_mask(__PAGE_KERNEL | _ENC)
-#define PAGE_KERNEL_NOENC __pgprot_mask(__PAGE_KERNEL | 0)
-#define PAGE_KERNEL_RO __pgprot_mask(__PAGE_KERNEL_RO | _ENC)
-#define PAGE_KERNEL_EXEC __pgprot_mask(__PAGE_KERNEL_EXEC | _ENC)
-#define PAGE_KERNEL_EXEC_NOENC __pgprot_mask(__PAGE_KERNEL_EXEC | 0)
-#define PAGE_KERNEL_ROX __pgprot_mask(__PAGE_KERNEL_ROX | _ENC)
-#define PAGE_KERNEL_NOCACHE __pgprot_mask(__PAGE_KERNEL_NOCACHE | _ENC)
-#define PAGE_KERNEL_LARGE __pgprot_mask(__PAGE_KERNEL_LARGE | _ENC)
-#define PAGE_KERNEL_LARGE_EXEC __pgprot_mask(__PAGE_KERNEL_LARGE_EXEC | _ENC)
-#define PAGE_KERNEL_VVAR __pgprot_mask(__PAGE_KERNEL_VVAR | _ENC)
+#define PAGE_KERNEL __pgprot_mask(__PAGE_KERNEL | _ENC)
+#define PAGE_KERNEL_NOENC __pgprot_mask(__PAGE_KERNEL | 0)
+#define PAGE_KERNEL_RO __pgprot_mask(__PAGE_KERNEL_RO | _ENC)
+#define PAGE_KERNEL_EXEC __pgprot_mask(__PAGE_KERNEL_EXEC | _ENC)
+#define PAGE_KERNEL_EXEC_NOENC __pgprot_mask(__PAGE_KERNEL_EXEC | 0)
+#define PAGE_KERNEL_ROX __pgprot_mask(__PAGE_KERNEL_ROX | _ENC)
+#define PAGE_KERNEL_NOCACHE __pgprot_mask(__PAGE_KERNEL_NOCACHE | _ENC)
+#define PAGE_KERNEL_NOCACHE_NOENC __pgprot_mask(__PAGE_KERNEL_NOCACHE | 0)
+#define PAGE_KERNEL_LARGE __pgprot_mask(__PAGE_KERNEL_LARGE | _ENC)
+#define PAGE_KERNEL_LARGE_EXEC __pgprot_mask(__PAGE_KERNEL_LARGE_EXEC | _ENC)
+#define PAGE_KERNEL_VVAR __pgprot_mask(__PAGE_KERNEL_VVAR | _ENC)
#endif /* __ASSEMBLY__ */
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 3102dda..4fe8d43 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -243,7 +243,7 @@ __ioremap_caller(resource_size_t phys_addr, unsigned long size,
* make sure the memory encryption attribute is enabled in the
* resulting mapping.
*/
- prot = PAGE_KERNEL;
+ prot = PAGE_KERNEL_NOENC;
if ((io_desc.flags & IORES_MAP_ENCRYPTED) || encrypted)
prot = pgprot_encrypted(prot);
prev parent reply other threads:[~2021-12-02 18:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-02 14:46 [PATCH] x86/mm: Fix PAGE_KERNEL_IO removal breakage Joerg Roedel
2021-12-02 15:52 ` Tom Lendacky
2021-12-02 15:55 ` Lucas De Marchi
2021-12-03 0:25 ` Lucas De Marchi
2021-12-03 17:28 ` Tom Lendacky
2021-12-03 17:32 ` Tom Lendacky
2021-12-03 18:48 ` Lucas De Marchi
2021-12-03 17:35 ` Dave Hansen
2021-12-03 19:11 ` Lucas De Marchi
2021-12-02 18:15 ` tip-bot2 for Joerg Roedel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=163846890716.11128.7464150139974319110.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=dave.hansen@linux.intel.com \
--cc=jroedel@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).