Subject: Re: [PATCH v7 05/11] iommu/arm-smmu-v3: Cache and restore MSI config

From: Pranjal Shrivastava <[email-masked]>
Date: Thu, 28 May 2026 21:57:04 +0000

On Thu, May 28, 2026 at 11:36:06AM -0700, Nicolin Chen wrote:
> On Wed, May 27, 2026 at 10:14:01PM +0000, Pranjal Shrivastava wrote:
> > The SMMU's MSI configuration registers (*_IRQ_CFGn) containing target
> > address, data and memory attributes lose their state when the SMMU is
> > powered down. We'll need to cache and restore their contents to ensure
> > that MSIs work after the system resumes.
> > 
> > To address this, cache the original `msi_msg` within the `msi_desc`
> > when the configuration is first written by `arm_smmu_write_msi_msg`.
> > This primarily includes the target address and data since the memory
> > attributes are fixed.
> > 
> > Introduce a new helper `arm_smmu_resume_msis` which will later be called
> > during the driver's resume callback. The helper would retrieve the
> > cached MSI message for each relevant interrupt (evtq, gerr, priq) via
> > get_cached_msi_msg & re-config the registers via arm_smmu_write_msi_msg.
> > 
> > Signed-off-by: Pranjal Shrivastava <[email-masked]>
> 
> Reviewed-by: Nicolin Chen <[email-masked]>
> 
> > +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);
> 
> I wonder if we could use __get_cached_msi_msg() since we got desc?

We could've (and that's a nice suggestion), but unfortunately it 
(__get_cached_msi_msg) is not exported via EXPORT_SYMBOL_GPL() :(
We could break modular builds as CONFIG_ARM_SMMU_V3 is tristate.

Let me know if you have a strong preference about exporting it, we can
add a patch in the next versions.

Thanks,
Praan