[PATCH v9 05/12] iommu/arm-smmu-v3: Cache and restore MSI config

Jason Gunthorpe jgg at nvidia.com
Tue Aug 25 09:36:11 PDT 2026


> [ ... 37 lines skipped ... ]
> +static void arm_smmu_resume_msi(struct arm_smmu_device *smmu,
> +				unsigned int irq, const char *name)
> +{
> +	struct msi_desc *desc;
> +	struct msi_msg msg;
> +
> +	if (!irq)
> +		return;
> +
> +	desc = irq_get_msi_desc(irq);
> +	if (!desc) {
> +		dev_err(smmu->dev, "Failed to resume msi: %s", name);
> +		return;
> +	}
> +
> +	get_cached_msi_msg(irq, &msg);
> +	arm_smmu_write_msi_msg(desc, &msg);
> +}

I'd really rather the irq core do this than open coding it like this,
it should be fairly common for any driver doing power management and
platform_device_msi stuff?

So maybe:

        platform_device_msi_rewrite(dev, irq, arm_smmu_write_msi_msg);

?

> +
> +static void arm_smmu_resume_msis(struct arm_smmu_device *smmu)
> +{


> +	if (!(smmu->features & ARM_SMMU_FEAT_MSI))
> +		return;
> +
> +	if (!dev_get_msi_domain(smmu->dev))
> +		return;

 [Severity: Medium]
 Will this correctly detect if we have fallen back to wired irqs?

 When setting up MSIs, if the allocation fails, the driver gracefully falls
 back to wired irqs without clearing the MSI feature flag:

 arm_smmu_setup_msis() {
     ...
     ret = platform_device_msi_init_and_alloc_irqs(...)
     if (ret) {
         dev_warn(dev, "failed to allocate MSIs - falling back to wired irqs\n");
         return;
     }
     ...
 }

 Does this mean the resume checks here will still pass during a fallback,
 causing irq_get_msi_desc() to return NULL and trigger a spurious dev_err()
 for each irq on every resume?

Seems believable..

-- 
Jason



More information about the linux-arm-kernel mailing list