diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-15 01:23:49 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-15 01:23:49 -0400 |
| commit | 23971bdffff5f7c904131dfb41c186711dc2c418 (patch) | |
| tree | 0cd5e379932a72af47dba17f8958908e7dd029cd /include/linux | |
| parent | c0fa2373f8cfed90437d8d7b17e0b1a84009a10a (diff) | |
| parent | 09b5269a1b3d47525d7c25efeb16f5407ef82ea2 (diff) | |
Merge tag 'iommu-updates-v3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU updates from Joerg Roedel:
"This pull-request includes:
- change in the IOMMU-API to convert the former iommu_domain_capable
function to just iommu_capable
- various fixes in handling RMRR ranges for the VT-d driver (one fix
requires a device driver core change which was acked by Greg KH)
- the AMD IOMMU driver now assigns and deassigns complete alias
groups to fix issues with devices using the wrong PCI request-id
- MMU-401 support for the ARM SMMU driver
- multi-master IOMMU group support for the ARM SMMU driver
- various other small fixes all over the place"
* tag 'iommu-updates-v3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (41 commits)
iommu/vt-d: Work around broken RMRR firmware entries
iommu/vt-d: Store bus information in RMRR PCI device path
iommu/vt-d: Only remove domain when device is removed
driver core: Add BUS_NOTIFY_REMOVED_DEVICE event
iommu/amd: Fix devid mapping for ivrs_ioapic override
iommu/irq_remapping: Fix the regression of hpet irq remapping
iommu: Fix bus notifier breakage
iommu/amd: Split init_iommu_group() from iommu_init_device()
iommu: Rework iommu_group_get_for_pci_dev()
iommu: Make of_device_id array const
amd_iommu: do not dereference a NULL pointer address.
iommu/omap: Remove omap_iommu unused owner field
iommu: Remove iommu_domain_has_cap() API function
IB/usnic: Convert to use new iommu_capable() API function
vfio: Convert to use new iommu_capable() API function
kvm: iommu: Convert to use new iommu_capable() API function
iommu/tegra: Convert to iommu_capable() API function
iommu/msm: Convert to iommu_capable() API function
iommu/vt-d: Convert to iommu_capable() API function
iommu/fsl: Convert to iommu_capable() API function
...
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 a608e237f0a8..ce1f21608b16 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 7b02bcc85b9e..e6a7c9ff72f2 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: |
| @@ -95,7 +98,6 @@ enum iommu_attr { | |||
| 95 | * @map: map a physically contiguous memory region to an iommu domain | 98 | * @map: map a physically contiguous memory region to an iommu domain |
| 96 | * @unmap: unmap a physically contiguous memory region from an iommu domain | 99 | * @unmap: unmap a physically contiguous memory region from an iommu domain |
| 97 | * @iova_to_phys: translate iova to physical address | 100 | * @iova_to_phys: translate iova to physical address |
| 98 | * @domain_has_cap: domain capabilities query | ||
| 99 | * @add_device: add device to iommu grouping | 101 | * @add_device: add device to iommu grouping |
| 100 | * @remove_device: remove device from iommu grouping | 102 | * @remove_device: remove device from iommu grouping |
| 101 | * @domain_get_attr: Query domain attributes | 103 | * @domain_get_attr: Query domain attributes |
| @@ -103,6 +105,7 @@ enum iommu_attr { | |||
| 103 | * @pgsize_bitmap: bitmap of supported page sizes | 105 | * @pgsize_bitmap: bitmap of supported page sizes |
| 104 | */ | 106 | */ |
| 105 | struct iommu_ops { | 107 | struct iommu_ops { |
| 108 | bool (*capable)(enum iommu_cap); | ||
| 106 | int (*domain_init)(struct iommu_domain *domain); | 109 | int (*domain_init)(struct iommu_domain *domain); |
| 107 | void (*domain_destroy)(struct iommu_domain *domain); | 110 | void (*domain_destroy)(struct iommu_domain *domain); |
| 108 | int (*attach_dev)(struct iommu_domain *domain, struct device *dev); | 111 | int (*attach_dev)(struct iommu_domain *domain, struct device *dev); |
| @@ -112,8 +115,6 @@ struct iommu_ops { | |||
| 112 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, | 115 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, |
| 113 | size_t size); | 116 | size_t size); |
| 114 | phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); | 117 | phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); |
| 115 | int (*domain_has_cap)(struct iommu_domain *domain, | ||
| 116 | unsigned long cap); | ||
| 117 | int (*add_device)(struct device *dev); | 118 | int (*add_device)(struct device *dev); |
| 118 | void (*remove_device)(struct device *dev); | 119 | void (*remove_device)(struct device *dev); |
| 119 | int (*device_group)(struct device *dev, unsigned int *groupid); | 120 | int (*device_group)(struct device *dev, unsigned int *groupid); |
| @@ -143,6 +144,7 @@ struct iommu_ops { | |||
| 143 | 144 | ||
| 144 | extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); | 145 | extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); |
| 145 | extern bool iommu_present(struct bus_type *bus); | 146 | extern bool iommu_present(struct bus_type *bus); |
| 147 | extern bool iommu_capable(struct bus_type *bus, enum iommu_cap cap); | ||
| 146 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); | 148 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); |
| 147 | extern struct iommu_group *iommu_group_get_by_id(int id); | 149 | extern struct iommu_group *iommu_group_get_by_id(int id); |
| 148 | extern void iommu_domain_free(struct iommu_domain *domain); | 150 | extern void iommu_domain_free(struct iommu_domain *domain); |
| @@ -155,8 +157,6 @@ extern int iommu_map(struct iommu_domain *domain, unsigned long iova, | |||
| 155 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, | 157 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, |
| 156 | size_t size); | 158 | size_t size); |
| 157 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); | 159 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); |
| 158 | extern int iommu_domain_has_cap(struct iommu_domain *domain, | ||
| 159 | unsigned long cap); | ||
| 160 | extern void iommu_set_fault_handler(struct iommu_domain *domain, | 160 | extern void iommu_set_fault_handler(struct iommu_domain *domain, |
| 161 | iommu_fault_handler_t handler, void *token); | 161 | iommu_fault_handler_t handler, void *token); |
| 162 | 162 | ||
| @@ -251,6 +251,11 @@ static inline bool iommu_present(struct bus_type *bus) | |||
| 251 | return false; | 251 | return false; |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | static inline bool iommu_capable(struct bus_type *bus, enum iommu_cap cap) | ||
| 255 | { | ||
| 256 | return false; | ||
| 257 | } | ||
| 258 | |||
| 254 | static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) | 259 | static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) |
| 255 | { | 260 | { |
| 256 | return NULL; | 261 | return NULL; |
| @@ -305,12 +310,6 @@ static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_ad | |||
| 305 | return 0; | 310 | return 0; |
| 306 | } | 311 | } |
| 307 | 312 | ||
| 308 | static inline int iommu_domain_has_cap(struct iommu_domain *domain, | ||
| 309 | unsigned long cap) | ||
| 310 | { | ||
| 311 | return 0; | ||
| 312 | } | ||
| 313 | |||
| 314 | static inline void iommu_set_fault_handler(struct iommu_domain *domain, | 313 | static inline void iommu_set_fault_handler(struct iommu_domain *domain, |
| 315 | iommu_fault_handler_t handler, void *token) | 314 | iommu_fault_handler_t handler, void *token) |
| 316 | { | 315 | { |
