From: Christoph Hellwig <hch@lst.de>
To: iommu@lists.linux-foundation.org
Cc: "Konrad Rzeszutek Wilk" <konrad@darnok.org>,
"Michal Simek" <monstr@monstr.eu>,
"Guan Xuetao" <gxt@mprc.pku.edu.cn>,
"Christian König" <ckoenig.leichtzumerken@gmail.com>,
linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org,
linux-mips@linux-mips.org, linuxppc-dev@lists.ozlabs.org,
x86@kernel.org, linux-arch@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 14/22] ia64: clean up swiotlb support
Date: Wed, 10 Jan 2018 09:09:24 +0100 [thread overview]
Message-ID: <20180110080932.14157-15-hch@lst.de> (raw)
In-Reply-To: <20180110080932.14157-1-hch@lst.de>
Move the few remaining bits of swiotlb glue towards their callers,
and remove the pointless on ia64 swiotlb variable.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/ia64/include/asm/dma-mapping.h | 1 -
arch/ia64/include/asm/swiotlb.h | 18 ------------------
arch/ia64/kernel/dma-mapping.c | 9 +++++++++
arch/ia64/kernel/pci-dma.c | 12 ++++++++++--
arch/ia64/kernel/pci-swiotlb.c | 36 ------------------------------------
drivers/iommu/intel-iommu.c | 2 +-
6 files changed, 20 insertions(+), 58 deletions(-)
delete mode 100644 arch/ia64/include/asm/swiotlb.h
delete mode 100644 arch/ia64/kernel/pci-swiotlb.c
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index eabee56d995c..76e4d6632d68 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -8,7 +8,6 @@
*/
#include <asm/machvec.h>
#include <linux/scatterlist.h>
-#include <asm/swiotlb.h>
#include <linux/dma-debug.h>
#define ARCH_HAS_DMA_GET_REQUIRED_MASK
diff --git a/arch/ia64/include/asm/swiotlb.h b/arch/ia64/include/asm/swiotlb.h
deleted file mode 100644
index 841e2c7d0b21..000000000000
--- a/arch/ia64/include/asm/swiotlb.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef ASM_IA64__SWIOTLB_H
-#define ASM_IA64__SWIOTLB_H
-
-#include <linux/dma-mapping.h>
-#include <linux/swiotlb.h>
-
-#ifdef CONFIG_SWIOTLB
-extern int swiotlb;
-extern void pci_swiotlb_init(void);
-#else
-#define swiotlb 0
-static inline void pci_swiotlb_init(void)
-{
-}
-#endif
-
-#endif /* ASM_IA64__SWIOTLB_H */
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c
index 7a82c9259609..f2d57e66fd86 100644
--- a/arch/ia64/kernel/dma-mapping.c
+++ b/arch/ia64/kernel/dma-mapping.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/dma-mapping.h>
+#include <linux/swiotlb.h>
#include <linux/export.h>
/* Set this to 1 if there is a HW IOMMU in the system */
@@ -23,3 +24,11 @@ const struct dma_map_ops *dma_get_ops(struct device *dev)
return dma_ops;
}
EXPORT_SYMBOL(dma_get_ops);
+
+#ifdef CONFIG_SWIOTLB
+void __init swiotlb_dma_init(void)
+{
+ dma_ops = &swiotlb_dma_ops;
+ swiotlb_init(1);
+}
+#endif
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
index 3ba87c22dfbc..35e0cad33b7d 100644
--- a/arch/ia64/kernel/pci-dma.c
+++ b/arch/ia64/kernel/pci-dma.c
@@ -104,8 +104,16 @@ void __init pci_iommu_alloc(void)
detect_intel_iommu();
#ifdef CONFIG_SWIOTLB
- pci_swiotlb_init();
-#endif
+ if (!iommu_detected) {
+#ifdef CONFIG_IA64_GENERIC
+ printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
+ machvec_init("dig");
+ swiotlb_dma_init();
+#else
+ panic("Unable to find Intel IOMMU");
+#endif /* CONFIG_IA64_GENERIC */
+ }
+#endif /* CONFIG_SWIOTLB */
}
#endif
diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c
deleted file mode 100644
index 0f8d5fbd86bd..000000000000
--- a/arch/ia64/kernel/pci-swiotlb.c
+++ /dev/null
@@ -1,36 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/* Glue code to lib/swiotlb.c */
-
-#include <linux/pci.h>
-#include <linux/gfp.h>
-#include <linux/cache.h>
-#include <linux/module.h>
-#include <linux/dma-mapping.h>
-#include <linux/swiotlb.h>
-#include <asm/dma.h>
-#include <asm/iommu.h>
-#include <asm/machvec.h>
-
-int swiotlb __read_mostly;
-EXPORT_SYMBOL(swiotlb);
-
-void __init swiotlb_dma_init(void)
-{
- dma_ops = &swiotlb_dma_ops;
- swiotlb_init(1);
-}
-
-void __init pci_swiotlb_init(void)
-{
- if (!iommu_detected) {
-#ifdef CONFIG_IA64_GENERIC
- swiotlb = 1;
- printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
- machvec_init("dig");
- swiotlb_init(1);
- dma_ops = &swiotlb_dma_ops;
-#else
- panic("Unable to find Intel IOMMU");
-#endif
- }
-}
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 4a2de34895ec..a1373cf34326 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4808,7 +4808,7 @@ int __init intel_iommu_init(void)
up_write(&dmar_global_lock);
pr_info("Intel(R) Virtualization Technology for Directed I/O\n");
-#ifdef CONFIG_SWIOTLB
+#if defined(CONFIG_X86) && defined(CONFIG_SWIOTLB)
swiotlb = 0;
#endif
dma_ops = &intel_dma_ops;
--
2.14.2
next prev parent reply other threads:[~2018-01-10 8:10 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 8:09 consolidate swiotlb dma_map implementations Christoph Hellwig
2018-01-10 8:09 ` [PATCH 01/22] swiotlb: suppress warning when __GFP_NOWARN is set Christoph Hellwig
2018-01-10 8:09 ` [PATCH 02/22] arm64: rename swiotlb_dma_ops Christoph Hellwig
2018-01-10 12:13 ` Robin Murphy
2018-01-10 8:09 ` [PATCH 03/22] ia64: " Christoph Hellwig
2018-01-12 13:24 ` Konrad Rzeszutek Wilk
2018-01-10 8:09 ` [PATCH 04/22] powerpc: " Christoph Hellwig
2018-01-12 13:25 ` Konrad Rzeszutek Wilk
2018-01-10 8:09 ` [PATCH 05/22] x86: " Christoph Hellwig
2018-01-12 13:25 ` Konrad Rzeszutek Wilk
2018-01-10 8:09 ` [PATCH 06/22] swiotlb: rename swiotlb_free to swiotlb_exit Christoph Hellwig
2018-01-12 13:39 ` Konrad Rzeszutek Wilk
2018-01-10 8:09 ` [PATCH 07/22] swiotlb: add common swiotlb_map_ops Christoph Hellwig
2018-01-10 8:09 ` [PATCH 08/22] swiotlb: wire up ->dma_supported in swiotlb_dma_ops Christoph Hellwig
2018-01-10 12:16 ` Robin Murphy
2018-01-10 15:35 ` Christoph Hellwig
2018-01-10 17:23 ` Robin Murphy
2018-01-10 8:09 ` [PATCH 09/22] swiotlb: refactor coherent buffer freeing Christoph Hellwig
2018-01-10 8:09 ` [PATCH 10/22] swiotlb: refactor coherent buffer allocation Christoph Hellwig
2018-01-10 12:22 ` Robin Murphy
2018-01-10 15:46 ` Christoph Hellwig
2018-01-10 17:02 ` Robin Murphy
2018-01-15 9:10 ` Christoph Hellwig
2018-01-10 8:09 ` [PATCH 11/22] swiotlb: remove various exports Christoph Hellwig
2018-01-10 8:09 ` [PATCH 12/22] ia64: replace ZONE_DMA with ZONE_DMA32 Christoph Hellwig
2018-01-10 8:09 ` [PATCH 13/22] ia64: use generic swiotlb_ops Christoph Hellwig
2018-01-10 8:09 ` Christoph Hellwig [this message]
2018-01-10 8:09 ` [PATCH 15/22] ia64: remove an ifdef around the content of pci-dma.c Christoph Hellwig
2018-01-10 8:09 ` [PATCH 16/22] unicore32: use generic swiotlb_ops Christoph Hellwig
2018-01-10 8:09 ` [PATCH 17/22] tile: replace ZONE_DMA with ZONE_DMA32 Christoph Hellwig
2018-01-10 8:09 ` [PATCH 18/22] tile: use generic swiotlb_ops Christoph Hellwig
2018-01-10 8:09 ` [PATCH 19/22] mips/netlogic: remove swiotlb support Christoph Hellwig
2018-01-10 8:09 ` [PATCH 20/22] mips: use swiotlb_{alloc,free} Christoph Hellwig
2018-01-10 8:09 ` [PATCH 21/22] arm64: replace ZONE_DMA with ZONE_DMA32 Christoph Hellwig
2018-01-10 12:58 ` Robin Murphy
2018-01-10 15:55 ` Christoph Hellwig
2018-01-10 15:55 ` Christoph Hellwig
2018-01-10 17:10 ` Robin Murphy
2018-01-10 8:09 ` [PATCH 22/22] arm64: use swiotlb_alloc and swiotlb_free Christoph Hellwig
2018-01-10 13:16 ` Robin Murphy
2018-01-10 8:23 ` consolidate swiotlb dma_map implementations Christian König
2018-01-16 7:53 ` Christoph Hellwig
2018-01-16 8:22 ` Christian König
2018-01-16 8:28 ` Christoph Hellwig
2018-01-16 8:52 ` Christian König
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=20180110080932.14157-15-hch@lst.de \
--to=hch@lst.de \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=gxt@mprc.pku.edu.cn \
--cc=iommu@lists.linux-foundation.org \
--cc=konrad@darnok.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=monstr@monstr.eu \
--cc=x86@kernel.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).