* [PATCH -tip v2 0/5] add common functions for struct dma_map_ops
@ 2009-05-15 3:55 FUJITA Tomonori
2009-05-15 3:55 ` [PATCH -tip 1/5] add asm-generic/dma-mappig-common.h FUJITA Tomonori
` (6 more replies)
0 siblings, 7 replies; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-15 3:55 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, tony.luck, linux-ia64, fujita.tomonori, arnd, joerg.roedel
We unified x86 and IA64's handling of multiple dma mapping operations
(struct dma_map_ops in linux/dma-mapping.h) so we can remove
duplication in their arch/include/asm/dma-mapping.h.
This patchset adds include/asm-generic/dma-mapping-common.h that
provides some generic dma mapping function definitions for the users
of struct dma_map_ops. This enables us to remove about 100 lines. This
also enables us to easily add CONFIG_DMA_API_DEBUG support, which only
x86 supports for now. The 4th patch adds CONFIG_DMA_API_DEBUG support
to IA64 by adding only 8 lines.
This is against tip/master since tip has some changes to
arch/x86/include/asm/dma-mapping.h.
The changes since the first version are
- fixed a bug that dma_attrs is not passed properly (thanks to Arnd
Bergmann).
- used a new name, dma-mapping-common.h, instead of dma-mapping.h
(suggested by Arnd Bergmann).
- added Joerg's Acked-by
=
arch/ia64/Kconfig | 1 +
arch/ia64/include/asm/dma-mapping.h | 110 ++----------------
arch/x86/Kconfig | 1 +
arch/x86/include/asm/dma-mapping.h | 174 +---------------------------
include/asm-generic/dma-mapping-common.h | 190 ++++++++++++++++++++++++++++++
lib/dma-debug.c | 82 ++++++++------
6 files changed, 252 insertions(+), 306 deletions(-)
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH -tip 1/5] add asm-generic/dma-mappig-common.h
2009-05-15 3:55 [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
@ 2009-05-15 3:55 ` FUJITA Tomonori
2009-05-15 12:05 ` Arnd Bergmann
2009-05-15 3:55 ` [PATCH -tip 2/5] x86: use asm-generic/dma-mapping-common.h FUJITA Tomonori
` (5 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-15 3:55 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, tony.luck, linux-ia64, fujita.tomonori, arnd, joerg.roedel
This header file provides some mapping function definitions that the
users of struct dma_map_ops can use.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
---
include/asm-generic/dma-mapping-common.h | 190 ++++++++++++++++++++++++++++++
1 files changed, 190 insertions(+), 0 deletions(-)
create mode 100644 include/asm-generic/dma-mapping-common.h
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
new file mode 100644
index 0000000..5406a60
--- /dev/null
+++ b/include/asm-generic/dma-mapping-common.h
@@ -0,0 +1,190 @@
+#ifndef _ASM_GENERIC_DMA_MAPPING_H
+#define _ASM_GENERIC_DMA_MAPPING_H
+
+#include <linux/kmemcheck.h>
+#include <linux/scatterlist.h>
+#include <linux/dma-debug.h>
+#include <linux/dma-attrs.h>
+
+static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,
+ size_t size,
+ enum dma_data_direction dir,
+ struct dma_attrs *attrs)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+ dma_addr_t addr;
+
+ kmemcheck_mark_initialized(ptr, size);
+ BUG_ON(!valid_dma_direction(dir));
+ addr = ops->map_page(dev, virt_to_page(ptr),
+ (unsigned long)ptr & ~PAGE_MASK, size,
+ dir, attrs);
+ debug_dma_map_page(dev, virt_to_page(ptr),
+ (unsigned long)ptr & ~PAGE_MASK, size,
+ dir, addr, true);
+ return addr;
+}
+
+static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr,
+ size_t size,
+ enum dma_data_direction dir,
+ struct dma_attrs *attrs)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+
+ BUG_ON(!valid_dma_direction(dir));
+ if (ops->unmap_page)
+ ops->unmap_page(dev, addr, size, dir, attrs);
+ debug_dma_unmap_page(dev, addr, size, dir, true);
+}
+
+static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
+ int nents, enum dma_data_direction dir,
+ struct dma_attrs *attrs)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+ int i, ents;
+ struct scatterlist *s;
+
+ for_each_sg(sg, s, nents, i)
+ kmemcheck_mark_initialized(sg_virt(s), s->length);
+ BUG_ON(!valid_dma_direction(dir));
+ ents = ops->map_sg(dev, sg, nents, dir, attrs);
+ debug_dma_map_sg(dev, sg, nents, ents, dir);
+
+ return ents;
+}
+
+static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg,
+ int nents, enum dma_data_direction dir,
+ struct dma_attrs *attrs)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+
+ BUG_ON(!valid_dma_direction(dir));
+ debug_dma_unmap_sg(dev, sg, nents, dir);
+ if (ops->unmap_sg)
+ ops->unmap_sg(dev, sg, nents, dir, attrs);
+}
+
+static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
+ size_t offset, size_t size,
+ enum dma_data_direction dir)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+ dma_addr_t addr;
+
+ kmemcheck_mark_initialized(page_address(page) + offset, size);
+ BUG_ON(!valid_dma_direction(dir));
+ addr = ops->map_page(dev, page, offset, size, dir, NULL);
+ debug_dma_map_page(dev, page, offset, size, dir, addr, false);
+
+ return addr;
+}
+
+static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
+ size_t size, enum dma_data_direction dir)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+
+ BUG_ON(!valid_dma_direction(dir));
+ if (ops->unmap_page)
+ ops->unmap_page(dev, addr, size, dir, NULL);
+ debug_dma_unmap_page(dev, addr, size, dir, false);
+}
+
+static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr,
+ size_t size,
+ enum dma_data_direction dir)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+
+ BUG_ON(!valid_dma_direction(dir));
+ if (ops->sync_single_for_cpu)
+ ops->sync_single_for_cpu(dev, addr, size, dir);
+ debug_dma_sync_single_for_cpu(dev, addr, size, dir);
+ flush_write_buffers();
+}
+
+static inline void dma_sync_single_for_device(struct device *dev,
+ dma_addr_t addr, size_t size,
+ enum dma_data_direction dir)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+
+ BUG_ON(!valid_dma_direction(dir));
+ if (ops->sync_single_for_device)
+ ops->sync_single_for_device(dev, addr, size, dir);
+ debug_dma_sync_single_for_device(dev, addr, size, dir);
+ flush_write_buffers();
+}
+
+static inline void dma_sync_single_range_for_cpu(struct device *dev,
+ dma_addr_t addr,
+ unsigned long offset,
+ size_t size,
+ enum dma_data_direction dir)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+
+ BUG_ON(!valid_dma_direction(dir));
+ if (ops->sync_single_range_for_cpu) {
+ ops->sync_single_range_for_cpu(dev, addr, offset, size, dir);
+ debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
+
+ flush_write_buffers();
+ } else
+ dma_sync_single_for_cpu(dev, addr, size, dir);
+}
+
+static inline void dma_sync_single_range_for_device(struct device *dev,
+ dma_addr_t addr,
+ unsigned long offset,
+ size_t size,
+ enum dma_data_direction dir)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+
+ BUG_ON(!valid_dma_direction(dir));
+ if (ops->sync_single_range_for_device) {
+ ops->sync_single_range_for_device(dev, addr, offset, size, dir);
+ debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
+
+ flush_write_buffers();
+ } else
+ dma_sync_single_for_device(dev, addr, size, dir);
+}
+
+static inline void
+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
+ int nelems, enum dma_data_direction dir)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+
+ BUG_ON(!valid_dma_direction(dir));
+ if (ops->sync_sg_for_cpu)
+ ops->sync_sg_for_cpu(dev, sg, nelems, dir);
+ debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir);
+ flush_write_buffers();
+}
+
+static inline void
+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
+ int nelems, enum dma_data_direction dir)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+
+ BUG_ON(!valid_dma_direction(dir));
+ if (ops->sync_sg_for_device)
+ ops->sync_sg_for_device(dev, sg, nelems, dir);
+ debug_dma_sync_sg_for_device(dev, sg, nelems, dir);
+
+ flush_write_buffers();
+}
+
+#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)
+#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL)
+#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL)
+#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL)
+
+#endif
--
1.6.0.6
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH -tip 2/5] x86: use asm-generic/dma-mapping-common.h
2009-05-15 3:55 [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
2009-05-15 3:55 ` [PATCH -tip 1/5] add asm-generic/dma-mappig-common.h FUJITA Tomonori
@ 2009-05-15 3:55 ` FUJITA Tomonori
2009-05-28 7:20 ` Andrew Morton
2009-05-15 3:55 ` [PATCH -tip 3/5] ia64: " FUJITA Tomonori
` (4 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-15 3:55 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, tony.luck, linux-ia64, fujita.tomonori, arnd, joerg.roedel
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/Kconfig | 1 +
arch/x86/include/asm/dma-mapping.h | 174 +-----------------------------------
2 files changed, 3 insertions(+), 172 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5f50179..666cb29 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -47,6 +47,7 @@ config X86
select HAVE_KERNEL_BZIP2
select HAVE_KERNEL_LZMA
select HAVE_ARCH_KMEMCHECK
+ select HAVE_DMA_ATTRS
config OUTPUT_FORMAT
string
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 916cbb6..1c3f943 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -33,6 +33,8 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
#endif
}
+#include <asm-generic/dma-mapping-common.h>
+
/* Make sure we keep the same behaviour */
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
@@ -53,178 +55,6 @@ extern int dma_set_mask(struct device *dev, u64 mask);
extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_addr, gfp_t flag);
-static inline dma_addr_t
-dma_map_single(struct device *hwdev, void *ptr, size_t size,
- enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(hwdev);
- dma_addr_t addr;
-
- kmemcheck_mark_initialized(ptr, size);
- BUG_ON(!valid_dma_direction(dir));
- addr = ops->map_page(hwdev, virt_to_page(ptr),
- (unsigned long)ptr & ~PAGE_MASK, size,
- dir, NULL);
- debug_dma_map_page(hwdev, virt_to_page(ptr),
- (unsigned long)ptr & ~PAGE_MASK, size,
- dir, addr, true);
- return addr;
-}
-
-static inline void
-dma_unmap_single(struct device *dev, dma_addr_t addr, size_t size,
- enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(dev);
-
- BUG_ON(!valid_dma_direction(dir));
- if (ops->unmap_page)
- ops->unmap_page(dev, addr, size, dir, NULL);
- debug_dma_unmap_page(dev, addr, size, dir, true);
-}
-
-static inline int
-dma_map_sg(struct device *hwdev, struct scatterlist *sg,
- int nents, enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(hwdev);
- int ents;
-
- struct scatterlist *s;
- int i;
-
- for_each_sg(sg, s, nents, i)
- kmemcheck_mark_initialized(sg_virt(s), s->length);
- BUG_ON(!valid_dma_direction(dir));
- ents = ops->map_sg(hwdev, sg, nents, dir, NULL);
- debug_dma_map_sg(hwdev, sg, nents, ents, dir);
-
- return ents;
-}
-
-static inline void
-dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
- enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(hwdev);
-
- BUG_ON(!valid_dma_direction(dir));
- debug_dma_unmap_sg(hwdev, sg, nents, dir);
- if (ops->unmap_sg)
- ops->unmap_sg(hwdev, sg, nents, dir, NULL);
-}
-
-static inline void
-dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
- size_t size, enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(hwdev);
-
- BUG_ON(!valid_dma_direction(dir));
- if (ops->sync_single_for_cpu)
- ops->sync_single_for_cpu(hwdev, dma_handle, size, dir);
- debug_dma_sync_single_for_cpu(hwdev, dma_handle, size, dir);
- flush_write_buffers();
-}
-
-static inline void
-dma_sync_single_for_device(struct device *hwdev, dma_addr_t dma_handle,
- size_t size, enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(hwdev);
-
- BUG_ON(!valid_dma_direction(dir));
- if (ops->sync_single_for_device)
- ops->sync_single_for_device(hwdev, dma_handle, size, dir);
- debug_dma_sync_single_for_device(hwdev, dma_handle, size, dir);
- flush_write_buffers();
-}
-
-static inline void
-dma_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
- unsigned long offset, size_t size,
- enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(hwdev);
-
- BUG_ON(!valid_dma_direction(dir));
- if (ops->sync_single_range_for_cpu)
- ops->sync_single_range_for_cpu(hwdev, dma_handle, offset,
- size, dir);
- debug_dma_sync_single_range_for_cpu(hwdev, dma_handle,
- offset, size, dir);
- flush_write_buffers();
-}
-
-static inline void
-dma_sync_single_range_for_device(struct device *hwdev, dma_addr_t dma_handle,
- unsigned long offset, size_t size,
- enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(hwdev);
-
- BUG_ON(!valid_dma_direction(dir));
- if (ops->sync_single_range_for_device)
- ops->sync_single_range_for_device(hwdev, dma_handle,
- offset, size, dir);
- debug_dma_sync_single_range_for_device(hwdev, dma_handle,
- offset, size, dir);
- flush_write_buffers();
-}
-
-static inline void
-dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
- int nelems, enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(hwdev);
-
- BUG_ON(!valid_dma_direction(dir));
- if (ops->sync_sg_for_cpu)
- ops->sync_sg_for_cpu(hwdev, sg, nelems, dir);
- debug_dma_sync_sg_for_cpu(hwdev, sg, nelems, dir);
- flush_write_buffers();
-}
-
-static inline void
-dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
- int nelems, enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(hwdev);
-
- BUG_ON(!valid_dma_direction(dir));
- if (ops->sync_sg_for_device)
- ops->sync_sg_for_device(hwdev, sg, nelems, dir);
- debug_dma_sync_sg_for_device(hwdev, sg, nelems, dir);
-
- flush_write_buffers();
-}
-
-static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
- size_t offset, size_t size,
- enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(dev);
- dma_addr_t addr;
-
- kmemcheck_mark_initialized(page_address(page) + offset, size);
- BUG_ON(!valid_dma_direction(dir));
- addr = ops->map_page(dev, page, offset, size, dir, NULL);
- debug_dma_map_page(dev, page, offset, size, dir, addr, false);
-
- return addr;
-}
-
-static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
- size_t size, enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = get_dma_ops(dev);
-
- BUG_ON(!valid_dma_direction(dir));
- if (ops->unmap_page)
- ops->unmap_page(dev, addr, size, dir, NULL);
- debug_dma_unmap_page(dev, addr, size, dir, false);
-}
-
static inline void
dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction dir)
--
1.6.0.6
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH -tip 3/5] ia64: use asm-generic/dma-mapping-common.h
2009-05-15 3:55 [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
2009-05-15 3:55 ` [PATCH -tip 1/5] add asm-generic/dma-mappig-common.h FUJITA Tomonori
2009-05-15 3:55 ` [PATCH -tip 2/5] x86: use asm-generic/dma-mapping-common.h FUJITA Tomonori
@ 2009-05-15 3:55 ` FUJITA Tomonori
2009-05-15 3:55 ` [PATCH -tip 4/5] ia64: add CONFIG_DMA_API_DEBUG support FUJITA Tomonori
` (3 subsequent siblings)
6 siblings, 0 replies; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-15 3:55 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, tony.luck, linux-ia64, fujita.tomonori, arnd, joerg.roedel
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/ia64/include/asm/dma-mapping.h | 102 +---------------------------------
1 files changed, 3 insertions(+), 99 deletions(-)
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index 36c0009..2475c91 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -37,82 +37,10 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-static inline dma_addr_t dma_map_single_attrs(struct device *dev,
- void *caddr, size_t size,
- enum dma_data_direction dir,
- struct dma_attrs *attrs)
-{
- struct dma_map_ops *ops = platform_dma_get_ops(dev);
- return ops->map_page(dev, virt_to_page(caddr),
- (unsigned long)caddr & ~PAGE_MASK, size,
- dir, attrs);
-}
-
-static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t daddr,
- size_t size,
- enum dma_data_direction dir,
- struct dma_attrs *attrs)
-{
- struct dma_map_ops *ops = platform_dma_get_ops(dev);
- ops->unmap_page(dev, daddr, size, dir, attrs);
-}
-
-#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)
-#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL)
-
-static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
- int nents, enum dma_data_direction dir,
- struct dma_attrs *attrs)
-{
- struct dma_map_ops *ops = platform_dma_get_ops(dev);
- return ops->map_sg(dev, sgl, nents, dir, attrs);
-}
-
-static inline void dma_unmap_sg_attrs(struct device *dev,
- struct scatterlist *sgl, int nents,
- enum dma_data_direction dir,
- struct dma_attrs *attrs)
-{
- struct dma_map_ops *ops = platform_dma_get_ops(dev);
- ops->unmap_sg(dev, sgl, nents, dir, attrs);
-}
+#define get_dma_ops(dev) platform_dma_get_ops(dev)
+#define flush_write_buffers()
-#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL)
-#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL)
-
-static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t daddr,
- size_t size,
- enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = platform_dma_get_ops(dev);
- ops->sync_single_for_cpu(dev, daddr, size, dir);
-}
-
-static inline void dma_sync_sg_for_cpu(struct device *dev,
- struct scatterlist *sgl,
- int nents, enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = platform_dma_get_ops(dev);
- ops->sync_sg_for_cpu(dev, sgl, nents, dir);
-}
-
-static inline void dma_sync_single_for_device(struct device *dev,
- dma_addr_t daddr,
- size_t size,
- enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = platform_dma_get_ops(dev);
- ops->sync_single_for_device(dev, daddr, size, dir);
-}
-
-static inline void dma_sync_sg_for_device(struct device *dev,
- struct scatterlist *sgl,
- int nents,
- enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = platform_dma_get_ops(dev);
- ops->sync_sg_for_device(dev, sgl, nents, dir);
-}
+#include <asm-generic/dma-mapping-common.h>
static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr)
{
@@ -120,30 +48,6 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr)
return ops->mapping_error(dev, daddr);
}
-static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
- size_t offset, size_t size,
- enum dma_data_direction dir)
-{
- struct dma_map_ops *ops = platform_dma_get_ops(dev);
- return ops->map_page(dev, page, offset, size, dir, NULL);
-}
-
-static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
- size_t size, enum dma_data_direction dir)
-{
- dma_unmap_single(dev, addr, size, dir);
-}
-
-/*
- * Rest of this file is part of the "Advanced DMA API". Use at your own risk.
- * See Documentation/DMA-API.txt for details.
- */
-
-#define dma_sync_single_range_for_cpu(dev, dma_handle, offset, size, dir) \
- dma_sync_single_for_cpu(dev, dma_handle, size, dir)
-#define dma_sync_single_range_for_device(dev, dma_handle, offset, size, dir) \
- dma_sync_single_for_device(dev, dma_handle, size, dir)
-
static inline int dma_supported(struct device *dev, u64 mask)
{
struct dma_map_ops *ops = platform_dma_get_ops(dev);
--
1.6.0.6
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH -tip 4/5] ia64: add CONFIG_DMA_API_DEBUG support
2009-05-15 3:55 [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
` (2 preceding siblings ...)
2009-05-15 3:55 ` [PATCH -tip 3/5] ia64: " FUJITA Tomonori
@ 2009-05-15 3:55 ` FUJITA Tomonori
2009-05-15 3:55 ` [PATCH -tip 5/5] dma-debug: fix compiler warnings on IA64 FUJITA Tomonori
` (2 subsequent siblings)
6 siblings, 0 replies; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-15 3:55 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, tony.luck, linux-ia64, fujita.tomonori, arnd, joerg.roedel
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/ia64/Kconfig | 1 +
arch/ia64/include/asm/dma-mapping.h | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 294a3b1..170042b 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -28,6 +28,7 @@ config IA64
select HAVE_DMA_ATTRS
select HAVE_KVM
select HAVE_ARCH_TRACEHOOK
+ select HAVE_DMA_API_DEBUG
default y
help
The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index 2475c91..5a61b5c 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -8,6 +8,7 @@
#include <asm/machvec.h>
#include <linux/scatterlist.h>
#include <asm/swiotlb.h>
+#include <linux/dma-debug.h>
#define ARCH_HAS_DMA_GET_REQUIRED_MASK
@@ -24,13 +25,18 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *daddr, gfp_t gfp)
{
struct dma_map_ops *ops = platform_dma_get_ops(dev);
- return ops->alloc_coherent(dev, size, daddr, gfp);
+ void *caddr;
+
+ caddr = ops->alloc_coherent(dev, size, daddr, gfp);
+ debug_dma_alloc_coherent(dev, size, *daddr, caddr);
+ return caddr;
}
static inline void dma_free_coherent(struct device *dev, size_t size,
void *caddr, dma_addr_t daddr)
{
struct dma_map_ops *ops = platform_dma_get_ops(dev);
+ debug_dma_free_coherent(dev, size, caddr, daddr);
ops->free_coherent(dev, size, caddr, daddr);
}
--
1.6.0.6
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH -tip 5/5] dma-debug: fix compiler warnings on IA64
2009-05-15 3:55 [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
` (3 preceding siblings ...)
2009-05-15 3:55 ` [PATCH -tip 4/5] ia64: add CONFIG_DMA_API_DEBUG support FUJITA Tomonori
@ 2009-05-15 3:55 ` FUJITA Tomonori
2009-05-22 10:54 ` [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
2009-05-28 7:20 ` Andrew Morton
6 siblings, 0 replies; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-15 3:55 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, tony.luck, linux-ia64, fujita.tomonori, arnd, joerg.roedel
Hopefully, we don't need such cast in the future (uses int-ll64.h) but
for now we get the following warnings:
lib/dma-debug.c: In function 'debug_dma_dump_mappings':
lib/dma-debug.c:233: warning: format '%Lx' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c:233: warning: format '%Lx' expects type 'long long unsigned int', but argument 8 has type 'u64'
lib/dma-debug.c: In function 'check_unmap':
lib/dma-debug.c:553: warning: format '%016llx' expects type 'long long unsigned int', but argument 6 has type 'u64'
lib/dma-debug.c:553: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c:561: warning: format '%016llx' expects type 'long long unsigned int', but argument 6 has type 'u64'
lib/dma-debug.c:561: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c:561: warning: format '%llu' expects type 'long long unsigned int', but argument 8 has type 'u64'
lib/dma-debug.c:569: warning: format '%016llx' expects type 'long long unsigned int', but argument 6 has type 'u64'
lib/dma-debug.c:569: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c:577: warning: format '%016llx' expects type 'long long unsigned int', but argument 6 has type 'u64'
lib/dma-debug.c:577: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c:598: warning: format '%016llx' expects type 'long long unsigned int', but argument 6 has type 'u64'
lib/dma-debug.c:598: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c: In function 'check_for_illegal_area':
lib/dma-debug.c:634: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c: In function 'check_sync':
lib/dma-debug.c:657: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c:665: warning: format '%016llx' expects type 'long long unsigned int', but argument 6 has type 'u64'
lib/dma-debug.c:665: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c:665: warning: format '%llu' expects type 'long long unsigned int', but argument 8 has type 'u64'
lib/dma-debug.c:665: warning: format '%llu' expects type 'long long unsigned int', but argument 9 has type 'u64'
lib/dma-debug.c:674: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c:688: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
lib/dma-debug.c:698: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'u64'
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
---
lib/dma-debug.c | 82 ++++++++++++++++++++++++++++++++-----------------------
1 files changed, 48 insertions(+), 34 deletions(-)
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index cdd205d..14e0fc2 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -234,7 +234,8 @@ void debug_dma_dump_mappings(struct device *dev)
"%s idx %d P=%Lx D=%Lx L=%Lx %s\n",
type2name[entry->type], idx,
(unsigned long long)entry->paddr,
- entry->dev_addr, entry->size,
+ (unsigned long long)entry->dev_addr,
+ (unsigned long long)entry->size,
dir2name[entry->direction]);
}
}
@@ -553,7 +554,8 @@ static void check_unmap(struct dma_debug_entry *ref)
err_printk(ref->dev, NULL, "DMA-API: device driver tries "
"to free DMA memory it has not allocated "
"[device address=0x%016llx] [size=%llu bytes]\n",
- ref->dev_addr, ref->size);
+ (unsigned long long)ref->dev_addr,
+ (unsigned long long)ref->size);
goto out;
}
@@ -562,7 +564,9 @@ static void check_unmap(struct dma_debug_entry *ref)
"DMA memory with different size "
"[device address=0x%016llx] [map size=%llu bytes] "
"[unmap size=%llu bytes]\n",
- ref->dev_addr, entry->size, ref->size);
+ (unsigned long long)ref->dev_addr,
+ (unsigned long long)entry->size,
+ (unsigned long long)ref->size);
}
if (ref->type != entry->type) {
@@ -570,7 +574,8 @@ static void check_unmap(struct dma_debug_entry *ref)
"DMA memory with wrong function "
"[device address=0x%016llx] [size=%llu bytes] "
"[mapped as %s] [unmapped as %s]\n",
- ref->dev_addr, ref->size,
+ (unsigned long long)ref->dev_addr,
+ (unsigned long long)ref->size,
type2name[entry->type], type2name[ref->type]);
} else if ((entry->type == dma_debug_coherent) &&
(ref->paddr != entry->paddr)) {
@@ -578,7 +583,8 @@ static void check_unmap(struct dma_debug_entry *ref)
"DMA memory with different CPU address "
"[device address=0x%016llx] [size=%llu bytes] "
"[cpu alloc address=%p] [cpu free address=%p]",
- ref->dev_addr, ref->size,
+ (unsigned long long)ref->dev_addr,
+ (unsigned long long)ref->size,
(void *)entry->paddr, (void *)ref->paddr);
}
@@ -599,7 +605,8 @@ static void check_unmap(struct dma_debug_entry *ref)
"DMA memory with different direction "
"[device address=0x%016llx] [size=%llu bytes] "
"[mapped with %s] [unmapped with %s]\n",
- ref->dev_addr, ref->size,
+ (unsigned long long)ref->dev_addr,
+ (unsigned long long)ref->size,
dir2name[entry->direction],
dir2name[ref->direction]);
}
@@ -632,8 +639,9 @@ static void check_for_illegal_area(struct device *dev, void *addr, u64 size)
if (overlap(addr, size, _text, _etext) ||
overlap(addr, size, __start_rodata, __end_rodata))
err_printk(dev, NULL, "DMA-API: device driver maps "
- "memory from kernel text or rodata "
- "[addr=%p] [size=%llu]\n", addr, size);
+ "memory from kernel text or rodata "
+ "[addr=%p] [size=%llu]\n", addr,
+ (unsigned long long)size);
}
static void check_sync(struct device *dev, dma_addr_t addr,
@@ -655,29 +663,33 @@ static void check_sync(struct device *dev, dma_addr_t addr,
if (!entry) {
err_printk(dev, NULL, "DMA-API: device driver tries "
- "to sync DMA memory it has not allocated "
- "[device address=0x%016llx] [size=%llu bytes]\n",
- (unsigned long long)addr, size);
+ "to sync DMA memory it has not allocated "
+ "[device address=0x%016llx] [size=%llu bytes]\n",
+ (unsigned long long)addr, (unsigned long long)size);
goto out;
}
if ((offset + size) > entry->size) {
err_printk(dev, entry, "DMA-API: device driver syncs"
- " DMA memory outside allocated range "
- "[device address=0x%016llx] "
- "[allocation size=%llu bytes] [sync offset=%llu] "
- "[sync size=%llu]\n", entry->dev_addr, entry->size,
- offset, size);
+ " DMA memory outside allocated range "
+ "[device address=0x%016llx] "
+ "[allocation size=%llu bytes] [sync offset=%llu] "
+ "[sync size=%llu]\n",
+ (unsigned long long)entry->dev_addr,
+ (unsigned long long)entry->size,
+ (unsigned long long)offset,
+ (unsigned long long)size);
}
if (direction != entry->direction) {
err_printk(dev, entry, "DMA-API: device driver syncs "
- "DMA memory with different direction "
- "[device address=0x%016llx] [size=%llu bytes] "
- "[mapped with %s] [synced with %s]\n",
- (unsigned long long)addr, entry->size,
- dir2name[entry->direction],
- dir2name[direction]);
+ "DMA memory with different direction "
+ "[device address=0x%016llx] [size=%llu bytes] "
+ "[mapped with %s] [synced with %s]\n",
+ (unsigned long long)addr,
+ (unsigned long long)entry->size,
+ dir2name[entry->direction],
+ dir2name[direction]);
}
if (entry->direction == DMA_BIDIRECTIONAL)
@@ -686,22 +698,24 @@ static void check_sync(struct device *dev, dma_addr_t addr,
if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) &&
!(direction == DMA_TO_DEVICE))
err_printk(dev, entry, "DMA-API: device driver syncs "
- "device read-only DMA memory for cpu "
- "[device address=0x%016llx] [size=%llu bytes] "
- "[mapped with %s] [synced with %s]\n",
- (unsigned long long)addr, entry->size,
- dir2name[entry->direction],
- dir2name[direction]);
+ "device read-only DMA memory for cpu "
+ "[device address=0x%016llx] [size=%llu bytes] "
+ "[mapped with %s] [synced with %s]\n",
+ (unsigned long long)addr,
+ (unsigned long long)entry->size,
+ dir2name[entry->direction],
+ dir2name[direction]);
if (!to_cpu && !(entry->direction == DMA_TO_DEVICE) &&
!(direction == DMA_FROM_DEVICE))
err_printk(dev, entry, "DMA-API: device driver syncs "
- "device write-only DMA memory to device "
- "[device address=0x%016llx] [size=%llu bytes] "
- "[mapped with %s] [synced with %s]\n",
- (unsigned long long)addr, entry->size,
- dir2name[entry->direction],
- dir2name[direction]);
+ "device write-only DMA memory to device "
+ "[device address=0x%016llx] [size=%llu bytes] "
+ "[mapped with %s] [synced with %s]\n",
+ (unsigned long long)addr,
+ (unsigned long long)entry->size,
+ dir2name[entry->direction],
+ dir2name[direction]);
out:
put_hash_bucket(bucket, &flags);
--
1.6.0.6
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH -tip 1/5] add asm-generic/dma-mappig-common.h
2009-05-15 3:55 ` [PATCH -tip 1/5] add asm-generic/dma-mappig-common.h FUJITA Tomonori
@ 2009-05-15 12:05 ` Arnd Bergmann
0 siblings, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2009-05-15 12:05 UTC (permalink / raw)
To: FUJITA Tomonori; +Cc: linux-kernel, mingo, tony.luck, linux-ia64, joerg.roedel
On Friday 15 May 2009, FUJITA Tomonori wrote:
> This header file provides some mapping function definitions that the
> users of struct dma_map_ops can use.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Acked-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip v2 0/5] add common functions for struct dma_map_ops
2009-05-15 3:55 [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
` (4 preceding siblings ...)
2009-05-15 3:55 ` [PATCH -tip 5/5] dma-debug: fix compiler warnings on IA64 FUJITA Tomonori
@ 2009-05-22 10:54 ` FUJITA Tomonori
2009-05-22 10:56 ` Joerg Roedel
2009-05-28 7:20 ` Andrew Morton
6 siblings, 1 reply; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-22 10:54 UTC (permalink / raw)
To: mingo, tony.luck; +Cc: linux-kernel, linux-ia64, arnd, joerg.roedel
On Fri, 15 May 2009 12:55:00 +0900
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> We unified x86 and IA64's handling of multiple dma mapping operations
> (struct dma_map_ops in linux/dma-mapping.h) so we can remove
> duplication in their arch/include/asm/dma-mapping.h.
>
> This patchset adds include/asm-generic/dma-mapping-common.h that
> provides some generic dma mapping function definitions for the users
> of struct dma_map_ops. This enables us to remove about 100 lines. This
> also enables us to easily add CONFIG_DMA_API_DEBUG support, which only
> x86 supports for now. The 4th patch adds CONFIG_DMA_API_DEBUG support
> to IA64 by adding only 8 lines.
>
> This is against tip/master since tip has some changes to
> arch/x86/include/asm/dma-mapping.h.
>
> The changes since the first version are
>
> - fixed a bug that dma_attrs is not passed properly (thanks to Arnd
> Bergmann).
>
> - used a new name, dma-mapping-common.h, instead of dma-mapping.h
> (suggested by Arnd Bergmann).
>
> - added Joerg's Acked-by
>
> =
> arch/ia64/Kconfig | 1 +
> arch/ia64/include/asm/dma-mapping.h | 110 ++----------------
> arch/x86/Kconfig | 1 +
> arch/x86/include/asm/dma-mapping.h | 174 +---------------------------
> include/asm-generic/dma-mapping-common.h | 190 ++++++++++++++++++++++++++++++
> lib/dma-debug.c | 82 ++++++++------
> 6 files changed, 252 insertions(+), 306 deletions(-)
Ping,
Any comments?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip v2 0/5] add common functions for struct dma_map_ops
2009-05-22 10:54 ` [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
@ 2009-05-22 10:56 ` Joerg Roedel
2009-05-22 11:17 ` FUJITA Tomonori
0 siblings, 1 reply; 17+ messages in thread
From: Joerg Roedel @ 2009-05-22 10:56 UTC (permalink / raw)
To: FUJITA Tomonori; +Cc: mingo, tony.luck, linux-kernel, linux-ia64, arnd
On Fri, May 22, 2009 at 07:54:35PM +0900, FUJITA Tomonori wrote:
> On Fri, 15 May 2009 12:55:00 +0900
> FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
>
> > We unified x86 and IA64's handling of multiple dma mapping operations
> > (struct dma_map_ops in linux/dma-mapping.h) so we can remove
> > duplication in their arch/include/asm/dma-mapping.h.
> >
> > This patchset adds include/asm-generic/dma-mapping-common.h that
> > provides some generic dma mapping function definitions for the users
> > of struct dma_map_ops. This enables us to remove about 100 lines. This
> > also enables us to easily add CONFIG_DMA_API_DEBUG support, which only
> > x86 supports for now. The 4th patch adds CONFIG_DMA_API_DEBUG support
> > to IA64 by adding only 8 lines.
> >
> > This is against tip/master since tip has some changes to
> > arch/x86/include/asm/dma-mapping.h.
> >
> > The changes since the first version are
> >
> > - fixed a bug that dma_attrs is not passed properly (thanks to Arnd
> > Bergmann).
> >
> > - used a new name, dma-mapping-common.h, instead of dma-mapping.h
> > (suggested by Arnd Bergmann).
> >
> > - added Joerg's Acked-by
> >
> > =
> > arch/ia64/Kconfig | 1 +
> > arch/ia64/include/asm/dma-mapping.h | 110 ++----------------
> > arch/x86/Kconfig | 1 +
> > arch/x86/include/asm/dma-mapping.h | 174 +---------------------------
> > include/asm-generic/dma-mapping-common.h | 190 ++++++++++++++++++++++++++++++
> > lib/dma-debug.c | 82 ++++++++------
> > 6 files changed, 252 insertions(+), 306 deletions(-)
>
> Ping,
>
> Any comments?
>
I already acked the patches :)
Joerg
--
| Advanced Micro Devices GmbH
Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
System |
Research | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
| Registergericht München, HRB Nr. 43632
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip v2 0/5] add common functions for struct dma_map_ops
2009-05-22 10:56 ` Joerg Roedel
@ 2009-05-22 11:17 ` FUJITA Tomonori
0 siblings, 0 replies; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-22 11:17 UTC (permalink / raw)
To: joerg.roedel
Cc: fujita.tomonori, mingo, tony.luck, linux-kernel, linux-ia64, arnd
On Fri, 22 May 2009 12:56:08 +0200
Joerg Roedel <joerg.roedel@amd.com> wrote:
> On Fri, May 22, 2009 at 07:54:35PM +0900, FUJITA Tomonori wrote:
> > On Fri, 15 May 2009 12:55:00 +0900
> > FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> >
> > > We unified x86 and IA64's handling of multiple dma mapping operations
> > > (struct dma_map_ops in linux/dma-mapping.h) so we can remove
> > > duplication in their arch/include/asm/dma-mapping.h.
> > >
> > > This patchset adds include/asm-generic/dma-mapping-common.h that
> > > provides some generic dma mapping function definitions for the users
> > > of struct dma_map_ops. This enables us to remove about 100 lines. This
> > > also enables us to easily add CONFIG_DMA_API_DEBUG support, which only
> > > x86 supports for now. The 4th patch adds CONFIG_DMA_API_DEBUG support
> > > to IA64 by adding only 8 lines.
> > >
> > > This is against tip/master since tip has some changes to
> > > arch/x86/include/asm/dma-mapping.h.
> > >
> > > The changes since the first version are
> > >
> > > - fixed a bug that dma_attrs is not passed properly (thanks to Arnd
> > > Bergmann).
> > >
> > > - used a new name, dma-mapping-common.h, instead of dma-mapping.h
> > > (suggested by Arnd Bergmann).
> > >
> > > - added Joerg's Acked-by
> > >
> > > =
> > > arch/ia64/Kconfig | 1 +
> > > arch/ia64/include/asm/dma-mapping.h | 110 ++----------------
> > > arch/x86/Kconfig | 1 +
> > > arch/x86/include/asm/dma-mapping.h | 174 +---------------------------
> > > include/asm-generic/dma-mapping-common.h | 190 ++++++++++++++++++++++++++++++
> > > lib/dma-debug.c | 82 ++++++++------
> > > 6 files changed, 252 insertions(+), 306 deletions(-)
> >
> > Ping,
> >
> > Any comments?
> >
>
> I already acked the patches :)
Oops, I kept you CC'ed but asked Ingo and Tony. I should have been
explicit.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip v2 0/5] add common functions for struct dma_map_ops
2009-05-15 3:55 [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
` (5 preceding siblings ...)
2009-05-22 10:54 ` [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
@ 2009-05-28 7:20 ` Andrew Morton
2009-05-28 7:44 ` FUJITA Tomonori
6 siblings, 1 reply; 17+ messages in thread
From: Andrew Morton @ 2009-05-28 7:20 UTC (permalink / raw)
To: FUJITA Tomonori
Cc: linux-kernel, mingo, tony.luck, linux-ia64, arnd, joerg.roedel
On Fri, 15 May 2009 12:55:00 +0900 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> We unified x86 and IA64's handling of multiple dma mapping operations
> (struct dma_map_ops in linux/dma-mapping.h) so we can remove
> duplication in their arch/include/asm/dma-mapping.h.
>
> This patchset adds include/asm-generic/dma-mapping-common.h that
> provides some generic dma mapping function definitions for the users
> of struct dma_map_ops. This enables us to remove about 100 lines. This
> also enables us to easily add CONFIG_DMA_API_DEBUG support, which only
> x86 supports for now. The 4th patch adds CONFIG_DMA_API_DEBUG support
> to IA64 by adding only 8 lines.
>
> This is against tip/master since tip has some changes to
> arch/x86/include/asm/dma-mapping.h.
>
> The changes since the first version are
>
> - fixed a bug that dma_attrs is not passed properly (thanks to Arnd
> Bergmann).
>
> - used a new name, dma-mapping-common.h, instead of dma-mapping.h
> (suggested by Arnd Bergmann).
>
> - added Joerg's Acked-by
>
> =
> arch/ia64/Kconfig | 1 +
> arch/ia64/include/asm/dma-mapping.h | 110 ++----------------
> arch/x86/Kconfig | 1 +
> arch/x86/include/asm/dma-mapping.h | 174 +---------------------------
> include/asm-generic/dma-mapping-common.h | 190 ++++++++++++++++++++++++++++++
> lib/dma-debug.c | 82 ++++++++------
> 6 files changed, 252 insertions(+), 306 deletions(-)
I'm hoping that a suitable merge scheme here would be for me to merge
1/5 into mainline then to send 2/5 to Ingo and 3/5, 4/5 and 5/5 to Tony
for merging. Will that all compile and work?
Alternatively I can merge the lot, with suitable acking.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip 2/5] x86: use asm-generic/dma-mapping-common.h
2009-05-15 3:55 ` [PATCH -tip 2/5] x86: use asm-generic/dma-mapping-common.h FUJITA Tomonori
@ 2009-05-28 7:20 ` Andrew Morton
2009-05-28 7:44 ` FUJITA Tomonori
0 siblings, 1 reply; 17+ messages in thread
From: Andrew Morton @ 2009-05-28 7:20 UTC (permalink / raw)
To: FUJITA Tomonori
Cc: linux-kernel, mingo, tony.luck, linux-ia64, arnd, joerg.roedel
On Fri, 15 May 2009 12:55:02 +0900 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Acked-by: Joerg Roedel <joerg.roedel@amd.com>
>
> ...
>
> /* Make sure we keep the same behaviour */
> static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
> {
> @@ -53,178 +55,6 @@ extern int dma_set_mask(struct device *dev, u64 mask);
> extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
> dma_addr_t *dma_addr, gfp_t flag);
>
> -static inline dma_addr_t
> -dma_map_single(struct device *hwdev, void *ptr, size_t size,
> - enum dma_data_direction dir)
> -{
> - struct dma_map_ops *ops = get_dma_ops(hwdev);
> - dma_addr_t addr;
> -
> - kmemcheck_mark_initialized(ptr, size);
This patch attempts to delete kmemcheck stuff which isn't presently in
linux-next.
So I went ahead and ported the patch, but it'll break if/when kmemcheck
returns.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip v2 0/5] add common functions for struct dma_map_ops
2009-05-28 7:20 ` Andrew Morton
@ 2009-05-28 7:44 ` FUJITA Tomonori
2009-05-28 8:58 ` Ingo Molnar
0 siblings, 1 reply; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-28 7:44 UTC (permalink / raw)
To: akpm
Cc: fujita.tomonori, linux-kernel, mingo, tony.luck, linux-ia64, arnd,
joerg.roedel
Thanks for picking up the patchset,
On Thu, 28 May 2009 00:20:20 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 15 May 2009 12:55:00 +0900 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
>
> > We unified x86 and IA64's handling of multiple dma mapping operations
> > (struct dma_map_ops in linux/dma-mapping.h) so we can remove
> > duplication in their arch/include/asm/dma-mapping.h.
> >
> > This patchset adds include/asm-generic/dma-mapping-common.h that
> > provides some generic dma mapping function definitions for the users
> > of struct dma_map_ops. This enables us to remove about 100 lines. This
> > also enables us to easily add CONFIG_DMA_API_DEBUG support, which only
> > x86 supports for now. The 4th patch adds CONFIG_DMA_API_DEBUG support
> > to IA64 by adding only 8 lines.
> >
> > This is against tip/master since tip has some changes to
> > arch/x86/include/asm/dma-mapping.h.
> >
> > The changes since the first version are
> >
> > - fixed a bug that dma_attrs is not passed properly (thanks to Arnd
> > Bergmann).
> >
> > - used a new name, dma-mapping-common.h, instead of dma-mapping.h
> > (suggested by Arnd Bergmann).
> >
> > - added Joerg's Acked-by
> >
> > =
> > arch/ia64/Kconfig | 1 +
> > arch/ia64/include/asm/dma-mapping.h | 110 ++----------------
> > arch/x86/Kconfig | 1 +
> > arch/x86/include/asm/dma-mapping.h | 174 +---------------------------
> > include/asm-generic/dma-mapping-common.h | 190 ++++++++++++++++++++++++++++++
> > lib/dma-debug.c | 82 ++++++++------
> > 6 files changed, 252 insertions(+), 306 deletions(-)
>
> I'm hoping that a suitable merge scheme here would be for me to merge
> 1/5 into mainline then to send 2/5 to Ingo and 3/5, 4/5 and 5/5 to Tony
> for merging. Will that all compile and work?
Yes, it works. The X86 patch (2/5) and the IA64 patches (3/5, 4/5, and
5/5) can be merged independently. Both depends on the first patch (1/5).
> Alternatively I can merge the lot, with suitable acking.
It would be easier, I think.
Thanks,
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip 2/5] x86: use asm-generic/dma-mapping-common.h
2009-05-28 7:20 ` Andrew Morton
@ 2009-05-28 7:44 ` FUJITA Tomonori
0 siblings, 0 replies; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-28 7:44 UTC (permalink / raw)
To: akpm
Cc: fujita.tomonori, linux-kernel, mingo, tony.luck, linux-ia64, arnd,
joerg.roedel
On Thu, 28 May 2009 00:20:32 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 15 May 2009 12:55:02 +0900 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
>
> > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> > Acked-by: Joerg Roedel <joerg.roedel@amd.com>
> >
> > ...
> >
> > /* Make sure we keep the same behaviour */
> > static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
> > {
> > @@ -53,178 +55,6 @@ extern int dma_set_mask(struct device *dev, u64 mask);
> > extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
> > dma_addr_t *dma_addr, gfp_t flag);
> >
> > -static inline dma_addr_t
> > -dma_map_single(struct device *hwdev, void *ptr, size_t size,
> > - enum dma_data_direction dir)
> > -{
> > - struct dma_map_ops *ops = get_dma_ops(hwdev);
> > - dma_addr_t addr;
> > -
> > - kmemcheck_mark_initialized(ptr, size);
>
> This patch attempts to delete kmemcheck stuff which isn't presently in
> linux-next.
kmemcheck_mark stuff is in the tip tree (this patchset is against the
tip tree).
I rework on this patchset against -mm if you merge all the patches.
>
> So I went ahead and ported the patch, but it'll break if/when kmemcheck
> returns.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip v2 0/5] add common functions for struct dma_map_ops
2009-05-28 7:44 ` FUJITA Tomonori
@ 2009-05-28 8:58 ` Ingo Molnar
2009-05-28 21:37 ` Luck, Tony
0 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2009-05-28 8:58 UTC (permalink / raw)
To: FUJITA Tomonori
Cc: akpm, linux-kernel, tony.luck, linux-ia64, arnd, joerg.roedel
* FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> Thanks for picking up the patchset,
>
> On Thu, 28 May 2009 00:20:20 -0700
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Fri, 15 May 2009 12:55:00 +0900 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> >
> > > We unified x86 and IA64's handling of multiple dma mapping operations
> > > (struct dma_map_ops in linux/dma-mapping.h) so we can remove
> > > duplication in their arch/include/asm/dma-mapping.h.
> > >
> > > This patchset adds include/asm-generic/dma-mapping-common.h that
> > > provides some generic dma mapping function definitions for the users
> > > of struct dma_map_ops. This enables us to remove about 100 lines. This
> > > also enables us to easily add CONFIG_DMA_API_DEBUG support, which only
> > > x86 supports for now. The 4th patch adds CONFIG_DMA_API_DEBUG support
> > > to IA64 by adding only 8 lines.
> > >
> > > This is against tip/master since tip has some changes to
> > > arch/x86/include/asm/dma-mapping.h.
> > >
> > > The changes since the first version are
> > >
> > > - fixed a bug that dma_attrs is not passed properly (thanks to Arnd
> > > Bergmann).
> > >
> > > - used a new name, dma-mapping-common.h, instead of dma-mapping.h
> > > (suggested by Arnd Bergmann).
> > >
> > > - added Joerg's Acked-by
> > >
> > > =
> > > arch/ia64/Kconfig | 1 +
> > > arch/ia64/include/asm/dma-mapping.h | 110 ++----------------
> > > arch/x86/Kconfig | 1 +
> > > arch/x86/include/asm/dma-mapping.h | 174 +---------------------------
> > > include/asm-generic/dma-mapping-common.h | 190 ++++++++++++++++++++++++++++++
> > > lib/dma-debug.c | 82 ++++++++------
> > > 6 files changed, 252 insertions(+), 306 deletions(-)
> >
> > I'm hoping that a suitable merge scheme here would be for me to merge
> > 1/5 into mainline then to send 2/5 to Ingo and 3/5, 4/5 and 5/5 to Tony
> > for merging. Will that all compile and work?
>
> Yes, it works. The X86 patch (2/5) and the IA64 patches (3/5, 4/5, and
> 5/5) can be merged independently. Both depends on the first patch (1/5).
>
>
> > Alternatively I can merge the lot, with suitable acking.
>
> It would be easier, I think.
Yeah, that's certainly fine with me. No sense pulling these apart.
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread
* RE: [PATCH -tip v2 0/5] add common functions for struct dma_map_ops
2009-05-28 8:58 ` Ingo Molnar
@ 2009-05-28 21:37 ` Luck, Tony
2009-05-28 22:57 ` FUJITA Tomonori
0 siblings, 1 reply; 17+ messages in thread
From: Luck, Tony @ 2009-05-28 21:37 UTC (permalink / raw)
To: Ingo Molnar, FUJITA Tomonori
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-ia64@vger.kernel.org, arnd@arndb.de, joerg.roedel@amd.com
> > > Alternatively I can merge the lot, with suitable acking.
> >
> > It would be easier, I think.
>
> Yeah, that's certainly fine with me. No sense pulling these apart.
Part 5/5 (cleaning up long long warnings) is about to be made
irrelevent. I have Matthew Wilcox's patch to switch ia64 over
to using <asm-generic/int-ll64.h> queued up (its in linux-next
already).
Other parts
Acked-by: Tony Luck <tony.luck@intel.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* RE: [PATCH -tip v2 0/5] add common functions for struct dma_map_ops
2009-05-28 21:37 ` Luck, Tony
@ 2009-05-28 22:57 ` FUJITA Tomonori
0 siblings, 0 replies; 17+ messages in thread
From: FUJITA Tomonori @ 2009-05-28 22:57 UTC (permalink / raw)
To: tony.luck
Cc: mingo, fujita.tomonori, akpm, linux-kernel, linux-ia64, arnd,
joerg.roedel
On Thu, 28 May 2009 14:37:37 -0700
"Luck, Tony" <tony.luck@intel.com> wrote:
> > > > Alternatively I can merge the lot, with suitable acking.
> > >
> > > It would be easier, I think.
> >
> > Yeah, that's certainly fine with me. No sense pulling these apart.
>
> Part 5/5 (cleaning up long long warnings) is about to be made
> irrelevent. I have Matthew Wilcox's patch to switch ia64 over
> to using <asm-generic/int-ll64.h> queued up (its in linux-next
> already).
Great! I didn't know that the patch is already in -next (I wrote this
patchset against -tip so I got warnings).
Andrew, please drop the 5/5,
dma-mapping-dma-debug-fix-compiler-warnings-on-ia64.patch in -mm tree.
Thanks,
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2009-05-28 22:58 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15 3:55 [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
2009-05-15 3:55 ` [PATCH -tip 1/5] add asm-generic/dma-mappig-common.h FUJITA Tomonori
2009-05-15 12:05 ` Arnd Bergmann
2009-05-15 3:55 ` [PATCH -tip 2/5] x86: use asm-generic/dma-mapping-common.h FUJITA Tomonori
2009-05-28 7:20 ` Andrew Morton
2009-05-28 7:44 ` FUJITA Tomonori
2009-05-15 3:55 ` [PATCH -tip 3/5] ia64: " FUJITA Tomonori
2009-05-15 3:55 ` [PATCH -tip 4/5] ia64: add CONFIG_DMA_API_DEBUG support FUJITA Tomonori
2009-05-15 3:55 ` [PATCH -tip 5/5] dma-debug: fix compiler warnings on IA64 FUJITA Tomonori
2009-05-22 10:54 ` [PATCH -tip v2 0/5] add common functions for struct dma_map_ops FUJITA Tomonori
2009-05-22 10:56 ` Joerg Roedel
2009-05-22 11:17 ` FUJITA Tomonori
2009-05-28 7:20 ` Andrew Morton
2009-05-28 7:44 ` FUJITA Tomonori
2009-05-28 8:58 ` Ingo Molnar
2009-05-28 21:37 ` Luck, Tony
2009-05-28 22:57 ` FUJITA Tomonori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox