Skip to contentSkip to conversation

STA2X11: patches for pci bridge support

PATCH Superseded Alessandro Rubini 2 participants 6 messages Feb 22, 2012 – Mar 1, 2012

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover STA2X11: patches for pci bridge support

This series is V3 of what I sent on Jan 30th as V2.

Patch 3 is dependent on patch 1 and 2, which are unordered. When I posted V2 of this set, patch 3 was picked up, but compilation failed because of the missing prerequisites. Also, some prototypes changed in the meanwhile and patch 3 was miscompiling in linux-next so it has been correctly dropped.

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       |  367 ++++++++++++++++++++++++++++++++++++
 5 files changed, 409 insertions(+), 7 deletions(-)
 create mode 100644 arch/x86/pci/sta2x11-fixup.c
Signature · 1 line
1.7.7.2
#1 lore raw

PATCH v3 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 a61db6d..1832f0b 100644
@@ -12,6 +12,7 @@ config X86_32
 
 config X86_64
 	def_bool 64BIT
+	select X86_DEV_DMA_OPS
 
 ### Arch settings
 config X86
@@ -2233,6 +2234,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

PATCH v3 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 1832f0b..16a1a7d 100644
@@ -2238,6 +2238,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
#3 lore raw

PATCH v3 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 |  367 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 392 insertions(+), 5 deletions(-)
 create mode 100644 arch/x86/pci/sta2x11-fixup.c
arch/x86/Kconfig +23 -5
index 16a1a7d..fc05ebe 100644
@@ -331,6 +331,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
@@ -462,10 +463,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
 
@@ -505,6 +506,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
@@ -2236,10 +2253,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 +367 -0

367 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#4 lore raw
In reply to Alessandro Rubini
Quoted 19 lines · On Wed, 22 Feb 2012 23:13:57 +0100 Alessandro Rubini <[email protected]> wrote:

This series is V3 of what I sent on Jan 30th as V2.

Patch 3 is dependent on patch 1 and 2, which are unordered. When I posted V2 of this set, patch 3 was picked up, but compilation failed because of the missing prerequisites. Also, some prototypes changed in the meanwhile and patch 3 was miscompiling in linux-next so it has been correctly dropped.

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

Quoted 8 lines
 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       |  367 ++++++++++++++++++++++++++++++++++++
 5 files changed, 409 insertions(+), 7 deletions(-)
 create mode 100644 arch/x86/pci/sta2x11-fixup.c

Ingo, you may as well take the lot of these; they won't clash with other PCI stuff if you take them, but if I take them they may well clash with other x86 stuff.

Thanks,

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#5 lore raw

Hello.

Jesse Barnes wrote on Feb 22nd:

Quoted 3 lines

Ingo, you may as well take the lot of these; they won't clash with other PCI stuff if you take them, but if I take them they may well clash with other x86 stuff.

After this message I got nothing more. I can currently find the patches in linux-next nor pci tree nor tip tree. I've other patches that depend on CONFIG_STA2X11 ready and already reviewed by the maintainers, so I'd like to have some feedback on the base set.

Thank you for your patience.
/alessandro