aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/irq_remapping.h22
-rw-r--r--arch/x86/kernel/apic/io_apic.c17
-rw-r--r--drivers/iommu/intel_intr_remapping.c20
-rw-r--r--include/linux/dmar.h59
4 files changed, 26 insertions, 92 deletions
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
deleted file mode 100644
index 0ddfc0b90adb..000000000000
--- a/arch/x86/include/asm/irq_remapping.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef _ASM_X86_IRQ_REMAPPING_H
2#define _ASM_X86_IRQ_REMAPPING_H
3
4#define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8)
5
6#ifdef CONFIG_IRQ_REMAP
7static void irq_remap_modify_chip_defaults(struct irq_chip *chip);
8static inline bool irq_remapped(struct irq_cfg *cfg)
9{
10 return cfg->irq_2_iommu.iommu != NULL;
11}
12#else
13static inline bool irq_remapped(struct irq_cfg *cfg)
14{
15 return false;
16}
17static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip)
18{
19}
20#endif
21
22#endif /* _ASM_X86_IRQ_REMAPPING_H */
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 3db693bda91d..073edd1d3c66 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -58,7 +58,6 @@
58#include <asm/hypertransport.h> 58#include <asm/hypertransport.h>
59#include <asm/setup.h> 59#include <asm/setup.h>
60#include <asm/intr_remapping.h> 60#include <asm/intr_remapping.h>
61#include <asm/irq_remapping.h>
62#include <asm/hpet.h> 61#include <asm/hpet.h>
63#include <asm/hw_irq.h> 62#include <asm/hw_irq.h>
64 63
@@ -87,6 +86,22 @@ void __init set_io_apic_ops(const struct io_apic_ops *ops)
87 io_apic_ops = *ops; 86 io_apic_ops = *ops;
88} 87}
89 88
89#ifdef CONFIG_IRQ_REMAP
90static void irq_remap_modify_chip_defaults(struct irq_chip *chip);
91static inline bool irq_remapped(struct irq_cfg *cfg)
92{
93 return cfg->irq_2_iommu.iommu != NULL;
94}
95#else
96static inline bool irq_remapped(struct irq_cfg *cfg)
97{
98 return false;
99}
100static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip)
101{
102}
103#endif
104
90/* 105/*
91 * Is the SiS APIC rmw bug present ? 106 * Is the SiS APIC rmw bug present ?
92 * -1 = don't know, 0 = no, 1 = yes 107 * -1 = don't know, 0 = no, 1 = yes
diff --git a/drivers/iommu/intel_intr_remapping.c b/drivers/iommu/intel_intr_remapping.c
index a3bae67ec43c..7472634df350 100644
--- a/drivers/iommu/intel_intr_remapping.c
+++ b/drivers/iommu/intel_intr_remapping.c
@@ -64,7 +64,7 @@ int get_irte(int irq, struct irte *entry)
64 return 0; 64 return 0;
65} 65}
66 66
67int alloc_irte(struct intel_iommu *iommu, int irq, u16 count) 67static int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
68{ 68{
69 struct ir_table *table = iommu->ir_table; 69 struct ir_table *table = iommu->ir_table;
70 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq); 70 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq);
@@ -136,7 +136,7 @@ static int qi_flush_iec(struct intel_iommu *iommu, int index, int mask)
136 return qi_submit_sync(&desc, iommu); 136 return qi_submit_sync(&desc, iommu);
137} 137}
138 138
139int map_irq_to_irte_handle(int irq, u16 *sub_handle) 139static int map_irq_to_irte_handle(int irq, u16 *sub_handle)
140{ 140{
141 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq); 141 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq);
142 unsigned long flags; 142 unsigned long flags;
@@ -152,7 +152,7 @@ int map_irq_to_irte_handle(int irq, u16 *sub_handle)
152 return index; 152 return index;
153} 153}
154 154
155int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, u16 subhandle) 155static int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, u16 subhandle)
156{ 156{
157 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq); 157 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq);
158 unsigned long flags; 158 unsigned long flags;
@@ -172,7 +172,7 @@ int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, u16 subhandle)
172 return 0; 172 return 0;
173} 173}
174 174
175int modify_irte(int irq, struct irte *irte_modified) 175static int modify_irte(int irq, struct irte *irte_modified)
176{ 176{
177 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq); 177 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq);
178 struct intel_iommu *iommu; 178 struct intel_iommu *iommu;
@@ -200,7 +200,7 @@ int modify_irte(int irq, struct irte *irte_modified)
200 return rc; 200 return rc;
201} 201}
202 202
203struct intel_iommu *map_hpet_to_ir(u8 hpet_id) 203static struct intel_iommu *map_hpet_to_ir(u8 hpet_id)
204{ 204{
205 int i; 205 int i;
206 206
@@ -210,7 +210,7 @@ struct intel_iommu *map_hpet_to_ir(u8 hpet_id)
210 return NULL; 210 return NULL;
211} 211}
212 212
213struct intel_iommu *map_ioapic_to_ir(int apic) 213static struct intel_iommu *map_ioapic_to_ir(int apic)
214{ 214{
215 int i; 215 int i;
216 216
@@ -220,7 +220,7 @@ struct intel_iommu *map_ioapic_to_ir(int apic)
220 return NULL; 220 return NULL;
221} 221}
222 222
223struct intel_iommu *map_dev_to_ir(struct pci_dev *dev) 223static struct intel_iommu *map_dev_to_ir(struct pci_dev *dev)
224{ 224{
225 struct dmar_drhd_unit *drhd; 225 struct dmar_drhd_unit *drhd;
226 226
@@ -312,7 +312,7 @@ static void set_irte_sid(struct irte *irte, unsigned int svt,
312 irte->sid = sid; 312 irte->sid = sid;
313} 313}
314 314
315int set_ioapic_sid(struct irte *irte, int apic) 315static int set_ioapic_sid(struct irte *irte, int apic)
316{ 316{
317 int i; 317 int i;
318 u16 sid = 0; 318 u16 sid = 0;
@@ -337,7 +337,7 @@ int set_ioapic_sid(struct irte *irte, int apic)
337 return 0; 337 return 0;
338} 338}
339 339
340int set_hpet_sid(struct irte *irte, u8 id) 340static int set_hpet_sid(struct irte *irte, u8 id)
341{ 341{
342 int i; 342 int i;
343 u16 sid = 0; 343 u16 sid = 0;
@@ -367,7 +367,7 @@ int set_hpet_sid(struct irte *irte, u8 id)
367 return 0; 367 return 0;
368} 368}
369 369
370int set_msi_sid(struct irte *irte, struct pci_dev *dev) 370static int set_msi_sid(struct irte *irte, struct pci_dev *dev)
371{ 371{
372 struct pci_dev *bridge; 372 struct pci_dev *bridge;
373 373
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 7a207a39f879..b029d1aa2d12 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -114,65 +114,6 @@ struct irte {
114 }; 114 };
115}; 115};
116 116
117#ifdef CONFIG_IRQ_REMAP
118extern int get_irte(int irq, struct irte *entry);
119extern int modify_irte(int irq, struct irte *irte_modified);
120extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
121extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
122 u16 sub_handle);
123extern int map_irq_to_irte_handle(int irq, u16 *sub_handle);
124
125extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
126extern struct intel_iommu *map_ioapic_to_ir(int apic);
127extern struct intel_iommu *map_hpet_to_ir(u8 id);
128extern int set_ioapic_sid(struct irte *irte, int apic);
129extern int set_hpet_sid(struct irte *irte, u8 id);
130extern int set_msi_sid(struct irte *irte, struct pci_dev *dev);
131#else
132static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
133{
134 return -1;
135}
136static inline int modify_irte(int irq, struct irte *irte_modified)
137{
138 return -1;
139}
140static inline int map_irq_to_irte_handle(int irq, u16 *sub_handle)
141{
142 return -1;
143}
144static inline int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
145 u16 sub_handle)
146{
147 return -1;
148}
149static inline struct intel_iommu *map_dev_to_ir(struct pci_dev *dev)
150{
151 return NULL;
152}
153static inline struct intel_iommu *map_ioapic_to_ir(int apic)
154{
155 return NULL;
156}
157static inline struct intel_iommu *map_hpet_to_ir(unsigned int hpet_id)
158{
159 return NULL;
160}
161static inline int set_ioapic_sid(struct irte *irte, int apic)
162{
163 return 0;
164}
165static inline int set_hpet_sid(struct irte *irte, u8 id)
166{
167 return -1;
168}
169static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
170{
171 return 0;
172}
173
174#endif
175
176enum { 117enum {
177 IRQ_REMAP_XAPIC_MODE, 118 IRQ_REMAP_XAPIC_MODE,
178 IRQ_REMAP_X2APIC_MODE, 119 IRQ_REMAP_X2APIC_MODE,