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

From: Jason Gunthorpe <[email-masked]>
Date: Fri, 24 Apr 2026 13:59:27 -0300

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..

Jason