Thread (71 messages) 71 messages, 9 authors, 2022-04-07
STALE1514d LANDED

[PATCH v3 24/35] iommu/amd: Implement select() method on remapping irqdomain

From: David Woodhouse <dwmw2@infradead.org>
Date: 2020-10-24 21:37:26
Also in: kvm, linux-iommu, lkml
Subsystem: amd iommu (amd-vi), iommu subsystem, the rest · Maintainers: Joerg Roedel, Will Deacon, Linus Torvalds

From: David Woodhouse <redacted>

Preparatory change to remove irq_remapping_get_irq_domain().

Signed-off-by: David Woodhouse <redacted>
Signed-off-by: Thomas Gleixner <redacted>
---
 drivers/iommu/amd/iommu.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 9744cdbefd88..31b22244e9c2 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -3882,7 +3882,26 @@ static void irq_remapping_deactivate(struct irq_domain *domain,
 					    irte_info->index);
 }
 
+static int irq_remapping_select(struct irq_domain *d, struct irq_fwspec *fwspec,
+				enum irq_domain_bus_token bus_token)
+{
+	struct amd_iommu *iommu;
+	int devid = -1;
+
+	if (x86_fwspec_is_ioapic(fwspec))
+		devid = get_ioapic_devid(fwspec->param[0]);
+	else if (x86_fwspec_is_hpet(fwspec))
+		devid = get_hpet_devid(fwspec->param[0]);
+
+	if (devid < 0)
+		return 0;
+
+	iommu = amd_iommu_rlookup_table[devid];
+	return iommu && iommu->ir_domain == d;
+}
+
 static const struct irq_domain_ops amd_ir_domain_ops = {
+	.select = irq_remapping_select,
 	.alloc = irq_remapping_alloc,
 	.free = irq_remapping_free,
 	.activate = irq_remapping_activate,
-- 
2.26.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help