* [PATCH 0/4] iommu: Header file cleanups @ 2017-04-26 15:45 Joerg Roedel 2017-04-26 15:45 ` [PATCH 1/4] iommu: Include device.h in iommu.h Joerg Roedel ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread From: Joerg Roedel @ 2017-04-26 15:45 UTC (permalink / raw) To: iommu; +Cc: linux-kernel, Joerg Roedel Hi, here is a small patch-set to remove some header dependencies from the IOMMU header files. The linux/iommu.h file does not include linux/pci.h and the iommu trace-event headers anymore. For this the report_iommu_fault function was moved to iommu.c and the place relying on above includes were fixed. Please review. Thanks, Joerg Joerg Roedel (4): iommu: Include device.h in iommu.h iommu: Move report_iommu_fault() to iommu.c iommu: Remove pci.h include from trace/events/iommu.h iommu: Remove trace-events include from iommu.h arch/arm64/mm/dma-mapping.c | 1 + drivers/iommu/fsl_pamu.h | 1 + drivers/iommu/iommu.c | 42 ++++++++++++++++++++++++++++ drivers/iommu/rockchip-iommu.c | 1 + drivers/iommu/tegra-smmu.c | 1 + drivers/media/platform/mtk-vpu/mtk_vpu.c | 1 + include/linux/dma-iommu.h | 1 + include/linux/iommu.h | 47 ++++---------------------------- include/trace/events/iommu.h | 1 - 9 files changed, 53 insertions(+), 43 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] iommu: Include device.h in iommu.h 2017-04-26 15:45 [PATCH 0/4] iommu: Header file cleanups Joerg Roedel @ 2017-04-26 15:45 ` Joerg Roedel 2017-04-26 15:45 ` [PATCH 2/4] iommu: Move report_iommu_fault() to iommu.c Joerg Roedel ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: Joerg Roedel @ 2017-04-26 15:45 UTC (permalink / raw) To: iommu; +Cc: linux-kernel, Joerg Roedel From: Joerg Roedel <jroedel@suse.de> We make use of 'struct device' in iommu.h, so include device.h to make it available explicitly. Re-order the other headers while at it. Signed-off-by: Joerg Roedel <jroedel@suse.de> --- include/linux/iommu.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 2e4de0d..0232104 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -19,11 +19,13 @@ #ifndef __LINUX_IOMMU_H #define __LINUX_IOMMU_H +#include <linux/scatterlist.h> +#include <linux/device.h> +#include <linux/types.h> #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) -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] iommu: Move report_iommu_fault() to iommu.c 2017-04-26 15:45 [PATCH 0/4] iommu: Header file cleanups Joerg Roedel 2017-04-26 15:45 ` [PATCH 1/4] iommu: Include device.h in iommu.h Joerg Roedel @ 2017-04-26 15:45 ` Joerg Roedel 2017-04-26 15:45 ` [PATCH 3/4] iommu: Remove pci.h include from trace/events/iommu.h Joerg Roedel 2017-04-26 15:45 ` [PATCH 4/4] iommu: Remove trace-events include from iommu.h Joerg Roedel 3 siblings, 0 replies; 6+ messages in thread From: Joerg Roedel @ 2017-04-26 15:45 UTC (permalink / raw) To: iommu; +Cc: linux-kernel, Joerg Roedel From: Joerg Roedel <jroedel@suse.de> The function is in no fast-path, there is no need for it to be static inline in a header file. This also removes the need to include iommu trace-points in iommu.h. Signed-off-by: Joerg Roedel <jroedel@suse.de> --- drivers/iommu/iommu.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/linux/iommu.h | 41 ++--------------------------------------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 3b67144..f51e9c8 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1652,6 +1652,48 @@ void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr) } EXPORT_SYMBOL_GPL(iommu_domain_window_disable); +/** + * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework + * @domain: the iommu domain where the fault has happened + * @dev: the device where the fault has happened + * @iova: the faulting address + * @flags: mmu fault flags (e.g. IOMMU_FAULT_READ/IOMMU_FAULT_WRITE/...) + * + * This function should be called by the low-level IOMMU implementations + * whenever IOMMU faults happen, to allow high-level users, that are + * interested in such events, to know about them. + * + * This event may be useful for several possible use cases: + * - mere logging of the event + * - dynamic TLB/PTE loading + * - if restarting of the faulting device is required + * + * Returns 0 on success and an appropriate error code otherwise (if dynamic + * PTE/TLB loading will one day be supported, implementations will be able + * to tell whether it succeeded or not according to this return value). + * + * Specifically, -ENOSYS is returned if a fault handler isn't installed + * (though fault handlers can also return -ENOSYS, in case they want to + * elicit the default behavior of the IOMMU drivers). + */ +int report_iommu_fault(struct iommu_domain *domain, struct device *dev, + unsigned long iova, int flags) +{ + int ret = -ENOSYS; + + /* + * if upper layers showed interest and installed a fault handler, + * invoke it. + */ + if (domain->handler) + ret = domain->handler(domain, dev, iova, flags, + domain->handler_token); + + trace_io_page_fault(dev, iova, flags); + return ret; +} +EXPORT_SYMBOL_GPL(report_iommu_fault); + static int __init iommu_init(void) { iommu_group_kset = kset_create_and_add("iommu_groups", diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 0232104..2a62593 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -338,46 +338,9 @@ extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, phys_addr_t offset, u64 size, int prot); extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr); -/** - * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework - * @domain: the iommu domain where the fault has happened - * @dev: the device where the fault has happened - * @iova: the faulting address - * @flags: mmu fault flags (e.g. IOMMU_FAULT_READ/IOMMU_FAULT_WRITE/...) - * - * This function should be called by the low-level IOMMU implementations - * whenever IOMMU faults happen, to allow high-level users, that are - * interested in such events, to know about them. - * - * This event may be useful for several possible use cases: - * - mere logging of the event - * - dynamic TLB/PTE loading - * - if restarting of the faulting device is required - * - * Returns 0 on success and an appropriate error code otherwise (if dynamic - * PTE/TLB loading will one day be supported, implementations will be able - * to tell whether it succeeded or not according to this return value). - * - * Specifically, -ENOSYS is returned if a fault handler isn't installed - * (though fault handlers can also return -ENOSYS, in case they want to - * elicit the default behavior of the IOMMU drivers). - */ -static inline int report_iommu_fault(struct iommu_domain *domain, - struct device *dev, unsigned long iova, int flags) -{ - int ret = -ENOSYS; - /* - * if upper layers showed interest and installed a fault handler, - * invoke it. - */ - if (domain->handler) - ret = domain->handler(domain, dev, iova, flags, - domain->handler_token); - - trace_io_page_fault(dev, iova, flags); - return ret; -} +extern int report_iommu_fault(struct iommu_domain *domain, struct device *dev, + unsigned long iova, int flags); static inline size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova, struct scatterlist *sg, -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] iommu: Remove pci.h include from trace/events/iommu.h 2017-04-26 15:45 [PATCH 0/4] iommu: Header file cleanups Joerg Roedel 2017-04-26 15:45 ` [PATCH 1/4] iommu: Include device.h in iommu.h Joerg Roedel 2017-04-26 15:45 ` [PATCH 2/4] iommu: Move report_iommu_fault() to iommu.c Joerg Roedel @ 2017-04-26 15:45 ` Joerg Roedel 2017-04-27 14:16 ` kbuild test robot 2017-04-26 15:45 ` [PATCH 4/4] iommu: Remove trace-events include from iommu.h Joerg Roedel 3 siblings, 1 reply; 6+ messages in thread From: Joerg Roedel @ 2017-04-26 15:45 UTC (permalink / raw) To: iommu; +Cc: linux-kernel, Joerg Roedel From: Joerg Roedel <jroedel@suse.de> The include file does not need any PCI specifics, so remove that include. Also fix the places that relied on it. Signed-off-by: Joerg Roedel <jroedel@suse.de> --- arch/arm64/mm/dma-mapping.c | 1 + drivers/iommu/fsl_pamu.h | 1 + drivers/iommu/rockchip-iommu.c | 1 + drivers/iommu/tegra-smmu.c | 1 + include/linux/dma-iommu.h | 1 + include/trace/events/iommu.h | 1 - 6 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 81cdb2e..982f85b 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -28,6 +28,7 @@ #include <linux/dma-contiguous.h> #include <linux/vmalloc.h> #include <linux/swiotlb.h> +#include <linux/pci.h> #include <asm/cacheflush.h> diff --git a/drivers/iommu/fsl_pamu.h b/drivers/iommu/fsl_pamu.h index aab723f..c3434f2 100644 --- a/drivers/iommu/fsl_pamu.h +++ b/drivers/iommu/fsl_pamu.h @@ -20,6 +20,7 @@ #define __FSL_PAMU_H #include <linux/iommu.h> +#include <linux/pci.h> #include <asm/fsl_pamu_stash.h> diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 9afcbf7..0ba303a 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -8,6 +8,7 @@ #include <linux/delay.h> #include <linux/device.h> #include <linux/dma-iommu.h> +#include <linux/dma-mapping.h> #include <linux/errno.h> #include <linux/interrupt.h> #include <linux/io.h> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 9305964..eeb19f5 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -15,6 +15,7 @@ #include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/slab.h> +#include <linux/dma-mapping.h> #include <soc/tegra/ahb.h> #include <soc/tegra/mc.h> diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h index 5725c94..abd9465 100644 --- a/include/linux/dma-iommu.h +++ b/include/linux/dma-iommu.h @@ -20,6 +20,7 @@ #include <asm/errno.h> #ifdef CONFIG_IOMMU_DMA +#include <linux/dma-mapping.h> #include <linux/iommu.h> #include <linux/msi.h> diff --git a/include/trace/events/iommu.h b/include/trace/events/iommu.h index 2c7befb..99254ed 100644 --- a/include/trace/events/iommu.h +++ b/include/trace/events/iommu.h @@ -11,7 +11,6 @@ #define _TRACE_IOMMU_H #include <linux/tracepoint.h> -#include <linux/pci.h> struct device; -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/4] iommu: Remove pci.h include from trace/events/iommu.h 2017-04-26 15:45 ` [PATCH 3/4] iommu: Remove pci.h include from trace/events/iommu.h Joerg Roedel @ 2017-04-27 14:16 ` kbuild test robot 0 siblings, 0 replies; 6+ messages in thread From: kbuild test robot @ 2017-04-27 14:16 UTC (permalink / raw) To: Joerg Roedel; +Cc: kbuild-all, iommu, linux-kernel, Joerg Roedel [-- Attachment #1: Type: text/plain, Size: 3701 bytes --] Hi Joerg, [auto build test WARNING on linus/master] [also build test WARNING on v4.11-rc8 next-20170426] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Joerg-Roedel/iommu-Header-file-cleanups/20170427-160734 config: tile-allmodconfig (attached as .config) compiler: tilegx-linux-gcc (GCC) 4.6.2 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=tile All warnings (new ones prefixed by >>): In file included from drivers/infiniband//hw/qedr/main.c:39:0: >> include/linux/qed/qede_roce.h:57:12: warning: 'struct pci_dev' declared inside parameter list [enabled by default] >> include/linux/qed/qede_roce.h:57:12: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] >> drivers/infiniband//hw/qedr/main.c:905:2: warning: initialization from incompatible pointer type [enabled by default] drivers/infiniband//hw/qedr/main.c:905:2: warning: (near initialization for 'qedr_drv.add') [enabled by default] -- In file included from drivers/infiniband/hw/qedr/main.c:39:0: >> include/linux/qed/qede_roce.h:57:12: warning: 'struct pci_dev' declared inside parameter list [enabled by default] >> include/linux/qed/qede_roce.h:57:12: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] drivers/infiniband/hw/qedr/main.c:905:2: warning: initialization from incompatible pointer type [enabled by default] drivers/infiniband/hw/qedr/main.c:905:2: warning: (near initialization for 'qedr_drv.add') [enabled by default] vim +57 include/linux/qed/qede_roce.h cee9fbd8 Ram Amrani 2016-10-01 41 QEDE_DOWN, cee9fbd8 Ram Amrani 2016-10-01 42 QEDE_CHANGE_ADDR, cee9fbd8 Ram Amrani 2016-10-01 43 QEDE_CLOSE cee9fbd8 Ram Amrani 2016-10-01 44 }; cee9fbd8 Ram Amrani 2016-10-01 45 cee9fbd8 Ram Amrani 2016-10-01 46 struct qede_roce_event_work { cee9fbd8 Ram Amrani 2016-10-01 47 struct list_head list; cee9fbd8 Ram Amrani 2016-10-01 48 struct work_struct work; cee9fbd8 Ram Amrani 2016-10-01 49 void *ptr; cee9fbd8 Ram Amrani 2016-10-01 50 enum qede_roce_event event; cee9fbd8 Ram Amrani 2016-10-01 51 }; cee9fbd8 Ram Amrani 2016-10-01 52 cee9fbd8 Ram Amrani 2016-10-01 53 struct qedr_driver { cee9fbd8 Ram Amrani 2016-10-01 54 unsigned char name[32]; cee9fbd8 Ram Amrani 2016-10-01 55 cee9fbd8 Ram Amrani 2016-10-01 56 struct qedr_dev* (*add)(struct qed_dev *, struct pci_dev *, cee9fbd8 Ram Amrani 2016-10-01 @57 struct net_device *); cee9fbd8 Ram Amrani 2016-10-01 58 cee9fbd8 Ram Amrani 2016-10-01 59 void (*remove)(struct qedr_dev *); cee9fbd8 Ram Amrani 2016-10-01 60 void (*notify)(struct qedr_dev *, enum qede_roce_event); cee9fbd8 Ram Amrani 2016-10-01 61 }; cee9fbd8 Ram Amrani 2016-10-01 62 cee9fbd8 Ram Amrani 2016-10-01 63 /* APIs for RoCE driver to register callback handlers, cee9fbd8 Ram Amrani 2016-10-01 64 * which will be invoked when device is added, removed, ifup, ifdown cee9fbd8 Ram Amrani 2016-10-01 65 */ :::::: The code at line 57 was first introduced by commit :::::: cee9fbd8e2e9e713cd8bf227c6492fd8854de74b qede: Add qedr framework :::::: TO: Ram Amrani <Ram.Amrani@caviumnetworks.com> :::::: CC: David S. Miller <davem@davemloft.net> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 48063 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] iommu: Remove trace-events include from iommu.h 2017-04-26 15:45 [PATCH 0/4] iommu: Header file cleanups Joerg Roedel ` (2 preceding siblings ...) 2017-04-26 15:45 ` [PATCH 3/4] iommu: Remove pci.h include from trace/events/iommu.h Joerg Roedel @ 2017-04-26 15:45 ` Joerg Roedel 3 siblings, 0 replies; 6+ messages in thread From: Joerg Roedel @ 2017-04-26 15:45 UTC (permalink / raw) To: iommu; +Cc: linux-kernel, Joerg Roedel From: Joerg Roedel <jroedel@suse.de> It is not needed there anymore. All places needing it are fixed. Signed-off-by: Joerg Roedel <jroedel@suse.de> --- drivers/media/platform/mtk-vpu/mtk_vpu.c | 1 + include/linux/iommu.h | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c index 463b69c..e011c8d 100644 --- a/drivers/media/platform/mtk-vpu/mtk_vpu.c +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c @@ -23,6 +23,7 @@ #include <linux/of_reserved_mem.h> #include <linux/sched.h> #include <linux/sizes.h> +#include <linux/dma-mapping.h> #include "mtk_vpu.h" diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 2a62593..407d8b8 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -26,8 +26,6 @@ #include <linux/err.h> #include <linux/of.h> -#include <trace/events/iommu.h> - #define IOMMU_READ (1 << 0) #define IOMMU_WRITE (1 << 1) #define IOMMU_CACHE (1 << 2) /* DMA cache coherency */ -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-04-27 14:17 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-04-26 15:45 [PATCH 0/4] iommu: Header file cleanups Joerg Roedel 2017-04-26 15:45 ` [PATCH 1/4] iommu: Include device.h in iommu.h Joerg Roedel 2017-04-26 15:45 ` [PATCH 2/4] iommu: Move report_iommu_fault() to iommu.c Joerg Roedel 2017-04-26 15:45 ` [PATCH 3/4] iommu: Remove pci.h include from trace/events/iommu.h Joerg Roedel 2017-04-27 14:16 ` kbuild test robot 2017-04-26 15:45 ` [PATCH 4/4] iommu: Remove trace-events include from iommu.h Joerg Roedel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).