public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] STA2X11 fixes for next
@ 2012-02-16 10:39 Alessandro Rubini
  2012-02-16 10:40 ` [PATCH 1/3] x86/PCI: change sta2x11-fixup to account for commit aa04651 Alessandro Rubini
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alessandro Rubini @ 2012-02-16 10:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: giancarlo.asnaghi, alan, andrzej.p, mingo, jbarnes

My patch to add sta2x11 initial support has been merged by Ingo Molnar
as commit 60dda96f, with signed-off by Jesse Barnes.  However, it
depended on two config symbols (the patch was 3/3, actually) and
I'm to get the blame for not noting it when Jesse told me he would
merge the 3/3.

Additionally, commit aa04651 by Andrzej Pietrasiewicz changed some
prototypes we use, so stuff is not compiling any more if
CONFIG_STA2X11 is on.

I Cc: all involved parties in all patches.  The commit
messages for the original patches have been reworded to match the fact
that they are going in after sta2x11-fixup.c .  At this point, they
are all bugfix patches.

Alessandro Rubini (3):
  x86/PCI: change sta2x11-fixup to account for commit aa04651
  x86: introduce CONFIG_X86_DEV_DMA_OPS
  x86: introduce CONFIG_X86_DMA_REMAP

 arch/x86/Kconfig                   |   11 +++++++++++
 arch/x86/include/asm/device.h      |    4 ++--
 arch/x86/include/asm/dma-mapping.h |    9 ++++++++-
 arch/x86/pci/sta2x11-fixup.c       |   12 +++++++-----
 4 files changed, 28 insertions(+), 8 deletions(-)

-- 
1.7.7.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] x86/PCI: change sta2x11-fixup to account for commit aa04651
  2012-02-16 10:39 [PATCH 0/3] STA2X11 fixes for next Alessandro Rubini
@ 2012-02-16 10:40 ` Alessandro Rubini
  2012-02-16 10:40 ` [PATCH 2/3] x86: introduce CONFIG_X86_DEV_DMA_OPS Alessandro Rubini
  2012-02-16 10:40 ` [PATCH 3/3] x86: introduce CONFIG_X86_DMA_REMAP Alessandro Rubini
  2 siblings, 0 replies; 4+ messages in thread
From: Alessandro Rubini @ 2012-02-16 10:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: giancarlo.asnaghi, alan, andrzej.p, mingo, jbarnes

Commit aa04651 changed the prototypes for swiotlb methods, so
the sta2x11 fixup file won't compile any more. This fixes our own
prototypes.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
---
 arch/x86/pci/sta2x11-fixup.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/x86/pci/sta2x11-fixup.c b/arch/x86/pci/sta2x11-fixup.c
index f61ce8b..5aaa434 100644
--- a/arch/x86/pci/sta2x11-fixup.c
+++ b/arch/x86/pci/sta2x11-fixup.c
@@ -168,21 +168,23 @@ static dma_addr_t a2p(dma_addr_t a, struct pci_dev *pdev)
 static void *sta2x11_swiotlb_alloc_coherent(struct device *dev,
 					    size_t size,
 					    dma_addr_t *dma_handle,
-					    gfp_t flags)
+					    gfp_t flags,
+					    struct dma_attrs *attrs)
 {
 	void *vaddr;
 
-	vaddr = dma_generic_alloc_coherent(dev, size, dma_handle, flags);
+	vaddr = dma_generic_alloc_coherent(dev, size, dma_handle, flags, attrs);
 	if (!vaddr)
-		vaddr = swiotlb_alloc_coherent(dev, size, dma_handle, flags);
+		vaddr = swiotlb_alloc_coherent(dev, size, dma_handle, flags,
+					       attrs);
 	*dma_handle = p2a(*dma_handle, to_pci_dev(dev));
 	return vaddr;
 }
 
 /* We have our own dma_ops: the same as swiotlb but from alloc (above) */
 static struct dma_map_ops sta2x11_dma_ops = {
-	.alloc_coherent = sta2x11_swiotlb_alloc_coherent,
-	.free_coherent = swiotlb_free_coherent,
+	.alloc = sta2x11_swiotlb_alloc_coherent,
+	.free = swiotlb_free_coherent,
 	.map_page = swiotlb_map_page,
 	.unmap_page = swiotlb_unmap_page,
 	.map_sg = swiotlb_map_sg_attrs,
-- 
1.7.7.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] x86: introduce CONFIG_X86_DEV_DMA_OPS
  2012-02-16 10:39 [PATCH 0/3] STA2X11 fixes for next Alessandro Rubini
  2012-02-16 10:40 ` [PATCH 1/3] x86/PCI: change sta2x11-fixup to account for commit aa04651 Alessandro Rubini
@ 2012-02-16 10:40 ` Alessandro Rubini
  2012-02-16 10:40 ` [PATCH 3/3] x86: introduce CONFIG_X86_DMA_REMAP Alessandro Rubini
  2 siblings, 0 replies; 4+ messages in thread
From: Alessandro Rubini @ 2012-02-16 10:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: giancarlo.asnaghi, alan, andrzej.p, mingo, jbarnes

32-bit x86 systems may need their own DMA operations, so add
a new config option, which is turned on for 64-bit systems and sta2x11.
Core sta2x11 support has already been accepted, but it won't compile
without this option.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
Cc: Alan Cox <alan@linux.intel.com>
---
 arch/x86/Kconfig                   |    6 ++++++
 arch/x86/include/asm/device.h      |    4 ++--
 arch/x86/include/asm/dma-mapping.h |    2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index dd18c2b..5bb23c3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -12,6 +12,7 @@ config X86_32
 
 config X86_64
 	def_bool 64BIT
+	select X86_DEV_DMA_OPS
 
 ### Arch settings
 config X86
@@ -510,6 +511,7 @@ config STA2X11
 	bool "STA2X11 Companion Chip Support"
 	depends on X86_32_NON_STANDARD && PCI
 	select SWIOTLB
+	select X86_DEV_DMA_OPS
 	select MFD_STA2X11
 	select ARCH_REQUIRE_GPIOLIB
 	default n
@@ -2249,6 +2251,10 @@ config HAVE_TEXT_POKE_SMP
 	bool
 	select STOP_MACHINE if SMP
 
+config X86_DEV_DMA_OPS
+	bool
+	depends on X86_64 || STA2X11
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h
index 63a2a03..93e1c55 100644
--- a/arch/x86/include/asm/device.h
+++ b/arch/x86/include/asm/device.h
@@ -5,8 +5,8 @@ struct dev_archdata {
 #ifdef CONFIG_ACPI
 	void	*acpi_handle;
 #endif
-#ifdef CONFIG_X86_64
-struct dma_map_ops *dma_ops;
+#ifdef CONFIG_X86_DEV_DMA_OPS
+	struct dma_map_ops *dma_ops;
 #endif
 #if defined(CONFIG_INTEL_IOMMU) || defined(CONFIG_AMD_IOMMU)
 	void *iommu; /* hook for IOMMU specific extension */
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 4b4331d..09aa473 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -30,7 +30,7 @@ extern struct dma_map_ops *dma_ops;
 
 static inline struct dma_map_ops *get_dma_ops(struct device *dev)
 {
-#ifdef CONFIG_X86_32
+#ifndef CONFIG_X86_DEV_DMA_OPS
 	return dma_ops;
 #else
 	if (unlikely(!dev) || !dev->archdata.dma_ops)
-- 
1.7.7.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] x86: introduce CONFIG_X86_DMA_REMAP
  2012-02-16 10:39 [PATCH 0/3] STA2X11 fixes for next Alessandro Rubini
  2012-02-16 10:40 ` [PATCH 1/3] x86/PCI: change sta2x11-fixup to account for commit aa04651 Alessandro Rubini
  2012-02-16 10:40 ` [PATCH 2/3] x86: introduce CONFIG_X86_DEV_DMA_OPS Alessandro Rubini
@ 2012-02-16 10:40 ` Alessandro Rubini
  2 siblings, 0 replies; 4+ messages in thread
From: Alessandro Rubini @ 2012-02-16 10:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: giancarlo.asnaghi, alan, andrzej.p, mingo, jbarnes

The default functions phys_to_dma, dma_to_phys implement identity
mapping as fast inline functions.  Some systems, however, need a
custom function to implement its own mapping between CPU addresses and
device addresses. This option is needed to support the sta2x11 I/O Hub,
whose support has been accepted but won't compile without this patch.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
Cc: Alan Cox <alan@linux.intel.com>
---
 arch/x86/Kconfig                   |    5 +++++
 arch/x86/include/asm/dma-mapping.h |    7 +++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5bb23c3..5426833 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -512,6 +512,7 @@ config STA2X11
 	depends on X86_32_NON_STANDARD && PCI
 	select SWIOTLB
 	select X86_DEV_DMA_OPS
+	select X86_DMA_REMAP
 	select MFD_STA2X11
 	select ARCH_REQUIRE_GPIOLIB
 	default n
@@ -2255,6 +2256,10 @@ config X86_DEV_DMA_OPS
 	bool
 	depends on X86_64 || STA2X11
 
+config X86_DMA_REMAP
+	bool
+	depends on STA2X11
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 09aa473..61c0bd2 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -62,6 +62,12 @@ extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 					dma_addr_t *dma_addr, gfp_t flag,
 					struct dma_attrs *attrs);
 
+#ifdef CONFIG_X86_DMA_REMAP /* Platform code defines bridge-specific code */
+extern bool dma_capable(struct device *dev, dma_addr_t addr, size_t size);
+extern dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
+extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
+#else
+
 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
 {
 	if (!dev->dma_mask)
@@ -79,6 +85,7 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
 {
 	return daddr;
 }
+#endif /* CONFIG_X86_DMA_REMAP */
 
 static inline void
 dma_cache_sync(struct device *dev, void *vaddr, size_t size,
-- 
1.7.7.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-16 10:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-16 10:39 [PATCH 0/3] STA2X11 fixes for next Alessandro Rubini
2012-02-16 10:40 ` [PATCH 1/3] x86/PCI: change sta2x11-fixup to account for commit aa04651 Alessandro Rubini
2012-02-16 10:40 ` [PATCH 2/3] x86: introduce CONFIG_X86_DEV_DMA_OPS Alessandro Rubini
2012-02-16 10:40 ` [PATCH 3/3] x86: introduce CONFIG_X86_DMA_REMAP Alessandro Rubini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox