commit:     ec737266d1761c7432af2d04d1fc38a60990ea02
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 19 23:21:27 2020 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Thu Mar 19 23:21:27 2020 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ec737266

x86/ioremap: Fix CONFIG_EFI=n build. See bug #713460.
Thanks to Phil Stracchino.

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 0000_README                                        |  4 +++
 ...x86-ioremap-Fix-CONFIG_EFI-equals-n-build.patch | 33 ++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/0000_README b/0000_README
index 9c4285d..7cca34e 100644
--- a/0000_README
+++ b/0000_README
@@ -91,6 +91,10 @@ Patch:  
1510_fs-enable-link-security-restrictions-by-default.patch
 From:   
http://sources.debian.net/src/linux/3.16.7-ckt4-3/debian/patches/debian/fs-enable-link-security-restrictions-by-default.patch/
 Desc:   Enable link security restrictions by default.
 
+Patch:  1800_x86-ioremap-Fix-CONFIG_EFI-equals-n-build.patch
+From:   https://lkml.org/lkml/diff/2020/3/18/809/1
+Desc:   x86/ioremap: Fix CONFIG_EFI=n build. See bug #713460. Thanks to Phil 
Stracchino.
+
 Patch:  2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
 From:   
https://lore.kernel.org/linux-bluetooth/20190522070540.48895-1-mar...@holtmann.org/raw
 Desc:   Bluetooth: Check key sizes only when Secure Simple Pairing is enabled. 
See bug #686758

diff --git a/1800_x86-ioremap-Fix-CONFIG_EFI-equals-n-build.patch 
b/1800_x86-ioremap-Fix-CONFIG_EFI-equals-n-build.patch
new file mode 100644
index 0000000..e6bc74f
--- /dev/null
+++ b/1800_x86-ioremap-Fix-CONFIG_EFI-equals-n-build.patch
@@ -0,0 +1,33 @@
+From: Borislav Petkov <b...@suse.de>
+Date: Wed, 18 Mar 2020 19:27:48 +0100
+
+In order to use efi_mem_type(), one needs CONFIG_EFI enabled. Otherwise
+that function is undefined. Use IS_ENABLED() to check and avoid the
+ifdeffery as the compiler optimizes away the following unreachable code
+then.
+
+Fixes: 985e537a4082 ("x86/ioremap: Map EFI runtime services data as encrypted 
for SEV")
+Reported-by: Randy Dunlap <rdun...@infradead.org>
+Signed-off-by: Borislav Petkov <b...@suse.de>
+Cc: Tom Lendacky <thomas.lenda...@amd.com>
+Link: 
https://lkml.kernel.org/r/7561e981-0d9b-d62c-0ef2-ce6007aff...@infradead.org
+---
+ arch/x86/mm/ioremap.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
+index 935a91e1fd77..18c637c0dc6f 100644
+--- a/arch/x86/mm/ioremap.c
++++ b/arch/x86/mm/ioremap.c
+@@ -115,6 +115,9 @@ static void __ioremap_check_other(resource_size_t addr, 
struct ioremap_desc *des
+       if (!sev_active())
+               return;
+ 
++      if (!IS_ENABLED(CONFIG_EFI))
++              return;
++
+       if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA)
+               desc->flags |= IORES_MAP_ENCRYPTED;
+ }
+-- 
+2.21.0

Reply via email to