[lkml]   [2017]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v6 07/34] x86/mm: Don't use phys_to_virt in ioremap() if SME is active
Currently there is a check if the address being mapped is in the ISA
range (is_ISA_range()), and if it is then phys_to_virt() is used to
perform the mapping. When SME is active, however, this will result
in the mapping having the encryption bit set when it is expected that
an ioremap() should not have the encryption bit set. So only use the
phys_to_virt() function if SME is not active

Signed-off-by: Tom Lendacky <>
arch/x86/mm/ioremap.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index bbc558b..2a0fa89 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -21,6 +21,7 @@
#include <asm/tlbflush.h>
#include <asm/pgalloc.h>
#include <asm/pat.h>
+#include <asm/mem_encrypt.h>

#include "physaddr.h"

@@ -106,9 +107,11 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,

- * Don't remap the low PCI/ISA area, it's always mapped..
+ * Don't remap the low PCI/ISA area, it's always mapped.
+ * But if SME is active, skip this so that the encryption bit
+ * doesn't get set.
- if (is_ISA_range(phys_addr, last_addr))
+ if (is_ISA_range(phys_addr, last_addr) && !sme_active())
return (__force void __iomem *)phys_to_virt(phys_addr);

 \ /
  Last update: 2017-06-12 01:11    [W:0.218 / U:16.988 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site