iommu/arm-smmu: Log CBFRSYNRA register on context fault
Subsystems (2)
PATCH v2 1/1 iommu/arm-smmu: Log CBFRSYNRA register on context fault
Bits[15:0] in CBFRSYNRA register contain information about StreamID of the incoming transaction that generated the fault. Dump CBFRSYNRA register to get this info. This is specially useful in a distributed SMMU architecture where multiple masters are connected to the SMMU. SID information helps to quickly identify the faulting master device.
---
Changes since v1:
- Addressed review comments, given by Bjorn, for nits.
drivers/iommu/arm-smmu-regs.h | 2 ++ drivers/iommu/arm-smmu.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/iommu/arm-smmu-regs.h +2 -0
@@ -147,6 +147,8 @@ enum arm_smmu_s2cr_privcfg {#define CBAR_IRPTNDX_SHIFT 24#define CBAR_IRPTNDX_MASK 0xff +#define ARM_SMMU_GR1_CBFRSYNRA (n) (0x400 + ((n) << 2)) +#define ARM_SMMU_GR1_CBA2R (n) (0x800 + ((n) << 2))#define CBA2R_RW64_32BIT (0 << 0)#define CBA2R_RW64_64BIT (1 << 0)
drivers/iommu/arm-smmu.c +5 -2
@@ -575,7 +575,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev)struct arm_smmu_domain *smmu_domain =to_smmu_domain (domain);struct arm_smmu_cfg *cfg = &smmu_domain->cfg;struct arm_smmu_device *smmu = smmu_domain->smmu; +void __iomem *gr1_base =ARM_SMMU_GR1 (smmu);void __iomem *cb_base; +u32 cbfrsynra; cb_base =ARM_SMMU_CB (smmu, cfg->cbndx); fsr =readl_relaxed (cb_base +ARM_SMMU_CB_FSR );
@@ -585,10 +587,11 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) fsynr =readl_relaxed (cb_base +ARM_SMMU_CB_FSYNR0 ); iova =readq_relaxed (cb_base +ARM_SMMU_CB_FAR ); + cbfrsynra =readl_relaxed (gr1_base +ARM_SMMU_GR1_CBFRSYNRA (cfg->cbndx));dev_err_ratelimited (smmu->dev, -"Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cb=%d\n" , - fsr, iova, fsynr, cfg->cbndx); +"Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n" , + fsr, iova, fsynr, cbfrsynra, cfg->cbndx);writel (fsr, cb_base +ARM_SMMU_CB_FSR );return IRQ_HANDLED ;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 37 lines · Vivek Gautam
Bits[15:0] in CBFRSYNRA register contain information about StreamID of the incoming transaction that generated the fault. Dump CBFRSYNRA register to get this info. This is specially useful in a distributed SMMU architecture where multiple masters are connected to the SMMU. SID information helps to quickly identify the faulting master device.
Signed-off-by Vivek Gautam <[email protected]>Reviewed-by Bjorn Andersson <[email protected]>---
Changes since v1:
- Addressed review comments, given by Bjorn, for nits.drivers/iommu/arm-smmu-regs.h | 2 ++ drivers/iommu/arm-smmu.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-)drivers/iommu/arm-smmu-regs.h +2
-0@@ -147,6 +147,8 @@ enum arm_smmu_s2cr_privcfg {#define CBAR_IRPTNDX_SHIFT 24#define CBAR_IRPTNDX_MASK 0xff +#define ARM_SMMU_GR1_CBFRSYNRA (n) (0x400 + ((n) << 2)) +#define ARM_SMMU_GR1_CBA2R (n) (0x800 + ((n) << 2))#define CBA2R_RW64_32BIT (0 << 0)#define CBA2R_RW64_64BIT (1 << 0)drivers/iommu/arm-smmu.c +0
-0
drivers/iommu/arm-smmu.c static irqreturn_t arm_smmu_context_fault(int irq, void *dev) · line 580
Quoted 6 lines
drivers/iommu/arm-smmu.c +2
-0@@ -575,7 +575,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev)struct arm_smmu_domain *smmu_domain =to_smmu_domain (domain);struct arm_smmu_cfg *cfg = &smmu_domain->cfg;struct arm_smmu_device *smmu = smmu_domain->smmu; +void __iomem *gr1_base =ARM_SMMU_GR1 (smmu);void __iomem *cb_base; +u32 cbfrsynra;
Nit: I would simply add to the existing "u32 fsr, fsynr;" declaration, but that's the sort of thing that could hopefully be fixed up when applying (or otherwise I might bulldoze it anyway in my eventual rework of register accesses throughout the driver). Regardless,
Quoted 17 lines
drivers/iommu/arm-smmu.c +3
-2cb_base =ARM_SMMU_CB (smmu, cfg->cbndx); fsr =readl_relaxed (cb_base +ARM_SMMU_CB_FSR );@@ -585,10 +587,11 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) fsynr =readl_relaxed (cb_base +ARM_SMMU_CB_FSYNR0 ); iova =readq_relaxed (cb_base +ARM_SMMU_CB_FAR ); + cbfrsynra =readl_relaxed (gr1_base +ARM_SMMU_GR1_CBFRSYNRA (cfg->cbndx));dev_err_ratelimited (smmu->dev, -"Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cb=%d\n" , - fsr, iova, fsynr, cfg->cbndx); +"Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n" , + fsr, iova, fsynr, cbfrsynra, cfg->cbndx);writel (fsr, cb_base +ARM_SMMU_CB_FSR );return IRQ_HANDLED ;
Ard Biesheuvel
Acked-byQuoted 67 lines · Robin Murphy
Quoted 37 lines · Vivek Gautam
Bits[15:0] in CBFRSYNRA register contain information about StreamID of the incoming transaction that generated the fault. Dump CBFRSYNRA register to get this info. This is specially useful in a distributed SMMU architecture where multiple masters are connected to the SMMU. SID information helps to quickly identify the faulting master device.
Signed-off-by Vivek Gautam <[email protected]>Reviewed-by Bjorn Andersson <[email protected]>---
Changes since v1:
- Addressed review comments, given by Bjorn, for nits.drivers/iommu/arm-smmu-regs.h | 2 ++ drivers/iommu/arm-smmu.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-)drivers/iommu/arm-smmu-regs.h +2
-0@@ -147,6 +147,8 @@ enum arm_smmu_s2cr_privcfg {#define CBAR_IRPTNDX_SHIFT 24#define CBAR_IRPTNDX_MASK 0xff +#define ARM_SMMU_GR1_CBFRSYNRA (n) (0x400 + ((n) << 2)) +#define ARM_SMMU_GR1_CBA2R (n) (0x800 + ((n) << 2))#define CBA2R_RW64_32BIT (0 << 0)#define CBA2R_RW64_64BIT (1 << 0)drivers/iommu/arm-smmu.c +0
-0drivers/iommu/arm-smmu.c static irqreturn_t arm_smmu_context_fault(int irq, void *dev) · line 580
Quoted 6 lines
drivers/iommu/arm-smmu.c +2
-0@@ -575,7 +575,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev)struct arm_smmu_domain *smmu_domain =to_smmu_domain (domain);struct arm_smmu_cfg *cfg = &smmu_domain->cfg;struct arm_smmu_device *smmu = smmu_domain->smmu; +void __iomem *gr1_base =ARM_SMMU_GR1 (smmu);void __iomem *cb_base; +u32 cbfrsynra;Nit: I would simply add to the existing "u32 fsr, fsynr;" declaration, but that's the sort of thing that could hopefully be fixed up when applying (or otherwise I might bulldoze it anyway in my eventual rework of register accesses throughout the driver). Regardless,
Reviewed-by Robin Murphy <[email protected]>Quoted 14 lines
drivers/iommu/arm-smmu.c +3
-2cb_base =ARM_SMMU_CB (smmu, cfg->cbndx); fsr =readl_relaxed (cb_base +ARM_SMMU_CB_FSR );@@ -585,10 +587,11 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) fsynr =readl_relaxed (cb_base +ARM_SMMU_CB_FSYNR0 ); iova =readq_relaxed (cb_base +ARM_SMMU_CB_FAR ); + cbfrsynra =readl_relaxed (gr1_base +ARM_SMMU_GR1_CBFRSYNRA (cfg->cbndx));dev_err_ratelimited (smmu->dev, -"Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cb=%d\n" , - fsr, iova, fsynr, cfg->cbndx); +"Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n" , + fsr, iova, fsynr, cbfrsynra, cfg->cbndx);
Quoted 4 lines
drivers/iommu/arm-smmu.c static irqreturn_t arm_smmu_context_fault(int irq, void *dev) · line 597
Quoted 3 lines
drivers/iommu/arm-smmu.c +0
-0writel (fsr, cb_base +ARM_SMMU_CB_FSR );return IRQ_HANDLED ;
This is something I've had to hack up locally in the past, so
Will Deacon
AppliedQuoted 8 lines · Vivek Gautam
Bits[15:0] in CBFRSYNRA register contain information about StreamID of the incoming transaction that generated the fault. Dump CBFRSYNRA register to get this info. This is specially useful in a distributed SMMU architecture where multiple masters are connected to the SMMU. SID information helps to quickly identify the faulting master device.
Quoted 6 lines
Signed-off-by Vivek Gautam <[email protected]>Reviewed-by Bjorn Andersson <[email protected]>---
Changes since v1:
- Addressed review comments, given by Bjorn, for nits.
Thanks, applied with minor fixup from Robin and Acks.
Will