Skip to content

Commit 2d9d6f6

Browse files
author
Christoph Hellwig
committed
powerpc: rename dma_direct_ to dma_nommu_
We want to use the dma_direct_ namespace for a generic implementation, so rename powerpc to the second best choice: dma_nommu_. Signed-off-by: Christoph Hellwig <[email protected]>
1 parent bf15f90 commit 2d9d6f6

File tree

15 files changed

+68
-68
lines changed

15 files changed

+68
-68
lines changed

arch/powerpc/include/asm/dma-mapping.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
#include <asm/swiotlb.h>
2020

2121
/* Some dma direct funcs must be visible for use in other dma_ops */
22-
extern void *__dma_direct_alloc_coherent(struct device *dev, size_t size,
22+
extern void *__dma_nommu_alloc_coherent(struct device *dev, size_t size,
2323
dma_addr_t *dma_handle, gfp_t flag,
2424
unsigned long attrs);
25-
extern void __dma_direct_free_coherent(struct device *dev, size_t size,
25+
extern void __dma_nommu_free_coherent(struct device *dev, size_t size,
2626
void *vaddr, dma_addr_t dma_handle,
2727
unsigned long attrs);
28-
extern int dma_direct_mmap_coherent(struct device *dev,
28+
extern int dma_nommu_mmap_coherent(struct device *dev,
2929
struct vm_area_struct *vma,
3030
void *cpu_addr, dma_addr_t handle,
3131
size_t size, unsigned long attrs);
@@ -73,7 +73,7 @@ static inline unsigned long device_to_mask(struct device *dev)
7373
#ifdef CONFIG_PPC64
7474
extern struct dma_map_ops dma_iommu_ops;
7575
#endif
76-
extern const struct dma_map_ops dma_direct_ops;
76+
extern const struct dma_map_ops dma_nommu_ops;
7777

7878
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
7979
{

arch/powerpc/kernel/dma-iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ int dma_iommu_mapping_error(struct device *dev, dma_addr_t dma_addr)
114114
struct dma_map_ops dma_iommu_ops = {
115115
.alloc = dma_iommu_alloc_coherent,
116116
.free = dma_iommu_free_coherent,
117-
.mmap = dma_direct_mmap_coherent,
117+
.mmap = dma_nommu_mmap_coherent,
118118
.map_sg = dma_iommu_map_sg,
119119
.unmap_sg = dma_iommu_unmap_sg,
120120
.dma_supported = dma_iommu_dma_supported,

arch/powerpc/kernel/dma-swiotlb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ static u64 swiotlb_powerpc_get_required(struct device *dev)
4747
* for everything else.
4848
*/
4949
const struct dma_map_ops swiotlb_dma_ops = {
50-
.alloc = __dma_direct_alloc_coherent,
51-
.free = __dma_direct_free_coherent,
52-
.mmap = dma_direct_mmap_coherent,
50+
.alloc = __dma_nommu_alloc_coherent,
51+
.free = __dma_nommu_free_coherent,
52+
.mmap = dma_nommu_mmap_coherent,
5353
.map_sg = swiotlb_map_sg_attrs,
5454
.unmap_sg = swiotlb_unmap_sg_attrs,
5555
.dma_supported = swiotlb_dma_supported,

arch/powerpc/kernel/dma.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static u64 __maybe_unused get_pfn_limit(struct device *dev)
4040
return pfn;
4141
}
4242

43-
static int dma_direct_dma_supported(struct device *dev, u64 mask)
43+
static int dma_nommu_dma_supported(struct device *dev, u64 mask)
4444
{
4545
#ifdef CONFIG_PPC64
4646
u64 limit = get_dma_offset(dev) + (memblock_end_of_DRAM() - 1);
@@ -62,7 +62,7 @@ static int dma_direct_dma_supported(struct device *dev, u64 mask)
6262
#endif
6363
}
6464

65-
void *__dma_direct_alloc_coherent(struct device *dev, size_t size,
65+
void *__dma_nommu_alloc_coherent(struct device *dev, size_t size,
6666
dma_addr_t *dma_handle, gfp_t flag,
6767
unsigned long attrs)
6868
{
@@ -119,7 +119,7 @@ void *__dma_direct_alloc_coherent(struct device *dev, size_t size,
119119
#endif
120120
}
121121

122-
void __dma_direct_free_coherent(struct device *dev, size_t size,
122+
void __dma_nommu_free_coherent(struct device *dev, size_t size,
123123
void *vaddr, dma_addr_t dma_handle,
124124
unsigned long attrs)
125125
{
@@ -130,7 +130,7 @@ void __dma_direct_free_coherent(struct device *dev, size_t size,
130130
#endif
131131
}
132132

133-
static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
133+
static void *dma_nommu_alloc_coherent(struct device *dev, size_t size,
134134
dma_addr_t *dma_handle, gfp_t flag,
135135
unsigned long attrs)
136136
{
@@ -139,8 +139,8 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
139139
/* The coherent mask may be smaller than the real mask, check if
140140
* we can really use the direct ops
141141
*/
142-
if (dma_direct_dma_supported(dev, dev->coherent_dma_mask))
143-
return __dma_direct_alloc_coherent(dev, size, dma_handle,
142+
if (dma_nommu_dma_supported(dev, dev->coherent_dma_mask))
143+
return __dma_nommu_alloc_coherent(dev, size, dma_handle,
144144
flag, attrs);
145145

146146
/* Ok we can't ... do we have an iommu ? If not, fail */
@@ -154,15 +154,15 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
154154
dev_to_node(dev));
155155
}
156156

157-
static void dma_direct_free_coherent(struct device *dev, size_t size,
157+
static void dma_nommu_free_coherent(struct device *dev, size_t size,
158158
void *vaddr, dma_addr_t dma_handle,
159159
unsigned long attrs)
160160
{
161161
struct iommu_table *iommu;
162162

163-
/* See comments in dma_direct_alloc_coherent() */
164-
if (dma_direct_dma_supported(dev, dev->coherent_dma_mask))
165-
return __dma_direct_free_coherent(dev, size, vaddr, dma_handle,
163+
/* See comments in dma_nommu_alloc_coherent() */
164+
if (dma_nommu_dma_supported(dev, dev->coherent_dma_mask))
165+
return __dma_nommu_free_coherent(dev, size, vaddr, dma_handle,
166166
attrs);
167167
/* Maybe we used an iommu ... */
168168
iommu = get_iommu_table_base(dev);
@@ -175,7 +175,7 @@ static void dma_direct_free_coherent(struct device *dev, size_t size,
175175
iommu_free_coherent(iommu, size, vaddr, dma_handle);
176176
}
177177

178-
int dma_direct_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
178+
int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
179179
void *cpu_addr, dma_addr_t handle, size_t size,
180180
unsigned long attrs)
181181
{
@@ -193,7 +193,7 @@ int dma_direct_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
193193
vma->vm_page_prot);
194194
}
195195

196-
static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
196+
static int dma_nommu_map_sg(struct device *dev, struct scatterlist *sgl,
197197
int nents, enum dma_data_direction direction,
198198
unsigned long attrs)
199199
{
@@ -213,13 +213,13 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
213213
return nents;
214214
}
215215

216-
static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
216+
static void dma_nommu_unmap_sg(struct device *dev, struct scatterlist *sg,
217217
int nents, enum dma_data_direction direction,
218218
unsigned long attrs)
219219
{
220220
}
221221

222-
static u64 dma_direct_get_required_mask(struct device *dev)
222+
static u64 dma_nommu_get_required_mask(struct device *dev)
223223
{
224224
u64 end, mask;
225225

@@ -231,7 +231,7 @@ static u64 dma_direct_get_required_mask(struct device *dev)
231231
return mask;
232232
}
233233

234-
static inline dma_addr_t dma_direct_map_page(struct device *dev,
234+
static inline dma_addr_t dma_nommu_map_page(struct device *dev,
235235
struct page *page,
236236
unsigned long offset,
237237
size_t size,
@@ -246,7 +246,7 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,
246246
return page_to_phys(page) + offset + get_dma_offset(dev);
247247
}
248248

249-
static inline void dma_direct_unmap_page(struct device *dev,
249+
static inline void dma_nommu_unmap_page(struct device *dev,
250250
dma_addr_t dma_address,
251251
size_t size,
252252
enum dma_data_direction direction,
@@ -255,7 +255,7 @@ static inline void dma_direct_unmap_page(struct device *dev,
255255
}
256256

257257
#ifdef CONFIG_NOT_COHERENT_CACHE
258-
static inline void dma_direct_sync_sg(struct device *dev,
258+
static inline void dma_nommu_sync_sg(struct device *dev,
259259
struct scatterlist *sgl, int nents,
260260
enum dma_data_direction direction)
261261
{
@@ -266,32 +266,32 @@ static inline void dma_direct_sync_sg(struct device *dev,
266266
__dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
267267
}
268268

269-
static inline void dma_direct_sync_single(struct device *dev,
269+
static inline void dma_nommu_sync_single(struct device *dev,
270270
dma_addr_t dma_handle, size_t size,
271271
enum dma_data_direction direction)
272272
{
273273
__dma_sync(bus_to_virt(dma_handle), size, direction);
274274
}
275275
#endif
276276

277-
const struct dma_map_ops dma_direct_ops = {
278-
.alloc = dma_direct_alloc_coherent,
279-
.free = dma_direct_free_coherent,
280-
.mmap = dma_direct_mmap_coherent,
281-
.map_sg = dma_direct_map_sg,
282-
.unmap_sg = dma_direct_unmap_sg,
283-
.dma_supported = dma_direct_dma_supported,
284-
.map_page = dma_direct_map_page,
285-
.unmap_page = dma_direct_unmap_page,
286-
.get_required_mask = dma_direct_get_required_mask,
277+
const struct dma_map_ops dma_nommu_ops = {
278+
.alloc = dma_nommu_alloc_coherent,
279+
.free = dma_nommu_free_coherent,
280+
.mmap = dma_nommu_mmap_coherent,
281+
.map_sg = dma_nommu_map_sg,
282+
.unmap_sg = dma_nommu_unmap_sg,
283+
.dma_supported = dma_nommu_dma_supported,
284+
.map_page = dma_nommu_map_page,
285+
.unmap_page = dma_nommu_unmap_page,
286+
.get_required_mask = dma_nommu_get_required_mask,
287287
#ifdef CONFIG_NOT_COHERENT_CACHE
288-
.sync_single_for_cpu = dma_direct_sync_single,
289-
.sync_single_for_device = dma_direct_sync_single,
290-
.sync_sg_for_cpu = dma_direct_sync_sg,
291-
.sync_sg_for_device = dma_direct_sync_sg,
288+
.sync_single_for_cpu = dma_nommu_sync_single,
289+
.sync_single_for_device = dma_nommu_sync_single,
290+
.sync_sg_for_cpu = dma_nommu_sync_sg,
291+
.sync_sg_for_device = dma_nommu_sync_sg,
292292
#endif
293293
};
294-
EXPORT_SYMBOL(dma_direct_ops);
294+
EXPORT_SYMBOL(dma_nommu_ops);
295295

296296
int dma_set_coherent_mask(struct device *dev, u64 mask)
297297
{
@@ -302,7 +302,7 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
302302
* is no dma_op->set_coherent_mask() so we have to do
303303
* things the hard way:
304304
*/
305-
if (get_dma_ops(dev) != &dma_direct_ops ||
305+
if (get_dma_ops(dev) != &dma_nommu_ops ||
306306
get_iommu_table_base(dev) == NULL ||
307307
!dma_iommu_dma_supported(dev, mask))
308308
return -EIO;

arch/powerpc/kernel/pci-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ resource_size_t isa_mem_base;
6060
EXPORT_SYMBOL(isa_mem_base);
6161

6262

63-
static const struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
63+
static const struct dma_map_ops *pci_dma_ops = &dma_nommu_ops;
6464

6565
void set_pci_dma_ops(const struct dma_map_ops *dma_ops)
6666
{

arch/powerpc/kernel/setup-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ void arch_setup_pdev_archdata(struct platform_device *pdev)
791791
{
792792
pdev->archdata.dma_mask = DMA_BIT_MASK(32);
793793
pdev->dev.dma_mask = &pdev->archdata.dma_mask;
794-
set_dma_ops(&pdev->dev, &dma_direct_ops);
794+
set_dma_ops(&pdev->dev, &dma_nommu_ops);
795795
}
796796

797797
static __init void print_system_info(void)

arch/powerpc/platforms/cell/iommu.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static struct cbe_iommu *cell_iommu_for_node(int nid)
541541
return NULL;
542542
}
543543

544-
static unsigned long cell_dma_direct_offset;
544+
static unsigned long cell_dma_nommu_offset;
545545

546546
static unsigned long dma_iommu_fixed_base;
547547

@@ -580,7 +580,7 @@ static void *dma_fixed_alloc_coherent(struct device *dev, size_t size,
580580
device_to_mask(dev), flag,
581581
dev_to_node(dev));
582582
else
583-
return dma_direct_ops.alloc(dev, size, dma_handle, flag,
583+
return dma_nommu_ops.alloc(dev, size, dma_handle, flag,
584584
attrs);
585585
}
586586

@@ -592,7 +592,7 @@ static void dma_fixed_free_coherent(struct device *dev, size_t size,
592592
iommu_free_coherent(cell_get_iommu_table(dev), size, vaddr,
593593
dma_handle);
594594
else
595-
dma_direct_ops.free(dev, size, vaddr, dma_handle, attrs);
595+
dma_nommu_ops.free(dev, size, vaddr, dma_handle, attrs);
596596
}
597597

598598
static dma_addr_t dma_fixed_map_page(struct device *dev, struct page *page,
@@ -601,7 +601,7 @@ static dma_addr_t dma_fixed_map_page(struct device *dev, struct page *page,
601601
unsigned long attrs)
602602
{
603603
if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING))
604-
return dma_direct_ops.map_page(dev, page, offset, size,
604+
return dma_nommu_ops.map_page(dev, page, offset, size,
605605
direction, attrs);
606606
else
607607
return iommu_map_page(dev, cell_get_iommu_table(dev), page,
@@ -614,7 +614,7 @@ static void dma_fixed_unmap_page(struct device *dev, dma_addr_t dma_addr,
614614
unsigned long attrs)
615615
{
616616
if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING))
617-
dma_direct_ops.unmap_page(dev, dma_addr, size, direction,
617+
dma_nommu_ops.unmap_page(dev, dma_addr, size, direction,
618618
attrs);
619619
else
620620
iommu_unmap_page(cell_get_iommu_table(dev), dma_addr, size,
@@ -626,7 +626,7 @@ static int dma_fixed_map_sg(struct device *dev, struct scatterlist *sg,
626626
unsigned long attrs)
627627
{
628628
if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING))
629-
return dma_direct_ops.map_sg(dev, sg, nents, direction, attrs);
629+
return dma_nommu_ops.map_sg(dev, sg, nents, direction, attrs);
630630
else
631631
return ppc_iommu_map_sg(dev, cell_get_iommu_table(dev), sg,
632632
nents, device_to_mask(dev),
@@ -638,7 +638,7 @@ static void dma_fixed_unmap_sg(struct device *dev, struct scatterlist *sg,
638638
unsigned long attrs)
639639
{
640640
if (iommu_fixed_is_weak == (attrs & DMA_ATTR_WEAK_ORDERING))
641-
dma_direct_ops.unmap_sg(dev, sg, nents, direction, attrs);
641+
dma_nommu_ops.unmap_sg(dev, sg, nents, direction, attrs);
642642
else
643643
ppc_iommu_unmap_sg(cell_get_iommu_table(dev), sg, nents,
644644
direction, attrs);
@@ -661,8 +661,8 @@ static void cell_dma_dev_setup(struct device *dev)
661661
{
662662
if (get_pci_dma_ops() == &dma_iommu_ops)
663663
set_iommu_table_base(dev, cell_get_iommu_table(dev));
664-
else if (get_pci_dma_ops() == &dma_direct_ops)
665-
set_dma_offset(dev, cell_dma_direct_offset);
664+
else if (get_pci_dma_ops() == &dma_nommu_ops)
665+
set_dma_offset(dev, cell_dma_nommu_offset);
666666
else
667667
BUG();
668668
}
@@ -810,14 +810,14 @@ static int __init cell_iommu_init_disabled(void)
810810
unsigned long base = 0, size;
811811

812812
/* When no iommu is present, we use direct DMA ops */
813-
set_pci_dma_ops(&dma_direct_ops);
813+
set_pci_dma_ops(&dma_nommu_ops);
814814

815815
/* First make sure all IOC translation is turned off */
816816
cell_disable_iommus();
817817

818818
/* If we have no Axon, we set up the spider DMA magic offset */
819819
if (of_find_node_by_name(NULL, "axon") == NULL)
820-
cell_dma_direct_offset = SPIDER_DMA_OFFSET;
820+
cell_dma_nommu_offset = SPIDER_DMA_OFFSET;
821821

822822
/* Now we need to check to see where the memory is mapped
823823
* in PCI space. We assume that all busses use the same dma
@@ -851,13 +851,13 @@ static int __init cell_iommu_init_disabled(void)
851851
return -ENODEV;
852852
}
853853

854-
cell_dma_direct_offset += base;
854+
cell_dma_nommu_offset += base;
855855

856-
if (cell_dma_direct_offset != 0)
856+
if (cell_dma_nommu_offset != 0)
857857
cell_pci_controller_ops.dma_dev_setup = cell_pci_dma_dev_setup;
858858

859859
printk("iommu: disabled, direct DMA offset is 0x%lx\n",
860-
cell_dma_direct_offset);
860+
cell_dma_nommu_offset);
861861

862862
return 0;
863863
}

arch/powerpc/platforms/pasemi/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static void pci_dma_dev_setup_pasemi(struct pci_dev *dev)
186186
*/
187187
if (dev->vendor == 0x1959 && dev->device == 0xa007 &&
188188
!firmware_has_feature(FW_FEATURE_LPAR)) {
189-
dev->dev.dma_ops = &dma_direct_ops;
189+
dev->dev.dma_ops = &dma_nommu_ops;
190190
/*
191191
* Set the coherent DMA mask to prevent the iommu
192192
* being used unnecessarily

arch/powerpc/platforms/pasemi/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static int pcmcia_notify(struct notifier_block *nb, unsigned long action,
363363
return 0;
364364

365365
/* We use the direct ops for localbus */
366-
dev->dma_ops = &dma_direct_ops;
366+
dev->dma_ops = &dma_nommu_ops;
367367

368368
return 0;
369369
}

arch/powerpc/platforms/powernv/pci-ioda.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,7 @@ static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
18501850

18511851
if (bypass) {
18521852
dev_info(&pdev->dev, "Using 64-bit DMA iommu bypass\n");
1853-
set_dma_ops(&pdev->dev, &dma_direct_ops);
1853+
set_dma_ops(&pdev->dev, &dma_nommu_ops);
18541854
} else {
18551855
/*
18561856
* If the device can't set the TCE bypass bit but still wants
@@ -1868,7 +1868,7 @@ static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
18681868
return rc;
18691869
/* 4GB offset bypasses 32-bit space */
18701870
set_dma_offset(&pdev->dev, (1ULL << 32));
1871-
set_dma_ops(&pdev->dev, &dma_direct_ops);
1871+
set_dma_ops(&pdev->dev, &dma_nommu_ops);
18721872
} else if (dma_mask >> 32 && dma_mask != DMA_BIT_MASK(64)) {
18731873
/*
18741874
* Fail the request if a DMA mask between 32 and 64 bits

0 commit comments

Comments
 (0)