Skip to content

Commit 543cea9

Browse files
author
Christoph Hellwig
committed
ia64: use generic swiotlb_ops
These are identical to the ia64 ops, and would also support CMA if enabled on ia64. Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Christian König <[email protected]>
1 parent d5c23eb commit 543cea9

File tree

4 files changed

+13
-40
lines changed

4 files changed

+13
-40
lines changed

arch/ia64/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ config IA64_GENERIC
146146
bool "generic"
147147
select NUMA
148148
select ACPI_NUMA
149+
select DMA_DIRECT_OPS
149150
select SWIOTLB
150151
select PCI_MSI
151152
help
@@ -166,6 +167,7 @@ config IA64_GENERIC
166167

167168
config IA64_DIG
168169
bool "DIG-compliant"
170+
select DMA_DIRECT_OPS
169171
select SWIOTLB
170172

171173
config IA64_DIG_VTD
@@ -181,6 +183,7 @@ config IA64_HP_ZX1
181183

182184
config IA64_HP_ZX1_SWIOTLB
183185
bool "HP-zx1/sx1000 with software I/O TLB"
186+
select DMA_DIRECT_OPS
184187
select SWIOTLB
185188
help
186189
Build a kernel that runs on HP zx1 and sx1000 systems even when they
@@ -204,6 +207,7 @@ config IA64_SGI_UV
204207
bool "SGI-UV"
205208
select NUMA
206209
select ACPI_NUMA
210+
select DMA_DIRECT_OPS
207211
select SWIOTLB
208212
help
209213
Selecting this option will optimize the kernel for use on UV based
@@ -214,6 +218,7 @@ config IA64_SGI_UV
214218

215219
config IA64_HP_SIM
216220
bool "Ski-simulator"
221+
select DMA_DIRECT_OPS
217222
select SWIOTLB
218223
depends on !PM
219224

arch/ia64/hp/common/hwsw_iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <linux/export.h>
2020
#include <asm/machvec.h>
2121

22-
extern const struct dma_map_ops sba_dma_ops, ia64_swiotlb_dma_ops;
22+
extern const struct dma_map_ops sba_dma_ops;
2323

2424
/* swiotlb declarations & definitions: */
2525
extern int swiotlb_late_init_with_default_size (size_t size);
@@ -38,7 +38,7 @@ static inline int use_swiotlb(struct device *dev)
3838
const struct dma_map_ops *hwsw_dma_get_ops(struct device *dev)
3939
{
4040
if (use_swiotlb(dev))
41-
return &ia64_swiotlb_dma_ops;
41+
return &swiotlb_dma_ops;
4242
return &sba_dma_ops;
4343
}
4444
EXPORT_SYMBOL(hwsw_dma_get_ops);

arch/ia64/hp/common/sba_iommu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,7 @@ static int __init acpi_sba_ioc_init_acpi(void)
20962096
/* This has to run before acpi_scan_init(). */
20972097
arch_initcall(acpi_sba_ioc_init_acpi);
20982098

2099-
extern const struct dma_map_ops ia64_swiotlb_dma_ops;
2099+
extern const struct dma_map_ops swiotlb_dma_ops;
21002100

21012101
static int __init
21022102
sba_init(void)
@@ -2111,7 +2111,7 @@ sba_init(void)
21112111
* a successful kdump kernel boot is to use the swiotlb.
21122112
*/
21132113
if (is_kdump_kernel()) {
2114-
dma_ops = &ia64_swiotlb_dma_ops;
2114+
dma_ops = &swiotlb_dma_ops;
21152115
if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0)
21162116
panic("Unable to initialize software I/O TLB:"
21172117
" Try machvec=dig boot option");
@@ -2133,7 +2133,7 @@ sba_init(void)
21332133
* If we didn't find something sba_iommu can claim, we
21342134
* need to setup the swiotlb and switch to the dig machvec.
21352135
*/
2136-
dma_ops = &ia64_swiotlb_dma_ops;
2136+
dma_ops = &swiotlb_dma_ops;
21372137
if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0)
21382138
panic("Unable to find SBA IOMMU or initialize "
21392139
"software I/O TLB: Try machvec=dig boot option");

arch/ia64/kernel/pci-swiotlb.c

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,17 @@
66
#include <linux/cache.h>
77
#include <linux/module.h>
88
#include <linux/dma-mapping.h>
9-
10-
#include <asm/swiotlb.h>
9+
#include <linux/swiotlb.h>
1110
#include <asm/dma.h>
1211
#include <asm/iommu.h>
1312
#include <asm/machvec.h>
1413

1514
int swiotlb __read_mostly;
1615
EXPORT_SYMBOL(swiotlb);
1716

18-
static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size,
19-
dma_addr_t *dma_handle, gfp_t gfp,
20-
unsigned long attrs)
21-
{
22-
if (dev->coherent_dma_mask != DMA_BIT_MASK(64))
23-
gfp |= GFP_DMA32;
24-
return swiotlb_alloc_coherent(dev, size, dma_handle, gfp);
25-
}
26-
27-
static void ia64_swiotlb_free_coherent(struct device *dev, size_t size,
28-
void *vaddr, dma_addr_t dma_addr,
29-
unsigned long attrs)
30-
{
31-
swiotlb_free_coherent(dev, size, vaddr, dma_addr);
32-
}
33-
34-
const struct dma_map_ops ia64_swiotlb_dma_ops = {
35-
.alloc = ia64_swiotlb_alloc_coherent,
36-
.free = ia64_swiotlb_free_coherent,
37-
.map_page = swiotlb_map_page,
38-
.unmap_page = swiotlb_unmap_page,
39-
.map_sg = swiotlb_map_sg_attrs,
40-
.unmap_sg = swiotlb_unmap_sg_attrs,
41-
.sync_single_for_cpu = swiotlb_sync_single_for_cpu,
42-
.sync_single_for_device = swiotlb_sync_single_for_device,
43-
.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
44-
.sync_sg_for_device = swiotlb_sync_sg_for_device,
45-
.dma_supported = swiotlb_dma_supported,
46-
.mapping_error = swiotlb_dma_mapping_error,
47-
};
48-
4917
void __init swiotlb_dma_init(void)
5018
{
51-
dma_ops = &ia64_swiotlb_dma_ops;
19+
dma_ops = &swiotlb_dma_ops;
5220
swiotlb_init(1);
5321
}
5422

@@ -60,7 +28,7 @@ void __init pci_swiotlb_init(void)
6028
printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
6129
machvec_init("dig");
6230
swiotlb_init(1);
63-
dma_ops = &ia64_swiotlb_dma_ops;
31+
dma_ops = &swiotlb_dma_ops;
6432
#else
6533
panic("Unable to find Intel IOMMU");
6634
#endif

0 commit comments

Comments
 (0)