Skip to content

Commit

Permalink
iommu/arm-smmu-v3: Don't disable SMMU in kdump kernel
Browse files Browse the repository at this point in the history
[ Upstream commit 3f54c44 ]

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)" <[email protected]>
Tested-by: "Leizhen (ThunderTown)" <[email protected]>
Tested-by: Bhupesh Sharma <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
wildea01 authored and gregkh committed Jun 15, 2019
1 parent f7883f9 commit 4b19a45
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/iommu/arm-smmu-v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2414,13 +2414,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);
Expand Down Expand Up @@ -2513,6 +2509,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) {
Expand Down

0 comments on commit 4b19a45

Please sign in to comment.