From: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org> To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org, will.deacon-5wv7dgnIgG8@public.gmane.org, catalin.marinas-5wv7dgnIgG8@public.gmane.org Cc: laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org, arnd-r2nGTMty4D4@public.gmane.org, djkurtz-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org, treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org, yong.wu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org Subject: [PATCH v2 4/4] arm64: Hook up IOMMU dma_ops Date: Thu, 11 Jun 2015 16:54:24 +0100 [thread overview] Message-ID: <74db00fa23da4de6a45cc28dc434e6691b95b9a4.1434036796.git.robin.murphy@arm.com> (raw) In-Reply-To: <cover.1434036796.git.robin.murphy-5wv7dgnIgG8@public.gmane.org> With iommu_dma_ops in place, hook them up to the configuration code, so IOMMU-fronted devices will get them automatically. Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org> --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/dma-mapping.h | 11 ++++++----- arch/arm64/mm/dma-mapping.c | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7796af4..257cd7e 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -70,6 +70,7 @@ config ARM64 select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE select HAVE_SYSCALL_TRACEPOINTS + select IOMMU_DMA if IOMMU_SUPPORT select IRQ_DOMAIN select MODULES_USE_ELF_RELA select NO_BOOTMEM diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 835a8d1..a87b507 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -45,11 +45,8 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) return __generic_dma_ops(dev); } -static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, - struct iommu_ops *iommu, bool coherent) -{ - dev->archdata.dma_coherent = coherent; -} +void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, + struct iommu_ops *iommu, bool coherent); #define arch_setup_dma_ops arch_setup_dma_ops /* do not use this function in a driver */ @@ -64,6 +61,10 @@ static inline bool is_device_dma_coherent(struct device *dev) #include <linux/dma-iommu.h> #ifdef CONFIG_IOMMU_DMA + +void arch_teardown_dma_ops(struct device *dev); +#define arch_teardown_dma_ops arch_teardown_dma_ops + static inline struct iommu_dma_domain *arch_get_dma_domain(struct device *dev) { return dev->archdata.dma_domain; diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 51b7ae5..c1e1a07 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -769,6 +769,14 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, mutex_unlock(&iommu_dma_notifier_lock); } +void arch_teardown_dma_ops(struct device *dev) +{ + if (dev->archdata.dma_domain) { + iommu_dma_detach_device(dev); + dev->archdata.dma_ops = NULL; + } +} + #else static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, @@ -776,3 +784,10 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, { } #endif /* CONFIG_IOMMU_DMA */ + +void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, + struct iommu_ops *iommu, bool coherent) +{ + dev->archdata.dma_coherent = coherent; + __iommu_setup_dma_ops(dev, dma_base, size, iommu); +} -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: robin.murphy@arm.com (Robin Murphy) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/4] arm64: Hook up IOMMU dma_ops Date: Thu, 11 Jun 2015 16:54:24 +0100 [thread overview] Message-ID: <74db00fa23da4de6a45cc28dc434e6691b95b9a4.1434036796.git.robin.murphy@arm.com> (raw) In-Reply-To: <cover.1434036796.git.robin.murphy@arm.com> With iommu_dma_ops in place, hook them up to the configuration code, so IOMMU-fronted devices will get them automatically. Signed-off-by: Robin Murphy <robin.murphy@arm.com> --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/dma-mapping.h | 11 ++++++----- arch/arm64/mm/dma-mapping.c | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7796af4..257cd7e 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -70,6 +70,7 @@ config ARM64 select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE select HAVE_SYSCALL_TRACEPOINTS + select IOMMU_DMA if IOMMU_SUPPORT select IRQ_DOMAIN select MODULES_USE_ELF_RELA select NO_BOOTMEM diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 835a8d1..a87b507 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -45,11 +45,8 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) return __generic_dma_ops(dev); } -static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, - struct iommu_ops *iommu, bool coherent) -{ - dev->archdata.dma_coherent = coherent; -} +void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, + struct iommu_ops *iommu, bool coherent); #define arch_setup_dma_ops arch_setup_dma_ops /* do not use this function in a driver */ @@ -64,6 +61,10 @@ static inline bool is_device_dma_coherent(struct device *dev) #include <linux/dma-iommu.h> #ifdef CONFIG_IOMMU_DMA + +void arch_teardown_dma_ops(struct device *dev); +#define arch_teardown_dma_ops arch_teardown_dma_ops + static inline struct iommu_dma_domain *arch_get_dma_domain(struct device *dev) { return dev->archdata.dma_domain; diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 51b7ae5..c1e1a07 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -769,6 +769,14 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, mutex_unlock(&iommu_dma_notifier_lock); } +void arch_teardown_dma_ops(struct device *dev) +{ + if (dev->archdata.dma_domain) { + iommu_dma_detach_device(dev); + dev->archdata.dma_ops = NULL; + } +} + #else static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, @@ -776,3 +784,10 @@ static void __iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, { } #endif /* CONFIG_IOMMU_DMA */ + +void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, + struct iommu_ops *iommu, bool coherent) +{ + dev->archdata.dma_coherent = coherent; + __iommu_setup_dma_ops(dev, dma_base, size, iommu); +} -- 1.9.1
next prev parent reply other threads:[~2015-06-11 15:54 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-11 15:54 [PATCH v2 0/4] arm64: IOMMU-backed DMA mapping Robin Murphy 2015-06-11 15:54 ` Robin Murphy [not found] ` <cover.1434036796.git.robin.murphy-5wv7dgnIgG8@public.gmane.org> 2015-06-11 15:54 ` [PATCH v2 1/4] iommu/iova: Avoid over-allocating when size-aligned Robin Murphy 2015-06-11 15:54 ` Robin Murphy 2015-06-11 15:54 ` [PATCH v2 2/4] iommu: Implement common IOMMU ops for DMA mapping Robin Murphy 2015-06-11 15:54 ` Robin Murphy [not found] ` <bf63d80c36533aa4dcc401b5a4b312ba00237e1c.1434036796.git.robin.murphy-5wv7dgnIgG8@public.gmane.org> 2015-06-18 15:00 ` Yong Wu 2015-06-18 15:00 ` Yong Wu 2015-06-18 16:54 ` Robin Murphy 2015-06-18 16:54 ` Robin Murphy [not found] ` <5582F7C5.8060901-5wv7dgnIgG8@public.gmane.org> 2015-06-19 1:06 ` Yong Wu 2015-06-19 1:06 ` Yong Wu 2015-07-03 9:27 ` Yong Wu 2015-07-03 9:27 ` Yong Wu 2015-07-03 16:44 ` Robin Murphy 2015-07-03 16:44 ` Robin Murphy [not found] ` <5596BBD3.1040708-5wv7dgnIgG8@public.gmane.org> 2015-07-07 7:37 ` Yong Wu 2015-07-07 7:37 ` Yong Wu 2015-06-11 15:54 ` [PATCH v2 3/4] arm64: Add IOMMU dma_ops Robin Murphy 2015-06-11 15:54 ` Robin Murphy [not found] ` <4e298538ccedbe6f593d8edc40eb3a08ad9e4df5.1434036796.git.robin.murphy-5wv7dgnIgG8@public.gmane.org> 2015-06-18 15:00 ` Yong Wu 2015-06-18 15:00 ` Yong Wu 2015-06-11 15:54 ` Robin Murphy [this message] 2015-06-11 15:54 ` [PATCH v2 4/4] arm64: Hook up " Robin Murphy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=74db00fa23da4de6a45cc28dc434e6691b95b9a4.1434036796.git.robin.murphy@arm.com \ --to=robin.murphy-5wv7dgnigg8@public.gmane.org \ --cc=arnd-r2nGTMty4D4@public.gmane.org \ --cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \ --cc=djkurtz-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \ --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \ --cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \ --cc=laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \ --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \ --cc=thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \ --cc=treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \ --cc=will.deacon-5wv7dgnIgG8@public.gmane.org \ --cc=yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \ --cc=yong.wu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.