--- /dev/null
+From e8254b6b6c46cd6a869ae3d07c882ea557f60a3b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Jun 2020 10:36:20 +0200
+Subject: KVM: s390: reduce number of IO pins to 1
+
+From: Christian Borntraeger <borntraeger@de.ibm.com>
+
+[ Upstream commit 774911290c589e98e3638e73b24b0a4d4530e97c ]
+
+The current number of KVM_IRQCHIP_NUM_PINS results in an order 3
+allocation (32kb) for each guest start/restart. This can result in OOM
+killer activity even with free swap when the memory is fragmented
+enough:
+
+kernel: qemu-system-s39 invoked oom-killer: gfp_mask=0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_COMP|__GFP_ZERO), order=3, oom_score_adj=0
+kernel: CPU: 1 PID: 357274 Comm: qemu-system-s39 Kdump: loaded Not tainted 5.4.0-29-generic #33-Ubuntu
+kernel: Hardware name: IBM 8562 T02 Z06 (LPAR)
+kernel: Call Trace:
+kernel: ([<00000001f848fe2a>] show_stack+0x7a/0xc0)
+kernel: [<00000001f8d3437a>] dump_stack+0x8a/0xc0
+kernel: [<00000001f8687032>] dump_header+0x62/0x258
+kernel: [<00000001f8686122>] oom_kill_process+0x172/0x180
+kernel: [<00000001f8686abe>] out_of_memory+0xee/0x580
+kernel: [<00000001f86e66b8>] __alloc_pages_slowpath+0xd18/0xe90
+kernel: [<00000001f86e6ad4>] __alloc_pages_nodemask+0x2a4/0x320
+kernel: [<00000001f86b1ab4>] kmalloc_order+0x34/0xb0
+kernel: [<00000001f86b1b62>] kmalloc_order_trace+0x32/0xe0
+kernel: [<00000001f84bb806>] kvm_set_irq_routing+0xa6/0x2e0
+kernel: [<00000001f84c99a4>] kvm_arch_vm_ioctl+0x544/0x9e0
+kernel: [<00000001f84b8936>] kvm_vm_ioctl+0x396/0x760
+kernel: [<00000001f875df66>] do_vfs_ioctl+0x376/0x690
+kernel: [<00000001f875e304>] ksys_ioctl+0x84/0xb0
+kernel: [<00000001f875e39a>] __s390x_sys_ioctl+0x2a/0x40
+kernel: [<00000001f8d55424>] system_call+0xd8/0x2c8
+
+As far as I can tell s390x does not use the iopins as we bail our for
+anything other than KVM_IRQ_ROUTING_S390_ADAPTER and the chip/pin is
+only used for KVM_IRQ_ROUTING_IRQCHIP. So let us use a small number to
+reduce the memory footprint.
+
+Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
+Reviewed-by: Cornelia Huck <cohuck@redhat.com>
+Reviewed-by: David Hildenbrand <david@redhat.com>
+Link: https://lore.kernel.org/r/20200617083620.5409-1-borntraeger@de.ibm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/s390/include/asm/kvm_host.h | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
+index abe60268335d2..0fe5600a037e4 100644
+--- a/arch/s390/include/asm/kvm_host.h
++++ b/arch/s390/include/asm/kvm_host.h
+@@ -31,12 +31,12 @@
+ #define KVM_USER_MEM_SLOTS 32
+
+ /*
+- * These seem to be used for allocating ->chip in the routing table,
+- * which we don't use. 4096 is an out-of-thin-air value. If we need
+- * to look at ->chip later on, we'll need to revisit this.
++ * These seem to be used for allocating ->chip in the routing table, which we
++ * don't use. 1 is as small as we can get to reduce the needed memory. If we
++ * need to look at ->chip later on, we'll need to revisit this.
+ */
+ #define KVM_NR_IRQCHIPS 1
+-#define KVM_IRQCHIP_NUM_PINS 4096
++#define KVM_IRQCHIP_NUM_PINS 1
+ #define KVM_HALT_POLL_NS_DEFAULT 50000
+
+ /* s390-specific vcpu->requests bit members */
+--
+2.25.1
+
--- /dev/null
+kvm-s390-reduce-number-of-io-pins-to-1.patch
+spi-spi-fsl-dspi-adding-shutdown-hook.patch
+spi-spi-fsl-dspi-fix-lockup-if-device-is-removed-dur.patch
--- /dev/null
+From 0f7364cc3351aa1d9be5bee917f3566cb9635c9a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 24 Apr 2020 14:12:16 +0800
+Subject: spi: spi-fsl-dspi: Adding shutdown hook
+
+From: Peng Ma <peng.ma@nxp.com>
+
+[ Upstream commit dc234825997ec6ff05980ca9e2204f4ac3f8d695 ]
+
+We need to ensure dspi controller could be stopped in order for kexec
+to start the next kernel.
+So add the shutdown operation support.
+
+Signed-off-by: Peng Ma <peng.ma@nxp.com>
+Link: https://lore.kernel.org/r/20200424061216.27445-1-peng.ma@nxp.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-fsl-dspi.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
+index 9a06818d28169..e34278a00b708 100644
+--- a/drivers/spi/spi-fsl-dspi.c
++++ b/drivers/spi/spi-fsl-dspi.c
+@@ -1,6 +1,7 @@
+ // SPDX-License-Identifier: GPL-2.0+
+ //
+ // Copyright 2013 Freescale Semiconductor, Inc.
++// Copyright 2020 NXP
+ //
+ // Freescale DSPI driver
+ // This file contains a driver for the Freescale DSPI
+@@ -33,6 +34,9 @@
+ #define SPI_MCR_CLR_TXF BIT(11)
+ #define SPI_MCR_CLR_RXF BIT(10)
+ #define SPI_MCR_XSPI BIT(3)
++#define SPI_MCR_DIS_TXF BIT(13)
++#define SPI_MCR_DIS_RXF BIT(12)
++#define SPI_MCR_HALT BIT(0)
+
+ #define SPI_TCR 0x08
+ #define SPI_TCR_GET_TCNT(x) (((x) & GENMASK(31, 16)) >> 16)
+@@ -1169,6 +1173,24 @@ static int dspi_remove(struct platform_device *pdev)
+ return 0;
+ }
+
++static void dspi_shutdown(struct platform_device *pdev)
++{
++ struct spi_controller *ctlr = platform_get_drvdata(pdev);
++ struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
++
++ /* Disable RX and TX */
++ regmap_update_bits(dspi->regmap, SPI_MCR,
++ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF,
++ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF);
++
++ /* Stop Running */
++ regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT);
++
++ dspi_release_dma(dspi);
++ clk_disable_unprepare(dspi->clk);
++ spi_unregister_controller(dspi->ctlr);
++}
++
+ static struct platform_driver fsl_dspi_driver = {
+ .driver.name = DRIVER_NAME,
+ .driver.of_match_table = fsl_dspi_dt_ids,
+@@ -1176,6 +1198,7 @@ static struct platform_driver fsl_dspi_driver = {
+ .driver.pm = &dspi_pm,
+ .probe = dspi_probe,
+ .remove = dspi_remove,
++ .shutdown = dspi_shutdown,
+ };
+ module_platform_driver(fsl_dspi_driver);
+
+--
+2.25.1
+
--- /dev/null
+From d478279bca0a7c4cf5c67419726dde934ed3ed72 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 22 Jun 2020 13:05:40 +0200
+Subject: spi: spi-fsl-dspi: Fix lockup if device is removed during SPI
+ transfer
+
+From: Krzysztof Kozlowski <krzk@kernel.org>
+
+[ Upstream commit 7684580d45bd3d84ed9b453a4cadf7a9a5605a3f ]
+
+During device removal, the driver should unregister the SPI controller
+and stop the hardware. Otherwise the dspi_transfer_one_message() could
+wait on completion infinitely.
+
+Additionally, calling spi_unregister_controller() first in device
+removal reverse-matches the probe function, where SPI controller is
+registered at the end.
+
+Fixes: 05209f457069 ("spi: fsl-dspi: add missing clk_disable_unprepare() in dspi_remove()")
+Reported-by: Vladimir Oltean <olteanv@gmail.com>
+Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20200622110543.5035-1-krzk@kernel.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-fsl-dspi.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
+index e34278a00b708..3e0e27731922e 100644
+--- a/drivers/spi/spi-fsl-dspi.c
++++ b/drivers/spi/spi-fsl-dspi.c
+@@ -1164,11 +1164,20 @@ static int dspi_remove(struct platform_device *pdev)
+ struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
+
+ /* Disconnect from the SPI framework */
++ spi_unregister_controller(dspi->ctlr);
++
++ /* Disable RX and TX */
++ regmap_update_bits(dspi->regmap, SPI_MCR,
++ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF,
++ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF);
++
++ /* Stop Running */
++ regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT);
++
+ dspi_release_dma(dspi);
+ if (dspi->irq)
+ free_irq(dspi->irq, dspi);
+ clk_disable_unprepare(dspi->clk);
+- spi_unregister_controller(dspi->ctlr);
+
+ return 0;
+ }
+--
+2.25.1
+