aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dmar.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/dmar.h')
-rw-r--r--include/linux/dmar.h63
1 files changed, 53 insertions, 10 deletions
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index f28440784cf0..e397dc342cda 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -24,16 +24,17 @@
24#include <linux/acpi.h> 24#include <linux/acpi.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/msi.h> 26#include <linux/msi.h>
27#include <linux/irqreturn.h>
27 28
28#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
29struct intel_iommu; 29struct intel_iommu;
30 30#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
31struct dmar_drhd_unit { 31struct dmar_drhd_unit {
32 struct list_head list; /* list of drhd units */ 32 struct list_head list; /* list of drhd units */
33 struct acpi_dmar_header *hdr; /* ACPI header */ 33 struct acpi_dmar_header *hdr; /* ACPI header */
34 u64 reg_base_addr; /* register base address*/ 34 u64 reg_base_addr; /* register base address*/
35 struct pci_dev **devices; /* target device array */ 35 struct pci_dev **devices; /* target device array */
36 int devices_cnt; /* target device count */ 36 int devices_cnt; /* target device count */
37 u16 segment; /* PCI domain */
37 u8 ignored:1; /* ignore drhd */ 38 u8 ignored:1; /* ignore drhd */
38 u8 include_all:1; 39 u8 include_all:1;
39 struct intel_iommu *iommu; 40 struct intel_iommu *iommu;
@@ -44,12 +45,20 @@ extern struct list_head dmar_drhd_units;
44#define for_each_drhd_unit(drhd) \ 45#define for_each_drhd_unit(drhd) \
45 list_for_each_entry(drhd, &dmar_drhd_units, list) 46 list_for_each_entry(drhd, &dmar_drhd_units, list)
46 47
48#define for_each_active_iommu(i, drhd) \
49 list_for_each_entry(drhd, &dmar_drhd_units, list) \
50 if (i=drhd->iommu, drhd->ignored) {} else
51
52#define for_each_iommu(i, drhd) \
53 list_for_each_entry(drhd, &dmar_drhd_units, list) \
54 if (i=drhd->iommu, 0) {} else
55
47extern int dmar_table_init(void); 56extern int dmar_table_init(void);
48extern int dmar_dev_scope_init(void); 57extern int dmar_dev_scope_init(void);
49 58
50/* Intel IOMMU detection */ 59/* Intel IOMMU detection */
51extern void detect_intel_iommu(void); 60extern void detect_intel_iommu(void);
52 61extern int enable_drhd_fault_handling(void);
53 62
54extern int parse_ioapics_under_ir(void); 63extern int parse_ioapics_under_ir(void);
55extern int alloc_iommu(struct dmar_drhd_unit *); 64extern int alloc_iommu(struct dmar_drhd_unit *);
@@ -63,12 +72,12 @@ static inline int dmar_table_init(void)
63{ 72{
64 return -ENODEV; 73 return -ENODEV;
65} 74}
75static inline int enable_drhd_fault_handling(void)
76{
77 return -1;
78}
66#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */ 79#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */
67 80
68#ifdef CONFIG_INTR_REMAP
69extern int intr_remapping_enabled;
70extern int enable_intr_remapping(int);
71
72struct irte { 81struct irte {
73 union { 82 union {
74 struct { 83 struct {
@@ -97,6 +106,12 @@ struct irte {
97 __u64 high; 106 __u64 high;
98 }; 107 };
99}; 108};
109#ifdef CONFIG_INTR_REMAP
110extern int intr_remapping_enabled;
111extern int enable_intr_remapping(int);
112extern void disable_intr_remapping(void);
113extern int reenable_intr_remapping(int);
114
100extern int get_irte(int irq, struct irte *entry); 115extern int get_irte(int irq, struct irte *entry);
101extern int modify_irte(int irq, struct irte *irte_modified); 116extern int modify_irte(int irq, struct irte *irte_modified);
102extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count); 117extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
@@ -111,14 +126,40 @@ extern int irq_remapped(int irq);
111extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); 126extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
112extern struct intel_iommu *map_ioapic_to_ir(int apic); 127extern struct intel_iommu *map_ioapic_to_ir(int apic);
113#else 128#else
129static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
130{
131 return -1;
132}
133static inline int modify_irte(int irq, struct irte *irte_modified)
134{
135 return -1;
136}
137static inline int free_irte(int irq)
138{
139 return -1;
140}
141static inline int map_irq_to_irte_handle(int irq, u16 *sub_handle)
142{
143 return -1;
144}
145static inline int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
146 u16 sub_handle)
147{
148 return -1;
149}
150static inline struct intel_iommu *map_dev_to_ir(struct pci_dev *dev)
151{
152 return NULL;
153}
154static inline struct intel_iommu *map_ioapic_to_ir(int apic)
155{
156 return NULL;
157}
114#define irq_remapped(irq) (0) 158#define irq_remapped(irq) (0)
115#define enable_intr_remapping(mode) (-1) 159#define enable_intr_remapping(mode) (-1)
116#define intr_remapping_enabled (0) 160#define intr_remapping_enabled (0)
117#endif 161#endif
118 162
119#ifdef CONFIG_DMAR
120extern const char *dmar_get_fault_reason(u8 fault_reason);
121
122/* Can't use the common MSI interrupt functions 163/* Can't use the common MSI interrupt functions
123 * since DMAR is not a pci device 164 * since DMAR is not a pci device
124 */ 165 */
@@ -127,8 +168,10 @@ extern void dmar_msi_mask(unsigned int irq);
127extern void dmar_msi_read(int irq, struct msi_msg *msg); 168extern void dmar_msi_read(int irq, struct msi_msg *msg);
128extern void dmar_msi_write(int irq, struct msi_msg *msg); 169extern void dmar_msi_write(int irq, struct msi_msg *msg);
129extern int dmar_set_interrupt(struct intel_iommu *iommu); 170extern int dmar_set_interrupt(struct intel_iommu *iommu);
171extern irqreturn_t dmar_fault(int irq, void *dev_id);
130extern int arch_setup_dmar_msi(unsigned int irq); 172extern int arch_setup_dmar_msi(unsigned int irq);
131 173
174#ifdef CONFIG_DMAR
132extern int iommu_detected, no_iommu; 175extern int iommu_detected, no_iommu;
133extern struct list_head dmar_rmrr_units; 176extern struct list_head dmar_rmrr_units;
134struct dmar_rmrr_unit { 177struct dmar_rmrr_unit {