2010-02-10 01:40:42

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 00/14] adds include/linux/pci-dma.h

This patch adds include/linux/pci-dma.h that defines the pci_unmap
state API to remove the duplication in architecture implementations:

DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
DECLARE_PCI_UNMAP_LEN(LEN_NAME)
pci_unmap_addr(PTR, ADDR_NAME)
pci_unmap_addr_set(PTR, ADDR_NAME, VAL)
pci_unmap_len(PTR, LEN_NAME)
pci_unmap_len_set(PTR, LEN_NAME, VAL)

This enables us to remove lots of the duplication in architecture
implementations since there are only two ways to define the API.

If architectures define CONFIG_NEED_DMA_MAP_STATE, they get the real
definition of pci_unmap state API. If not, they get the noop
definition.

In the long term, it's better to replace the API with the generic
device model API such as DECLARE_DMA_UNMAP_ADDR. We can map the API to
the generic one (like dma-mapping-compat.h does). This patch also
makes the migration process easier. We can remove this file after the
migration.

It might be simpler to add the API to include/linux/pci.h but looks
it's already too large. We'll remove pci-dma.h after finishing moving
to the generic device model. So I put the API to a separate file.

This is the second version of:

http://marc.info/?l=linux-kernel&m=126572502029999&w=2

=
arch/alpha/Kconfig | 3 +++
arch/alpha/include/asm/pci.h | 14 --------------
arch/arm/Kconfig | 3 +++
arch/arm/include/asm/pci.h | 11 -----------
arch/cris/include/asm/pci.h | 8 --------
arch/frv/include/asm/pci.h | 8 --------
arch/ia64/Kconfig | 3 +++
arch/ia64/include/asm/pci.h | 14 --------------
arch/mips/Kconfig | 4 ++--
arch/mips/include/asm/pci.h | 22 ----------------------
arch/parisc/Kconfig | 3 +++
arch/parisc/include/asm/pci.h | 14 --------------
arch/powerpc/Kconfig | 3 +++
arch/powerpc/include/asm/pci.h | 32 --------------------------------
arch/sh/Kconfig | 3 +++
arch/sh/include/asm/pci.h | 19 -------------------
arch/sparc/Kconfig | 3 +++
arch/sparc/include/asm/pci_32.h | 14 --------------
arch/sparc/include/asm/pci_64.h | 14 --------------
arch/x86/Kconfig | 3 +++
arch/x86/include/asm/pci.h | 28 ----------------------------
arch/xtensa/include/asm/pci.h | 8 --------
include/linux/pci-dma.h | 20 ++++++++++++++++++++
include/linux/pci.h | 1 +
24 files changed, 47 insertions(+), 208 deletions(-)



2010-02-10 01:39:09

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 13/14] cris: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Mikael Starvik <[email protected]>
---
arch/cris/include/asm/pci.h | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/arch/cris/include/asm/pci.h b/arch/cris/include/asm/pci.h
index 730ce40..43cfa0c 100644
--- a/arch/cris/include/asm/pci.h
+++ b/arch/cris/include/asm/pci.h
@@ -44,13 +44,7 @@ struct pci_dev;
*/
#define PCI_DMA_BUS_IS_PHYS (1)

-/* pci_unmap_{page,single} is a nop so... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME) (0)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
-#define pci_unmap_len(PTR, LEN_NAME) (0)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
+#include <linux/pci-dma.h>

#define HAVE_PCI_MMAP
extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
--
1.5.6.5

2010-02-10 01:39:08

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 03/14] alpha: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Ivan Kokshaysky <[email protected]>
Cc: Matt Turner <[email protected]>
---
arch/alpha/Kconfig | 3 +++
arch/alpha/include/asm/pci.h | 14 +-------------
2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index bd7261e..759f49d 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -58,6 +58,9 @@ config ZONE_DMA
bool
default y

+config NEED_DMA_MAP_STATE
+ def_bool y
+
config GENERIC_ISA_DMA
bool
default y
diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index dd8dcab..4765946 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -119,19 +119,7 @@ pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
extern void pci_unmap_single(struct pci_dev *, dma_addr_t, size_t, int);
extern void pci_unmap_page(struct pci_dev *, dma_addr_t, size_t, int);

-/* pci_unmap_{single,page} is not a nop, thus... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
- dma_addr_t ADDR_NAME;
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
- __u32 LEN_NAME;
-#define pci_unmap_addr(PTR, ADDR_NAME) \
- ((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
- (((PTR)->ADDR_NAME) = (VAL))
-#define pci_unmap_len(PTR, LEN_NAME) \
- ((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
- (((PTR)->LEN_NAME) = (VAL))
+#include <linux/pci-dma.h>

/* Map a set of buffers described by scatterlist in streaming mode for
PCI DMA. This is the scatter-gather version of the above
--
1.5.6.5

2010-02-10 01:39:31

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 06/14] ia64: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Tony Luck <[email protected]>
---
arch/ia64/Kconfig | 3 +++
arch/ia64/include/asm/pci.h | 14 +-------------
2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 2d7f56a..15feb68 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -53,6 +53,9 @@ config MMU
bool
default y

+config NEED_DMA_MAP_STATE
+ def_bool y
+
config SWIOTLB
bool

diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 55281aa..4adf227 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -56,19 +56,7 @@ pcibios_penalize_isa_irq (int irq, int active)

#include <asm-generic/pci-dma-compat.h>

-/* pci_unmap_{single,page} is not a nop, thus... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
- dma_addr_t ADDR_NAME;
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
- __u32 LEN_NAME;
-#define pci_unmap_addr(PTR, ADDR_NAME) \
- ((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
- (((PTR)->ADDR_NAME) = (VAL))
-#define pci_unmap_len(PTR, LEN_NAME) \
- ((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
- (((PTR)->LEN_NAME) = (VAL))
+#include <linux/pci-dma.h>

#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
--
1.5.6.5

2010-02-10 01:39:35

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 07/14] mips: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Ralf Baechle <[email protected]>
---
arch/mips/Kconfig | 4 ++--
arch/mips/include/asm/pci.h | 22 +---------------------
2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 591ca0c..29e8692 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -812,9 +812,9 @@ config DMA_COHERENT

config DMA_NONCOHERENT
bool
- select DMA_NEED_PCI_MAP_STATE
+ select NEED_DMA_MAP_STATE

-config DMA_NEED_PCI_MAP_STATE
+config NEED_DMA_MAP_STATE
bool

config SYS_HAS_EARLY_PRINTK
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 5ebf825..9b196f8 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -102,27 +102,7 @@ struct pci_dev;
*/
extern unsigned int PCI_DMA_BUS_IS_PHYS;

-#ifdef CONFIG_DMA_NEED_PCI_MAP_STATE
-
-/* pci_unmap_{single,page} is not a nop, thus... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME;
-#define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
-#define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
-
-#else /* CONFIG_DMA_NEED_PCI_MAP_STATE */
-
-/* pci_unmap_{page,single} is a nop so... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME) (0)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
-#define pci_unmap_len(PTR, LEN_NAME) (0)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
-
-#endif /* CONFIG_DMA_NEED_PCI_MAP_STATE */
+#include <linux/pci-dma.h>

#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
--
1.5.6.5

2010-02-10 01:39:32

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 09/14] powerpc: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
---
arch/powerpc/Kconfig | 3 +++
arch/powerpc/include/asm/pci.h | 32 +-------------------------------
2 files changed, 4 insertions(+), 31 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 181dd84..c816a2c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -645,6 +645,9 @@ config ZONE_DMA
bool
default y

+config NEED_DMA_MAP_STATE
+ def_bool (PPC64 || NOT_COHERENT_CACHE)
+
config GENERIC_ISA_DMA
bool
depends on PPC64 || POWER4 || 6xx && !CPM2
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index b5ea626..4a9991b 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -141,37 +141,7 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,

#define HAVE_PCI_LEGACY 1

-#if defined(CONFIG_PPC64) || defined(CONFIG_NOT_COHERENT_CACHE)
-/*
- * For 64-bit kernels, pci_unmap_{single,page} is not a nop.
- * For 32-bit non-coherent kernels, pci_dma_sync_single_for_cpu() and
- * so on are not nops.
- * and thus...
- */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
- dma_addr_t ADDR_NAME;
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
- __u32 LEN_NAME;
-#define pci_unmap_addr(PTR, ADDR_NAME) \
- ((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
- (((PTR)->ADDR_NAME) = (VAL))
-#define pci_unmap_len(PTR, LEN_NAME) \
- ((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
- (((PTR)->LEN_NAME) = (VAL))
-
-#else /* 32-bit && coherent */
-
-/* pci_unmap_{page,single} is a nop so... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME) (0)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
-#define pci_unmap_len(PTR, LEN_NAME) (0)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
-
-#endif /* CONFIG_PPC64 || CONFIG_NOT_COHERENT_CACHE */
+#include <linux/pci-dma.h>

#ifdef CONFIG_PPC64

--
1.5.6.5

2010-02-10 01:39:45

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 08/14] parisc: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Kyle McMartin <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: James Bottomley <[email protected]>
---
arch/parisc/Kconfig | 3 +++
arch/parisc/include/asm/pci.h | 14 +-------------
2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 524d935..efae9fa 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -96,6 +96,9 @@ config PM
config STACKTRACE_SUPPORT
def_bool y

+config NEED_DMA_MAP_STATE
+ def_bool y
+
config ISA_DMA_API
bool

diff --git a/arch/parisc/include/asm/pci.h b/arch/parisc/include/asm/pci.h
index 64c7aa5..632088d 100644
--- a/arch/parisc/include/asm/pci.h
+++ b/arch/parisc/include/asm/pci.h
@@ -183,19 +183,7 @@ struct pci_bios_ops {
void (*fixup_bus)(struct pci_bus *bus);
};

-/* pci_unmap_{single,page} is not a nop, thus... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
- dma_addr_t ADDR_NAME;
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
- __u32 LEN_NAME;
-#define pci_unmap_addr(PTR, ADDR_NAME) \
- ((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
- (((PTR)->ADDR_NAME) = (VAL))
-#define pci_unmap_len(PTR, LEN_NAME) \
- ((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
- (((PTR)->LEN_NAME) = (VAL))
+#include <linux/pci-dma.h>

/*
** Stuff declared in arch/parisc/kernel/pci.c
--
1.5.6.5

2010-02-10 01:39:48

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 05/14] frv: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: David Howells <[email protected]>
---
arch/frv/include/asm/pci.h | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/arch/frv/include/asm/pci.h b/arch/frv/include/asm/pci.h
index 8c7260a..05db569 100644
--- a/arch/frv/include/asm/pci.h
+++ b/arch/frv/include/asm/pci.h
@@ -43,13 +43,7 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
/* Return the index of the PCI controller for device PDEV. */
#define pci_controller_num(PDEV) (0)

-/* pci_unmap_{page,single} is a nop so... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME) (0)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
-#define pci_unmap_len(PTR, LEN_NAME) (0)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
+#include <linux/pci-dma.h>

#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
--
1.5.6.5

2010-02-10 01:39:28

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 10/14] sh: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Paul Mundt <[email protected]>
---
arch/sh/Kconfig | 3 +++
arch/sh/include/asm/pci.h | 19 +------------------
2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 05cef50..8d90564 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -183,6 +183,9 @@ config DMA_COHERENT
config DMA_NONCOHERENT
def_bool !DMA_COHERENT

+config NEED_DMA_MAP_STATE
+ def_bool DMA_NONCOHERENT
+
source "init/Kconfig"

source "kernel/Kconfig.freezer"
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 1042f7f..991c2a4 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -83,24 +83,7 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
*/
#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)

-/* pci_unmap_{single,page} being a nop depends upon the
- * configuration.
- */
-#ifdef CONFIG_DMA_NONCOHERENT
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME;
-#define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
-#define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
-#else
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME) (0)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
-#define pci_unmap_len(PTR, LEN_NAME) (0)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
-#endif
+#include <linux/pci-dma.h>

#ifdef CONFIG_PCI
/*
--
1.5.6.5

2010-02-10 01:40:52

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 01/14] adds include/linux/pci-dma.h

This patch adds include/linux/pci-dma.h that defines the pci_unmap
state API:

DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
DECLARE_PCI_UNMAP_LEN(LEN_NAME)
pci_unmap_addr(PTR, ADDR_NAME)
pci_unmap_addr_set(PTR, ADDR_NAME, VAL)
pci_unmap_len(PTR, LEN_NAME)
pci_unmap_len_set(PTR, LEN_NAME, VAL)

This enables us to remove lots of the duplication in architecture
implementations since there are only two ways to define the API.

If architectures define CONFIG_NEED_DMA_MAP_STATE, they get the real
definition of pci_unmap state API. If not, they get the noop
definition.

In the long term, it's better to replace the API with the generic
device model API such as DECLARE_DMA_UNMAP_ADDR. We can map the API to
the generic one (like dma-mapping-compat.h does). This patch also
makes the migration process easier. We can remove this file after the
migration.

It might be simpler to add the API to include/linux/pci.h but looks
it's already too large. We'll remove pci-dma.h after finishing moving
to the generic device model. So I put the API to a separate file.

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: [email protected]
Cc: Richard Henderson <[email protected]>
Cc: Ivan Kokshaysky <[email protected]>
Cc: Matt Turner <[email protected]>
Cc: Russell King <[email protected]>
Cc: David Howells <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Kyle McMartin <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: James Bottomley <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mundt <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Chris Zankel <[email protected]>
Cc: Arnd Bergmann <[email protected]>
---
include/linux/pci-dma.h | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
create mode 100644 include/linux/pci-dma.h

diff --git a/include/linux/pci-dma.h b/include/linux/pci-dma.h
new file mode 100644
index 0000000..cfd63ab
--- /dev/null
+++ b/include/linux/pci-dma.h
@@ -0,0 +1,20 @@
+#ifndef _LINUX_PCI_DMA_H
+#define _LINUX_PCI_DMA_H
+
+#ifdef CONFIG_NEED_DMA_MAP_STATE
+#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
+#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME;
+#define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
+#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
+#define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
+#define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
+#else
+#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
+#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
+#define pci_unmap_addr(PTR, ADDR_NAME) (0)
+#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
+#define pci_unmap_len(PTR, LEN_NAME) (0)
+#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
+#endif
+
+#endif
--
1.5.6.5

2010-02-10 01:39:26

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 04/14] arm: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Russell King <[email protected]>
---
arch/arm/Kconfig | 3 +++
arch/arm/include/asm/pci.h | 11 +----------
2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0c9cedc..f4e42dc 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -155,6 +155,9 @@ config ARCH_MAY_HAVE_PC_FDC
config ZONE_DMA
bool

+config NEED_DMA_MAP_STATE
+ def_bool y
+
config GENERIC_ISA_DMA
bool

diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index 226cddd..aea3450 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -30,16 +30,7 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
*/
#define PCI_DMA_BUS_IS_PHYS (1)

-/*
- * Whether pci_unmap_{single,page} is a nop depends upon the
- * configuration.
- */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME;
-#define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
-#define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
+#include <linux/pci-dma.h>

#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
--
1.5.6.5

2010-02-10 01:41:14

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 11/14] sparc: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: David S. Miller <[email protected]>
---
arch/sparc/Kconfig | 3 +++
arch/sparc/include/asm/pci.h | 2 ++
arch/sparc/include/asm/pci_32.h | 14 --------------
arch/sparc/include/asm/pci_64.h | 14 --------------
4 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 4097f6a..6db5136 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -127,6 +127,9 @@ config ZONE_DMA
bool
default y if SPARC32

+config NEED_DMA_MAP_STATE
+ def_bool y
+
config GENERIC_ISA_DMA
bool
default y if SPARC32
diff --git a/arch/sparc/include/asm/pci.h b/arch/sparc/include/asm/pci.h
index d9c031f..5ce773e 100644
--- a/arch/sparc/include/asm/pci.h
+++ b/arch/sparc/include/asm/pci.h
@@ -6,6 +6,8 @@
#include <asm/pci_32.h>
#endif

+#include <linux/pci-dma.h>
+
#include <asm-generic/pci-dma-compat.h>

#endif
diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h
index e769f66..332ac9a 100644
--- a/arch/sparc/include/asm/pci_32.h
+++ b/arch/sparc/include/asm/pci_32.h
@@ -32,20 +32,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)

struct pci_dev;

-/* pci_unmap_{single,page} is not a nop, thus... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
- dma_addr_t ADDR_NAME;
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
- __u32 LEN_NAME;
-#define pci_unmap_addr(PTR, ADDR_NAME) \
- ((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
- (((PTR)->ADDR_NAME) = (VAL))
-#define pci_unmap_len(PTR, LEN_NAME) \
- ((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
- (((PTR)->LEN_NAME) = (VAL))
-
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat,
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h
index b0576df..5312782 100644
--- a/arch/sparc/include/asm/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
@@ -32,20 +32,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
*/
#define PCI_DMA_BUS_IS_PHYS (0)

-/* pci_unmap_{single,page} is not a nop, thus... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
- dma_addr_t ADDR_NAME;
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
- __u32 LEN_NAME;
-#define pci_unmap_addr(PTR, ADDR_NAME) \
- ((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
- (((PTR)->ADDR_NAME) = (VAL))
-#define pci_unmap_len(PTR, LEN_NAME) \
- ((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
- (((PTR)->LEN_NAME) = (VAL))
-
/* PCI IOMMU mapping bypass support. */

/* PCI 64-bit addressing works for all slots on all controller
--
1.5.6.5

2010-02-10 01:39:24

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 02/14] x86: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: [email protected]
---
arch/x86/Kconfig | 3 +++
arch/x86/include/asm/pci.h | 30 ++----------------------------
2 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 15c1c09..46da6ce 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -100,6 +100,9 @@ config ZONE_DMA
config SBUS
bool

+config NEED_DMA_MAP_STATE
+ def_bool (X86_64 || DMAR || DMA_API_DEBUG)
+
config GENERIC_ISA_DMA
def_bool y

diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index ada8c20..d9bef0a 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -90,34 +90,6 @@ extern void pci_iommu_alloc(void);

#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)

-#if defined(CONFIG_X86_64) || defined(CONFIG_DMAR) || defined(CONFIG_DMA_API_DEBUG)
-
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
- dma_addr_t ADDR_NAME;
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
- __u32 LEN_NAME;
-#define pci_unmap_addr(PTR, ADDR_NAME) \
- ((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
- (((PTR)->ADDR_NAME) = (VAL))
-#define pci_unmap_len(PTR, LEN_NAME) \
- ((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
- (((PTR)->LEN_NAME) = (VAL))
-
-#else
-
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME[0];
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) unsigned LEN_NAME[0];
-#define pci_unmap_addr(PTR, ADDR_NAME) sizeof((PTR)->ADDR_NAME)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
- do { break; } while (pci_unmap_addr(PTR, ADDR_NAME))
-#define pci_unmap_len(PTR, LEN_NAME) sizeof((PTR)->LEN_NAME)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
- do { break; } while (pci_unmap_len(PTR, LEN_NAME))
-
-#endif
-
#endif /* __KERNEL__ */

#ifdef CONFIG_X86_64
@@ -127,6 +99,8 @@ extern void pci_iommu_alloc(void);
/* implement the pci_ DMA API in terms of the generic device dma_ one */
#include <asm-generic/pci-dma-compat.h>

+#include <linux/pci-dma.h>
+
/* generic pci stuff */
#include <asm-generic/pci.h>
#define PCIBIOS_MAX_MEM_32 0xffffffff
--
1.5.6.5

2010-02-10 01:41:38

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 12/14] xtensa: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Chris Zankel <[email protected]>
---
arch/xtensa/include/asm/pci.h | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/arch/xtensa/include/asm/pci.h b/arch/xtensa/include/asm/pci.h
index 66410ac..f3f0cf3 100644
--- a/arch/xtensa/include/asm/pci.h
+++ b/arch/xtensa/include/asm/pci.h
@@ -56,13 +56,7 @@ struct pci_dev;

#define PCI_DMA_BUS_IS_PHYS (1)

-/* pci_unmap_{page,single} is a no-op, so */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME) (0)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
-#define pci_ubnmap_len(PTR, LEN_NAME) (0)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
+#include <linux/pci-dma.h>

/* Map a range of PCI memory or I/O space for a device into user space */
int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
--
1.5.6.5

2010-02-10 01:39:06

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH v2 -mm 14/14] add linux/pci-dma.h to linux/pci.h

All the architectures properly set NEED_DMA_MAP_STATE now so we can
safely add linux/pci-dma.h to linux/pci.h and remove the
linux/pci-dma.h inclusion in arch's asm/pci.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Arnd Bergmann <[email protected]>
---
arch/alpha/include/asm/pci.h | 2 --
arch/arm/include/asm/pci.h | 2 --
arch/cris/include/asm/pci.h | 2 --
arch/frv/include/asm/pci.h | 2 --
arch/ia64/include/asm/pci.h | 2 --
arch/mips/include/asm/pci.h | 2 --
arch/parisc/include/asm/pci.h | 2 --
arch/powerpc/include/asm/pci.h | 2 --
arch/sh/include/asm/pci.h | 2 --
arch/sparc/include/asm/pci.h | 2 --
arch/x86/include/asm/pci.h | 2 --
arch/xtensa/include/asm/pci.h | 2 --
include/linux/pci.h | 1 +
13 files changed, 1 insertions(+), 24 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index 4765946..e1846ba 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -119,8 +119,6 @@ pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
extern void pci_unmap_single(struct pci_dev *, dma_addr_t, size_t, int);
extern void pci_unmap_page(struct pci_dev *, dma_addr_t, size_t, int);

-#include <linux/pci-dma.h>
-
/* Map a set of buffers described by scatterlist in streaming mode for
PCI DMA. This is the scatter-gather version of the above
pci_map_single interface. Here the scatter gather list elements
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index aea3450..4798011 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -30,8 +30,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
*/
#define PCI_DMA_BUS_IS_PHYS (1)

-#include <linux/pci-dma.h>
-
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat,
diff --git a/arch/cris/include/asm/pci.h b/arch/cris/include/asm/pci.h
index 43cfa0c..9f1cd56 100644
--- a/arch/cris/include/asm/pci.h
+++ b/arch/cris/include/asm/pci.h
@@ -44,8 +44,6 @@ struct pci_dev;
*/
#define PCI_DMA_BUS_IS_PHYS (1)

-#include <linux/pci-dma.h>
-
#define HAVE_PCI_MMAP
extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine);
diff --git a/arch/frv/include/asm/pci.h b/arch/frv/include/asm/pci.h
index 05db569..0d59979 100644
--- a/arch/frv/include/asm/pci.h
+++ b/arch/frv/include/asm/pci.h
@@ -43,8 +43,6 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
/* Return the index of the PCI controller for device PDEV. */
#define pci_controller_num(PDEV) (0)

-#include <linux/pci-dma.h>
-
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat,
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 4adf227..73b5f78 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -56,8 +56,6 @@ pcibios_penalize_isa_irq (int irq, int active)

#include <asm-generic/pci-dma-compat.h>

-#include <linux/pci-dma.h>
-
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat,
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 9b196f8..3beea14 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -102,8 +102,6 @@ struct pci_dev;
*/
extern unsigned int PCI_DMA_BUS_IS_PHYS;

-#include <linux/pci-dma.h>
-
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat,
diff --git a/arch/parisc/include/asm/pci.h b/arch/parisc/include/asm/pci.h
index 632088d..2242a5c 100644
--- a/arch/parisc/include/asm/pci.h
+++ b/arch/parisc/include/asm/pci.h
@@ -183,8 +183,6 @@ struct pci_bios_ops {
void (*fixup_bus)(struct pci_bus *bus);
};

-#include <linux/pci-dma.h>
-
/*
** Stuff declared in arch/parisc/kernel/pci.c
*/
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 4a9991b..a20a9ad 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -141,8 +141,6 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,

#define HAVE_PCI_LEGACY 1

-#include <linux/pci-dma.h>
-
#ifdef CONFIG_PPC64

/* The PCI address space does not equal the physical memory address
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 991c2a4..8bd952f 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -83,8 +83,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
*/
#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)

-#include <linux/pci-dma.h>
-
#ifdef CONFIG_PCI
/*
* None of the SH PCI controllers support MWI, it is always treated as a
diff --git a/arch/sparc/include/asm/pci.h b/arch/sparc/include/asm/pci.h
index 5ce773e..d9c031f 100644
--- a/arch/sparc/include/asm/pci.h
+++ b/arch/sparc/include/asm/pci.h
@@ -6,8 +6,6 @@
#include <asm/pci_32.h>
#endif

-#include <linux/pci-dma.h>
-
#include <asm-generic/pci-dma-compat.h>

#endif
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index d9bef0a..e1aa5a7 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -99,8 +99,6 @@ extern void pci_iommu_alloc(void);
/* implement the pci_ DMA API in terms of the generic device dma_ one */
#include <asm-generic/pci-dma-compat.h>

-#include <linux/pci-dma.h>
-
/* generic pci stuff */
#include <asm-generic/pci.h>
#define PCIBIOS_MAX_MEM_32 0xffffffff
diff --git a/arch/xtensa/include/asm/pci.h b/arch/xtensa/include/asm/pci.h
index f3f0cf3..4609b0f 100644
--- a/arch/xtensa/include/asm/pci.h
+++ b/arch/xtensa/include/asm/pci.h
@@ -56,8 +56,6 @@ struct pci_dev;

#define PCI_DMA_BUS_IS_PHYS (1)

-#include <linux/pci-dma.h>
-
/* Map a range of PCI memory or I/O space for a device into user space */
int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 4a02d84..67e2158 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -872,6 +872,7 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode,
unsigned int command_bits, bool change_bridge);
/* kmem_cache style wrapper around pci_alloc_consistent() */

+#include <linux/pci-dma.h>
#include <linux/dmapool.h>

#define pci_pool dma_pool
--
1.5.6.5

2010-02-10 06:11:09

by Mikael Starvik

[permalink] [raw]
Subject: RE: [PATCH v2 -mm 13/14] cris: use include/linux/pci-dma.h

Sure, that is ok.

Signed-off-by: Mikael Starvik <[email protected]>

-----Original Message-----
From: FUJITA Tomonori [mailto:[email protected]]
Sent: den 10 februari 2010 02:35
To: [email protected]
Cc: [email protected]; [email protected]; Mikael Starvik
Subject: [PATCH v2 -mm 13/14] cris: use include/linux/pci-dma.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Mikael Starvik <[email protected]>
---
arch/cris/include/asm/pci.h | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/arch/cris/include/asm/pci.h b/arch/cris/include/asm/pci.h
index 730ce40..43cfa0c 100644
--- a/arch/cris/include/asm/pci.h
+++ b/arch/cris/include/asm/pci.h
@@ -44,13 +44,7 @@ struct pci_dev;
*/
#define PCI_DMA_BUS_IS_PHYS (1)

-/* pci_unmap_{page,single} is a nop so... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME) (0)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
-#define pci_unmap_len(PTR, LEN_NAME) (0)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
+#include <linux/pci-dma.h>

#define HAVE_PCI_MMAP
extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
--
1.5.6.5

2010-02-10 06:55:43

by David Miller

[permalink] [raw]
Subject: Re: [PATCH v2 -mm 11/14] sparc: use include/linux/pci-dma.h

From: FUJITA Tomonori <[email protected]>
Date: Wed, 10 Feb 2010 10:34:44 +0900

> Signed-off-by: FUJITA Tomonori <[email protected]>

Acked-by: David S. Miller <[email protected]>

2010-02-10 06:57:53

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 -mm 01/14] adds include/linux/pci-dma.h

On Wednesday 10 February 2010, FUJITA Tomonori wrote:
> This patch adds include/linux/pci-dma.h that defines the pci_unmap
> state API:
>
> DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
> DECLARE_PCI_UNMAP_LEN(LEN_NAME)
> pci_unmap_addr(PTR, ADDR_NAME)
> pci_unmap_addr_set(PTR, ADDR_NAME, VAL)
> pci_unmap_len(PTR, LEN_NAME)
> pci_unmap_len_set(PTR, LEN_NAME, VAL)
> ...
>
> Signed-off-by: FUJITA Tomonori <[email protected]>

Acked-by: Arnd Bergmann <[email protected]>

2010-02-10 06:58:34

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 -mm 14/14] add linux/pci-dma.h to linux/pci.h

On Wednesday 10 February 2010, FUJITA Tomonori wrote:
> All the architectures properly set NEED_DMA_MAP_STATE now so we can
> safely add linux/pci-dma.h to linux/pci.h and remove the
> linux/pci-dma.h inclusion in arch's asm/pci.h
>
> Signed-off-by: FUJITA Tomonori <[email protected]>
> Cc: Arnd Bergmann <[email protected]>

Acked-by: Arnd Bergmann <[email protected]>

2010-02-10 08:49:25

by Paul Mundt

[permalink] [raw]
Subject: Re: [PATCH v2 -mm 10/14] sh: use include/linux/pci-dma.h

On Wed, Feb 10, 2010 at 10:34:43AM +0900, FUJITA Tomonori wrote:
> Signed-off-by: FUJITA Tomonori <[email protected]>
> Cc: Paul Mundt <[email protected]>
> ---
> arch/sh/Kconfig | 3 +++
> arch/sh/include/asm/pci.h | 19 +------------------
> 2 files changed, 4 insertions(+), 18 deletions(-)
>
Looks ok to me.

Acked-by: Paul Mundt <[email protected]>

2010-02-10 11:11:47

by David Howells

[permalink] [raw]
Subject: Re: [PATCH v2 -mm 05/14] frv: use include/linux/pci-dma.h

FUJITA Tomonori <[email protected]> wrote:

> Signed-off-by: FUJITA Tomonori <[email protected]>

Acked-by: David Howells <[email protected]>

2010-02-11 18:49:58

by Matt Turner

[permalink] [raw]
Subject: Re: [PATCH v2 -mm 03/14] alpha: use include/linux/pci-dma.h

On Tue, Feb 9, 2010 at 8:34 PM, FUJITA Tomonori
<[email protected]> wrote:
> Signed-off-by: FUJITA Tomonori <[email protected]>
> Cc: Richard Henderson <[email protected]>
> Cc: Ivan Kokshaysky <[email protected]>
> Cc: Matt Turner <[email protected]>
> ---
> ?arch/alpha/Kconfig ? ? ? ? ? | ? ?3 +++
> ?arch/alpha/include/asm/pci.h | ? 14 +-------------
> ?2 files changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
> index bd7261e..759f49d 100644
> --- a/arch/alpha/Kconfig
> +++ b/arch/alpha/Kconfig
> @@ -58,6 +58,9 @@ config ZONE_DMA
> ? ? ? ?bool
> ? ? ? ?default y
>
> +config NEED_DMA_MAP_STATE
> + ? ? ? def_bool y
> +
> ?config GENERIC_ISA_DMA
> ? ? ? ?bool
> ? ? ? ?default y
> diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
> index dd8dcab..4765946 100644
> --- a/arch/alpha/include/asm/pci.h
> +++ b/arch/alpha/include/asm/pci.h
> @@ -119,19 +119,7 @@ pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
> ?extern void pci_unmap_single(struct pci_dev *, dma_addr_t, size_t, int);
> ?extern void pci_unmap_page(struct pci_dev *, dma_addr_t, size_t, int);
>
> -/* pci_unmap_{single,page} is not a nop, thus... */
> -#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) ? ? ?\
> - ? ? ? dma_addr_t ADDR_NAME;
> -#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) ? ? ? ? ? ? ? ?\
> - ? ? ? __u32 LEN_NAME;
> -#define pci_unmap_addr(PTR, ADDR_NAME) ? ? ? ? ? ? ? ? \
> - ? ? ? ((PTR)->ADDR_NAME)
> -#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) ? ? ? ? ? ? ? ?\
> - ? ? ? (((PTR)->ADDR_NAME) = (VAL))
> -#define pci_unmap_len(PTR, LEN_NAME) ? ? ? ? ? ? ? ? ? \
> - ? ? ? ((PTR)->LEN_NAME)
> -#define pci_unmap_len_set(PTR, LEN_NAME, VAL) ? ? ? ? ?\
> - ? ? ? (((PTR)->LEN_NAME) = (VAL))
> +#include <linux/pci-dma.h>
>
> ?/* Map a set of buffers described by scatterlist in streaming mode for
> ? ?PCI DMA. ?This is the scatter-gather version of the above
> --
> 1.5.6.5
>
>

Acked-by: Matt Turner <[email protected]>

2010-02-12 14:52:17

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH v2 -mm 04/14] arm: use include/linux/pci-dma.h

On Wed, Feb 10, 2010 at 10:34:37AM +0900, FUJITA Tomonori wrote:
> Signed-off-by: FUJITA Tomonori <[email protected]>

Acked-by: Russell King <[email protected]>

2010-02-12 14:52:18

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH v2 -mm 01/14] adds include/linux/pci-dma.h

On Wed, Feb 10, 2010 at 10:34:34AM +0900, FUJITA Tomonori wrote:
> This patch adds include/linux/pci-dma.h that defines the pci_unmap
> state API:
>
> DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
> DECLARE_PCI_UNMAP_LEN(LEN_NAME)
> pci_unmap_addr(PTR, ADDR_NAME)
> pci_unmap_addr_set(PTR, ADDR_NAME, VAL)
> pci_unmap_len(PTR, LEN_NAME)
> pci_unmap_len_set(PTR, LEN_NAME, VAL)
>
> This enables us to remove lots of the duplication in architecture
> implementations since there are only two ways to define the API.
>
> If architectures define CONFIG_NEED_DMA_MAP_STATE, they get the real
> definition of pci_unmap state API. If not, they get the noop
> definition.
>
> In the long term, it's better to replace the API with the generic
> device model API such as DECLARE_DMA_UNMAP_ADDR. We can map the API to
> the generic one (like dma-mapping-compat.h does). This patch also
> makes the migration process easier. We can remove this file after the
> migration.
>
> It might be simpler to add the API to include/linux/pci.h but looks
> it's already too large. We'll remove pci-dma.h after finishing moving
> to the generic device model. So I put the API to a separate file.
>
> Signed-off-by: FUJITA Tomonori <[email protected]>

Acked-by: Russell King <[email protected]>

2010-02-12 15:00:21

by Kyle McMartin

[permalink] [raw]
Subject: Re: [PATCH v2 -mm 08/14] parisc: use include/linux/pci-dma.h

On Wed, Feb 10, 2010 at 10:34:41AM +0900, FUJITA Tomonori wrote:
> Signed-off-by: FUJITA Tomonori <[email protected]>
> Cc: Kyle McMartin <[email protected]>
> Cc: Helge Deller <[email protected]>
> Cc: James Bottomley <[email protected]>

Acked-by: Kyle McMartin <[email protected]>

2010-02-12 15:10:44

by David Howells

[permalink] [raw]
Subject: Re: [PATCH v2 -mm 01/14] adds include/linux/pci-dma.h

FUJITA Tomonori <[email protected]> wrote:

> This patch adds include/linux/pci-dma.h that defines the pci_unmap
> state API:
>
> DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
> DECLARE_PCI_UNMAP_LEN(LEN_NAME)
> pci_unmap_addr(PTR, ADDR_NAME)
> pci_unmap_addr_set(PTR, ADDR_NAME, VAL)
> pci_unmap_len(PTR, LEN_NAME)
> pci_unmap_len_set(PTR, LEN_NAME, VAL)
>
> This enables us to remove lots of the duplication in architecture
> implementations since there are only two ways to define the API.
>
> If architectures define CONFIG_NEED_DMA_MAP_STATE, they get the real
> definition of pci_unmap state API. If not, they get the noop
> definition.
>
> In the long term, it's better to replace the API with the generic
> device model API such as DECLARE_DMA_UNMAP_ADDR. We can map the API to
> the generic one (like dma-mapping-compat.h does). This patch also
> makes the migration process easier. We can remove this file after the
> migration.
>
> It might be simpler to add the API to include/linux/pci.h but looks
> it's already too large. We'll remove pci-dma.h after finishing moving
> to the generic device model. So I put the API to a separate file.
>
> Signed-off-by: FUJITA Tomonori <[email protected]>

Acked-by: David Howells <[email protected]>