Skip to content

Commit a8e6d95

Browse files
author
Christoph Hellwig
committed
xen/arm: use dev_is_dma_coherent
Use the dma-noncoherent dev_is_dma_coherent helper instead of the home grown variant. Note that both are always initialized to the same value in arch_setup_dma_ops. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Julien Grall <julien.grall@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
1 parent bef4d20 commit a8e6d95

3 files changed

Lines changed: 6 additions & 21 deletions

File tree

‎arch/arm/include/asm/dma-mapping.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
9191
}
9292
#endif
9393

94-
/* do not use this function in a driver */
95-
static inline bool is_device_dma_coherent(struct device *dev)
96-
{
97-
return dev->archdata.dma_coherent;
98-
}
99-
10094
/**
10195
* arm_dma_alloc - allocate consistent memory for DMA
10296
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices

‎arch/arm/xen/mm.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
#include <linux/cpu.h>
3-
#include <linux/dma-mapping.h>
3+
#include <linux/dma-noncoherent.h>
44
#include <linux/gfp.h>
55
#include <linux/highmem.h>
66
#include <linux/export.h>
@@ -99,7 +99,7 @@ void __xen_dma_map_page(struct device *hwdev, struct page *page,
9999
dma_addr_t dev_addr, unsigned long offset, size_t size,
100100
enum dma_data_direction dir, unsigned long attrs)
101101
{
102-
if (is_device_dma_coherent(hwdev))
102+
if (dev_is_dma_coherent(hwdev))
103103
return;
104104
if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
105105
return;
@@ -112,7 +112,7 @@ void __xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
112112
unsigned long attrs)
113113

114114
{
115-
if (is_device_dma_coherent(hwdev))
115+
if (dev_is_dma_coherent(hwdev))
116116
return;
117117
if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
118118
return;
@@ -123,15 +123,15 @@ void __xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
123123
void __xen_dma_sync_single_for_cpu(struct device *hwdev,
124124
dma_addr_t handle, size_t size, enum dma_data_direction dir)
125125
{
126-
if (is_device_dma_coherent(hwdev))
126+
if (dev_is_dma_coherent(hwdev))
127127
return;
128128
__xen_dma_page_dev_to_cpu(hwdev, handle, size, dir);
129129
}
130130

131131
void __xen_dma_sync_single_for_device(struct device *hwdev,
132132
dma_addr_t handle, size_t size, enum dma_data_direction dir)
133133
{
134-
if (is_device_dma_coherent(hwdev))
134+
if (dev_is_dma_coherent(hwdev))
135135
return;
136136
__xen_dma_page_cpu_to_dev(hwdev, handle, size, dir);
137137
}
@@ -159,7 +159,7 @@ bool xen_arch_need_swiotlb(struct device *dev,
159159
* memory and we are not able to flush the cache.
160160
*/
161161
return (!hypercall_cflush && (xen_pfn != bfn) &&
162-
!is_device_dma_coherent(dev));
162+
!dev_is_dma_coherent(dev));
163163
}
164164

165165
int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,

‎arch/arm64/include/asm/dma-mapping.h‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,5 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
1818
return NULL;
1919
}
2020

21-
/*
22-
* Do not use this function in a driver, it is only provided for
23-
* arch/arm/mm/xen.c, which is used by arm64 as well.
24-
*/
25-
static inline bool is_device_dma_coherent(struct device *dev)
26-
{
27-
return dev->dma_coherent;
28-
}
29-
3021
#endif /* __KERNEL__ */
3122
#endif /* __ASM_DMA_MAPPING_H */

0 commit comments

Comments
 (0)