Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Tesarik <ptesarik@suse.cz>2019-05-02 09:19:39 +0200
committerPetr Tesarik <ptesarik@suse.cz>2019-05-02 09:19:39 +0200
commit392a637fbdb2d57a7fa879afe4d69200542bbc9f (patch)
treecfbaa9564f99114ab7aa61fdf703006f3e1e3d66
parente73adb1c3f6b8e36ba5930fa4e9e66fbfd72f47a (diff)
parent63160223bf34022b5fff9a267afd307999b25afe (diff)
Merge branch 'users/mbrugger/SLE15-SP1/for-next' into SLE15-SP1
Pull arm fixes from Matthias Brugger Conflicts: series.conf
-rw-r--r--config/arm64/default1
-rw-r--r--config/ppc64le/default1
-rw-r--r--config/x86_64/default1
-rw-r--r--patches.arch/arm64-acpi-fix-alignment-fault-in-accessing-ACPI.patch173
-rw-r--r--patches.arch/drivers-acpi-add-dependency-of-EFI-for-arm64.patch42
-rw-r--r--patches.arch/efi-arm-Don-t-mark-ACPI-reclaim-memory-as-MEMBLOCK_N.patch66
-rw-r--r--patches.arch/efi-arm-map-UEFI-memory-map-even-w-o-runtime-service.patch64
-rw-r--r--patches.arch/efi-arm-preserve-early-mapping-of-UEFI-memory-map-lo.patch62
-rw-r--r--patches.drivers/ACPI-fix-menuconfig-presentation-of-ACPI-submenu.patch51
-rw-r--r--patches.drivers/arm64-fix-ACPI-dependencies.patch91
-rw-r--r--patches.drivers/arm64-mm-efi-Account-for-GICv3-LPI-tables-in-static-.patch133
-rw-r--r--patches.drivers/efi-Permit-calling-efi_mem_reserve_persistent-from-a.patch90
-rw-r--r--patches.drivers/efi-Permit-multiple-entries-in-persistent-memreserve.patch148
-rw-r--r--patches.drivers/efi-Prevent-GICv3-WARN-by-mapping-the-memreserve-tab.patch97
-rw-r--r--patches.drivers/efi-Reduce-the-amount-of-memblock-reservations-for-p.patch112
-rw-r--r--patches.drivers/efi-arm-Defer-persistent-reservations-until-after-pa.patch106
-rw-r--r--patches.drivers/efi-arm-Revert-Defer-persistent-reservations-until-a.patch102
-rw-r--r--patches.drivers/efi-arm-Revert-deferred-unmap-of-early-memmap-mappin.patch81
-rw-r--r--patches.drivers/iommu-arm-smmu-v3-Abort-all-transactions-if-SMMU-is-.patch84
-rw-r--r--patches.drivers/iommu-arm-smmu-v3-Don-t-disable-SMMU-in-kdump-kernel.patch60
-rw-r--r--patches.kabi/arch-arm64-acpi-KABI-ignore-includes.patch28
-rw-r--r--patches.suse/0002-MODSIGN-print-appropriate-status-message-when-gettin.patch6
-rw-r--r--patches.suse/0003-MODSIGN-load-blacklist-from-MOKx.patch7
-rwxr-xr-xscripts/git_sort/git_sort.py2
-rw-r--r--series.conf21
25 files changed, 1618 insertions, 11 deletions
diff --git a/config/arm64/default b/config/arm64/default
index 40edc1d576..4ad7feb942 100644
--- a/config/arm64/default
+++ b/config/arm64/default
@@ -6850,6 +6850,7 @@ CONFIG_MESON_SM=y
#
CONFIG_TEGRA_IVC=y
CONFIG_TEGRA_BPMP=y
+CONFIG_ARCH_SUPPORTS_ACPI=y
CONFIG_ACPI=y
CONFIG_ACPI_GENERIC_GSI=y
CONFIG_ACPI_CCA_REQUIRED=y
diff --git a/config/ppc64le/default b/config/ppc64le/default
index 74ede9847d..afd104a6a2 100644
--- a/config/ppc64le/default
+++ b/config/ppc64le/default
@@ -4210,7 +4210,6 @@ CONFIG_INFINIBAND_SRP=m
CONFIG_INFINIBAND_SRPT=m
CONFIG_INFINIBAND_ISER=m
CONFIG_INFINIBAND_ISERT=m
-CONFIG_INFINIBAND_RDMAVT=m
CONFIG_RDMA_RXE=m
CONFIG_INFINIBAND_QEDR=m
CONFIG_INFINIBAND_BNXT_RE=m
diff --git a/config/x86_64/default b/config/x86_64/default
index bcc0f02128..8b7b8ccc6a 100644
--- a/config/x86_64/default
+++ b/config/x86_64/default
@@ -725,6 +725,7 @@ CONFIG_PM_CLK=y
CONFIG_PM_GENERIC_DOMAINS=y
# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
CONFIG_PM_GENERIC_DOMAINS_SLEEP=y
+CONFIG_ARCH_SUPPORTS_ACPI=y
CONFIG_ACPI=y
CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y
CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y
diff --git a/patches.arch/arm64-acpi-fix-alignment-fault-in-accessing-ACPI.patch b/patches.arch/arm64-acpi-fix-alignment-fault-in-accessing-ACPI.patch
new file mode 100644
index 0000000000..f6cadadeb0
--- /dev/null
+++ b/patches.arch/arm64-acpi-fix-alignment-fault-in-accessing-ACPI.patch
@@ -0,0 +1,173 @@
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Mon, 23 Jul 2018 10:57:32 +0900
+Subject: arm64: acpi: fix alignment fault in accessing ACPI
+Git-commit: 09ffcb0d718a0b100f0bed029b830987ecf53fab
+Patch-mainline: v4.19-rc1
+References: bsc#1117158
+
+This is a fix against the issue that crash dump kernel may hang up
+during booting, which can happen on any ACPI-based system with "ACPI
+Reclaim Memory."
+
+(kernel messages after panic kicked off kdump)
+ (snip...)
+ Bye!
+ (snip...)
+ ACPI: Core revision 20170728
+ pud=000000002e7d0003, *pmd=000000002e7c0003, *pte=00e8000039710707
+ Internal error: Oops: 96000021 [#1] SMP
+ Modules linked in:
+ CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.0-rc6 #1
+ task: ffff000008d05180 task.stack: ffff000008cc0000
+ PC is at acpi_ns_lookup+0x25c/0x3c0
+ LR is at acpi_ds_load1_begin_op+0xa4/0x294
+ (snip...)
+ Process swapper/0 (pid: 0, stack limit = 0xffff000008cc0000)
+ Call trace:
+ (snip...)
+ [<ffff0000084a6764>] acpi_ns_lookup+0x25c/0x3c0
+ [<ffff00000849b4f8>] acpi_ds_load1_begin_op+0xa4/0x294
+ [<ffff0000084ad4ac>] acpi_ps_build_named_op+0xc4/0x198
+ [<ffff0000084ad6cc>] acpi_ps_create_op+0x14c/0x270
+ [<ffff0000084acfa8>] acpi_ps_parse_loop+0x188/0x5c8
+ [<ffff0000084ae048>] acpi_ps_parse_aml+0xb0/0x2b8
+ [<ffff0000084a8e10>] acpi_ns_one_complete_parse+0x144/0x184
+ [<ffff0000084a8e98>] acpi_ns_parse_table+0x48/0x68
+ [<ffff0000084a82cc>] acpi_ns_load_table+0x4c/0xdc
+ [<ffff0000084b32f8>] acpi_tb_load_namespace+0xe4/0x264
+ [<ffff000008baf9b4>] acpi_load_tables+0x48/0xc0
+ [<ffff000008badc20>] acpi_early_init+0x9c/0xd0
+ [<ffff000008b70d50>] start_kernel+0x3b4/0x43c
+ Code: b9008fb9 2a000318 36380054 32190318 (b94002c0)
+ ---[ end trace c46ed37f9651c58e ]---
+ Kernel panic - not syncing: Fatal exception
+ Rebooting in 10 seconds..
+
+(diagnosis)
+* This fault is a data abort, alignment fault (ESR=0x96000021)
+ during reading out ACPI table.
+* Initial ACPI tables are normally stored in system ram and marked as
+ "ACPI Reclaim memory" by the firmware.
+* After the commit f56ab9a5b73c ("efi/arm: Don't mark ACPI reclaim
+ memory as MEMBLOCK_NOMAP"), those regions are differently handled
+ as they are "memblock-reserved", without NOMAP bit.
+* So they are now excluded from device tree's "usable-memory-range"
+ which kexec-tools determines based on a current view of /proc/iomem.
+* When crash dump kernel boots up, it tries to accesses ACPI tables by
+ mapping them with ioremap(), not ioremap_cache(), in acpi_os_ioremap()
+ since they are no longer part of mapped system ram.
+* Given that ACPI accessor/helper functions are compiled in without
+ unaligned access support (ACPI_MISALIGNMENT_NOT_SUPPORTED),
+ any unaligned access to ACPI tables can cause a fatal panic.
+
+With this patch, acpi_os_ioremap() always honors memory attribute
+information provided by the firmware (EFI) and retaining cacheability
+allows the kernel safe access to ACPI tables.
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Reviewed-by: James Morse <james.morse@arm.com>
+Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Reported-by and Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ arch/arm64/include/asm/acpi.h | 23 ++++++++++++++++-------
+ arch/arm64/kernel/acpi.c | 11 +++--------
+ 2 files changed, 19 insertions(+), 15 deletions(-)
+
+--- a/arch/arm64/include/asm/acpi.h
++++ b/arch/arm64/include/asm/acpi.h
+@@ -12,10 +12,12 @@
+ #ifndef _ASM_ACPI_H
+ #define _ASM_ACPI_H
+
++#include <linux/efi.h>
+ #include <linux/memblock.h>
+ #include <linux/psci.h>
+
+ #include <asm/cputype.h>
++#include <asm/io.h>
+ #include <asm/smp_plat.h>
+ #include <asm/tlbflush.h>
+
+@@ -29,18 +31,22 @@
+
+ /* Basic configuration for ACPI */
+ #ifdef CONFIG_ACPI
++pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);
++
+ /* ACPI table mapping after acpi_permanent_mmap is set */
+ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
+ acpi_size size)
+ {
++ /* For normal memory we already have a cacheable mapping. */
++ if (memblock_is_map_memory(phys))
++ return (void __iomem *)__phys_to_virt(phys);
++
+ /*
+- * EFI's reserve_regions() call adds memory with the WB attribute
+- * to memblock via early_init_dt_add_memory_arch().
++ * We should still honor the memory's attribute here because
++ * crash dump kernel possibly excludes some ACPI (reclaim)
++ * regions from memblock list.
+ */
+- if (!memblock_is_memory(phys))
+- return ioremap(phys, size);
+-
+- return ioremap_cache(phys, size);
++ return __ioremap(phys, size, __acpi_get_mem_attribute(phys));
+ }
+ #define acpi_os_ioremap acpi_os_ioremap
+
+@@ -129,7 +135,10 @@ static inline const char *acpi_get_enabl
+ * for compatibility.
+ */
+ #define acpi_disable_cmcff 1
+-pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr);
++static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
++{
++ return __acpi_get_mem_attribute(addr);
++}
+ #endif /* CONFIG_ACPI_APEI */
+
+ #ifdef CONFIG_ACPI_NUMA
+--- a/arch/arm64/kernel/acpi.c
++++ b/arch/arm64/kernel/acpi.c
+@@ -18,6 +18,7 @@
+ #include <linux/acpi.h>
+ #include <linux/bootmem.h>
+ #include <linux/cpumask.h>
++#include <linux/efi.h>
+ #include <linux/efi-bgrt.h>
+ #include <linux/init.h>
+ #include <linux/irq.h>
+@@ -29,13 +30,9 @@
+
+ #include <asm/cputype.h>
+ #include <asm/cpu_ops.h>
++#include <asm/pgtable.h>
+ #include <asm/smp_plat.h>
+
+-#ifdef CONFIG_ACPI_APEI
+-# include <linux/efi.h>
+-# include <asm/pgtable.h>
+-#endif
+-
+ int acpi_noirq = 1; /* skip ACPI IRQ initialization */
+ int acpi_disabled = 1;
+ EXPORT_SYMBOL(acpi_disabled);
+@@ -239,8 +236,7 @@ done:
+ }
+ }
+
+-#ifdef CONFIG_ACPI_APEI
+-pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
++pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)
+ {
+ /*
+ * According to "Table 8 Map: EFI memory types to AArch64 memory
+@@ -261,4 +257,3 @@ pgprot_t arch_apei_get_mem_attribute(phy
+ return __pgprot(PROT_NORMAL_NC);
+ return __pgprot(PROT_DEVICE_nGnRnE);
+ }
+-#endif
diff --git a/patches.arch/drivers-acpi-add-dependency-of-EFI-for-arm64.patch b/patches.arch/drivers-acpi-add-dependency-of-EFI-for-arm64.patch
new file mode 100644
index 0000000000..19c447eb28
--- /dev/null
+++ b/patches.arch/drivers-acpi-add-dependency-of-EFI-for-arm64.patch
@@ -0,0 +1,42 @@
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Mon, 23 Jul 2018 10:57:29 +0900
+Subject: drivers: acpi: add dependency of EFI for arm64
+Git-commit: 5bcd44083a082f314032969cd6db1eb8275ac77a
+Patch-mainline: v4.19-rc1
+References: bsc#1117158
+
+As Ard suggested, CONFIG_ACPI && !CONFIG_EFI doesn't make sense on arm64,
+while CONFIG_ACPI and CONFIG_CPU_BIG_ENDIAN doesn't make sense either.
+
+As CONFIG_EFI already has a dependency of !CONFIG_CPU_BIG_ENDIAN, it is
+good enough to add a dependency of CONFIG_EFI to avoid any useless
+combination of configuration.
+
+This bug, reported by Will, will be revealed when my patch series,
+"arm64: kexec,kdump: fix boot failures on acpi-only system," is applied
+and the kernel is built under allmodconfig.
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/acpi/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
+index b533eeb6139d..15ab1daaa808 100644
+--- a/drivers/acpi/Kconfig
++++ b/drivers/acpi/Kconfig
+@@ -6,7 +6,7 @@
+ menuconfig ACPI
+ bool "ACPI (Advanced Configuration and Power Interface) Support"
+ depends on !IA64_HP_SIM
+- depends on IA64 || X86 || ARM64
++ depends on IA64 || X86 || (ARM64 && EFI)
+ depends on PCI
+ select PNP
+ default y if (IA64 || X86)
+--
+2.20.1
+
diff --git a/patches.arch/efi-arm-Don-t-mark-ACPI-reclaim-memory-as-MEMBLOCK_N.patch b/patches.arch/efi-arm-Don-t-mark-ACPI-reclaim-memory-as-MEMBLOCK_N.patch
new file mode 100644
index 0000000000..6767501ce6
--- /dev/null
+++ b/patches.arch/efi-arm-Don-t-mark-ACPI-reclaim-memory-as-MEMBLOCK_N.patch
@@ -0,0 +1,66 @@
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Fri, 18 Aug 2017 20:49:34 +0100
+Subject: efi/arm: Don't mark ACPI reclaim memory as MEMBLOCK_NOMAP
+Git-commit: f56ab9a5b73ca2aee777ccdf2d355ae2dd31db5a
+Patch-mainline: v4.14-rc1
+References: bsc#1117158 bsc#1115688 bsc#1120566
+
+On ARM, regions of memory that are described by UEFI as having special
+significance to the firmware itself are omitted from the linear mapping.
+This is necessary since we cannot guarantee that alternate mappings of
+the same physical region will use attributes that are compatible with
+the ones we use for the linear mapping, and aliases with mismatched
+attributes are prohibited by the architecture.
+
+The above does not apply to ACPI reclaim regions: such regions have no
+special significance to the firmware, and it is up to the OS to decide
+whether or not to preserve them after it has consumed their contents,
+and for how long, after which time the OS can use the memory in any way
+it likes. In the Linux case, such regions are preserved indefinitely,
+and are simply treated the same way as other 'reserved' memory types.
+
+Punching holes into the linear mapping causes page table fragmentation,
+which increases TLB pressure, and so we should avoid doing so if we can.
+So add a special case for regions of type EFI_ACPI_RECLAIM_MEMORY, and
+memblock_reserve() them instead of marking them MEMBLOCK_NOMAP.
+
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Acked-by: Mark Rutland <mark.rutland@arm.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Matt Fleming <matt@codeblueprint.co.uk>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-efi@vger.kernel.org
+Link: http://lkml.kernel.org/r/20170818194947.19347-2-ard.biesheuvel@linaro.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/firmware/efi/arm-init.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
+index 1027d7b44358..0aa4ce7b4fbb 100644
+--- a/drivers/firmware/efi/arm-init.c
++++ b/drivers/firmware/efi/arm-init.c
+@@ -159,6 +159,7 @@ static __init int is_usable_memory(efi_memory_desc_t *md)
+ switch (md->type) {
+ case EFI_LOADER_CODE:
+ case EFI_LOADER_DATA:
++ case EFI_ACPI_RECLAIM_MEMORY:
+ case EFI_BOOT_SERVICES_CODE:
+ case EFI_BOOT_SERVICES_DATA:
+ case EFI_CONVENTIONAL_MEMORY:
+@@ -211,6 +212,10 @@ static __init void reserve_regions(void)
+
+ if (!is_usable_memory(md))
+ memblock_mark_nomap(paddr, size);
++
++ /* keep ACPI reclaim memory intact for kexec etc. */
++ if (md->type == EFI_ACPI_RECLAIM_MEMORY)
++ memblock_reserve(paddr, size);
+ }
+ }
+ }
+--
+2.20.1
+
diff --git a/patches.arch/efi-arm-map-UEFI-memory-map-even-w-o-runtime-service.patch b/patches.arch/efi-arm-map-UEFI-memory-map-even-w-o-runtime-service.patch
new file mode 100644
index 0000000000..3a4756b435
--- /dev/null
+++ b/patches.arch/efi-arm-map-UEFI-memory-map-even-w-o-runtime-service.patch
@@ -0,0 +1,64 @@
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Mon, 23 Jul 2018 10:57:31 +0900
+Subject: efi/arm: map UEFI memory map even w/o runtime services enabled
+Git-commit: 20d12cf990618845e76d3f24daaebd15d65a5e46
+Patch-mainline: v4.19-rc1
+References: bsc#1117158
+
+Under the current implementation, UEFI memory map will be mapped and made
+available in virtual mappings only if runtime services are enabled.
+But in a later patch, we want to use UEFI memory map in acpi_os_ioremap()
+to create mappings of ACPI tables using memory attributes described in
+UEFI memory map.
+See the following commit:
+ arm64: acpi: fix alignment fault in accessing ACPI tables
+
+So, as a first step, arm_enter_runtime_services() is modified, alongside
+Ard's patch[1], so that UEFI memory map will not be freed even if
+efi=noruntime.
+
+[1] https://marc.info/?l=linux-efi&m=152930773507524&w=2
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/firmware/efi/arm-runtime.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
+index 4712445c3213..922cfb813109 100644
+--- a/drivers/firmware/efi/arm-runtime.c
++++ b/drivers/firmware/efi/arm-runtime.c
+@@ -117,6 +117,13 @@ static int __init arm_enable_runtime_services(void)
+
+ efi_memmap_unmap();
+
++ mapsize = efi.memmap.desc_size * efi.memmap.nr_map;
++
++ if (efi_memmap_init_late(efi.memmap.phys_map, mapsize)) {
++ pr_err("Failed to remap EFI memory map\n");
++ return 0;
++ }
++
+ if (efi_runtime_disabled()) {
+ pr_info("EFI runtime services will be disabled.\n");
+ return 0;
+@@ -129,13 +136,6 @@ static int __init arm_enable_runtime_services(void)
+
+ pr_info("Remapping and enabling EFI services.\n");
+
+- mapsize = efi.memmap.desc_size * efi.memmap.nr_map;
+-
+- if (efi_memmap_init_late(efi.memmap.phys_map, mapsize)) {
+- pr_err("Failed to remap EFI memory map\n");
+- return -ENOMEM;
+- }
+-
+ if (!efi_virtmap_init()) {
+ pr_err("UEFI virtual mapping missing or invalid -- runtime services will not be available\n");
+ return -ENOMEM;
+--
+2.20.1
+
diff --git a/patches.arch/efi-arm-preserve-early-mapping-of-UEFI-memory-map-lo.patch b/patches.arch/efi-arm-preserve-early-mapping-of-UEFI-memory-map-lo.patch
new file mode 100644
index 0000000000..7b649e6314
--- /dev/null
+++ b/patches.arch/efi-arm-preserve-early-mapping-of-UEFI-memory-map-lo.patch
@@ -0,0 +1,62 @@
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Mon, 23 Jul 2018 10:57:30 +0900
+Subject: efi/arm: preserve early mapping of UEFI memory map longer for BGRT
+Git-commit: 3ea86495aef2f6de26b7cb1599ba350dd6a0c521
+Patch-mainline: v4.19-rc1
+References: bsc#1117158
+
+The BGRT code validates the contents of the table against the UEFI
+memory map, and so it expects it to be mapped when the code runs.
+
+On ARM, this is currently not the case, since we tear down the early
+mapping after efi_init() completes, and only create the permanent
+mapping in arm_enable_runtime_services(), which executes as an early
+initcall, but still leaves a window where the UEFI memory map is not
+mapped.
+
+So move the call to efi_memmap_unmap() from efi_init() to
+arm_enable_runtime_services().
+
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+[will: fold in EFI_MEMMAP attribute check from Ard]
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/firmware/efi/arm-init.c | 1 -
+ drivers/firmware/efi/arm-runtime.c | 4 +++-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
+index b5214c143fee..388a929baf95 100644
+--- a/drivers/firmware/efi/arm-init.c
++++ b/drivers/firmware/efi/arm-init.c
+@@ -259,7 +259,6 @@ void __init efi_init(void)
+
+ reserve_regions();
+ efi_esrt_init();
+- efi_memmap_unmap();
+
+ memblock_reserve(params.mmap & PAGE_MASK,
+ PAGE_ALIGN(params.mmap_size +
+diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
+index 5889cbea60b8..4712445c3213 100644
+--- a/drivers/firmware/efi/arm-runtime.c
++++ b/drivers/firmware/efi/arm-runtime.c
+@@ -110,11 +110,13 @@ static int __init arm_enable_runtime_services(void)
+ {
+ u64 mapsize;
+
+- if (!efi_enabled(EFI_BOOT)) {
++ if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) {
+ pr_info("EFI services will not be available.\n");
+ return 0;
+ }
+
++ efi_memmap_unmap();
++
+ if (efi_runtime_disabled()) {
+ pr_info("EFI runtime services will be disabled.\n");
+ return 0;
+--
+2.20.1
+
diff --git a/patches.drivers/ACPI-fix-menuconfig-presentation-of-ACPI-submenu.patch b/patches.drivers/ACPI-fix-menuconfig-presentation-of-ACPI-submenu.patch
new file mode 100644
index 0000000000..9f726c1d09
--- /dev/null
+++ b/patches.drivers/ACPI-fix-menuconfig-presentation-of-ACPI-submenu.patch
@@ -0,0 +1,51 @@
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 21 Aug 2018 22:37:33 +0200
+Subject: ACPI: fix menuconfig presentation of ACPI submenu
+Git-commit: f5d707ede37a962bc3cb9b3f8531a870dae29e46
+Patch-mainline: v4.19-rc1
+References: bsc#1117158
+
+My fix for a recursive Kconfig dependency caused another issue where the
+ACPI specific options end up in the top-level menu in 'menuconfig'. This
+was an unintended side-effect of having a silent option between
+'menuconfig ACPI' and 'if ACPI'.
+
+Moving the ARCH_SUPPORTS_ACPI symbol ahead of the ACPI menu solves that
+problem and restores the previous presentation.
+
+Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Fixes: 2c870e61132c (arm64: fix ACPI dependencies)
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/acpi/Kconfig | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
+index 4a46344bf0e3..dd1eea90f67f 100644
+--- a/drivers/acpi/Kconfig
++++ b/drivers/acpi/Kconfig
+@@ -3,6 +3,9 @@
+ # ACPI Configuration
+ #
+
++config ARCH_SUPPORTS_ACPI
++ bool
++
+ menuconfig ACPI
+ bool "ACPI (Advanced Configuration and Power Interface) Support"
+ depends on ARCH_SUPPORTS_ACPI
+@@ -40,9 +43,6 @@ menuconfig ACPI
+ <http://www.acpi.info>
+ <http://www.uefi.org/acpi/specs>
+
+-config ARCH_SUPPORTS_ACPI
+- bool
+-
+ if ACPI
+
+ config ACPI_LEGACY_TABLES_LOOKUP
+--
+2.21.0
+
diff --git a/patches.drivers/arm64-fix-ACPI-dependencies.patch b/patches.drivers/arm64-fix-ACPI-dependencies.patch
new file mode 100644
index 0000000000..a80fe9f45f
--- /dev/null
+++ b/patches.drivers/arm64-fix-ACPI-dependencies.patch
@@ -0,0 +1,91 @@
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 24 Jul 2018 11:48:45 +0200
+Subject: arm64: fix ACPI dependencies
+Git-commit: 2c870e61132c082a03769d2ac0a2849ba33c10e3
+Patch-mainline: v4.19-rc1
+References: bsc#1117158
+
+Kconfig reports a warning on x86 builds after the ARM64 dependency
+was added.
+
+drivers/acpi/Kconfig:6:error: recursive dependency detected!
+drivers/acpi/Kconfig:6: symbol ACPI depends on EFI
+
+This rephrases the dependency to keep the ARM64 details out of the
+shared Kconfig file, so Kconfig no longer gets confused by it.
+
+For consistency, all three architectures that support ACPI now
+select ARCH_SUPPORTS_ACPI in exactly the configuration in which
+they allow it. We still need the 'default x86', as each one
+wants a different default: default-y on x86, default-n on arm64,
+and always-y on ia64.
+
+Fixes: 5bcd44083a08 ("drivers: acpi: add dependency of EFI for arm64")
+Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Acked-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ arch/arm64/Kconfig | 1 +
+ arch/ia64/Kconfig | 1 +
+ arch/x86/Kconfig | 1 +
+ drivers/acpi/Kconfig | 8 +++++---
+ 4 files changed, 8 insertions(+), 3 deletions(-)
+
+--- a/arch/arm64/Kconfig
++++ b/arch/arm64/Kconfig
+@@ -1200,6 +1200,7 @@ config EFI
+ bool "UEFI runtime support"
+ depends on OF && !CPU_BIG_ENDIAN
+ depends on KERNEL_MODE_NEON
++ select ARCH_SUPPORTS_ACPI
+ select LIBFDT
+ select UCS2_STRING
+ select EFI_PARAMS_FROM_FDT
+--- a/arch/ia64/Kconfig
++++ b/arch/ia64/Kconfig
+@@ -15,6 +15,7 @@ config IA64
+ select ARCH_MIGHT_HAVE_PC_SERIO
+ select PCI if (!IA64_HP_SIM)
+ select ACPI if (!IA64_HP_SIM)
++ select ARCH_SUPPORTS_ACPI if (!IA64_HP_SIM)
+ select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
+ select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
+ select HAVE_UNSTABLE_SCHED_CLOCK
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -65,6 +65,7 @@ config X86
+ select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
+ select ARCH_MIGHT_HAVE_PC_PARPORT
+ select ARCH_MIGHT_HAVE_PC_SERIO
++ select ARCH_SUPPORTS_ACPI
+ select ARCH_SUPPORTS_ATOMIC_RMW
+ select ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT
+ select ARCH_SUPPORTS_NUMA_BALANCING if X86_64
+--- a/drivers/acpi/Kconfig
++++ b/drivers/acpi/Kconfig
+@@ -4,11 +4,10 @@
+
+ menuconfig ACPI
+ bool "ACPI (Advanced Configuration and Power Interface) Support"
+- depends on !IA64_HP_SIM
+- depends on IA64 || X86 || (ARM64 && EFI)
++ depends on ARCH_SUPPORTS_ACPI
+ depends on PCI
+ select PNP
+- default y if (IA64 || X86)
++ default y if X86
+ help
+ Advanced Configuration and Power Interface (ACPI) support for
+ Linux requires an ACPI-compliant platform (hardware/firmware),
+@@ -40,6 +39,9 @@ menuconfig ACPI
+ <http://www.acpi.info>
+ <http://www.uefi.org/acpi/specs>
+
++config ARCH_SUPPORTS_ACPI
++ bool
++
+ if ACPI
+
+ config ACPI_LEGACY_TABLES_LOOKUP
diff --git a/patches.drivers/arm64-mm-efi-Account-for-GICv3-LPI-tables-in-static-.patch b/patches.drivers/arm64-mm-efi-Account-for-GICv3-LPI-tables-in-static-.patch
new file mode 100644
index 0000000000..cca10d7d4a
--- /dev/null
+++ b/patches.drivers/arm64-mm-efi-Account-for-GICv3-LPI-tables-in-static-.patch
@@ -0,0 +1,133 @@
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Fri, 15 Feb 2019 13:33:32 +0100
+Subject: arm64, mm, efi: Account for GICv3 LPI tables in static memblock
+ reserve table
+Git-commit: 8a5b403d71affa098009cc3dff1b2c45113021ad
+Patch-mainline: v5.0-rc7
+References: bsc#1117158
+
+In the irqchip and EFI code, we have what basically amounts to a quirk
+to work around a peculiarity in the GICv3 architecture, which permits
+the system memory address of LPI tables to be programmable only once
+after a CPU reset. This means kexec kernels must use the same memory
+as the first kernel, and thus ensure that this memory has not been
+given out for other purposes by the time the ITS init code runs, which
+is not very early for secondary CPUs.
+
+On systems with many CPUs, these reservations could overflow the
+memblock reservation table, and this was addressed in commit:
+
+ eff896288872 ("efi/arm: Defer persistent reservations until after paging_init()")
+
+However, this turns out to have made things worse, since the allocation
+of page tables and heap space for the resized memblock reservation table
+itself may overwrite the regions we are attempting to reserve, which may
+cause all kinds of corruption, also considering that the ITS will still
+be poking bits into that memory in response to incoming MSIs.
+
+So instead, let's grow the static memblock reservation table on such
+systems so it can accommodate these reservations at an earlier time.
+This will permit us to revert the above commit in a subsequent patch.
+
+[ mingo: Minor cleanups. ]
+
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Acked-by: Mike Rapoport <rppt@linux.ibm.com>
+Acked-by: Will Deacon <will.deacon@arm.com>
+Acked-by: Marc Zyngier <marc.zyngier@arm.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-arm-kernel@lists.infradead.org
+Cc: linux-efi@vger.kernel.org
+Link: http://lkml.kernel.org/r/20190215123333.21209-2-ard.biesheuvel@linaro.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ arch/arm64/include/asm/memory.h | 11 +++++++++++
+ drivers/firmware/efi/efi.c | 11 ++++++++++-
+ include/linux/memblock.h | 3 ---
+ mm/memblock.c | 11 +++++++++--
+ 4 files changed, 30 insertions(+), 6 deletions(-)
+
+--- a/arch/arm64/include/asm/memory.h
++++ b/arch/arm64/include/asm/memory.h
+@@ -300,6 +300,17 @@ static inline void *phys_to_virt(phys_ad
+ #define virt_addr_valid(kaddr) (_virt_addr_is_linear(kaddr) && \
+ _virt_addr_valid(kaddr))
+
++/*
++ * Given that the GIC architecture permits ITS implementations that can only be
++ * configured with a LPI table address once, GICv3 systems with many CPUs may
++ * end up reserving a lot of different regions after a kexec for their LPI
++ * tables (one per CPU), as we are forced to reuse the same memory after kexec
++ * (and thus reserve it persistently with EFI beforehand)
++ */
++#if defined(CONFIG_EFI) && defined(CONFIG_ARM_GIC_V3_ITS)
++# define INIT_MEMBLOCK_RESERVED_REGIONS (INIT_MEMBLOCK_REGIONS + NR_CPUS + 1)
++#endif
++
+ #include <asm-generic/memory_model.h>
+
+ #endif
+--- a/drivers/firmware/efi/efi.c
++++ b/drivers/firmware/efi/efi.c
+@@ -962,7 +962,16 @@ int __ref efi_mem_reserve_persistent(phy
+ /* first try to find a slot in an existing linked list entry */
+ for (prsv = efi_memreserve_root->next; prsv; prsv = rsv->next) {
+ rsv = __va(prsv);
+- index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);
++ /* implement atomic_fetch_add_unless for
++ * index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);
++ */
++ index = atomic_read(&rsv->count);
++
++ do {
++ if (unlikely(index == rsv->size))
++ break;
++ } while (!atomic_try_cmpxchg(&rsv->count, &index, index + 1));
++
+ if (index < rsv->size) {
+ rsv->entry[index].base = addr;
+ rsv->entry[index].size = size;
+--- a/include/linux/memblock.h
++++ b/include/linux/memblock.h
+@@ -17,9 +17,6 @@
+ #include <linux/init.h>
+ #include <linux/mm.h>
+
+-#define INIT_MEMBLOCK_REGIONS 128
+-#define INIT_PHYSMEM_REGIONS 4
+-
+ /* Definition of memblock flags. */
+ enum {
+ MEMBLOCK_NONE = 0x0, /* No special request */
+--- a/mm/memblock.c
++++ b/mm/memblock.c
+@@ -25,8 +25,15 @@
+
+ #include "internal.h"
+
++#define INIT_MEMBLOCK_REGIONS 128
++#define INIT_PHYSMEM_REGIONS 4
++
++#ifndef INIT_MEMBLOCK_RESERVED_REGIONS
++# define INIT_MEMBLOCK_RESERVED_REGIONS INIT_MEMBLOCK_REGIONS
++#endif
++
+ static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
+-static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
++static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_RESERVED_REGIONS] __initdata_memblock;
+ #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
+ static struct memblock_region memblock_physmem_init_regions[INIT_PHYSMEM_REGIONS] __initdata_memblock;
+ #endif
+@@ -39,7 +46,7 @@ struct memblock memblock __initdata_memb
+
+ .reserved.regions = memblock_reserved_init_regions,
+ .reserved.cnt = 1, /* empty dummy entry */
+- .reserved.max = INIT_MEMBLOCK_REGIONS,
++ .reserved.max = INIT_MEMBLOCK_RESERVED_REGIONS,
+ .reserved.name = "reserved",
+
+ #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
diff --git a/patches.drivers/efi-Permit-calling-efi_mem_reserve_persistent-from-a.patch b/patches.drivers/efi-Permit-calling-efi_mem_reserve_persistent-from-a.patch
new file mode 100644
index 0000000000..c4100f7f02
--- /dev/null
+++ b/patches.drivers/efi-Permit-calling-efi_mem_reserve_persistent-from-a.patch
@@ -0,0 +1,90 @@
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Wed, 14 Nov 2018 09:55:44 -0800
+Subject: efi: Permit calling efi_mem_reserve_persistent() from atomic context
+Git-commit: 63eb322d89c8505af9b4a3d703e85e42281ebaa0
+Patch-mainline: v4.20-rc3
+References: bsc#1117158
+
+Currently, efi_mem_reserve_persistent() may not be called from atomic
+context, since both the kmalloc() call and the memremap() call may
+sleep.
+
+The kmalloc() call is easy enough to fix, but the memremap() call
+needs to be moved into an init hook since we cannot control the
+memory allocation behavior of memremap() at the call site.
+
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-efi@vger.kernel.org
+Link: http://lkml.kernel.org/r/20181114175544.12860-6-ard.biesheuvel@linaro.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/firmware/efi/efi.c | 31 +++++++++++++++++++------------
+ 1 file changed, 19 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
+index 72a4da76d274..fad7c62cfc0e 100644
+--- a/drivers/firmware/efi/efi.c
++++ b/drivers/firmware/efi/efi.c
+@@ -967,36 +967,43 @@ bool efi_is_table_address(unsigned long phys_addr)
+ }
+
+ static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock);
++static struct linux_efi_memreserve *efi_memreserve_root __ro_after_init;
+
+ int efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
+ {
+- struct linux_efi_memreserve *rsv, *parent;
++ struct linux_efi_memreserve *rsv;
+
+- if (efi.mem_reserve == EFI_INVALID_TABLE_ADDR)
++ if (!efi_memreserve_root)
+ return -ENODEV;
+
+- rsv = kmalloc(sizeof(*rsv), GFP_KERNEL);
++ rsv = kmalloc(sizeof(*rsv), GFP_ATOMIC);
+ if (!rsv)
+ return -ENOMEM;
+
+- parent = memremap(efi.mem_reserve, sizeof(*rsv), MEMREMAP_WB);
+- if (!parent) {
+- kfree(rsv);
+- return -ENOMEM;
+- }
+-
+ rsv->base = addr;
+ rsv->size = size;
+
+ spin_lock(&efi_mem_reserve_persistent_lock);
+- rsv->next = parent->next;
+- parent->next = __pa(rsv);
++ rsv->next = efi_memreserve_root->next;
++ efi_memreserve_root->next = __pa(rsv);
+ spin_unlock(&efi_mem_reserve_persistent_lock);
+
+- memunmap(parent);
++ return 0;
++}
+
++static int __init efi_memreserve_root_init(void)
++{
++ if (efi.mem_reserve == EFI_INVALID_TABLE_ADDR)
++ return -ENODEV;
++
++ efi_memreserve_root = memremap(efi.mem_reserve,
++ sizeof(*efi_memreserve_root),
++ MEMREMAP_WB);
++ if (!efi_memreserve_root)
++ return -ENOMEM;
+ return 0;
+ }
++early_initcall(efi_memreserve_root_init);
+
+ #ifdef CONFIG_KEXEC
+ static int update_efi_random_seed(struct notifier_block *nb,
+--
+2.21.0
+
diff --git a/patches.drivers/efi-Permit-multiple-entries-in-persistent-memreserve.patch b/patches.drivers/efi-Permit-multiple-entries-in-persistent-memreserve.patch
new file mode 100644
index 0000000000..e5f05abf51
--- /dev/null
+++ b/patches.drivers/efi-Permit-multiple-entries-in-persistent-memreserve.patch
@@ -0,0 +1,148 @@
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Thu, 29 Nov 2018 18:12:28 +0100
+Subject: efi: Permit multiple entries in persistent memreserve data structure
+Git-commit: 5f0b0ecf043a5319e729c11a53bc8294df12dab3
+Patch-mainline: v5.0-rc1
+References: bsc#1117158
+
+In preparation of updating efi_mem_reserve_persistent() to cause less
+fragmentation when dealing with many persistent reservations, update
+the struct definition and the code that handles it currently so it
+can describe an arbitrary number of reservations using a single linked
+list entry. The actual optimization will be implemented in a subsequent
+patch.
+
+Tested-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Arend van Spriel <arend.vanspriel@broadcom.com>
+Cc: Bhupesh Sharma <bhsharma@redhat.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Eric Snowberg <eric.snowberg@oracle.com>
+Cc: Hans de Goede <hdegoede@redhat.com>
+Cc: Joe Perches <joe@perches.com>
+Cc: Jon Hunter <jonathanh@nvidia.com>
+Cc: Julien Thierry <julien.thierry@arm.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Matt Fleming <matt@codeblueprint.co.uk>
+Cc: Nathan Chancellor <natechancellor@gmail.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
+Cc: Sedat Dilek <sedat.dilek@gmail.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: YiFei Zhu <zhuyifei1999@gmail.com>
+Cc: linux-efi@vger.kernel.org
+Link: http://lkml.kernel.org/r/20181129171230.18699-10-ard.biesheuvel@linaro.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/firmware/efi/efi.c | 37 ++++++++++++++++++++++----------
+ drivers/firmware/efi/libstub/arm-stub.c | 2 -
+ include/linux/efi.h | 13 ++++++++---
+ 3 files changed, 37 insertions(+), 15 deletions(-)
+
+--- a/drivers/firmware/efi/efi.c
++++ b/drivers/firmware/efi/efi.c
+@@ -577,21 +577,33 @@ int __init efi_apply_persistent_mem_rese
+
+ while (prsv) {
+ struct linux_efi_memreserve *rsv;
++ u8 *p;
++ int i;
+
+- /* reserve the entry itself */
+- memblock_reserve(prsv, sizeof(*rsv));
+-
+- rsv = early_memremap(prsv, sizeof(*rsv));
+- if (rsv == NULL) {
++ /*
++ * Just map a full page: that is what we will get
++ * anyway, and it permits us to map the entire entry
++ * before knowing its size.
++ */
++ p = early_memremap(ALIGN_DOWN(prsv, PAGE_SIZE),
++ PAGE_SIZE);
++ if (p == NULL) {
+ pr_err("Could not map UEFI memreserve entry!\n");
+ return -ENOMEM;
+ }
+
+- if (rsv->size)
+- memblock_reserve(rsv->base, rsv->size);
++ rsv = (void *)(p + prsv % PAGE_SIZE);
++
++ /* reserve the entry itself */
++ memblock_reserve(prsv, EFI_MEMRESERVE_SIZE(rsv->size));
++
++ for (i = 0; i < atomic_read(&rsv->count); i++) {
++ memblock_reserve(rsv->entry[i].base,
++ rsv->entry[i].size);
++ }
+
+ prsv = rsv->next;
+- early_memunmap(rsv, sizeof(*rsv));
++ early_memunmap(p, PAGE_SIZE);
+ }
+ }
+
+@@ -935,6 +947,7 @@ static int __init efi_memreserve_map_roo
+ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
+ {
+ struct linux_efi_memreserve *rsv;
++ int rsvsize = EFI_MEMRESERVE_SIZE(1);
+ int rc;
+
+ if (efi_memreserve_root == (void *)ULONG_MAX)
+@@ -946,12 +959,14 @@ int __ref efi_mem_reserve_persistent(phy
+ return rc;
+ }
+
+- rsv = kmalloc(sizeof(*rsv), GFP_ATOMIC);
++ rsv = kmalloc(rsvsize, GFP_ATOMIC);
+ if (!rsv)
+ return -ENOMEM;
+
+- rsv->base = addr;
+- rsv->size = size;
++ rsv->size = 1;
++ atomic_set(&rsv->count, 1);
++ rsv->entry[0].base = addr;
++ rsv->entry[0].size = size;
+
+ spin_lock(&efi_mem_reserve_persistent_lock);
+ rsv->next = efi_memreserve_root->next;
+--- a/drivers/firmware/efi/libstub/arm-stub.c
++++ b/drivers/firmware/efi/libstub/arm-stub.c
+@@ -111,8 +111,8 @@ void install_memreserve_table(efi_system
+ }
+
+ rsv->next = 0;
+- rsv->base = 0;
+ rsv->size = 0;
++ atomic_set(&rsv->count, 0);
+
+ status = efi_call_early(install_configuration_table,
+ &memreserve_table_guid,
+--- a/include/linux/efi.h
++++ b/include/linux/efi.h
+@@ -1590,9 +1590,16 @@ struct linux_efi_random_seed {
+ };
+
+ struct linux_efi_memreserve {
+- phys_addr_t next;
+- phys_addr_t base;
+- phys_addr_t size;
++ int size; // allocated size of the array
++ atomic_t count; // number of entries used
++ phys_addr_t next; // pa of next struct instance
++ struct {
++ phys_addr_t base;
++ phys_addr_t size;
++ } entry[0];
+ };
+
++#define EFI_MEMRESERVE_SIZE(count) (sizeof(struct linux_efi_memreserve) + \
++ (count) * sizeof(((struct linux_efi_memreserve *)0)->entry[0]))
++
+ #endif /* _LINUX_EFI_H */
diff --git a/patches.drivers/efi-Prevent-GICv3-WARN-by-mapping-the-memreserve-tab.patch b/patches.drivers/efi-Prevent-GICv3-WARN-by-mapping-the-memreserve-tab.patch
new file mode 100644
index 0000000000..0da8bc91e5
--- /dev/null
+++ b/patches.drivers/efi-Prevent-GICv3-WARN-by-mapping-the-memreserve-tab.patch
@@ -0,0 +1,97 @@
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Fri, 23 Nov 2018 22:51:32 +0100
+Subject: efi: Prevent GICv3 WARN() by mapping the memreserve table before
+ first use
+Git-commit: 976b489120cdab2b1b3a41ffa14661db43d58190
+Patch-mainline: v4.20-rc5
+References: bsc#1117158
+
+Mapping the MEMRESERVE EFI configuration table from an early initcall
+is too late: the GICv3 ITS code that creates persistent reservations
+for the boot CPU's LPI tables is invoked from init_IRQ(), which runs
+much earlier than the handling of the initcalls. This results in a
+WARN() splat because the LPI tables cannot be reserved persistently,
+which will result in silent memory corruption after a kexec reboot.
+
+So instead, invoke the initialization performed by the initcall from
+efi_mem_reserve_persistent() itself as well, but keep the initcall so
+that the init is guaranteed to have been called before SMP boot.
+
+Tested-by: Marc Zyngier <marc.zyngier@arm.com>
+Tested-by: Jan Glauber <jglauber@cavium.com>
+Tested-by: John Garry <john.garry@huawei.com>
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-efi@vger.kernel.org
+Fixes: 63eb322d89c8 ("efi: Permit calling efi_mem_reserve_persistent() ...")
+Link: http://lkml.kernel.org/r/20181123215132.7951-2-ard.biesheuvel@linaro.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/firmware/efi/efi.c | 36 ++++++++++++++++++++++++++----------
+ 1 file changed, 26 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
+index fad7c62cfc0e..415849bab233 100644
+--- a/drivers/firmware/efi/efi.c
++++ b/drivers/firmware/efi/efi.c
+@@ -969,13 +969,33 @@ bool efi_is_table_address(unsigned long phys_addr)
+ static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock);
+ static struct linux_efi_memreserve *efi_memreserve_root __ro_after_init;
+
+-int efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
++static int __init efi_memreserve_map_root(void)
++{
++ if (efi.mem_reserve == EFI_INVALID_TABLE_ADDR)
++ return -ENODEV;
++
++ efi_memreserve_root = memremap(efi.mem_reserve,
++ sizeof(*efi_memreserve_root),
++ MEMREMAP_WB);
++ if (WARN_ON_ONCE(!efi_memreserve_root))
++ return -ENOMEM;
++ return 0;
++}
++
++int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
+ {
+ struct linux_efi_memreserve *rsv;
++ int rc;
+
+- if (!efi_memreserve_root)
++ if (efi_memreserve_root == (void *)ULONG_MAX)
+ return -ENODEV;
+
++ if (!efi_memreserve_root) {
++ rc = efi_memreserve_map_root();
++ if (rc)
++ return rc;
++ }
++
+ rsv = kmalloc(sizeof(*rsv), GFP_ATOMIC);
+ if (!rsv)
+ return -ENOMEM;
+@@ -993,14 +1013,10 @@ int efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
+
+ static int __init efi_memreserve_root_init(void)
+ {
+- if (efi.mem_reserve == EFI_INVALID_TABLE_ADDR)
+- return -ENODEV;
+-
+- efi_memreserve_root = memremap(efi.mem_reserve,
+- sizeof(*efi_memreserve_root),
+- MEMREMAP_WB);
+- if (!efi_memreserve_root)
+- return -ENOMEM;
++ if (efi_memreserve_root)
++ return 0;
++ if (efi_memreserve_map_root())
++ efi_memreserve_root = (void *)ULONG_MAX;
+ return 0;
+ }
+ early_initcall(efi_memreserve_root_init);
+--
+2.21.0
+
diff --git a/patches.drivers/efi-Reduce-the-amount-of-memblock-reservations-for-p.patch b/patches.drivers/efi-Reduce-the-amount-of-memblock-reservations-for-p.patch
new file mode 100644
index 0000000000..db95878d7d
--- /dev/null
+++ b/patches.drivers/efi-Reduce-the-amount-of-memblock-reservations-for-p.patch
@@ -0,0 +1,112 @@
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Thu, 29 Nov 2018 18:12:29 +0100
+Subject: efi: Reduce the amount of memblock reservations for persistent
+ allocations
+Git-commit: 80424b02d42bb22f8ff8839cb93a84ade53b39c0
+Patch-mainline: v5.0-rc1
+References: bsc#1117158
+
+The current implementation of efi_mem_reserve_persistent() is rather
+naive, in the sense that for each invocation, it creates a separate
+linked list entry to describe the reservation. Since the linked list
+entries themselves need to persist across subsequent kexec reboots,
+every reservation created this way results in two memblock_reserve()
+calls at the next boot.
+
+On arm64 systems with 100s of CPUs, this may result in a excessive
+number of memblock reservations, and needless fragmentation.
+
+So instead, make use of the newly updated struct linux_efi_memreserve
+layout to put multiple reservations into a single linked list entry.
+This should get rid of the numerous tiny memblock reservations, and
+effectively cut the total number of reservations in half on arm64
+systems with many CPUs.
+
+ [ mingo: build warning fix. ]
+
+Tested-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Arend van Spriel <arend.vanspriel@broadcom.com>
+Cc: Bhupesh Sharma <bhsharma@redhat.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Eric Snowberg <eric.snowberg@oracle.com>
+Cc: Hans de Goede <hdegoede@redhat.com>
+Cc: Joe Perches <joe@perches.com>
+Cc: Jon Hunter <jonathanh@nvidia.com>
+Cc: Julien Thierry <julien.thierry@arm.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Matt Fleming <matt@codeblueprint.co.uk>
+Cc: Nathan Chancellor <natechancellor@gmail.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
+Cc: Sedat Dilek <sedat.dilek@gmail.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: YiFei Zhu <zhuyifei1999@gmail.com>
+Cc: linux-efi@vger.kernel.org
+Link: http://lkml.kernel.org/r/20181129171230.18699-11-ard.biesheuvel@linaro.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/firmware/efi/efi.c | 21 +++++++++++++++++----
+ include/linux/efi.h | 3 +++
+ 2 files changed, 20 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
+index 80b11521627a..4c46ff6f2242 100644
+--- a/drivers/firmware/efi/efi.c
++++ b/drivers/firmware/efi/efi.c
+@@ -997,8 +997,8 @@ static int __init efi_memreserve_map_root(void)
+ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
+ {
+ struct linux_efi_memreserve *rsv;
+- int rsvsize = EFI_MEMRESERVE_SIZE(1);
+- int rc;
++ unsigned long prsv;
++ int rc, index;
+
+ if (efi_memreserve_root == (void *)ULONG_MAX)
+ return -ENODEV;
+@@ -1009,11 +1009,24 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
+ return rc;
+ }
+
+- rsv = kmalloc(rsvsize, GFP_ATOMIC);
++ /* first try to find a slot in an existing linked list entry */
++ for (prsv = efi_memreserve_root->next; prsv; prsv = rsv->next) {
++ rsv = __va(prsv);
++ index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);
++ if (index < rsv->size) {
++ rsv->entry[index].base = addr;
++ rsv->entry[index].size = size;
++
++ return 0;
++ }
++ }
++
++ /* no slot found - allocate a new linked list entry */
++ rsv = (struct linux_efi_memreserve *)__get_free_page(GFP_ATOMIC);
+ if (!rsv)
+ return -ENOMEM;
+
+- rsv->size = 1;
++ rsv->size = EFI_MEMRESERVE_COUNT(PAGE_SIZE);
+ atomic_set(&rsv->count, 1);
+ rsv->entry[0].base = addr;
+ rsv->entry[0].size = size;
+diff --git a/include/linux/efi.h b/include/linux/efi.h
+index 4f27640fdcdc..becd5d76a207 100644
+--- a/include/linux/efi.h
++++ b/include/linux/efi.h
+@@ -1724,4 +1724,7 @@ struct linux_efi_memreserve {
+ #define EFI_MEMRESERVE_SIZE(count) (sizeof(struct linux_efi_memreserve) + \
+ (count) * sizeof(((struct linux_efi_memreserve *)0)->entry[0]))
+
++#define EFI_MEMRESERVE_COUNT(size) (((size) - sizeof(struct linux_efi_memreserve)) \
++ / sizeof(((struct linux_efi_memreserve *)0)->entry[0]))
++
+ #endif /* _LINUX_EFI_H */
+--
+2.21.0
+
diff --git a/patches.drivers/efi-arm-Defer-persistent-reservations-until-after-pa.patch b/patches.drivers/efi-arm-Defer-persistent-reservations-until-after-pa.patch
new file mode 100644
index 0000000000..16c8f04d58
--- /dev/null
+++ b/patches.drivers/efi-arm-Defer-persistent-reservations-until-after-pa.patch
@@ -0,0 +1,106 @@
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Wed, 14 Nov 2018 09:55:43 -0800
+Subject: efi/arm: Defer persistent reservations until after paging_init()
+Git-commit: eff896288872d687d9662000ec9ae11b6d61766f
+Patch-mainline: v4.20-rc3
+References: bsc#1117158
+
+The new memory EFI reservation feature we introduced to allow memory
+reservations to persist across kexec may trigger an unbounded number
+of calls to memblock_reserve(). The memblock subsystem can deal with
+this fine, but not before memblock resizing is enabled, which we can
+only do after paging_init(), when the memory we reallocate the array
+into is actually mapped.
+
+So break out the memreserve table processing into a separate routine
+and call it after paging_init() on arm64. On ARM, because of limited
+reviewing bandwidth of the maintainer, we cannot currently fix this,
+so instead, disable the EFI persistent memreserve entirely on ARM so
+we can fix it later.
+
+Tested-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-efi@vger.kernel.org
+Link: http://lkml.kernel.org/r/20181114175544.12860-5-ard.biesheuvel@linaro.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ arch/arm64/kernel/setup.c | 1 +
+ drivers/firmware/efi/efi.c | 4 ++++
+ drivers/firmware/efi/libstub/arm-stub.c | 3 +++
+ include/linux/efi.h | 7 +++++++
+ 4 files changed, 15 insertions(+)
+
+diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
+index 953e316521fc..f4fc1e0544b7 100644
+--- a/arch/arm64/kernel/setup.c
++++ b/arch/arm64/kernel/setup.c
+@@ -313,6 +313,7 @@ void __init setup_arch(char **cmdline_p)
+ arm64_memblock_init();
+
+ paging_init();
++ efi_apply_persistent_mem_reservations();
+
+ acpi_table_upgrade();
+
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
+index 249eb70691b0..72a4da76d274 100644
+--- a/drivers/firmware/efi/efi.c
++++ b/drivers/firmware/efi/efi.c
+@@ -592,7 +592,11 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
+
+ early_memunmap(tbl, sizeof(*tbl));
+ }
++ return 0;
++}
+
++int __init efi_apply_persistent_mem_reservations(void)
++{
+ if (efi.mem_reserve != EFI_INVALID_TABLE_ADDR) {
+ unsigned long prsv = efi.mem_reserve;
+
+diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c
+index 30ac0c975f8a..3d36142cf812 100644
+--- a/drivers/firmware/efi/libstub/arm-stub.c
++++ b/drivers/firmware/efi/libstub/arm-stub.c
+@@ -75,6 +75,9 @@ void install_memreserve_table(efi_system_table_t *sys_table_arg)
+ efi_guid_t memreserve_table_guid = LINUX_EFI_MEMRESERVE_TABLE_GUID;
+ efi_status_t status;
+
++ if (IS_ENABLED(CONFIG_ARM))
++ return;
++
+ status = efi_call_early(allocate_pool, EFI_LOADER_DATA, sizeof(*rsv),
+ (void **)&rsv);
+ if (status != EFI_SUCCESS) {
+diff --git a/include/linux/efi.h b/include/linux/efi.h
+index 845174e113ce..100ce4a4aff6 100644
+--- a/include/linux/efi.h
++++ b/include/linux/efi.h
+@@ -1167,6 +1167,8 @@ static inline bool efi_enabled(int feature)
+ extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
+
+ extern bool efi_is_table_address(unsigned long phys_addr);
++
++extern int efi_apply_persistent_mem_reservations(void);
+ #else
+ static inline bool efi_enabled(int feature)
+ {
+@@ -1185,6 +1187,11 @@ static inline bool efi_is_table_address(unsigned long phys_addr)
+ {
+ return false;
+ }
++
++static inline int efi_apply_persistent_mem_reservations(void)
++{
++ return 0;
++}
+ #endif
+
+ extern int efi_status_to_err(efi_status_t status);
+--
+2.21.0
+
diff --git a/patches.drivers/efi-arm-Revert-Defer-persistent-reservations-until-a.patch b/patches.drivers/efi-arm-Revert-Defer-persistent-reservations-until-a.patch
new file mode 100644
index 0000000000..8bdb5720c0
--- /dev/null
+++ b/patches.drivers/efi-arm-Revert-Defer-persistent-reservations-until-a.patch
@@ -0,0 +1,102 @@
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Fri, 15 Feb 2019 13:33:33 +0100
+Subject: efi/arm: Revert "Defer persistent reservations until after
+ paging_init()"
+Git-commit: 582a32e708823e5957fd73ccd78dc4a9e49d21ea
+Patch-mainline: v5.0-rc7
+References: bsc#1117158
+
+This reverts commit eff896288872d687d9662000ec9ae11b6d61766f, which
+deferred the processing of persistent memory reservations to a point
+where the memory may have already been allocated and overwritten,
+defeating the purpose.
+
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Acked-by: Will Deacon <will.deacon@arm.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Marc Zyngier <marc.zyngier@arm.com>
+Cc: Mike Rapoport <rppt@linux.ibm.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-arm-kernel@lists.infradead.org
+Cc: linux-efi@vger.kernel.org
+Link: http://lkml.kernel.org/r/20190215123333.21209-3-ard.biesheuvel@linaro.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ arch/arm64/kernel/setup.c | 1 -
+ drivers/firmware/efi/efi.c | 4 ----
+ drivers/firmware/efi/libstub/arm-stub.c | 3 ---
+ include/linux/efi.h | 7 -------
+ 4 files changed, 15 deletions(-)
+
+diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
+index 4b0e1231625c..d09ec76f08cf 100644
+--- a/arch/arm64/kernel/setup.c
++++ b/arch/arm64/kernel/setup.c
+@@ -313,7 +313,6 @@ void __init setup_arch(char **cmdline_p)
+ arm64_memblock_init();
+
+ paging_init();
+- efi_apply_persistent_mem_reservations();
+
+ acpi_table_upgrade();
+
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
+index 4c46ff6f2242..55b77c576c42 100644
+--- a/drivers/firmware/efi/efi.c
++++ b/drivers/firmware/efi/efi.c
+@@ -592,11 +592,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
+
+ early_memunmap(tbl, sizeof(*tbl));
+ }
+- return 0;
+-}
+
+-int __init efi_apply_persistent_mem_reservations(void)
+-{
+ if (efi.mem_reserve != EFI_INVALID_TABLE_ADDR) {
+ unsigned long prsv = efi.mem_reserve;
+
+diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c
+index eee42d5e25ee..c037c6c5d0b7 100644
+--- a/drivers/firmware/efi/libstub/arm-stub.c
++++ b/drivers/firmware/efi/libstub/arm-stub.c
+@@ -75,9 +75,6 @@ void install_memreserve_table(efi_system_table_t *sys_table_arg)
+ efi_guid_t memreserve_table_guid = LINUX_EFI_MEMRESERVE_TABLE_GUID;
+ efi_status_t status;
+
+- if (IS_ENABLED(CONFIG_ARM))
+- return;
+-
+ status = efi_call_early(allocate_pool, EFI_LOADER_DATA, sizeof(*rsv),
+ (void **)&rsv);
+ if (status != EFI_SUCCESS) {
+diff --git a/include/linux/efi.h b/include/linux/efi.h
+index 45ff763fba76..28604a8d0aa9 100644
+--- a/include/linux/efi.h
++++ b/include/linux/efi.h
+@@ -1198,8 +1198,6 @@ static inline bool efi_enabled(int feature)
+ extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
+
+ extern bool efi_is_table_address(unsigned long phys_addr);
+-
+-extern int efi_apply_persistent_mem_reservations(void);
+ #else
+ static inline bool efi_enabled(int feature)
+ {
+@@ -1218,11 +1216,6 @@ static inline bool efi_is_table_address(unsigned long phys_addr)
+ {
+ return false;
+ }
+-
+-static inline int efi_apply_persistent_mem_reservations(void)
+-{
+- return 0;
+-}
+ #endif
+
+ extern int efi_status_to_err(efi_status_t status);
+--
+2.21.0
+
diff --git a/patches.drivers/efi-arm-Revert-deferred-unmap-of-early-memmap-mappin.patch b/patches.drivers/efi-arm-Revert-deferred-unmap-of-early-memmap-mappin.patch
new file mode 100644
index 0000000000..f107fbd261
--- /dev/null
+++ b/patches.drivers/efi-arm-Revert-deferred-unmap-of-early-memmap-mappin.patch
@@ -0,0 +1,81 @@
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Wed, 14 Nov 2018 09:55:41 -0800
+Subject: efi/arm: Revert deferred unmap of early memmap mapping
+Git-commit: 33412b8673135b18ea42beb7f5117ed0091798b6
+Patch-mainline: v4.20-rc3
+References: bsc#1117158
+
+Commit:
+
+ 3ea86495aef2 ("efi/arm: preserve early mapping of UEFI memory map longer for BGRT")
+
+deferred the unmap of the early mapping of the UEFI memory map to
+accommodate the ACPI BGRT code, which looks up the memory type that
+backs the BGRT table to validate it against the requirements of the UEFI spec.
+
+Unfortunately, this causes problems on ARM, which does not permit
+early mappings to persist after paging_init() is called, resulting
+in a WARN() splat. Since we don't support the BGRT table on ARM anway,
+let's revert ARM to the old behaviour, which is to take down the
+early mapping at the end of efi_init().
+
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-efi@vger.kernel.org
+Fixes: 3ea86495aef2 ("efi/arm: preserve early mapping of UEFI memory ...")
+Link: http://lkml.kernel.org/r/20181114175544.12860-3-ard.biesheuvel@linaro.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/firmware/efi/arm-init.c | 4 ++++
+ drivers/firmware/efi/arm-runtime.c | 2 +-
+ drivers/firmware/efi/memmap.c | 3 +++
+ 3 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
+index 388a929baf95..1a6a77df8a5e 100644
+--- a/drivers/firmware/efi/arm-init.c
++++ b/drivers/firmware/efi/arm-init.c
+@@ -265,6 +265,10 @@ void __init efi_init(void)
+ (params.mmap & ~PAGE_MASK)));
+
+ init_screen_info();
++
++ /* ARM does not permit early mappings to persist across paging_init() */
++ if (IS_ENABLED(CONFIG_ARM))
++ efi_memmap_unmap();
+ }
+
+ static int __init register_gop_device(void)
+diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
+index 922cfb813109..a00934d263c5 100644
+--- a/drivers/firmware/efi/arm-runtime.c
++++ b/drivers/firmware/efi/arm-runtime.c
+@@ -110,7 +110,7 @@ static int __init arm_enable_runtime_services(void)
+ {
+ u64 mapsize;
+
+- if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) {
++ if (!efi_enabled(EFI_BOOT)) {
+ pr_info("EFI services will not be available.\n");
+ return 0;
+ }
+diff --git a/drivers/firmware/efi/memmap.c b/drivers/firmware/efi/memmap.c
+index fa2904fb841f..38b686c67b17 100644
+--- a/drivers/firmware/efi/memmap.c
++++ b/drivers/firmware/efi/memmap.c
+@@ -118,6 +118,9 @@ int __init efi_memmap_init_early(struct efi_memory_map_data *data)
+
+ void __init efi_memmap_unmap(void)
+ {
++ if (!efi_enabled(EFI_MEMMAP))
++ return;
++
+ if (!efi.memmap.late) {
+ unsigned long size;
+
+--
+2.21.0
+
diff --git a/patches.drivers/iommu-arm-smmu-v3-Abort-all-transactions-if-SMMU-is-.patch b/patches.drivers/iommu-arm-smmu-v3-Abort-all-transactions-if-SMMU-is-.patch
new file mode 100644
index 0000000000..cc74bf93fb
--- /dev/null
+++ b/patches.drivers/iommu-arm-smmu-v3-Abort-all-transactions-if-SMMU-is-.patch
@@ -0,0 +1,84 @@
+From: Will Deacon <will.deacon@arm.com>
+Date: Wed, 25 Jul 2018 15:58:43 +0100
+Subject: iommu/arm-smmu-v3: Abort all transactions if SMMU is enabled in kdump
+ kernel
+Git-commit: b63b3439b85609338e4faabd5d2588dbda137e5c
+Patch-mainline: v4.19-rc1
+References: bsc#1117158
+
+If we find that the SMMU is enabled during probe, we reset it by
+re-initialising its registers and either enabling translation or placing
+it into bypass based on the disable_bypass commandline option.
+
+In the case of a kdump kernel, the SMMU won't have been shutdown cleanly
+by the previous kernel and there may be concurrent DMA through the SMMU.
+Rather than reset the SMMU to bypass, which would likely lead to rampant
+data corruption, we can instead configure the SMMU to abort all incoming
+transactions when we find that it is enabled from within a kdump kernel.
+
+Reported-by: Sameer Goel <sgoel@codeaurora.org>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/iommu/arm-smmu-v3.c | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
+index 7fb5230cd145..446703eeee7a 100644
+--- a/drivers/iommu/arm-smmu-v3.c
++++ b/drivers/iommu/arm-smmu-v3.c
+@@ -24,6 +24,7 @@
+ #include <linux/acpi_iort.h>
+ #include <linux/bitfield.h>
+ #include <linux/bitops.h>
++#include <linux/crash_dump.h>
+ #include <linux/delay.h>
+ #include <linux/dma-iommu.h>
+ #include <linux/err.h>
+@@ -2212,8 +2213,12 @@ static int arm_smmu_update_gbpa(struct arm_smmu_device *smmu, u32 set, u32 clr)
+ reg &= ~clr;
+ reg |= set;
+ writel_relaxed(reg | GBPA_UPDATE, gbpa);
+- return readl_relaxed_poll_timeout(gbpa, reg, !(reg & GBPA_UPDATE),
+- 1, ARM_SMMU_POLL_TIMEOUT_US);
++ ret = readl_relaxed_poll_timeout(gbpa, reg, !(reg & GBPA_UPDATE),
++ 1, ARM_SMMU_POLL_TIMEOUT_US);
++
++ if (ret)
++ dev_err(smmu->dev, "GBPA not responding to update\n");
++ return ret;
+ }
+
+ static void arm_smmu_free_msis(void *data)
+@@ -2393,8 +2398,15 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass)
+
+ /* Clear CR0 and sync (disables SMMU and queue processing) */
+ reg = readl_relaxed(smmu->base + ARM_SMMU_CR0);
+- if (reg & CR0_SMMUEN)
++ if (reg & CR0_SMMUEN) {
++ if (is_kdump_kernel()) {
++ arm_smmu_update_gbpa(smmu, GBPA_ABORT, 0);
++ arm_smmu_device_disable(smmu);
++ return -EBUSY;
++ }
++
+ dev_warn(smmu->dev, "SMMU currently enabled! Resetting...\n");
++ }
+
+ ret = arm_smmu_device_disable(smmu);
+ if (ret)
+@@ -2492,10 +2504,8 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass)
+ enables |= CR0_SMMUEN;
+ } else {
+ ret = arm_smmu_update_gbpa(smmu, 0, GBPA_ABORT);
+- if (ret) {
+- dev_err(smmu->dev, "GBPA not responding to update\n");
++ if (ret)
+ return ret;
+- }
+ }
+ ret = arm_smmu_write_reg_sync(smmu, enables, ARM_SMMU_CR0,
+ ARM_SMMU_CR0ACK);
+--
+2.21.0
+
diff --git a/patches.drivers/iommu-arm-smmu-v3-Don-t-disable-SMMU-in-kdump-kernel.patch b/patches.drivers/iommu-arm-smmu-v3-Don-t-disable-SMMU-in-kdump-kernel.patch
new file mode 100644
index 0000000000..d062b08630
--- /dev/null
+++ b/patches.drivers/iommu-arm-smmu-v3-Don-t-disable-SMMU-in-kdump-kernel.patch
@@ -0,0 +1,60 @@
+From: Will Deacon <will.deacon@arm.com>
+Date: Tue, 23 Apr 2019 11:59:36 +0100
+Subject: iommu/arm-smmu-v3: Don't disable SMMU in kdump kernel
+Git-commit: 3f54c447df34ff9efac7809a4a80fd3208efc619
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git
+References: bsc#1120566
+
+Disabling the SMMU when probing from within a kdump kernel so that all
+incoming transactions are terminated can prevent the core of the crashed
+kernel from being transferred off the machine if all I/O devices are
+behind the SMMU.
+
+Instead, continue to probe the SMMU after it is disabled so that we can
+reinitialise it entirely and re-attach the DMA masters as they are reset.
+Since the kdump kernel may not have drivers for all of the active DMA
+masters, we suppress fault reporting to avoid spamming the console and
+swamping the IRQ threads.
+
+Reported-by: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
+Tested-by: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
+Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ drivers/iommu/arm-smmu-v3.c | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
+index 99b83fda11e4..4d5a694f02c2 100644
+--- a/drivers/iommu/arm-smmu-v3.c
++++ b/drivers/iommu/arm-smmu-v3.c
+@@ -2649,13 +2649,9 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass)
+ /* Clear CR0 and sync (disables SMMU and queue processing) */
+ reg = readl_relaxed(smmu->base + ARM_SMMU_CR0);
+ if (reg & CR0_SMMUEN) {
+- if (is_kdump_kernel()) {
+- arm_smmu_update_gbpa(smmu, GBPA_ABORT, 0);
+- arm_smmu_device_disable(smmu);
+- return -EBUSY;
+- }
+-
+ dev_warn(smmu->dev, "SMMU currently enabled! Resetting...\n");
++ WARN_ON(is_kdump_kernel() && !disable_bypass);
++ arm_smmu_update_gbpa(smmu, GBPA_ABORT, 0);
+ }
+
+ ret = arm_smmu_device_disable(smmu);
+@@ -2758,6 +2754,8 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass)
+ return ret;
+ }
+
++ if (is_kdump_kernel())
++ enables &= ~(CR0_EVTQEN | CR0_PRIQEN);
+
+ /* Enable the SMMU interface, or ensure bypass */
+ if (!bypass || disable_bypass) {
+--
+2.21.0
+
diff --git a/patches.kabi/arch-arm64-acpi-KABI-ignore-includes.patch b/patches.kabi/arch-arm64-acpi-KABI-ignore-includes.patch
new file mode 100644
index 0000000000..dc8fd96003
--- /dev/null
+++ b/patches.kabi/arch-arm64-acpi-KABI-ignore-includes.patch
@@ -0,0 +1,28 @@
+From: Matthias Brugger <mbrugger@suse.com>
+Subject: arch: arm64: acpi: KABI ginore includes
+Patch-mainline: never, kabi
+References: bsc#1117158
+
+Upstream commit
+09ffcb0d718a ("arm64: acpi: fix alignment fault in accessing ACPI")
+adds new header file inclusions which trigger kABI checker to fail.
+Mark the include statements as not needed for kABI checker to fix that.
+
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ arch/arm64/include/asm/acpi.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/arch/arm64/include/asm/acpi.h
++++ b/arch/arm64/include/asm/acpi.h
+@@ -12,7 +12,10 @@
+ #ifndef _ASM_ACPI_H
+ #define _ASM_ACPI_H
+
++#ifndef __GENKSYMS__
+ #include <linux/efi.h>
++#endif
++
+ #include <linux/memblock.h>
+ #include <linux/psci.h>
+
diff --git a/patches.suse/0002-MODSIGN-print-appropriate-status-message-when-gettin.patch b/patches.suse/0002-MODSIGN-print-appropriate-status-message-when-gettin.patch
index 762b30e48f..6810e07a30 100644
--- a/patches.suse/0002-MODSIGN-print-appropriate-status-message-when-gettin.patch
+++ b/patches.suse/0002-MODSIGN-print-appropriate-status-message-when-gettin.patch
@@ -126,9 +126,9 @@ Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
if (rc)
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
-@@ -1623,4 +1623,29 @@ struct linux_efi_memreserve {
- phys_addr_t size;
- };
+@@ -1640,4 +1640,29 @@ struct linux_efi_memreserve {
+ #define EFI_MEMRESERVE_COUNT(size) (((size) - sizeof(struct linux_efi_memreserve)) \
+ / sizeof(((struct linux_efi_memreserve *)0)->entry[0]))
+#define EFI_STATUS_STR(_status) \
+ case EFI_##_status: \
diff --git a/patches.suse/0003-MODSIGN-load-blacklist-from-MOKx.patch b/patches.suse/0003-MODSIGN-load-blacklist-from-MOKx.patch
index 54340581f8..b9f1888e40 100644
--- a/patches.suse/0003-MODSIGN-load-blacklist-from-MOKx.patch
+++ b/patches.suse/0003-MODSIGN-load-blacklist-from-MOKx.patch
@@ -10,11 +10,9 @@ certificates from MOKx which is maintained by shim bootloader.
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
- certs/load_uefi.c | 16 +++++++++++++---
+ certs/load_uefi.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
-diff --git a/certs/load_uefi.c b/certs/load_uefi.c
-index f2f372b..dc66a79 100644
--- a/certs/load_uefi.c
+++ b/certs/load_uefi.c
@@ -164,8 +164,8 @@ static int __init load_uefi_certs(void)
@@ -54,6 +52,3 @@ index f2f372b..dc66a79 100644
return rc;
}
late_initcall(load_uefi_certs);
---
-2.10.2
-
diff --git a/scripts/git_sort/git_sort.py b/scripts/git_sort/git_sort.py
index 630472b2d8..c35ba6b90b 100755
--- a/scripts/git_sort/git_sort.py
+++ b/scripts/git_sort/git_sort.py
@@ -237,6 +237,8 @@ remotes = (
Head(RepoURL("git://git.infradead.org/nvme.git"), "nvme-5.0"),
Head(RepoURL("git://git.linux-nfs.org/projects/anna/linux-nfs.git"), "linux-next"),
Head(RepoURL("acme/linux.git"), "perf/core"),
+ Head(RepoURL("will/linux.git"), "for-joerg/arm-smmu/updates"),
+ Head(RepoURL("joro/iommu.git"), "next"),
)
diff --git a/series.conf b/series.conf
index 52b2301f56..54077f8cd9 100644
--- a/series.conf
+++ b/series.conf
@@ -9321,6 +9321,7 @@
patches.suse/msft-hv-1457-x86-hyper-v-Use-hypercall-for-remote-TLB-flush.patch
patches.suse/msft-hv-1486-x86-hyper-v-Support-extended-CPU-ranges-for-TLB-flus.patch
patches.suse/msft-hv-1487-tracing-hyper-v-Trace-hyperv_mmu_flush_tlb_others.patch
+ patches.arch/efi-arm-Don-t-mark-ACPI-reclaim-memory-as-MEMBLOCK_N.patch
patches.suse/0001-drivers-fbdev-efifb-Allow-BAR-to-be-moved-instead-of.patch
patches.drivers/powerpc-powernv-Add-IMC-OPAL-APIs.patch
patches.drivers/powerpc-powernv-Detect-and-create-IMC-device.patch
@@ -35443,6 +35444,11 @@
patches.drivers/0009-arm64-remove-unused-COMPAT_PSR-definitions.patch
patches.drivers/0019-arm64-numa-rework-ACPI-NUMA-initialization.patch
patches.drivers/0008-arm64-export-memblock_reserve-d-regions-via-proc-iom.patch
+ patches.arch/drivers-acpi-add-dependency-of-EFI-for-arm64.patch
+ patches.arch/efi-arm-preserve-early-mapping-of-UEFI-memory-map-lo.patch
+ patches.arch/efi-arm-map-UEFI-memory-map-even-w-o-runtime-service.patch
+ patches.arch/arm64-acpi-fix-alignment-fault-in-accessing-ACPI.patch
+ patches.drivers/arm64-fix-ACPI-dependencies.patch
patches.drivers/0081-perf-arm-cci-Remove-VLA-usage.patch
patches.drivers/0082-drivers-perf-Initialise-return-value-in-armpmu_reque.patch
patches.drivers/0083-arm_pmu-Clean-up-maximum-period-handling.patch
@@ -39044,6 +39050,7 @@
patches.fixes/userns-move-user-access-out-of-the-mutex.patch
patches.fixes/sys-don-t-hold-uts_sem-while-accessing-userspace-mem.patch
patches.fixes/getxattr-use-correct-xattr-length.patch
+ patches.drivers/ACPI-fix-menuconfig-presentation-of-ACPI-submenu.patch
patches.arch/s390-sles15sp1-00-03-08-zcrypt-fix-ap_instructions_available-returncode.patch
patches.arch/s390-sles15-15-01-pci-fix-out-of-bounds-access-during-irq-setup.patch
patches.arch/s390-sles15-17-01-02-s390-kdump-Make-elfcorehdr-size-calculation-ABI-comp.patch
@@ -39062,6 +39069,7 @@
patches.apparmor/apparmor-remove-no-op-permission-check-in-policy_unpack.patch
patches.drivers/iommu-arm-smmu-error-out-only-if-not-enough-context-interrupts
patches.drivers/iommu-arm-smmu-v3-Prevent-any-devices-access-to-memo.patch
+ patches.drivers/iommu-arm-smmu-v3-Abort-all-transactions-if-SMMU-is-.patch
patches.drivers/iommu-amd-make-sure-tlb-to-be-flushed-before-iova-freed
patches.arch/x86-irq_remapping-move-irq-remapping-mode-enum
patches.drivers/iommu-amd-add-support-for-higher-64-bit-iommu-control-register
@@ -42248,6 +42256,9 @@
patches.fixes/crypto-user-fix-leaking-uninitialized-memory-to-user.patch
patches.fixes/gfs2-Put-bitmap-buffers-in-put_super.patch
patches.fixes/fanotify-fix-handling-of-events-on-child-sub-directo.patch
+ patches.drivers/efi-arm-Revert-deferred-unmap-of-early-memmap-mappin.patch
+ patches.drivers/efi-arm-Defer-persistent-reservations-until-after-pa.patch
+ patches.drivers/efi-Permit-calling-efi_mem_reserve_persistent-from-a.patch
patches.arch/perf-x86-intel-uncore-support-coffeelake-8th-cbox.patch
patches.fixes/ocfs2-free-up-write-context-when-direct-IO-failed.patch
patches.suse/mm-vmstat.c-fix-NUMA-statistics-updates.patch
@@ -42467,6 +42478,7 @@
patches.fixes/exportfs-do-not-read-dentry-after-free.patch
patches.suse/objtool-fix-double-free-in-cold-detection-error-path.patch
patches.suse/objtool-fix-segfault-in-cold-detection-with-ffunction-sections.patch
+ patches.drivers/efi-Prevent-GICv3-WARN-by-mapping-the-memreserve-tab.patch
patches.fixes/uprobes-Fix-handle_swbp-vs.-unregister-register-race.patch
patches.arch/x86-mce-amd-fix-the-thresholding-machinery-initialization-order.patch
patches.fixes/test_hexdump-use-memcpy-instead-of-strncpy.patch
@@ -43094,6 +43106,8 @@
patches.arch/kvm-x86-use-jmp-to-invoke-kvm_spurious_fault-from-fixup
patches.arch/x86-resctrl-fix-rdt_find_domain-return-value-and-checks.patch
patches.drivers/firmware-efi-Add-NULL-pointer-checks-in-efivars-API-.patch
+ patches.drivers/efi-Permit-multiple-entries-in-persistent-memreserve.patch
+ patches.drivers/efi-Reduce-the-amount-of-memblock-reservations-for-p.patch
patches.fixes/tools-lib-lockdep-Rename-trywlock-into-trywrlock.patch
patches.drivers/hwmon-k10temp-x86-amd_nb-consolidate-shared-device-ids.patch
patches.arch/x86-amd_nb-add-support-for-newer-pci-topologies.patch
@@ -44310,6 +44324,8 @@
patches.drivers/i2c-bcm2835-Clear-current-buffer-pointers-and-counts.patch
patches.arch/x86-a-out-clear-the-dump-structure-initially.patch
patches.arch/x86-platform-uv-use-efi_runtime_lock-to-serialise-bios-calls
+ patches.drivers/arm64-mm-efi-Account-for-GICv3-LPI-tables-in-static-.patch
+ patches.drivers/efi-arm-Revert-Defer-persistent-reservations-until-a.patch
patches.fixes/mailbox-bcm-flexrm-mailbox-Fix-FlexRM-ring-flush-tim.patch
patches.fixes/mac80211-Free-mpath-object-when-rhashtable-insertion.patch
patches.fixes/mac80211-Restore-vif-beacon-interval-if-start-ap-fai.patch
@@ -45065,6 +45081,9 @@
patches.suse/0005-MODSIGN-Allow-the-db-UEFI-variable-to-be-suppressed.patch
patches.suse/0006-modsign-Use-secondary-trust-keyring-for-module-signi.patch
+ # will/linux for-joerg/arm-smmu/updates
+ patches.drivers/iommu-arm-smmu-v3-Don-t-disable-SMMU-in-kdump-kernel.patch
+
# out-of-tree patches
patches.drivers/firmware-arm_sdei-fix-wrong-of_node_put-in-init-function.patch
patches.arch/powerpc-pseries-Track-LMB-nid-instead-of-using-devic.patch
@@ -45728,7 +45747,7 @@
patches.suse/0008-kabi-arm64-reserve-space-in-cpu_hwcaps-and-cpu_hwcap.patch
patches.suse/prepare-arm64-kgraft
patches.suse/powerpc-KABI-add-aux_ptr-to-hole-in-paca_struct-to-e.patch
-
+ patches.kabi/arch-arm64-acpi-KABI-ignore-includes.patch
# KVM
patches.suse/0001-kvm-Introduce-nopvspin-kernel-parameter.patch