public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iommu/vt-d: Rename fault IRQ variable
@ 2024-04-03 23:45 Jacob Pan
  2024-04-03 23:45 ` [PATCH 2/2] iommu/vt-d: Share DMAR fault IRQ to prevent vector exhaustion Jacob Pan
  0 siblings, 1 reply; 6+ messages in thread
From: Jacob Pan @ 2024-04-03 23:45 UTC (permalink / raw)
  To: sivanich, Thomas Gleixner, LKML, iommu, Lu Baolu, Joerg Roedel
  Cc: Tian, Kevin, Yi Liu, steve.wahl, russ.anderson, Peter Zijlstra,
	Will Deacon, Robin Murphy, Jacob Pan

Originally, DMAR fault IRQ was the only source of interrupts for VT-d
itself, thus simply named 'irq'. Newer interrupt sources were added later
for page requests and perfmon with proper names, i.e. pr_irq and perf_irq.

Rename the fault IRQ to reflect its usage. This avoids confusion when
programming MSI messages for the three possible sources.

Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
 drivers/iommu/intel/dmar.c  | 16 ++++++++--------
 drivers/iommu/intel/iommu.h |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
index 36d7427b1202..ab325af93f71 100644
--- a/drivers/iommu/intel/dmar.c
+++ b/drivers/iommu/intel/dmar.c
@@ -1175,15 +1175,15 @@ static void free_iommu(struct intel_iommu *iommu)
 
 	free_iommu_pmu(iommu);
 
-	if (iommu->irq) {
+	if (iommu->fault_irq) {
 		if (iommu->pr_irq) {
 			free_irq(iommu->pr_irq, iommu);
 			dmar_free_hwirq(iommu->pr_irq);
 			iommu->pr_irq = 0;
 		}
-		free_irq(iommu->irq, iommu);
-		dmar_free_hwirq(iommu->irq);
-		iommu->irq = 0;
+		free_irq(iommu->fault_irq, iommu);
+		dmar_free_hwirq(iommu->fault_irq);
+		iommu->fault_irq = 0;
 	}
 
 	if (iommu->qi) {
@@ -1918,7 +1918,7 @@ static const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
 
 static inline int dmar_msi_reg(struct intel_iommu *iommu, int irq)
 {
-	if (iommu->irq == irq)
+	if (iommu->fault_irq == irq)
 		return DMAR_FECTL_REG;
 	else if (iommu->pr_irq == irq)
 		return DMAR_PECTL_REG;
@@ -2105,12 +2105,12 @@ int dmar_set_interrupt(struct intel_iommu *iommu)
 	/*
 	 * Check if the fault interrupt is already initialized.
 	 */
-	if (iommu->irq)
+	if (iommu->fault_irq)
 		return 0;
 
 	irq = dmar_alloc_hwirq(iommu->seq_id, iommu->node, iommu);
 	if (irq > 0) {
-		iommu->irq = irq;
+		iommu->fault_irq = irq;
 	} else {
 		pr_err("No free IRQ vectors\n");
 		return -EINVAL;
@@ -2143,7 +2143,7 @@ int __init enable_drhd_fault_handling(void)
 		/*
 		 * Clear any previous faults.
 		 */
-		dmar_fault(iommu->irq, iommu);
+		dmar_fault(iommu->fault_irq, iommu);
 		fault_status = readl(iommu->reg + DMAR_FSTS_REG);
 		writel(fault_status, iommu->reg + DMAR_FSTS_REG);
 	}
diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h
index 404d2476a877..deebd4817d27 100644
--- a/drivers/iommu/intel/iommu.h
+++ b/drivers/iommu/intel/iommu.h
@@ -699,7 +699,7 @@ struct intel_iommu {
 	int		seq_id;	/* sequence id of the iommu */
 	int		agaw; /* agaw of this iommu */
 	int		msagaw; /* max sagaw of this iommu */
-	unsigned int	irq, pr_irq, perf_irq;
+	unsigned int	fault_irq, pr_irq, perf_irq;
 	u16		segment;     /* PCI segment# */
 	unsigned char 	name[13];    /* Device Name */
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-09  7:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03 23:45 [PATCH 1/2] iommu/vt-d: Rename fault IRQ variable Jacob Pan
2024-04-03 23:45 ` [PATCH 2/2] iommu/vt-d: Share DMAR fault IRQ to prevent vector exhaustion Jacob Pan
2024-04-08  8:48   ` Tian, Kevin
2024-04-08 16:05     ` Jacob Pan
2024-04-08 17:38       ` Jacob Pan
2024-04-09  7:07         ` Tian, Kevin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox