aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-03-30 14:47:04 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2012-05-07 08:34:59 -0400
commit9d619f65722236e0e0c35467d1528caed206e439 (patch)
tree6d0a77b7835fc056810a05be5a217e96d9153ff7
parent4c1bad6a0af1e297c8d05365e65af89d8c7bf9d1 (diff)
iommu/vt-d: Convert free_irte into a remap_ops callback
The operation for releasing a remapping entry is iommu specific too. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r--arch/x86/include/asm/intr_remapping.h2
-rw-r--r--arch/x86/kernel/apic/io_apic.c2
-rw-r--r--drivers/iommu/intel_intr_remapping.c3
-rw-r--r--drivers/iommu/intr_remapping.c8
-rw-r--r--drivers/iommu/intr_remapping.h3
-rw-r--r--include/linux/dmar.h5
6 files changed, 16 insertions, 7 deletions
diff --git a/arch/x86/include/asm/intr_remapping.h b/arch/x86/include/asm/intr_remapping.h
index ae933ecfd8f0..a195b7d6995c 100644
--- a/arch/x86/include/asm/intr_remapping.h
+++ b/arch/x86/include/asm/intr_remapping.h
@@ -43,6 +43,7 @@ extern int intr_setup_ioapic_entry(int irq,
43extern int intr_set_affinity(struct irq_data *data, 43extern int intr_set_affinity(struct irq_data *data,
44 const struct cpumask *mask, 44 const struct cpumask *mask,
45 bool force); 45 bool force);
46extern void intr_free_irq(int irq);
46 47
47#else /* CONFIG_IRQ_REMAP */ 48#else /* CONFIG_IRQ_REMAP */
48 49
@@ -68,6 +69,7 @@ static inline int intr_set_affinity(struct irq_data *data,
68{ 69{
69 return 0; 70 return 0;
70} 71}
72static inline void intr_free_irq(int irq) { }
71#endif /* CONFIG_IRQ_REMAP */ 73#endif /* CONFIG_IRQ_REMAP */
72 74
73#endif /* __X86_INTR_REMAPPING_H */ 75#endif /* __X86_INTR_REMAPPING_H */
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index a97c79aa25cf..5690469555fb 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3041,7 +3041,7 @@ void destroy_irq(unsigned int irq)
3041 irq_set_status_flags(irq, IRQ_NOREQUEST|IRQ_NOPROBE); 3041 irq_set_status_flags(irq, IRQ_NOREQUEST|IRQ_NOPROBE);
3042 3042
3043 if (irq_remapped(cfg)) 3043 if (irq_remapped(cfg))
3044 free_irte(irq); 3044 intr_free_irq(irq);
3045 raw_spin_lock_irqsave(&vector_lock, flags); 3045 raw_spin_lock_irqsave(&vector_lock, flags);
3046 __clear_irq_vector(irq, cfg); 3046 __clear_irq_vector(irq, cfg);
3047 raw_spin_unlock_irqrestore(&vector_lock, flags); 3047 raw_spin_unlock_irqrestore(&vector_lock, flags);
diff --git a/drivers/iommu/intel_intr_remapping.c b/drivers/iommu/intel_intr_remapping.c
index 25372c1f3c8c..44a6e04a070b 100644
--- a/drivers/iommu/intel_intr_remapping.c
+++ b/drivers/iommu/intel_intr_remapping.c
@@ -253,7 +253,7 @@ static int clear_entries(struct irq_2_iommu *irq_iommu)
253 return qi_flush_iec(iommu, index, irq_iommu->irte_mask); 253 return qi_flush_iec(iommu, index, irq_iommu->irte_mask);
254} 254}
255 255
256int free_irte(int irq) 256static int free_irte(int irq)
257{ 257{
258 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq); 258 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq);
259 unsigned long flags; 259 unsigned long flags;
@@ -964,4 +964,5 @@ struct irq_remap_ops intel_irq_remap_ops = {
964 .enable_faulting = enable_drhd_fault_handling, 964 .enable_faulting = enable_drhd_fault_handling,
965 .setup_ioapic_entry = intel_setup_ioapic_entry, 965 .setup_ioapic_entry = intel_setup_ioapic_entry,
966 .set_affinity = intel_ioapic_set_affinity, 966 .set_affinity = intel_ioapic_set_affinity,
967 .free_irq = free_irte,
967}; 968};
diff --git a/drivers/iommu/intr_remapping.c b/drivers/iommu/intr_remapping.c
index 2f4f27ffb861..a68d304f9729 100644
--- a/drivers/iommu/intr_remapping.c
+++ b/drivers/iommu/intr_remapping.c
@@ -119,3 +119,11 @@ int intr_set_affinity(struct irq_data *data, const struct cpumask *mask,
119 119
120 return remap_ops->set_affinity(data, mask, force); 120 return remap_ops->set_affinity(data, mask, force);
121} 121}
122
123void intr_free_irq(int irq)
124{
125 if (!remap_ops || !remap_ops->free_irq)
126 return;
127
128 remap_ops->free_irq(irq);
129}
diff --git a/drivers/iommu/intr_remapping.h b/drivers/iommu/intr_remapping.h
index e0bc6e0ba1fb..57485539383d 100644
--- a/drivers/iommu/intr_remapping.h
+++ b/drivers/iommu/intr_remapping.h
@@ -60,6 +60,9 @@ struct irq_remap_ops {
60 /* Set the CPU affinity of a remapped interrupt */ 60 /* Set the CPU affinity of a remapped interrupt */
61 int (*set_affinity)(struct irq_data *data, const struct cpumask *mask, 61 int (*set_affinity)(struct irq_data *data, const struct cpumask *mask,
62 bool force); 62 bool force);
63
64 /* Free an IRQ */
65 int (*free_irq)(int);
63}; 66};
64 67
65extern struct irq_remap_ops intel_irq_remap_ops; 68extern struct irq_remap_ops intel_irq_remap_ops;
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index f2bd87f52a8d..7a207a39f879 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -121,7 +121,6 @@ extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
121extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, 121extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
122 u16 sub_handle); 122 u16 sub_handle);
123extern int map_irq_to_irte_handle(int irq, u16 *sub_handle); 123extern int map_irq_to_irte_handle(int irq, u16 *sub_handle);
124extern int free_irte(int irq);
125 124
126extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); 125extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
127extern struct intel_iommu *map_ioapic_to_ir(int apic); 126extern struct intel_iommu *map_ioapic_to_ir(int apic);
@@ -138,10 +137,6 @@ static inline int modify_irte(int irq, struct irte *irte_modified)
138{ 137{
139 return -1; 138 return -1;
140} 139}
141static inline int free_irte(int irq)
142{
143 return -1;
144}
145static inline int map_irq_to_irte_handle(int irq, u16 *sub_handle) 140static inline int map_irq_to_irte_handle(int irq, u16 *sub_handle)
146{ 141{
147 return -1; 142 return -1;