diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/dma_remapping.h | 10 | ||||
-rw-r--r-- | include/linux/dmar.h | 43 | ||||
-rw-r--r-- | include/linux/intel-iommu.h | 6 |
3 files changed, 45 insertions, 14 deletions
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h index bbd8661b3473..ef90cbd8e173 100644 --- a/include/linux/dma_remapping.h +++ b/include/linux/dma_remapping.h | |||
@@ -25,11 +25,12 @@ struct intel_iommu; | |||
25 | struct dmar_domain; | 25 | struct dmar_domain; |
26 | struct root_entry; | 26 | struct root_entry; |
27 | 27 | ||
28 | extern void free_dmar_iommu(struct intel_iommu *iommu); | ||
29 | 28 | ||
30 | #ifdef CONFIG_DMAR | 29 | #ifdef CONFIG_INTEL_IOMMU |
30 | extern void free_dmar_iommu(struct intel_iommu *iommu); | ||
31 | extern int iommu_calculate_agaw(struct intel_iommu *iommu); | 31 | extern int iommu_calculate_agaw(struct intel_iommu *iommu); |
32 | extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); | 32 | extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); |
33 | extern int dmar_disabled; | ||
33 | #else | 34 | #else |
34 | static inline int iommu_calculate_agaw(struct intel_iommu *iommu) | 35 | static inline int iommu_calculate_agaw(struct intel_iommu *iommu) |
35 | { | 36 | { |
@@ -39,8 +40,11 @@ static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu) | |||
39 | { | 40 | { |
40 | return 0; | 41 | return 0; |
41 | } | 42 | } |
43 | static inline void free_dmar_iommu(struct intel_iommu *iommu) | ||
44 | { | ||
45 | } | ||
46 | #define dmar_disabled (1) | ||
42 | #endif | 47 | #endif |
43 | 48 | ||
44 | extern int dmar_disabled; | ||
45 | 49 | ||
46 | #endif | 50 | #endif |
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 7b776d71d36d..a8b1a847c103 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
@@ -26,8 +26,13 @@ | |||
26 | #include <linux/msi.h> | 26 | #include <linux/msi.h> |
27 | #include <linux/irqreturn.h> | 27 | #include <linux/irqreturn.h> |
28 | 28 | ||
29 | /* DMAR Flags */ | ||
30 | #define DMAR_INTR_REMAP 0x1 | ||
31 | #define DMAR_X2APIC_OPT_OUT 0x2 | ||
32 | |||
29 | struct intel_iommu; | 33 | struct intel_iommu; |
30 | #if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP) | 34 | #ifdef CONFIG_DMAR_TABLE |
35 | extern struct acpi_table_header *dmar_tbl; | ||
31 | struct dmar_drhd_unit { | 36 | struct dmar_drhd_unit { |
32 | struct list_head list; /* list of drhd units */ | 37 | struct list_head list; /* list of drhd units */ |
33 | struct acpi_dmar_header *hdr; /* ACPI header */ | 38 | struct acpi_dmar_header *hdr; /* ACPI header */ |
@@ -76,7 +81,7 @@ static inline int enable_drhd_fault_handling(void) | |||
76 | { | 81 | { |
77 | return -1; | 82 | return -1; |
78 | } | 83 | } |
79 | #endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */ | 84 | #endif /* !CONFIG_DMAR_TABLE */ |
80 | 85 | ||
81 | struct irte { | 86 | struct irte { |
82 | union { | 87 | union { |
@@ -107,10 +112,10 @@ struct irte { | |||
107 | }; | 112 | }; |
108 | }; | 113 | }; |
109 | 114 | ||
110 | #ifdef CONFIG_INTR_REMAP | 115 | #ifdef CONFIG_IRQ_REMAP |
111 | extern int intr_remapping_enabled; | 116 | extern int intr_remapping_enabled; |
112 | extern int intr_remapping_supported(void); | 117 | extern int intr_remapping_supported(void); |
113 | extern int enable_intr_remapping(int); | 118 | extern int enable_intr_remapping(void); |
114 | extern void disable_intr_remapping(void); | 119 | extern void disable_intr_remapping(void); |
115 | extern int reenable_intr_remapping(int); | 120 | extern int reenable_intr_remapping(int); |
116 | 121 | ||
@@ -177,7 +182,7 @@ static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev) | |||
177 | 182 | ||
178 | #define intr_remapping_enabled (0) | 183 | #define intr_remapping_enabled (0) |
179 | 184 | ||
180 | static inline int enable_intr_remapping(int eim) | 185 | static inline int enable_intr_remapping(void) |
181 | { | 186 | { |
182 | return -1; | 187 | return -1; |
183 | } | 188 | } |
@@ -192,6 +197,11 @@ static inline int reenable_intr_remapping(int eim) | |||
192 | } | 197 | } |
193 | #endif | 198 | #endif |
194 | 199 | ||
200 | enum { | ||
201 | IRQ_REMAP_XAPIC_MODE, | ||
202 | IRQ_REMAP_X2APIC_MODE, | ||
203 | }; | ||
204 | |||
195 | /* Can't use the common MSI interrupt functions | 205 | /* Can't use the common MSI interrupt functions |
196 | * since DMAR is not a pci device | 206 | * since DMAR is not a pci device |
197 | */ | 207 | */ |
@@ -204,7 +214,7 @@ extern int dmar_set_interrupt(struct intel_iommu *iommu); | |||
204 | extern irqreturn_t dmar_fault(int irq, void *dev_id); | 214 | extern irqreturn_t dmar_fault(int irq, void *dev_id); |
205 | extern int arch_setup_dmar_msi(unsigned int irq); | 215 | extern int arch_setup_dmar_msi(unsigned int irq); |
206 | 216 | ||
207 | #ifdef CONFIG_DMAR | 217 | #ifdef CONFIG_INTEL_IOMMU |
208 | extern int iommu_detected, no_iommu; | 218 | extern int iommu_detected, no_iommu; |
209 | extern struct list_head dmar_rmrr_units; | 219 | extern struct list_head dmar_rmrr_units; |
210 | struct dmar_rmrr_unit { | 220 | struct dmar_rmrr_unit { |
@@ -227,9 +237,26 @@ struct dmar_atsr_unit { | |||
227 | u8 include_all:1; /* include all ports */ | 237 | u8 include_all:1; /* include all ports */ |
228 | }; | 238 | }; |
229 | 239 | ||
240 | int dmar_parse_rmrr_atsr_dev(void); | ||
241 | extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header); | ||
242 | extern int dmar_parse_one_atsr(struct acpi_dmar_header *header); | ||
243 | extern int dmar_parse_dev_scope(void *start, void *end, int *cnt, | ||
244 | struct pci_dev ***devices, u16 segment); | ||
230 | extern int intel_iommu_init(void); | 245 | extern int intel_iommu_init(void); |
231 | #else /* !CONFIG_DMAR: */ | 246 | #else /* !CONFIG_INTEL_IOMMU: */ |
232 | static inline int intel_iommu_init(void) { return -ENODEV; } | 247 | static inline int intel_iommu_init(void) { return -ENODEV; } |
233 | #endif /* CONFIG_DMAR */ | 248 | static inline int dmar_parse_one_rmrr(struct acpi_dmar_header *header) |
249 | { | ||
250 | return 0; | ||
251 | } | ||
252 | static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header) | ||
253 | { | ||
254 | return 0; | ||
255 | } | ||
256 | static inline int dmar_parse_rmrr_atsr_dev(void) | ||
257 | { | ||
258 | return 0; | ||
259 | } | ||
260 | #endif /* CONFIG_INTEL_IOMMU */ | ||
234 | 261 | ||
235 | #endif /* __DMAR_H__ */ | 262 | #endif /* __DMAR_H__ */ |
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 9310c699a37d..235b8879af45 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
@@ -279,7 +279,7 @@ struct q_inval { | |||
279 | int free_cnt; | 279 | int free_cnt; |
280 | }; | 280 | }; |
281 | 281 | ||
282 | #ifdef CONFIG_INTR_REMAP | 282 | #ifdef CONFIG_IRQ_REMAP |
283 | /* 1MB - maximum possible interrupt remapping table size */ | 283 | /* 1MB - maximum possible interrupt remapping table size */ |
284 | #define INTR_REMAP_PAGE_ORDER 8 | 284 | #define INTR_REMAP_PAGE_ORDER 8 |
285 | #define INTR_REMAP_TABLE_REG_SIZE 0xf | 285 | #define INTR_REMAP_TABLE_REG_SIZE 0xf |
@@ -318,7 +318,7 @@ struct intel_iommu { | |||
318 | unsigned int irq; | 318 | unsigned int irq; |
319 | unsigned char name[13]; /* Device Name */ | 319 | unsigned char name[13]; /* Device Name */ |
320 | 320 | ||
321 | #ifdef CONFIG_DMAR | 321 | #ifdef CONFIG_INTEL_IOMMU |
322 | unsigned long *domain_ids; /* bitmap of domains */ | 322 | unsigned long *domain_ids; /* bitmap of domains */ |
323 | struct dmar_domain **domains; /* ptr to domains */ | 323 | struct dmar_domain **domains; /* ptr to domains */ |
324 | spinlock_t lock; /* protect context, domain ids */ | 324 | spinlock_t lock; /* protect context, domain ids */ |
@@ -329,7 +329,7 @@ struct intel_iommu { | |||
329 | struct q_inval *qi; /* Queued invalidation info */ | 329 | struct q_inval *qi; /* Queued invalidation info */ |
330 | u32 *iommu_state; /* Store iommu states between suspend and resume.*/ | 330 | u32 *iommu_state; /* Store iommu states between suspend and resume.*/ |
331 | 331 | ||
332 | #ifdef CONFIG_INTR_REMAP | 332 | #ifdef CONFIG_IRQ_REMAP |
333 | struct ir_table *ir_table; /* Interrupt remapping info */ | 333 | struct ir_table *ir_table; /* Interrupt remapping info */ |
334 | #endif | 334 | #endif |
335 | int node; | 335 | int node; |