Re: [PATCH rc v2 2/5] iommu/arm-smmu-v3: Implement is_attach_deferred() for kdump

Jason Gunthorpe
2026-04-24T20:51:15Z

On Fri, Apr 24, 2026 at 11:44:12AM -0700, Nicolin Chen wrote:
> On Fri, Apr 24, 2026 at 01:59:27PM -0300, Jason Gunthorpe wrote:
> > On Wed, Apr 15, 2026 at 02:17:37PM -0700, Nicolin Chen wrote:
> > > +static bool arm_smmu_is_attach_deferred(struct device *dev)
> > > +{
> > > + struct arm_smmu_master *master = dev_iommu_priv_get(dev);
> > > + struct arm_smmu_device *smmu = master->smmu;
> > > + int i;
> > > +
> > > + if (!(smmu->options & ARM_SMMU_OPT_KDUMP))
> > > + return false;
> > > +
> > > + for (i = 0; i < master->num_streams; i++) {
> > > + u32 sid = master->streams[i].id;
> > > + struct arm_smmu_ste *step;
> > > +
> > > + /* Guard against unpopulated L2 entries in the adopted table */
> > > + if ((smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB) &&
> > > + !smmu->strtab_cfg.l2.l2ptrs[arm_smmu_strtab_l1_idx(sid)])
> > > + continue;
> >
> > This can probably just call arm_smmu_init_sid_strtab()
> >
> > I think it is OK to allocate another level 2 here and it also has
> > protections for SID out of range..
>
> Actually, sashiko pointed out that this guard is a dead code.
>
> arm_smmu_init_sid_strtab() is called in arm_smmu_insert_master().

Even better

Jason