diff options
| author | Patrick Daly <pdaly@codeaurora.org> | 2016-02-16 15:55:09 -0800 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:10:55 -0700 |
| commit | 86a828d8207435b6c2266c06ed6578c64b0afa9e (patch) | |
| tree | 43e0dc32d6b37692e7dea80dc18ed79e2613c1df /include | |
| parent | 0ff886d8f4f98efa045f9d80fcef3832a56521ff (diff) | |
iommu: Sync files for kernel upgrade
Reset the following files:
arm-smmu.c
iommu.c
include/linux/iommu.h
include/trace/events/iommu.h
to the git merge base between 3.18 and 4.4:
b2776bf7149bddd1f4161f14f79520f17fc1d71d
Change-Id: I9aa58e08125e3a72d1e9742e26d4a6fab34b0ed5
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/iommu.h | 120 | ||||
| -rw-r--r-- | include/trace/events/iommu.h | 31 |
2 files changed, 19 insertions, 132 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index f28dff313b07..e6a7c9ff72f2 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -21,15 +21,13 @@ #include <linux/errno.h> #include <linux/err.h> -#include <linux/of.h> #include <linux/types.h> -#include <linux/scatterlist.h> #include <trace/events/iommu.h> #define IOMMU_READ (1 << 0) #define IOMMU_WRITE (1 << 1) #define IOMMU_CACHE (1 << 2) /* DMA cache coherency */ -#define IOMMU_NOEXEC (1 << 3) +#define IOMMU_EXEC (1 << 3) struct iommu_ops; struct iommu_group; @@ -51,44 +49,18 @@ struct iommu_domain_geometry { bool force_aperture; /* DMA only allowed in mappable range? */ }; -/* Domain feature flags */ -#define __IOMMU_DOMAIN_PAGING (1U << 0) /* Support for iommu_map/unmap */ -#define __IOMMU_DOMAIN_DMA_API (1U << 1) /* Domain for use in DMA-API - implementation */ -#define __IOMMU_DOMAIN_PT (1U << 2) /* Domain is identity mapped */ - -/* - * This are the possible domain-types - * - * IOMMU_DOMAIN_BLOCKED - All DMA is blocked, can be used to isolate - * devices - * IOMMU_DOMAIN_IDENTITY - DMA addresses are system physical addresses - * IOMMU_DOMAIN_UNMANAGED - DMA mappings managed by IOMMU-API user, used - * for VMs - * IOMMU_DOMAIN_DMA - Internally used for DMA-API implementations. - * This flag allows IOMMU drivers to implement - * certain optimizations for these domains - */ -#define IOMMU_DOMAIN_BLOCKED (0U) -#define IOMMU_DOMAIN_IDENTITY (__IOMMU_DOMAIN_PT) -#define IOMMU_DOMAIN_UNMANAGED (__IOMMU_DOMAIN_PAGING) -#define IOMMU_DOMAIN_DMA (__IOMMU_DOMAIN_PAGING | \ - __IOMMU_DOMAIN_DMA_API) - struct iommu_domain { - unsigned type; const struct iommu_ops *ops; + void *priv; iommu_fault_handler_t handler; void *handler_token; struct iommu_domain_geometry geometry; - void *iova_cookie; }; enum iommu_cap { IOMMU_CAP_CACHE_COHERENCY, /* IOMMU can enforce cache coherent DMA transactions */ IOMMU_CAP_INTR_REMAP, /* IOMMU supports interrupt isolation */ - IOMMU_CAP_NOEXEC, /* IOMMU_NOEXEC flag */ }; /* @@ -115,20 +87,6 @@ enum iommu_attr { DOMAIN_ATTR_MAX, }; -/** - * struct iommu_dm_region - descriptor for a direct mapped memory region - * @list: Linked list pointers - * @start: System physical start address of the region - * @length: Length of the region in bytes - * @prot: IOMMU Protection flags (READ/WRITE/...) - */ -struct iommu_dm_region { - struct list_head list; - phys_addr_t start; - size_t length; - int prot; -}; - #ifdef CONFIG_IOMMU_API /** @@ -139,45 +97,32 @@ struct iommu_dm_region { * @detach_dev: detach device from an iommu domain * @map: map a physically contiguous memory region to an iommu domain * @unmap: unmap a physically contiguous memory region from an iommu domain - * @map_sg: map a scatter-gather list of physically contiguous memory chunks - * to an iommu domain * @iova_to_phys: translate iova to physical address * @add_device: add device to iommu grouping * @remove_device: remove device from iommu grouping * @domain_get_attr: Query domain attributes * @domain_set_attr: Change domain attributes - * @of_xlate: add OF master IDs to iommu grouping * @pgsize_bitmap: bitmap of supported page sizes - * @priv: per-instance data private to the iommu driver */ struct iommu_ops { bool (*capable)(enum iommu_cap); - - /* Domain allocation and freeing by the iommu driver */ - struct iommu_domain *(*domain_alloc)(unsigned iommu_domain_type); - void (*domain_free)(struct iommu_domain *); - + int (*domain_init)(struct iommu_domain *domain); + void (*domain_destroy)(struct iommu_domain *domain); int (*attach_dev)(struct iommu_domain *domain, struct device *dev); void (*detach_dev)(struct iommu_domain *domain, struct device *dev); int (*map)(struct iommu_domain *domain, unsigned long iova, phys_addr_t paddr, size_t size, int prot); size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, size_t size); - size_t (*map_sg)(struct iommu_domain *domain, unsigned long iova, - struct scatterlist *sg, unsigned int nents, int prot); phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); int (*add_device)(struct device *dev); void (*remove_device)(struct device *dev); - struct iommu_group *(*device_group)(struct device *dev); + int (*device_group)(struct device *dev, unsigned int *groupid); int (*domain_get_attr)(struct iommu_domain *domain, enum iommu_attr attr, void *data); int (*domain_set_attr)(struct iommu_domain *domain, enum iommu_attr attr, void *data); - /* Request/Free a list of direct mapping requirements for a device */ - void (*get_dm_regions)(struct device *dev, struct list_head *list); - void (*put_dm_regions)(struct device *dev, struct list_head *list); - /* Window handling functions */ int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr, phys_addr_t paddr, u64 size, int prot); @@ -187,12 +132,7 @@ struct iommu_ops { /* Get the numer of window per domain */ u32 (*domain_get_windows)(struct iommu_domain *domain); -#ifdef CONFIG_OF_IOMMU - int (*of_xlate)(struct device *dev, struct of_phandle_args *args); -#endif - unsigned long pgsize_bitmap; - void *priv; }; #define IOMMU_GROUP_NOTIFY_ADD_DEVICE 1 /* Device added */ @@ -212,22 +152,14 @@ extern int iommu_attach_device(struct iommu_domain *domain, struct device *dev); extern void iommu_detach_device(struct iommu_domain *domain, struct device *dev); -extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev); extern int iommu_map(struct iommu_domain *domain, unsigned long iova, phys_addr_t paddr, size_t size, int prot); extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size); -extern size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long iova, - struct scatterlist *sg,unsigned int nents, - int prot); extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); extern void iommu_set_fault_handler(struct iommu_domain *domain, iommu_fault_handler_t handler, void *token); -extern void iommu_get_dm_regions(struct device *dev, struct list_head *list); -extern void iommu_put_dm_regions(struct device *dev, struct list_head *list); -extern int iommu_request_dm_for_dev(struct device *dev); - extern int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group); extern void iommu_detach_group(struct iommu_domain *domain, @@ -251,7 +183,6 @@ extern int iommu_group_unregister_notifier(struct iommu_group *group, struct notifier_block *nb); extern int iommu_group_id(struct iommu_group *group); extern struct iommu_group *iommu_group_get_for_dev(struct device *dev); -extern struct iommu_domain *iommu_group_default_domain(struct iommu_group *); extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr, void *data); @@ -259,7 +190,7 @@ extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, void *data); struct device *iommu_device_create(struct device *parent, void *drvdata, const struct attribute_group **groups, - const char *fmt, ...) __printf(4, 5); + const char *fmt, ...); void iommu_device_destroy(struct device *dev); int iommu_device_link(struct device *dev, struct device *link); void iommu_device_unlink(struct device *dev, struct device *link); @@ -310,18 +241,6 @@ static inline int report_iommu_fault(struct iommu_domain *domain, return ret; } -static inline size_t iommu_map_sg(struct iommu_domain *domain, - unsigned long iova, struct scatterlist *sg, - unsigned int nents, int prot) -{ - return domain->ops->map_sg(domain, iova, sg, nents, prot); -} - -/* PCI device grouping function */ -extern struct iommu_group *pci_device_group(struct device *dev); -/* Generic device grouping function */ -extern struct iommu_group *generic_device_group(struct device *dev); - #else /* CONFIG_IOMMU_API */ struct iommu_ops {}; @@ -362,11 +281,6 @@ static inline void iommu_detach_device(struct iommu_domain *domain, { } -static inline struct iommu_domain *iommu_get_domain_for_dev(struct device *dev) -{ - return NULL; -} - static inline int iommu_map(struct iommu_domain *domain, unsigned long iova, phys_addr_t paddr, int gfp_order, int prot) { @@ -379,13 +293,6 @@ static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova, return -ENODEV; } -static inline size_t iommu_map_sg(struct iommu_domain *domain, - unsigned long iova, struct scatterlist *sg, - unsigned int nents, int prot) -{ - return -ENODEV; -} - static inline int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, phys_addr_t paddr, u64 size, int prot) @@ -408,21 +315,6 @@ static inline void iommu_set_fault_handler(struct iommu_domain *domain, { } -static inline void iommu_get_dm_regions(struct device *dev, - struct list_head *list) -{ -} - -static inline void iommu_put_dm_regions(struct device *dev, - struct list_head *list) -{ -} - -static inline int iommu_request_dm_for_dev(struct device *dev) -{ - return -ENODEV; -} - static inline int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group) { diff --git a/include/trace/events/iommu.h b/include/trace/events/iommu.h index 2c7befb10f13..a8f5c32d174b 100644 --- a/include/trace/events/iommu.h +++ b/include/trace/events/iommu.h @@ -83,7 +83,7 @@ DEFINE_EVENT(iommu_device_event, detach_device_from_domain, TP_ARGS(dev) ); -TRACE_EVENT(map, +DECLARE_EVENT_CLASS(iommu_map_unmap, TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size), @@ -92,7 +92,7 @@ TRACE_EVENT(map, TP_STRUCT__entry( __field(u64, iova) __field(u64, paddr) - __field(size_t, size) + __field(int, size) ), TP_fast_assign( @@ -101,31 +101,26 @@ TRACE_EVENT(map, __entry->size = size; ), - TP_printk("IOMMU: iova=0x%016llx paddr=0x%016llx size=%zu", + TP_printk("IOMMU: iova=0x%016llx paddr=0x%016llx size=0x%x", __entry->iova, __entry->paddr, __entry->size ) ); -TRACE_EVENT(unmap, +DEFINE_EVENT(iommu_map_unmap, map, - TP_PROTO(unsigned long iova, size_t size, size_t unmapped_size), + TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size), - TP_ARGS(iova, size, unmapped_size), + TP_ARGS(iova, paddr, size) +); - TP_STRUCT__entry( - __field(u64, iova) - __field(size_t, size) - __field(size_t, unmapped_size) - ), +DEFINE_EVENT_PRINT(iommu_map_unmap, unmap, - TP_fast_assign( - __entry->iova = iova; - __entry->size = size; - __entry->unmapped_size = unmapped_size; - ), + TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size), + + TP_ARGS(iova, paddr, size), - TP_printk("IOMMU: iova=0x%016llx size=%zu unmapped_size=%zu", - __entry->iova, __entry->size, __entry->unmapped_size + TP_printk("IOMMU: iova=0x%016llx size=0x%x", + __entry->iova, __entry->size ) ); |
