aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dmar.h
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2014-03-07 10:08:36 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2014-03-24 10:05:08 -0400
commit832bd858674023b2415c7585db3beba345ef807f (patch)
treef45c9360a2ff71957f2ac3f7a4d83c91e4d7841f /include/linux/dmar.h
parent07cb52ff6aadac0ad68b29be2ef73dba3111c5ec (diff)
iommu/vt-d: Change scope lists to struct device, bus, devfn
It's not only for PCI devices any more, and the scope information for an ACPI device provides the bus and devfn so that has to be stored here too. It is the device pointer itself which needs to be protected with RCU, so the __rcu annotation follows it into the definition of struct dmar_dev_scope, since we're no longer just passing arrays of device pointers around. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux/dmar.h')
-rw-r--r--include/linux/dmar.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 0a92e4d978bc..23c8db129560 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -36,13 +36,19 @@ struct acpi_dmar_header;
36 36
37struct intel_iommu; 37struct intel_iommu;
38 38
39struct dmar_dev_scope {
40 struct device __rcu *dev;
41 u8 bus;
42 u8 devfn;
43};
44
39#ifdef CONFIG_DMAR_TABLE 45#ifdef CONFIG_DMAR_TABLE
40extern struct acpi_table_header *dmar_tbl; 46extern struct acpi_table_header *dmar_tbl;
41struct dmar_drhd_unit { 47struct dmar_drhd_unit {
42 struct list_head list; /* list of drhd units */ 48 struct list_head list; /* list of drhd units */
43 struct acpi_dmar_header *hdr; /* ACPI header */ 49 struct acpi_dmar_header *hdr; /* ACPI header */
44 u64 reg_base_addr; /* register base address*/ 50 u64 reg_base_addr; /* register base address*/
45 struct pci_dev __rcu **devices;/* target device array */ 51 struct dmar_dev_scope *devices;/* target device array */
46 int devices_cnt; /* target device count */ 52 int devices_cnt; /* target device count */
47 u16 segment; /* PCI domain */ 53 u16 segment; /* PCI domain */
48 u8 ignored:1; /* ignore drhd */ 54 u8 ignored:1; /* ignore drhd */
@@ -86,7 +92,7 @@ static inline bool dmar_rcu_check(void)
86#define dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check()) 92#define dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check())
87 93
88#define for_each_dev_scope(a, c, p, d) \ 94#define for_each_dev_scope(a, c, p, d) \
89 for ((p) = 0; ((d) = (p) < (c) ? dmar_rcu_dereference((a)[(p)]) : \ 95 for ((p) = 0; ((d) = (p) < (c) ? dmar_rcu_dereference((a)[(p)].dev) : \
90 NULL, (p) < (c)); (p)++) 96 NULL, (p) < (c)); (p)++)
91 97
92#define for_each_active_dev_scope(a, c, p, d) \ 98#define for_each_active_dev_scope(a, c, p, d) \
@@ -95,15 +101,15 @@ static inline bool dmar_rcu_check(void)
95extern int dmar_table_init(void); 101extern int dmar_table_init(void);
96extern int dmar_dev_scope_init(void); 102extern int dmar_dev_scope_init(void);
97extern int dmar_parse_dev_scope(void *start, void *end, int *cnt, 103extern int dmar_parse_dev_scope(void *start, void *end, int *cnt,
98 struct pci_dev ***devices, u16 segment); 104 struct dmar_dev_scope **devices, u16 segment);
99extern void *dmar_alloc_dev_scope(void *start, void *end, int *cnt); 105extern void *dmar_alloc_dev_scope(void *start, void *end, int *cnt);
100extern void dmar_free_dev_scope(struct pci_dev __rcu ***devices, int *cnt); 106extern void dmar_free_dev_scope(struct dmar_dev_scope **devices, int *cnt);
101extern int dmar_insert_dev_scope(struct dmar_pci_notify_info *info, 107extern int dmar_insert_dev_scope(struct dmar_pci_notify_info *info,
102 void *start, void*end, u16 segment, 108 void *start, void*end, u16 segment,
103 struct pci_dev __rcu **devices, 109 struct dmar_dev_scope *devices,
104 int devices_cnt); 110 int devices_cnt);
105extern int dmar_remove_dev_scope(struct dmar_pci_notify_info *info, 111extern int dmar_remove_dev_scope(struct dmar_pci_notify_info *info,
106 u16 segment, struct pci_dev __rcu **devices, 112 u16 segment, struct dmar_dev_scope *devices,
107 int count); 113 int count);
108/* Intel IOMMU detection */ 114/* Intel IOMMU detection */
109extern int detect_intel_iommu(void); 115extern int detect_intel_iommu(void);