Skip to contentSkip to conversation

STA2X11: patches for pci bridge support

PATCH In review Alessandro Rubini 1 participant 7 messages Apr 4, 2012 – Apr 12, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v5 cover STA2X11: patches for pci bridge support

This is a repost of the patch set I sent on Mar 13th. Patch 3 is modified to accound for a change in prototype for the swiotlb alloc method.

Patch 3 is dependent on patch 1 and 2, which are unordered. The big patch was picked up from V2 but without its dependencies. It seems like the set can be accepted but was probably forgotten.

Other patches (for the sub-devices in this chip) are being worked on, but they all depend on CONFIG_STA2X11, so I'd like these to be merged. No problems have been reported on V4 and I actually expected Ingo to pull them.

thanks
/alessandro

Summary:

Patch 1: no functional effect (it uses an existing "#ifdef CONFIG_X86_64" in the 32-bit world, so it's not CONFIG_X86_64 but a new name)

Patch 2: no functional effect (it allows some inline functions to not be inline where needed, with a new config symbol).

Patch 3: it's the real content.

History:

V5: rebased on next-20120403, fixed swiotlb change.

V4: rebased on next-20120309, no changes.

V3: rebased on next-20120221. Fixed patch 3 to match new DMA prototypes. Renamed patch 3 as Ingo and Jesse merged it. Added both of them to explicit Cc: list in the email set.

V2: rebased, minor and less-minor changes in patch 3/3.

Alessandro Rubini (3):
x86: introduce CONFIG_X86_DEV_DMA_OPS
x86: introduce CONFIG_X86_DMA_REMAP
x86/PCI: initial support for sta2x11 I/O hub

 arch/x86/Kconfig                   |   34 +++-
 arch/x86/include/asm/device.h      |    4 +-
 arch/x86/include/asm/dma-mapping.h |    9 +-
 arch/x86/pci/Makefile              |    2 +
 arch/x86/pci/sta2x11-fixup.c       |  366 ++++++++++++++++++++++++++++++++++++
 5 files changed, 408 insertions(+), 7 deletions(-)
 create mode 100644 arch/x86/pci/sta2x11-fixup.c
Signature · 1 line
1.7.7.2
#1 lore raw

PATCH v5 1/3 x86: introduce CONFIG_X86_DEV_DMA_OPS

32-bit x86 systems may need their own DMA operations, so add a new config option, which is turned on for 64-bit systems. This patch has no functional effect but it paves the way for supporting the STA2x11 I/O Hub and possibly other chips.

---
 arch/x86/Kconfig                   |    5 +++++
 arch/x86/include/asm/device.h      |    4 ++--
 arch/x86/include/asm/dma-mapping.h |    2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)
arch/x86/Kconfig +5 -0
index b3baf10..a3ce2e7 100644
@@ -12,6 +12,7 @@ config X86_32
 
 config X86_64
 	def_bool 64BIT
+	select X86_DEV_DMA_OPS
 
 ### Arch settings
 config X86
@@ -2249,6 +2250,10 @@ config HAVE_TEXT_POKE_SMP
 	bool
 	select STOP_MACHINE if SMP
 
+config X86_DEV_DMA_OPS
+	bool
+	depends on X86_64
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
arch/x86/include/asm/device.h +2 -2
index 63a2a03..93e1c55 100644
@@ -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 */
arch/x86/include/asm/dma-mapping.h +1 -1
index 4b4331d..09aa473 100644
@@ -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)
Signature · 1 line
1.7.7.2
#2 lore raw

[tip:x86/platform] x86-32: Introduce CONFIG_X86_DEV_DMA_OPS

Commit-ID:  4692d77fc3c8978a36406a3cf9e8b899f86f68f1
Gitweb:     http://git.kernel.org/tip/4692d77fc3c8978a36406a3cf9e8b899f86f68f1
Author:     Alessandro Rubini <[email protected]>
AuthorDate: Wed, 4 Apr 2012 19:39:58 +0200
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 12 Apr 2012 11:09:56 -0700

x86-32: Introduce CONFIG_X86_DEV_DMA_OPS

32-bit x86 systems may need their own DMA operations, so add a new config option, which is turned on for 64-bit systems. This patch has no functional effect but it paves the way for supporting the STA2x11 I/O Hub and possibly other chips.

---
 arch/x86/Kconfig                   |    5 +++++
 arch/x86/include/asm/device.h      |    4 ++--
 arch/x86/include/asm/dma-mapping.h |    2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)
arch/x86/Kconfig +5 -0
index 1d14cc6..07b412a 100644
@@ -12,6 +12,7 @@ config X86_32
 
 config X86_64
 	def_bool 64BIT
+	select X86_DEV_DMA_OPS
 
 ### Arch settings
 config X86
@@ -2215,6 +2216,10 @@ config HAVE_TEXT_POKE_SMP
 	bool
 	select STOP_MACHINE if SMP
 
+config X86_DEV_DMA_OPS
+	bool
+	depends on X86_64
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
arch/x86/include/asm/device.h +2 -2
index 63a2a03..93e1c55 100644
@@ -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 */
arch/x86/include/asm/dma-mapping.h +1 -1
index 4b4331d..09aa473 100644
@@ -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)
#3 lore raw

PATCH v5 2/3 x86: introduce CONFIG_X86_DMA_REMAP

In reply to Alessandro Rubini

The default functions phys_to_dma, dma_to_phys implement identity mapping as fast inline functions. Some systems, however, may need a custom function to implement its own mapping between CPU addresses and device addresses. This new configuration option allows the functions to be external when needed (such as for the ConneXt device)

---
 arch/x86/Kconfig                   |    3 +++
 arch/x86/include/asm/dma-mapping.h |    7 +++++++
 2 files changed, 10 insertions(+), 0 deletions(-)
arch/x86/Kconfig +3 -0
index a3ce2e7..46de79d 100644
@@ -2254,6 +2254,9 @@ config X86_DEV_DMA_OPS
 	bool
 	depends on X86_64
 
+config X86_DMA_REMAP
+	bool
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
arch/x86/include/asm/dma-mapping.h +7 -0
index 09aa473..61c0bd2 100644
@@ -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,
Signature · 1 line
1.7.7.2
#4 lore raw

[tip:x86/platform] x86: Introduce CONFIG_X86_DMA_REMAP

Commit-ID:  f7219a5300ba753b0c762d631763bd878b8bb00c
Gitweb:     http://git.kernel.org/tip/f7219a5300ba753b0c762d631763bd878b8bb00c
Author:     Alessandro Rubini <[email protected]>
AuthorDate: Wed, 4 Apr 2012 19:40:10 +0200
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 12 Apr 2012 11:10:18 -0700

x86: Introduce CONFIG_X86_DMA_REMAP

The default functions phys_to_dma, dma_to_phys implement identity mapping as fast inline functions. Some systems, however, may need a custom function to implement its own mapping between CPU addresses and device addresses. This new configuration option allows the functions to be external when needed (such as for the ConneXt device)

---
 arch/x86/Kconfig                   |    3 +++
 arch/x86/include/asm/dma-mapping.h |    7 +++++++
 2 files changed, 10 insertions(+), 0 deletions(-)
arch/x86/Kconfig +3 -0
index 07b412a..95ca560 100644
@@ -2220,6 +2220,9 @@ config X86_DEV_DMA_OPS
 	bool
 	depends on X86_64
 
+config X86_DMA_REMAP
+	bool
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
arch/x86/include/asm/dma-mapping.h +7 -0
index 09aa473..61c0bd2 100644
@@ -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,
#5 lore raw

PATCH v5 3/3 x86/PCI: initial support for sta2x11 I/O hub

In reply to Alessandro Rubini

The "ConneXt" sta2x11 I/O Hub is a bridge from PCIe to AMBA, and is used as main chipset in some Atom boards. The set of peripherals it exports live in an AMBA bus internal to the chip, so a custom remapping of addresses is needed. This is implemented by fixup calls for the PCI deivices, based on CONFIG_X86_DEV_DMA_OPS and CONFIG_X86_DMA_REMAP .

---
 arch/x86/Kconfig             |   28 +++-
 arch/x86/pci/Makefile        |    2 +
 arch/x86/pci/sta2x11-fixup.c |  366 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 391 insertions(+), 5 deletions(-)
 create mode 100644 arch/x86/pci/sta2x11-fixup.c
arch/x86/Kconfig +23 -5
index 46de79d..16012ba 100644
@@ -332,6 +332,7 @@ config X86_EXTENDED_PLATFORM
 		NUMAQ (IBM/Sequent)
 		RDC R-321x SoC
 		SGI 320/540 (Visual Workstation)
+		STA2X11-based (e.g. Northville)
 		Summit/EXA (IBM x440)
 		Unisys ES7000 IA32 series
 		Moorestown MID devices
@@ -464,10 +465,10 @@ config X86_32_NON_STANDARD
 	depends on X86_32 && SMP
 	depends on X86_EXTENDED_PLATFORM
 	---help---
-	  This option compiles in the NUMAQ, Summit, bigsmp, ES7000, default
-	  subarchitectures.  It is intended for a generic binary kernel.
-	  if you select them all, kernel will probe it one by one. and will
-	  fallback to default.
+	  This option compiles in the NUMAQ, Summit, bigsmp, ES7000, 
+	  STA2X11, default subarchitectures.  It is intended for a generic
+	  binary kernel. If you select them all, kernel will probe it
+	  one by one and will fallback to default.
 
 # Alphabetically sorted list of Non standard 32 bit platforms
 
@@ -507,6 +508,22 @@ config X86_VISWS
 	  A kernel compiled for the Visual Workstation will run on general
 	  PCs as well. See <file:Documentation/sgi-visws.txt> for details.
 
+config STA2X11
+	bool "STA2X11 Companion Chip Support"
+	depends on X86_32_NON_STANDARD && PCI
+	select X86_DEV_DMA_OPS
+	select X86_DMA_REMAP
+	select SWIOTLB
+	select MFD_STA2X11
+	select ARCH_REQUIRE_GPIOLIB
+	default n
+	---help---
+	  This adds support for boards based on the STA2X11 IO-Hub,
+	  a.k.a. "ConneXt". The chip is used in place of the standard
+	  PC chipset, so all "standard" peripherals are missing. If this
+	  option is selected the kernel will still be able to boot on
+	  standard PC machines.
+
 config X86_SUMMIT
 	bool "Summit/EXA (IBM x440)"
 	depends on X86_32_NON_STANDARD
@@ -2252,10 +2269,11 @@ config HAVE_TEXT_POKE_SMP
 
 config X86_DEV_DMA_OPS
 	bool
-	depends on X86_64
+	depends on X86_64 || STA2X11
 
 config X86_DMA_REMAP
 	bool
+	depends on STA2X11
 
 source "net/Kconfig"
 
arch/x86/pci/Makefile +2 -0
index e76e18c..3af5a1e 100644
@@ -11,6 +11,8 @@ obj-$(CONFIG_X86_INTEL_CE)      += ce4100.o
 obj-$(CONFIG_ACPI)		+= acpi.o
 obj-y				+= legacy.o irq.o
 
+obj-$(CONFIG_STA2X11)           += sta2x11-fixup.o
+
 obj-$(CONFIG_X86_VISWS)		+= visws.o
 
 obj-$(CONFIG_X86_NUMAQ)		+= numaq_32.o
arch/x86/pci/sta2x11-fixup.c new file +366 -0

366 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#6 lore raw

[tip:x86/platform] x86, platform: Initial support for sta2x11 I/ O hub

Commit-ID:  83125a3a189ec34fb22a04e8efad69ae6d52674a
Gitweb:     http://git.kernel.org/tip/83125a3a189ec34fb22a04e8efad69ae6d52674a
Author:     Alessandro Rubini <[email protected]>
AuthorDate: Wed, 4 Apr 2012 19:40:21 +0200
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 12 Apr 2012 11:10:30 -0700

x86, platform: Initial support for sta2x11 I/O hub

The "ConneXt" sta2x11 I/O Hub is a bridge from PCIe to AMBA, and is used as main chipset in some Atom boards. The set of peripherals it exports live in an AMBA bus internal to the chip, so a custom remapping of addresses is needed. This is implemented by fixup calls for the PCI deivices, based on CONFIG_X86_DEV_DMA_OPS and CONFIG_X86_DMA_REMAP .

---
 arch/x86/Kconfig             |   28 +++-
 arch/x86/pci/Makefile        |    2 +
 arch/x86/pci/sta2x11-fixup.c |  366 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 391 insertions(+), 5 deletions(-)
arch/x86/Kconfig +23 -5
index 95ca560..f9ed801 100644
@@ -329,6 +329,7 @@ config X86_EXTENDED_PLATFORM
 		NUMAQ (IBM/Sequent)
 		RDC R-321x SoC
 		SGI 320/540 (Visual Workstation)
+		STA2X11-based (e.g. Northville)
 		Summit/EXA (IBM x440)
 		Unisys ES7000 IA32 series
 		Moorestown MID devices
@@ -461,10 +462,10 @@ config X86_32_NON_STANDARD
 	depends on X86_32 && SMP
 	depends on X86_EXTENDED_PLATFORM
 	---help---
-	  This option compiles in the NUMAQ, Summit, bigsmp, ES7000, default
-	  subarchitectures.  It is intended for a generic binary kernel.
-	  if you select them all, kernel will probe it one by one. and will
-	  fallback to default.
+	  This option compiles in the NUMAQ, Summit, bigsmp, ES7000,
+	  STA2X11, default subarchitectures.  It is intended for a generic
+	  binary kernel. If you select them all, kernel will probe it
+	  one by one and will fallback to default.
 
 # Alphabetically sorted list of Non standard 32 bit platforms
 
@@ -504,6 +505,22 @@ config X86_VISWS
 	  A kernel compiled for the Visual Workstation will run on general
 	  PCs as well. See <file:Documentation/sgi-visws.txt> for details.
 
+config STA2X11
+	bool "STA2X11 Companion Chip Support"
+	depends on X86_32_NON_STANDARD && PCI
+	select X86_DEV_DMA_OPS
+	select X86_DMA_REMAP
+	select SWIOTLB
+	select MFD_STA2X11
+	select ARCH_REQUIRE_GPIOLIB
+	default n
+	---help---
+	  This adds support for boards based on the STA2X11 IO-Hub,
+	  a.k.a. "ConneXt". The chip is used in place of the standard
+	  PC chipset, so all "standard" peripherals are missing. If this
+	  option is selected the kernel will still be able to boot on
+	  standard PC machines.
+
 config X86_SUMMIT
 	bool "Summit/EXA (IBM x440)"
 	depends on X86_32_NON_STANDARD
@@ -2218,10 +2235,11 @@ config HAVE_TEXT_POKE_SMP
 
 config X86_DEV_DMA_OPS
 	bool
-	depends on X86_64
+	depends on X86_64 || STA2X11
 
 config X86_DMA_REMAP
 	bool
+	depends on STA2X11
 
 source "net/Kconfig"
 
arch/x86/pci/Makefile +2 -0
index e76e18c..3af5a1e 100644
@@ -11,6 +11,8 @@ obj-$(CONFIG_X86_INTEL_CE)      += ce4100.o
 obj-$(CONFIG_ACPI)		+= acpi.o
 obj-y				+= legacy.o irq.o
 
+obj-$(CONFIG_STA2X11)           += sta2x11-fixup.o
+
 obj-$(CONFIG_X86_VISWS)		+= visws.o
 
 obj-$(CONFIG_X86_NUMAQ)		+= numaq_32.o
arch/x86/pci/sta2x11-fixup.c new file +366 -0

366 lines not on this page · raw message