Re: [PATCH v3 3/3] iommu/arm-smmu: Pretty-print context fault related regs

Manivannan Sadhasivam
2024-08-22T11:12:16Z

On Thu, Aug 22, 2024 at 10:31:45AM +0000, Pranjal Shrivastava wrote:
> On Thu, Aug 22, 2024 at 03:39:41PM +0530, Manivannan Sadhasivam wrote:
> > On Mon, Jul 01, 2024 at 09:20:12AM -0700, Rob Clark wrote:
> > > From: Rob Clark <robdclark@chromium.org>
> > >
> > > Parse out the bitfields for easier-to-read fault messages.
> > >
> > > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > > ---
> > > .../iommu/arm/arm-smmu/arm-smmu-qcom-debug.c | 52 +++++---------
> > > drivers/iommu/arm/arm-smmu/arm-smmu.c | 70 +++++++++++++++----
> > > drivers/iommu/arm/arm-smmu/arm-smmu.h | 21 ++++++
> > > 3 files changed, 92 insertions(+), 51 deletions(-)
> > >
> >
> > [...]
> >
> > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> > > index 23cf91ac409b..79ec911ae151 100644
> > > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
> > > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> > > @@ -405,32 +405,72 @@ static const struct iommu_flush_ops arm_smmu_s2_tlb_ops_v1 = {
> > > .tlb_add_page = arm_smmu_tlb_add_page_s2_v1,
> > > };
> > >
> > > +
> > > +void arm_smmu_read_context_fault_info(struct arm_smmu_device *smmu, int idx,
> > > + struct arm_smmu_context_fault_info *cfi)
> > > +{
> > > + cfi->iova = arm_smmu_cb_readq(smmu, idx, ARM_SMMU_CB_FAR);
> > > + cfi->fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR);
> > > + cfi->fsynr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSYNR0);
> > > + cfi->cbfrsynra = arm_smmu_gr1_read(smmu, ARM_SMMU_GR1_CBFRSYNRA(idx));
> > > +}
> > > +
> > > +void arm_smmu_print_context_fault_info(struct arm_smmu_device *smmu, int idx,
> > > + const struct arm_smmu_context_fault_info *cfi)
> > > +{
> > > + dev_dbg(smmu->dev,
> > > + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n",
> > > + cfi->fsr, cfi->iova, cfi->fsynr, cfi->cbfrsynra, idx);
> > > +
> >
> > I just happen to hit an IOMMU fault in 6.11-rc4 and I did not see the 'Unhandled
> > context fault' log, but just the register dump in dmesg. Tracking that lead me
> > to this patch.
> >
> > May I know the reasoning behind making the actual error message _dbg()? It is
> > intentional first place?
> >
> > - Mani
>
> Hi Mani,
>
> That was a miss in this series, but it was fixed recently in [1].
> I think it should land soon.
>
> [1] https://lore.kernel.org/linux-iommu/172381862229.1794487.17068761066364130246.b4-ty@kernel.org/
>

Cool, thanks!

- Mani

--
மணிவண்ணன் சதாசிவம்