]>
Commit | Line | Data |
---|---|---|
37554d48 SL |
1 | From abaa80c71ba926dfc788a37cfad7db31121304ac Mon Sep 17 00:00:00 2001 |
2 | From: Will Deacon <will.deacon@arm.com> | |
3 | Date: Tue, 23 Apr 2019 11:59:36 +0100 | |
4 | Subject: iommu/arm-smmu-v3: Don't disable SMMU in kdump kernel | |
5 | ||
6 | [ Upstream commit 3f54c447df34ff9efac7809a4a80fd3208efc619 ] | |
7 | ||
8 | Disabling the SMMU when probing from within a kdump kernel so that all | |
9 | incoming transactions are terminated can prevent the core of the crashed | |
10 | kernel from being transferred off the machine if all I/O devices are | |
11 | behind the SMMU. | |
12 | ||
13 | Instead, continue to probe the SMMU after it is disabled so that we can | |
14 | reinitialise it entirely and re-attach the DMA masters as they are reset. | |
15 | Since the kdump kernel may not have drivers for all of the active DMA | |
16 | masters, we suppress fault reporting to avoid spamming the console and | |
17 | swamping the IRQ threads. | |
18 | ||
19 | Reported-by: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com> | |
20 | Tested-by: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com> | |
21 | Tested-by: Bhupesh Sharma <bhsharma@redhat.com> | |
22 | Signed-off-by: Will Deacon <will.deacon@arm.com> | |
23 | Signed-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 | ||
28 | diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c | |
29 | index 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 | -- | |
58 | 2.20.1 | |
59 |