]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.19/iommu-arm-smmu-v3-don-t-disable-smmu-in-kdump-kernel.patch
Linux 5.1.10
[thirdparty/kernel/stable-queue.git] / queue-4.19 / iommu-arm-smmu-v3-don-t-disable-smmu-in-kdump-kernel.patch
CommitLineData
37554d48
SL
1From abaa80c71ba926dfc788a37cfad7db31121304ac Mon Sep 17 00:00:00 2001
2From: Will Deacon <will.deacon@arm.com>
3Date: Tue, 23 Apr 2019 11:59:36 +0100
4Subject: iommu/arm-smmu-v3: Don't disable SMMU in kdump kernel
5
6[ Upstream commit 3f54c447df34ff9efac7809a4a80fd3208efc619 ]
7
8Disabling the SMMU when probing from within a kdump kernel so that all
9incoming transactions are terminated can prevent the core of the crashed
10kernel from being transferred off the machine if all I/O devices are
11behind the SMMU.
12
13Instead, continue to probe the SMMU after it is disabled so that we can
14reinitialise it entirely and re-attach the DMA masters as they are reset.
15Since the kdump kernel may not have drivers for all of the active DMA
16masters, we suppress fault reporting to avoid spamming the console and
17swamping the IRQ threads.
18
19Reported-by: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
20Tested-by: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
21Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
22Signed-off-by: Will Deacon <will.deacon@arm.com>
23Signed-off-by: Sasha Levin <sashal@kernel.org>
24---
25 drivers/iommu/arm-smmu-v3.c | 10 ++++------
26 1 file changed, 4 insertions(+), 6 deletions(-)
27
28diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
29index 9ae3678844eb..40fbf20d69e5 100644
30--- a/drivers/iommu/arm-smmu-v3.c
31+++ b/drivers/iommu/arm-smmu-v3.c
32@@ -2414,13 +2414,9 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass)
33 /* Clear CR0 and sync (disables SMMU and queue processing) */
34 reg = readl_relaxed(smmu->base + ARM_SMMU_CR0);
35 if (reg & CR0_SMMUEN) {
36- if (is_kdump_kernel()) {
37- arm_smmu_update_gbpa(smmu, GBPA_ABORT, 0);
38- arm_smmu_device_disable(smmu);
39- return -EBUSY;
40- }
41-
42 dev_warn(smmu->dev, "SMMU currently enabled! Resetting...\n");
43+ WARN_ON(is_kdump_kernel() && !disable_bypass);
44+ arm_smmu_update_gbpa(smmu, GBPA_ABORT, 0);
45 }
46
47 ret = arm_smmu_device_disable(smmu);
48@@ -2513,6 +2509,8 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass)
49 return ret;
50 }
51
52+ if (is_kdump_kernel())
53+ enables &= ~(CR0_EVTQEN | CR0_PRIQEN);
54
55 /* Enable the SMMU interface, or ensure bypass */
56 if (!bypass || disable_bypass) {
57--
582.20.1
59