From dbee5229343b2832d1886a8f3646390bf8dc295f Mon Sep 17 00:00:00 2001 From: Prakash Gupta Date: Wed, 6 Nov 2019 13:29:47 +0530 Subject: [PATCH] iommu: arm-smmu: clear TBU halt request when halt times out TBU halt request is considered timed out after some wait. But the halt request is not cleared. This can result in halt request succeeding subsequently and driver not resuming the TBU. This can cause functional issue of TBU power collapse or TBU remaining halted. Clear the TBU halt request in case of timeout. Change-Id: I2225485cae8146917ea8cfdf3bf50742278ae628 Signed-off-by: Prakash Gupta [isaacm@codeaurora.org: Use DEBUG_SID_HALT_REQ] Signed-off-by: Isaac J. Manjarres --- drivers/iommu/arm-smmu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 52ef346b3c23..7540be31d29a 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -5010,6 +5010,11 @@ static int qsmmuv500_tbu_halt(struct qsmmuv500_tbu_device *tbu, (status & DEBUG_SR_HALT_ACK_VAL), 0, TBU_DBG_TIMEOUT_US)) { dev_err(tbu->dev, "Couldn't halt TBU!\n"); + + halt = readl_relaxed(tbu_base + DEBUG_SID_HALT_REG); + halt &= ~DEBUG_SID_HALT_REQ; + writel_relaxed(halt, tbu_base + DEBUG_SID_HALT_REG); + spin_unlock_irqrestore(&tbu->halt_lock, flags); return -ETIMEDOUT; }