Thread (40 messages) 40 messages, 4 authors, 28d ago

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

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2026-08-25 16:36:43
Also in: linux-iommu

[ ... 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help