diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/device.h | 11 | ||||
| -rw-r--r-- | include/linux/dmar.h | 8 | ||||
| -rw-r--r-- | include/linux/iommu.h | 25 |
3 files changed, 25 insertions, 19 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 43d183aeb25b..d0d5c5db509d 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -181,13 +181,14 @@ extern int bus_unregister_notifier(struct bus_type *bus, | |||
| 181 | * with the device lock held in the core, so be careful. | 181 | * with the device lock held in the core, so be careful. |
| 182 | */ | 182 | */ |
| 183 | #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ | 183 | #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ |
| 184 | #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ | 184 | #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device to be removed */ |
| 185 | #define BUS_NOTIFY_BIND_DRIVER 0x00000003 /* driver about to be | 185 | #define BUS_NOTIFY_REMOVED_DEVICE 0x00000003 /* device removed */ |
| 186 | #define BUS_NOTIFY_BIND_DRIVER 0x00000004 /* driver about to be | ||
| 186 | bound */ | 187 | bound */ |
| 187 | #define BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */ | 188 | #define BUS_NOTIFY_BOUND_DRIVER 0x00000005 /* driver bound to device */ |
| 188 | #define BUS_NOTIFY_UNBIND_DRIVER 0x00000005 /* driver about to be | 189 | #define BUS_NOTIFY_UNBIND_DRIVER 0x00000006 /* driver about to be |
| 189 | unbound */ | 190 | unbound */ |
| 190 | #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound | 191 | #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007 /* driver is unbound |
| 191 | from the device */ | 192 | from the device */ |
| 192 | 193 | ||
| 193 | extern struct kset *bus_get_kset(struct bus_type *bus); | 194 | extern struct kset *bus_get_kset(struct bus_type *bus); |
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 1deece46a0ca..593fff99e6bf 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
| @@ -56,13 +56,19 @@ struct dmar_drhd_unit { | |||
| 56 | struct intel_iommu *iommu; | 56 | struct intel_iommu *iommu; |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | struct dmar_pci_path { | ||
| 60 | u8 bus; | ||
| 61 | u8 device; | ||
| 62 | u8 function; | ||
| 63 | }; | ||
| 64 | |||
| 59 | struct dmar_pci_notify_info { | 65 | struct dmar_pci_notify_info { |
| 60 | struct pci_dev *dev; | 66 | struct pci_dev *dev; |
| 61 | unsigned long event; | 67 | unsigned long event; |
| 62 | int bus; | 68 | int bus; |
| 63 | u16 seg; | 69 | u16 seg; |
| 64 | u16 level; | 70 | u16 level; |
| 65 | struct acpi_dmar_pci_path path[]; | 71 | struct dmar_pci_path path[]; |
| 66 | } __attribute__((packed)); | 72 | } __attribute__((packed)); |
| 67 | 73 | ||
| 68 | extern struct rw_semaphore dmar_global_lock; | 74 | extern struct rw_semaphore dmar_global_lock; |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 20f9a527922a..379a6179fd96 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
| @@ -57,8 +57,11 @@ struct iommu_domain { | |||
| 57 | struct iommu_domain_geometry geometry; | 57 | struct iommu_domain_geometry geometry; |
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | #define IOMMU_CAP_CACHE_COHERENCY 0x1 | 60 | enum iommu_cap { |
| 61 | #define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ | 61 | IOMMU_CAP_CACHE_COHERENCY, /* IOMMU can enforce cache coherent DMA |
| 62 | transactions */ | ||
| 63 | IOMMU_CAP_INTR_REMAP, /* IOMMU supports interrupt isolation */ | ||
| 64 | }; | ||
| 62 | 65 | ||
| 63 | /* | 66 | /* |
| 64 | * Following constraints are specifc to FSL_PAMUV1: | 67 | * Following constraints are specifc to FSL_PAMUV1: |
| @@ -94,7 +97,6 @@ enum iommu_attr { | |||
| 94 | * @map: map a physically contiguous memory region to an iommu domain | 97 | * @map: map a physically contiguous memory region to an iommu domain |
| 95 | * @unmap: unmap a physically contiguous memory region from an iommu domain | 98 | * @unmap: unmap a physically contiguous memory region from an iommu domain |
| 96 | * @iova_to_phys: translate iova to physical address | 99 | * @iova_to_phys: translate iova to physical address |
| 97 | * @domain_has_cap: domain capabilities query | ||
| 98 | * @add_device: add device to iommu grouping | 100 | * @add_device: add device to iommu grouping |
| 99 | * @remove_device: remove device from iommu grouping | 101 | * @remove_device: remove device from iommu grouping |
| 100 | * @domain_get_attr: Query domain attributes | 102 | * @domain_get_attr: Query domain attributes |
| @@ -102,6 +104,7 @@ enum iommu_attr { | |||
| 102 | * @pgsize_bitmap: bitmap of supported page sizes | 104 | * @pgsize_bitmap: bitmap of supported page sizes |
| 103 | */ | 105 | */ |
| 104 | struct iommu_ops { | 106 | struct iommu_ops { |
| 107 | bool (*capable)(enum iommu_cap); | ||
| 105 | int (*domain_init)(struct iommu_domain *domain); | 108 | int (*domain_init)(struct iommu_domain *domain); |
| 106 | void (*domain_destroy)(struct iommu_domain *domain); | 109 | void (*domain_destroy)(struct iommu_domain *domain); |
| 107 | int (*attach_dev)(struct iommu_domain *domain, struct device *dev); | 110 | int (*attach_dev)(struct iommu_domain *domain, struct device *dev); |
| @@ -111,8 +114,6 @@ struct iommu_ops { | |||
| 111 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, | 114 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, |
| 112 | size_t size); | 115 | size_t size); |
| 113 | phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); | 116 | phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); |
| 114 | int (*domain_has_cap)(struct iommu_domain *domain, | ||
| 115 | unsigned long cap); | ||
| 116 | int (*add_device)(struct device *dev); | 117 | int (*add_device)(struct device *dev); |
| 117 | void (*remove_device)(struct device *dev); | 118 | void (*remove_device)(struct device *dev); |
| 118 | int (*device_group)(struct device *dev, unsigned int *groupid); | 119 | int (*device_group)(struct device *dev, unsigned int *groupid); |
| @@ -142,6 +143,7 @@ struct iommu_ops { | |||
| 142 | 143 | ||
| 143 | extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); | 144 | extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); |
| 144 | extern bool iommu_present(struct bus_type *bus); | 145 | extern bool iommu_present(struct bus_type *bus); |
| 146 | extern bool iommu_capable(struct bus_type *bus, enum iommu_cap cap); | ||
| 145 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); | 147 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); |
| 146 | extern struct iommu_group *iommu_group_get_by_id(int id); | 148 | extern struct iommu_group *iommu_group_get_by_id(int id); |
| 147 | extern void iommu_domain_free(struct iommu_domain *domain); | 149 | extern void iommu_domain_free(struct iommu_domain *domain); |
| @@ -154,8 +156,6 @@ extern int iommu_map(struct iommu_domain *domain, unsigned long iova, | |||
| 154 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, | 156 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, |
| 155 | size_t size); | 157 | size_t size); |
| 156 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); | 158 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); |
| 157 | extern int iommu_domain_has_cap(struct iommu_domain *domain, | ||
| 158 | unsigned long cap); | ||
| 159 | extern void iommu_set_fault_handler(struct iommu_domain *domain, | 159 | extern void iommu_set_fault_handler(struct iommu_domain *domain, |
| 160 | iommu_fault_handler_t handler, void *token); | 160 | iommu_fault_handler_t handler, void *token); |
| 161 | 161 | ||
| @@ -250,6 +250,11 @@ static inline bool iommu_present(struct bus_type *bus) | |||
| 250 | return false; | 250 | return false; |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | static inline bool iommu_capable(struct bus_type *bus, enum iommu_cap cap) | ||
| 254 | { | ||
| 255 | return false; | ||
| 256 | } | ||
| 257 | |||
| 253 | static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) | 258 | static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) |
| 254 | { | 259 | { |
| 255 | return NULL; | 260 | return NULL; |
| @@ -304,12 +309,6 @@ static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_ad | |||
| 304 | return 0; | 309 | return 0; |
| 305 | } | 310 | } |
| 306 | 311 | ||
| 307 | static inline int iommu_domain_has_cap(struct iommu_domain *domain, | ||
| 308 | unsigned long cap) | ||
| 309 | { | ||
| 310 | return 0; | ||
| 311 | } | ||
| 312 | |||
| 313 | static inline void iommu_set_fault_handler(struct iommu_domain *domain, | 312 | static inline void iommu_set_fault_handler(struct iommu_domain *domain, |
| 314 | iommu_fault_handler_t handler, void *token) | 313 | iommu_fault_handler_t handler, void *token) |
| 315 | { | 314 | { |
