[PATCH v7 05/11] iommu/arm-smmu-v3: Cache and restore MSI config
Pranjal Shrivastava
praan at google.com
Thu May 28 14:57:04 PDT 2026
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 <praan at google.com>
>
> Reviewed-by: Nicolin Chen <nicolinc at nvidia.com>
>
> > +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
More information about the linux-arm-kernel
mailing list