Skip to contentSkip to conversation

SWIOTLB for ppc/mpc86xx

PATCH New Becky Bruce 6 participants 27 messages Apr 20, 2009 – Apr 22, 2009

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

cover SWIOTLB for ppc/mpc86xx

This patch series allows the use of swiotlb on mpc86xx, with 85xx support soon to follow. The most notable change here is the addition of addr_needs_map to dma_ops. This is used to tell if a device can reach an address without bounce buffering. I believe that patches will be coming out soon to make dma_ops non-arch-specific, and I expect to see something similar there as well.

I've also changed sg_dma_len to be the same on both 32 and 64-bit. We now look at sg->dma_length in both cases (see patch log).

The dma_window* elements in the pci_controller struct are hoisted out of an #ifdef CONFIG_PPC64 so we can use them to store off information about how much memory is mapped via the inbound pci windows.

A dma-swiotlb.c is created in arch/powerpc/kernel to contain all the platform-specific iotlb code.

Finally, hooks are provided to allow enabling of this feature on 86xx via Kconfig, and a 36-bit device tree for 8641hpcn is provided.

Ye Olde Diffstat:

 arch/powerpc/Kconfig                       |    2 +-
 arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts |  597 ++++++++++++++++++++++++++++
 arch/powerpc/include/asm/dma-mapping.h     |   11 +
 arch/powerpc/include/asm/pci-bridge.h      |    6 +-
 arch/powerpc/include/asm/scatterlist.h     |    6 +-
 arch/powerpc/include/asm/swiotlb.h         |   24 ++
 arch/powerpc/kernel/Makefile               |    1 +
 arch/powerpc/kernel/dma-swiotlb.c          |  161 ++++++++
 arch/powerpc/kernel/dma.c                  |    2 +-
 arch/powerpc/kernel/setup_32.c             |    4 +
 arch/powerpc/sysdev/fsl_pci.c              |    4 +
 11 files changed, 809 insertions(+), 9 deletions(-)

Cheers,
Becky

#1 lore raw

cover enable swiotlb on ppc/86xx

GIT: Please enter your email below.
GIT: Lines beginning in "GIT: " will be removed.
GIT: Consider including an overall diffstat or table of contents
GIT: for the patch you are writing.

#2 lore raw

cover Allow swiotlb use on ppc/mpc86xx

GIT: Please enter your email below.
GIT: Lines beginning in "GIT: " will be removed.
GIT: Consider including an overall diffstat or table of contents
GIT: for the patch you are writing.

#3 lore raw

PATCH 1/5 powerpc: Use sg->dma_length in sg_dma_len() macro on 32-bit

Currently, the 32-bit code uses sg->length instead of sg->dma_lentgh to report sg_dma_len. However, since the default dma code for 32-bit (the dma_direct case) sets dma_length and length to the same thing, we should be able to use dma_length there as well. This gets rid of some 32-vs-64-bit ifdefs, and is needed by the swiotlb code which actually distinguishes between dma_length and length.

---
 arch/powerpc/include/asm/scatterlist.h |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/scatterlist.h +1 -5
index fcf7d55..912bf59 100644
@@ -21,7 +21,7 @@ struct scatterlist {
 	unsigned int offset;
 	unsigned int length;
 
-	/* For TCE support */
+	/* For TCE or SWIOTLB support */
 	dma_addr_t dma_address;
 	u32 dma_length;
 };
@@ -34,11 +34,7 @@ struct scatterlist {
  * is 0.
  */
 #define sg_dma_address(sg)	((sg)->dma_address)
-#ifdef __powerpc64__
 #define sg_dma_len(sg)		((sg)->dma_length)
-#else
-#define sg_dma_len(sg)		((sg)->length)
-#endif
 
 #ifdef __powerpc64__
 #define ISA_DMA_THRESHOLD	(~0UL)
Signature · 1 line
1.6.0.6
#4 lore raw

PATCH 2/5 powerpc: Add 36-bit device tree for mpc8641hpcn

The new dts places most of the devices in physical address space above 32-bits, which allows us to have more than 4GB of RAM present.

---
 arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts |  597 ++++++++++++++++++++++++++++
 1 files changed, 597 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts
arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts new file +597 -0
new file mode 100644
index 0000000..baa3dba
@@ -0,0 +1,597 @@
+/*
+ * MPC8641 HPCN Device Tree Source
+ *
+ * Copyright 2006 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+/dts-v1/;
+
+/ {
+	model = "MPC8641HPCN";
+	compatible = "fsl,mpc8641hpcn";
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	aliases {
+		ethernet0 = &enet0;
+		ethernet1 = &enet1;
+		ethernet2 = &enet2;
+		ethernet3 = &enet3;
+		serial0 = &serial0;
+		serial1 = &serial1;
+		pci0 = &pci0;
+		pci1 = &pci1;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		PowerPC,8641@0 {
+			device_type = "cpu";
+			reg = <0>;
+			d-cache-line-size = <32>;	// 32 bytes
+			i-cache-line-size = <32>;	// 32 bytes
+			d-cache-size = <32768>;		// L1, 32K
+			i-cache-size = <32768>;		// L1, 32K
+			timebase-frequency = <0>;	// 33 MHz, from uboot
+			bus-frequency = <0>;		// From uboot
+			clock-frequency = <0>;		// From uboot
+		};
+		PowerPC,8641@1 {
+			device_type = "cpu";
+			reg = <1>;
+			d-cache-line-size = <32>;	// 32 bytes
+			i-cache-line-size = <32>;	// 32 bytes
+			d-cache-size = <32768>;		// L1, 32K
+			i-cache-size = <32768>;		// L1, 32K
+			timebase-frequency = <0>;	// 33 MHz, from uboot
+			bus-frequency = <0>;		// From uboot
+			clock-frequency = <0>;		// From uboot
+		};
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <0x0 0x00000000 0x0 0x40000000>;	// 1G at 0x0
+	};
+
+	localbus@fffe05000 {
+		#address-cells = <2>;
+		#size-cells = <1>;
+		compatible = "fsl,mpc8641-localbus", "simple-bus";
+		reg = <0x0f 0xffe05000 0x0 0x1000>;
+		interrupts = <19 2>;
+		interrupt-parent = <&mpic>;
+
+		ranges = <0 0 0xf 0xef800000 0x00800000
+			  2 0 0xf 0xffdf8000 0x00008000
+			  3 0 0xf 0xffdf0000 0x00008000>;
+
+		flash@0,0 {
+			compatible = "cfi-flash";
+			reg = <0 0 0x00800000>;
+			bank-width = <2>;
+			device-width = <2>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			partition@0 {
+				label = "kernel";
+				reg = <0x00000000 0x00300000>;
+			};
+			partition@300000 {
+				label = "firmware b";
+				reg = <0x00300000 0x00100000>;
+				read-only;
+			};
+			partition@400000 {
+				label = "fs";
+				reg = <0x00400000 0x00300000>;
+			};
+			partition@700000 {
+				label = "firmware a";
+				reg = <0x00700000 0x00100000>;
+				read-only;
+			};
+		};
+	};
+
+	soc8641@fffe00000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		device_type = "soc";
+		compatible = "simple-bus";
+		ranges = <0x00000000 0x0f 0xffe00000 0x00100000>;
+		reg = <0x0f 0xffe00000 0x0 0x00001000>;	// CCSRBAR
+		bus-frequency = <0>;
+
+		i2c@3000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <0>;
+			compatible = "fsl-i2c";
+			reg = <0x3000 0x100>;
+			interrupts = <43 2>;
+			interrupt-parent = <&mpic>;
+			dfsrr;
+		};
+
+		i2c@3100 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <1>;
+			compatible = "fsl-i2c";
+			reg = <0x3100 0x100>;
+			interrupts = <43 2>;
+			interrupt-parent = <&mpic>;
+			dfsrr;
+		};
+
+		dma@21300 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "fsl,mpc8641-dma", "fsl,eloplus-dma";
+			reg = <0x21300 0x4>;
+			ranges = <0x0 0x21100 0x200>;
+			cell-index = <0>;
+			dma-channel@0 {
+				compatible = "fsl,mpc8641-dma-channel",
+						"fsl,eloplus-dma-channel";
+				reg = <0x0 0x80>;
+				cell-index = <0>;
+				interrupt-parent = <&mpic>;
+				interrupts = <20 2>;
+			};
+			dma-channel@80 {
+				compatible = "fsl,mpc8641-dma-channel",
+						"fsl,eloplus-dma-channel";
+				reg = <0x80 0x80>;
+				cell-index = <1>;
+				interrupt-parent = <&mpic>;
+				interrupts = <21 2>;
+			};
+			dma-channel@100 {
+				compatible = "fsl,mpc8641-dma-channel",
+						"fsl,eloplus-dma-channel";
+				reg = <0x100 0x80>;
+				cell-index = <2>;
+				interrupt-parent = <&mpic>;
+				interrupts = <22 2>;
+			};
+			dma-channel@180 {
+				compatible = "fsl,mpc8641-dma-channel",
+						"fsl,eloplus-dma-channel";
+				reg = <0x180 0x80>;
+				cell-index = <3>;
+				interrupt-parent = <&mpic>;
+				interrupts = <23 2>;
+			};
+		};
+
+		enet0: ethernet@24000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			cell-index = <0>;
+			device_type = "network";
+			model = "TSEC";
+			compatible = "gianfar";
+			reg = <0x24000 0x1000>;
+			ranges = <0x0 0x24000 0x1000>;
+			local-mac-address = [ 00 00 00 00 00 00 ];
+			interrupts = <29 2 30 2 34 2>;
+			interrupt-parent = <&mpic>;
+			tbi-handle = <&tbi0>;
+			phy-handle = <&phy0>;
+			phy-connection-type = "rgmii-id";
+
+			mdio@520 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "fsl,gianfar-mdio";
+				reg = <0x520 0x20>;
+
+				phy0: ethernet-phy@0 {
+					interrupt-parent = <&mpic>;
+					interrupts = <10 1>;
+					reg = <0>;
+					device_type = "ethernet-phy";
+				};
+				phy1: ethernet-phy@1 {
+					interrupt-parent = <&mpic>;
+					interrupts = <10 1>;
+					reg = <1>;
+					device_type = "ethernet-phy";
+				};
+				phy2: ethernet-phy@2 {
+					interrupt-parent = <&mpic>;
+					interrupts = <10 1>;
+					reg = <2>;
+					device_type = "ethernet-phy";
+				};
+				phy3: ethernet-phy@3 {
+					interrupt-parent = <&mpic>;
+					interrupts = <10 1>;
+					reg = <3>;
+					device_type = "ethernet-phy";
+				};
+				tbi0: tbi-phy@11 {
+					reg = <0x11>;
+					device_type = "tbi-phy";
+				};
+			};
+		};
+
+		enet1: ethernet@25000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			cell-index = <1>;
+			device_type = "network";
+			model = "TSEC";
+			compatible = "gianfar";
+			reg = <0x25000 0x1000>;
+			ranges = <0x0 0x25000 0x1000>;
+			local-mac-address = [ 00 00 00 00 00 00 ];
+			interrupts = <35 2 36 2 40 2>;
+			interrupt-parent = <&mpic>;
+			tbi-handle = <&tbi1>;
+			phy-handle = <&phy1>;
+			phy-connection-type = "rgmii-id";
+
+			mdio@520 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "fsl,gianfar-tbi";
+				reg = <0x520 0x20>;
+
+				tbi1: tbi-phy@11 {
+					reg = <0x11>;
+					device_type = "tbi-phy";
+				};
+			};
+		};
+
+		enet2: ethernet@26000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			cell-index = <2>;
+			device_type = "network";
+			model = "TSEC";
+			compatible = "gianfar";
+			reg = <0x26000 0x1000>;
+			ranges = <0x0 0x26000 0x1000>;
+			local-mac-address = [ 00 00 00 00 00 00 ];
+			interrupts = <31 2 32 2 33 2>;
+			interrupt-parent = <&mpic>;
+			tbi-handle = <&tbi2>;
+			phy-handle = <&phy2>;
+			phy-connection-type = "rgmii-id";
+
+			mdio@520 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "fsl,gianfar-tbi";
+				reg = <0x520 0x20>;
+
+				tbi2: tbi-phy@11 {
+					reg = <0x11>;
+					device_type = "tbi-phy";
+				};
+			};
+		};
+
+		enet3: ethernet@27000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			cell-index = <3>;
+			device_type = "network";
+			model = "TSEC";
+			compatible = "gianfar";
+			reg = <0x27000 0x1000>;
+			ranges = <0x0 0x27000 0x1000>;
+			local-mac-address = [ 00 00 00 00 00 00 ];
+			interrupts = <37 2 38 2 39 2>;
+			interrupt-parent = <&mpic>;
+			tbi-handle = <&tbi3>;
+			phy-handle = <&phy3>;
+			phy-connection-type = "rgmii-id";
+
+			mdio@520 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "fsl,gianfar-tbi";
+				reg = <0x520 0x20>;
+
+				tbi3: tbi-phy@11 {
+					reg = <0x11>;
+					device_type = "tbi-phy";
+				};
+			};
+		};
+
+		serial0: serial@4500 {
+			cell-index = <0>;
+			device_type = "serial";
+			compatible = "ns16550";
+			reg = <0x4500 0x100>;
+			clock-frequency = <0>;
+			interrupts = <42 2>;
+			interrupt-parent = <&mpic>;
+		};
+
+		serial1: serial@4600 {
+			cell-index = <1>;
+			device_type = "serial";
+			compatible = "ns16550";
+			reg = <0x4600 0x100>;
+			clock-frequency = <0>;
+			interrupts = <28 2>;
+			interrupt-parent = <&mpic>;
+		};
+
+		mpic: pic@40000 {
+			interrupt-controller;
+			#address-cells = <0>;
+			#interrupt-cells = <2>;
+			reg = <0x40000 0x40000>;
+			compatible = "chrp,open-pic";
+			device_type = "open-pic";
+		};
+
+		global-utilities@e0000 {
+			compatible = "fsl,mpc8641-guts";
+			reg = <0xe0000 0x1000>;
+			fsl,has-rstcr;
+		};
+	};
+
+	pci0: pcie@fffe08000 {
+		cell-index = <0>;
+		compatible = "fsl,mpc8641-pcie";
+		device_type = "pci";
+		#interrupt-cells = <1>;
+		#size-cells = <2>;
+		#address-cells = <3>;
+		reg = <0x0f 0xffe08000 0x0 0x1000>;
+		bus-range = <0x0 0xff>;
+		ranges = <0x02000000 0x0 0xc0000000 0x0c 0x00000000 0x0 0x20000000
+			  0x01000000 0x0 0x00000000 0x0f 0xffc00000 0x0 0x00010000>;
+		clock-frequency = <33333333>;
+		interrupt-parent = <&mpic>;
+		interrupts = <24 2>;
+		interrupt-map-mask = <0xff00 0 0 7>;
+		interrupt-map = <
+			/* IDSEL 0x11 func 0 - PCI slot 1 */
+			0x8800 0 0 1 &mpic 2 1
+			0x8800 0 0 2 &mpic 3 1
+			0x8800 0 0 3 &mpic 4 1
+			0x8800 0 0 4 &mpic 1 1
+
+			/* IDSEL 0x11 func 1 - PCI slot 1 */
+			0x8900 0 0 1 &mpic 2 1
+			0x8900 0 0 2 &mpic 3 1
+			0x8900 0 0 3 &mpic 4 1
+			0x8900 0 0 4 &mpic 1 1
+
+			/* IDSEL 0x11 func 2 - PCI slot 1 */
+			0x8a00 0 0 1 &mpic 2 1
+			0x8a00 0 0 2 &mpic 3 1
+			0x8a00 0 0 3 &mpic 4 1
+			0x8a00 0 0 4 &mpic 1 1
+
+			/* IDSEL 0x11 func 3 - PCI slot 1 */
+			0x8b00 0 0 1 &mpic 2 1
+			0x8b00 0 0 2 &mpic 3 1
+			0x8b00 0 0 3 &mpic 4 1
+			0x8b00 0 0 4 &mpic 1 1
+
+			/* IDSEL 0x11 func 4 - PCI slot 1 */
+			0x8c00 0 0 1 &mpic 2 1
+			0x8c00 0 0 2 &mpic 3 1
+			0x8c00 0 0 3 &mpic 4 1
+			0x8c00 0 0 4 &mpic 1 1
+
+			/* IDSEL 0x11 func 5 - PCI slot 1 */
+			0x8d00 0 0 1 &mpic 2 1
+			0x8d00 0 0 2 &mpic 3 1
+			0x8d00 0 0 3 &mpic 4 1
+			0x8d00 0 0 4 &mpic 1 1
+
+			/* IDSEL 0x11 func 6 - PCI slot 1 */
+			0x8e00 0 0 1 &mpic 2 1
+			0x8e00 0 0 2 &mpic 3 1
+			0x8e00 0 0 3 &mpic 4 1
+			0x8e00 0 0 4 &mpic 1 1
+
+			/* IDSEL 0x11 func 7 - PCI slot 1 */
+			0x8f00 0 0 1 &mpic 2 1
+			0x8f00 0 0 2 &mpic 3 1
+			0x8f00 0 0 3 &mpic 4 1
+			0x8f00 0 0 4 &mpic 1 1
+
+			/* IDSEL 0x12 func 0 - PCI slot 2 */
+			0x9000 0 0 1 &mpic 3 1
+			0x9000 0 0 2 &mpic 4 1
+			0x9000 0 0 3 &mpic 1 1
+			0x9000 0 0 4 &mpic 2 1
+
+			/* IDSEL 0x12 func 1 - PCI slot 2 */
+			0x9100 0 0 1 &mpic 3 1
+			0x9100 0 0 2 &mpic 4 1
+			0x9100 0 0 3 &mpic 1 1
+			0x9100 0 0 4 &mpic 2 1
+
+			/* IDSEL 0x12 func 2 - PCI slot 2 */
+			0x9200 0 0 1 &mpic 3 1
+			0x9200 0 0 2 &mpic 4 1
+			0x9200 0 0 3 &mpic 1 1
+			0x9200 0 0 4 &mpic 2 1
+
+			/* IDSEL 0x12 func 3 - PCI slot 2 */
+			0x9300 0 0 1 &mpic 3 1
+			0x9300 0 0 2 &mpic 4 1
+			0x9300 0 0 3 &mpic 1 1
+			0x9300 0 0 4 &mpic 2 1
+
+			/* IDSEL 0x12 func 4 - PCI slot 2 */
+			0x9400 0 0 1 &mpic 3 1
+			0x9400 0 0 2 &mpic 4 1
+			0x9400 0 0 3 &mpic 1 1
+			0x9400 0 0 4 &mpic 2 1
+
+			/* IDSEL 0x12 func 5 - PCI slot 2 */
+			0x9500 0 0 1 &mpic 3 1
+			0x9500 0 0 2 &mpic 4 1
+			0x9500 0 0 3 &mpic 1 1
+			0x9500 0 0 4 &mpic 2 1
+
+			/* IDSEL 0x12 func 6 - PCI slot 2 */
+			0x9600 0 0 1 &mpic 3 1
+			0x9600 0 0 2 &mpic 4 1
+			0x9600 0 0 3 &mpic 1 1
+			0x9600 0 0 4 &mpic 2 1
+
+			/* IDSEL 0x12 func 7 - PCI slot 2 */
+			0x9700 0 0 1 &mpic 3 1
+			0x9700 0 0 2 &mpic 4 1
+			0x9700 0 0 3 &mpic 1 1
+			0x9700 0 0 4 &mpic 2 1
+
+			// IDSEL 0x1c  USB
+			0xe000 0 0 1 &i8259 12 2
+			0xe100 0 0 2 &i8259 9 2
+			0xe200 0 0 3 &i8259 10 2
+			0xe300 0 0 4 &i8259 11 2
+
+			// IDSEL 0x1d  Audio
+			0xe800 0 0 1 &i8259 6 2
+
+			// IDSEL 0x1e Legacy
+			0xf000 0 0 1 &i8259 7 2
+			0xf100 0 0 1 &i8259 7 2
+
+			// IDSEL 0x1f IDE/SATA
+			0xf800 0 0 1 &i8259 14 2
+			0xf900 0 0 1 &i8259 5 2
+			>;
+
+		pcie@0 {
+			reg = <0 0 0 0 0>;
+			#size-cells = <2>;
+			#address-cells = <3>;
+			device_type = "pci";
+			ranges = <0x02000000 0x0 0xc0000000
+				  0x02000000 0x0 0xc0000000
+				  0x0 0x20000000
+
+				  0x01000000 0x0 0x00000000
+				  0x01000000 0x0 0x00000000
+				  0x0 0x00010000>;
+			uli1575@0 {
+				reg = <0 0 0 0 0>;
+				#size-cells = <2>;
+				#address-cells = <3>;
+				ranges = <0x02000000 0x0 0xc0000000
+					  0x02000000 0x0 0xc0000000
+					  0x0 0x20000000
+					  0x01000000 0x0 0x00000000
+					  0x01000000 0x0 0x00000000
+					  0x0 0x00010000>;
+				isa@1e {
+					device_type = "isa";
+					#interrupt-cells = <2>;
+					#size-cells = <1>;
+					#address-cells = <2>;
+					reg = <0xf000 0 0 0 0>;
+					ranges = <1 0 0x01000000 0 0
+						  0x00001000>;
+					interrupt-parent = <&i8259>;
+
+					i8259: interrupt-controller@20 {
+						reg = <1 0x20 2
+						       1 0xa0 2
+						       1 0x4d0 2>;
+						interrupt-controller;
+						device_type = "interrupt-controller";
+						#address-cells = <0>;
+						#interrupt-cells = <2>;
+						compatible = "chrp,iic";
+						interrupts = <9 2>;
+						interrupt-parent = <&mpic>;
+					};
+
+					i8042@60 {
+						#size-cells = <0>;
+						#address-cells = <1>;
+						reg = <1 0x60 1 1 0x64 1>;
+						interrupts = <1 3 12 3>;
+						interrupt-parent =
+							<&i8259>;
+
+						keyboard@0 {
+							reg = <0>;
+							compatible = "pnpPNP,303";
+						};
+
+						mouse@1 {
+							reg = <1>;
+							compatible = "pnpPNP,f03";
+						};
+					};
+
+					rtc@70 {
+						compatible =
+							"pnpPNP,b00";
+						reg = <1 0x70 2>;
+					};
+
+					gpio@400 {
+						reg = <1 0x400 0x80>;
+					};
+				};
+			};
+		};
+
+	};
+
+	pci1: pcie@fffe09000 {
+		cell-index = <1>;
+		compatible = "fsl,mpc8641-pcie";
+		device_type = "pci";
+		#interrupt-cells = <1>;
+		#size-cells = <2>;
+		#address-cells = <3>;
+		reg = <0x0f 0xffe09000 0x0 0x1000>;
+		bus-range = <0x0 0xff>;
+		ranges = <0x02000000 0x0 0xc0000000 0x0c 0x20000000 0x0 0x20000000
+			  0x01000000 0x0 0x00000000 0x0f 0xffc10000 0x0 0x00010000>;
+		clock-frequency = <33333333>;
+		interrupt-parent = <&mpic>;
+		interrupts = <25 2>;
+		interrupt-map-mask = <0xf800 0 0 7>;
+		interrupt-map = <
+			/* IDSEL 0x0 */
+			0x0000 0 0 1 &mpic 4 1
+			0x0000 0 0 2 &mpic 5 1
+			0x0000 0 0 3 &mpic 6 1
+			0x0000 0 0 4 &mpic 7 1
+			>;
+		pcie@0 {
+			reg = <0 0 0 0 0>;
+			#size-cells = <2>;
+			#address-cells = <3>;
+			device_type = "pci";
+			ranges = <0x02000000 0x0 0xc0000000
+				  0x02000000 0x0 0xc0000000
+				  0x0 0x20000000
+
+				  0x01000000 0x0 0x00000000
+				  0x01000000 0x0 0x00000000
+				  0x0 0x00010000>;
+		};
+	};
+};
Signature · 1 line
1.6.0.6
#5 lore raw

PATCH 3/5 powerpc: make dma_window_* in pci_controller struct avail on 32b

Also, convert them to resource_size_t (which is unsigned long on 64-bit, so it's not a change there).

We will be using these on fsl 32b to indicate the start and size address of memory that the pci controller can actually reach - this is needed to determine if an address requires bounce buffering. For now, initialize them to a standard value; in the near future, the value will be calculated based on how the inbound windows are programmed.

---
 arch/powerpc/include/asm/pci-bridge.h |    6 ++++--
 arch/powerpc/sysdev/fsl_pci.c         |    4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/pci-bridge.h +4 -2
index 84007af..9861258 100644
@@ -140,10 +140,12 @@ struct pci_controller {
 	struct resource	io_resource;
 	struct resource mem_resources[3];
 	int global_number;		/* PCI domain number */
+
+	resource_size_t dma_window_base_cur;
+	resource_size_t dma_window_size;
+
 #ifdef CONFIG_PPC64
 	unsigned long buid;
-	unsigned long dma_window_base_cur;
-	unsigned long dma_window_size;
 
 	void *private_data;
 #endif	/* CONFIG_PPC64 */
arch/powerpc/sysdev/fsl_pci.c +4 -0
index 78021d8..376603d 100644
@@ -152,6 +152,10 @@ static void __init setup_pci_atmu(struct pci_controller *hose,
 	out_be32(&pci->piw[2].piwbar,0x00000000);
 	out_be32(&pci->piw[2].piwar, PIWAR_2G);
 
+	/* Save the base address and size covered by inbound window mappings */
+	hose->dma_window_base_cur = 0x00000000;
+	hose->dma_window_size = 0x80000000;
+
 	iounmap(pci);
 }
 
Signature · 1 line
1.6.0.6
#6 lore raw

PATCH 4/5 powerpc: Add support for swiotlb on 32-bit

This patch includes the basic infrastructure to use swiotlb bounce buffering on 32-bit powerpc. It is not yet enabled on any platforms.

---
 arch/powerpc/Kconfig                   |    2 +-
 arch/powerpc/include/asm/dma-mapping.h |   11 ++
 arch/powerpc/include/asm/swiotlb.h     |   24 +++++
 arch/powerpc/kernel/Makefile           |    1 +
 arch/powerpc/kernel/dma-swiotlb.c      |  161 ++++++++++++++++++++++++++++++++
 arch/powerpc/kernel/dma.c              |    2 +-
 arch/powerpc/kernel/setup_32.c         |    4 +
 7 files changed, 203 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/include/asm/swiotlb.h
 create mode 100644 arch/powerpc/kernel/dma-swiotlb.c
arch/powerpc/Kconfig +1 -1
index 5b50e1a..197f6a3 100644
@@ -294,7 +294,7 @@ config IOMMU_HELPER
 
 config PPC_NEED_DMA_SYNC_OPS
 	def_bool y
-	depends on NOT_COHERENT_CACHE
+	depends on (NOT_COHERENT_CACHE || SWIOTLB)
 
 config HOTPLUG_CPU
 	bool "Support for enabling/disabling CPUs"
arch/powerpc/include/asm/dma-mapping.h +11 -0
index c69f2b5..71bbc17 100644
@@ -15,9 +15,18 @@
 #include <linux/scatterlist.h>
 #include <linux/dma-attrs.h>
 #include <asm/io.h>
+#include <asm/swiotlb.h>
 
 #define DMA_ERROR_CODE		(~(dma_addr_t)0x0)
 
+/* Some dma direct funcs must be visible for use in other dma_ops */
+extern void *dma_direct_alloc_coherent(struct device *dev, size_t size,
+				       dma_addr_t *dma_handle, gfp_t flag);
+extern void dma_direct_free_coherent(struct device *dev, size_t size,
+				     void *vaddr, dma_addr_t dma_handle);
+
+extern unsigned long get_dma_direct_offset(struct device *dev);
+
 #ifdef CONFIG_NOT_COHERENT_CACHE
 /*
  * DMA-consistent mapping functions for PowerPCs that don't support
@@ -76,6 +85,8 @@ struct dma_mapping_ops {
 				dma_addr_t dma_address, size_t size,
 				enum dma_data_direction direction,
 				struct dma_attrs *attrs);
+	int		(*addr_needs_map)(struct device *dev, dma_addr_t addr,
+				size_t size);
 #ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
 	void            (*sync_single_range_for_cpu)(struct device *hwdev,
 				dma_addr_t dma_handle, unsigned long offset,
arch/powerpc/include/asm/swiotlb.h new file +24 -0
new file mode 100644
index 0000000..6440fdf
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2009 Becky Bruce, Freescale Semiconductor
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef __ASM_SWIOTLB_H
+#define __ASM_SWIOTLB_H
+
+#include <linux/swiotlb.h>
+
+extern struct dma_mapping_ops swiotlb_dma_ops;
+extern struct dma_mapping_ops swiotlb_pci_dma_ops;
+
+int swiotlb_arch_address_needs_mapping(struct device *, dma_addr_t,
+				       size_t size);
+
+static inline void dma_mark_clean(void *addr, size_t size) {}
+
+#endif /* __ASM_SWIOTLB_H */
arch/powerpc/kernel/Makefile +1 -0
index 71901fb..34c0a95 100644
@@ -82,6 +82,7 @@ obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o
 obj-$(CONFIG_PPC_UDBG_16550)	+= legacy_serial.o udbg_16550.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
+obj-$(CONFIG_SWIOTLB)		+= dma-swiotlb.o
 
 pci64-$(CONFIG_PPC64)		+= pci_dn.o isa-bridge.o
 obj-$(CONFIG_PCI)		+= pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \
arch/powerpc/kernel/dma-swiotlb.c new file +161 -0

161 lines not on this page · raw message

arch/powerpc/kernel/dma.c +1 -1
index 53c7788..62d80c4 100644
@@ -19,7 +19,7 @@
  * default the offset is PCI_DRAM_OFFSET.
  */
 
-static unsigned long get_dma_direct_offset(struct device *dev)
+unsigned long get_dma_direct_offset(struct device *dev)
 {
 	if (dev)
 		return (unsigned long)dev->archdata.dma_data;
arch/powerpc/kernel/setup_32.c +4 -0
index 9e1ca74..f038b13 100644
@@ -332,6 +332,10 @@ void __init setup_arch(char **cmdline_p)
 		ppc_md.setup_arch();
 	if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
 
+	/* Allow iotlb to do it's setup */
+#ifdef CONFIG_SWIOTLB
+	swiotlb_init();
+#endif
 	paging_init();
 
 	/* Initialize the MMU context management stuff */
Signature · 1 line
1.6.0.6
#7 lore raw

PATCH 5/5 powerpc: Add 86xx support for SWIOTLB

Minor code to allow enabling swiotlb on mpc86xx, including Kconfig addition for SWIOTLB.

---
 arch/powerpc/Kconfig                       |   10 ++++++++++
 arch/powerpc/kernel/dma-swiotlb.c          |    2 ++
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    3 +++
 3 files changed, 15 insertions(+), 0 deletions(-)
arch/powerpc/Kconfig +10 -0
index 197f6a3..e47c81d 100644
@@ -292,6 +292,16 @@ config IOMMU_VMERGE
 config IOMMU_HELPER
 	def_bool PPC64
 
+config SWIOTLB
+	bool "SWIOTLB support"
+	depends on PPC_86xx
+	select IOMMU_HELPER
+	---help---
+	  Support for IO bounce buffering for systems without an IOMMU.
+	  This allows us to DMA to the full physical address space on
+	  platforms where the size of a physical address is larger
+	  than the bus address.
+
 config PPC_NEED_DMA_SYNC_OPS
 	def_bool y
 	depends on (NOT_COHERENT_CACHE || SWIOTLB)
arch/powerpc/kernel/dma-swiotlb.c +2 -0
index 29a68e6..3065d03 100644
@@ -159,3 +159,5 @@ static int __init setup_bus_notifier(void)
 
 	return 0;
 }
+
+machine_arch_initcall(mpc86xx_hpcn, setup_bus_notifier);
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +3 -0
index c4ec49b..f7b88b9 100644
@@ -88,6 +88,9 @@ mpc86xx_hpcn_setup_arch(void)
 
 	ppc_md.pci_exclude_device = mpc86xx_exclude_device;
 
+#ifdef CONFIG_SWIOTLB
+	set_pci_dma_ops(&swiotlb_pci_dma_ops);
+#endif
 #endif
 
 	printk("MPC86xx HPCN board from Freescale Semiconductor\n");
Signature · 1 line
1.6.0.6
#8 lore raw

Re: [PATCH 5/5] powerpc: Add 86xx support for SWIOTLB

Quoted 18 lines · Becky Bruce

Minor code to allow enabling swiotlb on mpc86xx, including Kconfig addition for SWIOTLB.

---

arch/powerpc/Kconfig                       |   10 ++++++++++
arch/powerpc/kernel/dma-swiotlb.c          |    2 ++
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    3 +++
3 files changed, 15 insertions(+), 0 deletions(-)
arch/powerpc/Kconfig +0 -0
index 197f6a3..e47c81d 100644
@@ -292,6 +292,16 @@ config IOMMU_VMERGE

config IOMMU_HELPER
def_bool PPC64

arch/powerpc/Kconfig config IOMMU_VMERGE · line 304

Quoted 10 lines
arch/powerpc/Kconfig +10 -0
+config SWIOTLB
+	bool "SWIOTLB support"
+	depends on PPC_86xx
+	select IOMMU_HELPER
+	---help---
+	  Support for IO bounce buffering for systems without an IOMMU.
+	  This allows us to DMA to the full physical address space on
+	  platforms where the size of a physical address is larger
+	  than the bus address.
+

As stated on previous patch, move the bulk of this into 4/5.

Quoted 9 lines

config PPC_NEED_DMA_SYNC_OPS

	def_bool y
	depends on (NOT_COHERENT_CACHE || SWIOTLB)
arch/powerpc/kernel/dma-swiotlb.c +0 -0
index 29a68e6..3065d03 100644

arch/powerpc/kernel/dma-swiotlb.c static int __init setup_bus_notifier(void) · line 163

Quoted 5 lines
arch/powerpc/kernel/dma-swiotlb.c +2 -0
@@ -159,3 +159,5 @@ static int __init setup_bus_notifier(void)
 
 	return 0;
 }
+
+machine_arch_initcall(mpc86xx_hpcn, setup_bus_notifier);

Hmm, not sure what we chatted about here, but I don't want to have to add every board into this file to register the bus notifiers.

Quoted 22 lines
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +3 -0
index c4ec49b..f7b88b9 100644
@@ -88,6 +88,9 @@ mpc86xx_hpcn_setup_arch(void)
 
 	ppc_md.pci_exclude_device = mpc86xx_exclude_device;
 
+#ifdef CONFIG_SWIOTLB
+	set_pci_dma_ops(&swiotlb_pci_dma_ops);
+#endif
 #endif
 
 	printk("MPC86xx HPCN board from Freescale Semiconductor\n");
Signature · 6 lines
1.6.0.6

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev
#9 lore raw

Re: [PATCH 5/5] powerpc: Add 86xx support for SWIOTLB

Quoted 21 lines · Kumar Gala
Quoted 18 lines · Becky Bruce

Minor code to allow enabling swiotlb on mpc86xx, including Kconfig addition for SWIOTLB.

---

arch/powerpc/Kconfig                       |   10 ++++++++++
arch/powerpc/kernel/dma-swiotlb.c          |    2 ++
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    3 +++
3 files changed, 15 insertions(+), 0 deletions(-)
arch/powerpc/Kconfig +0 -0
index 197f6a3..e47c81d 100644
@@ -292,6 +292,16 @@ config IOMMU_VMERGE

config IOMMU_HELPER
def_bool PPC64

Quoted 12 lines

arch/powerpc/Kconfig config IOMMU_VMERGE · line 304

Quoted 10 lines
arch/powerpc/Kconfig +10 -0
+config SWIOTLB
+	bool "SWIOTLB support"
+	depends on PPC_86xx
+	select IOMMU_HELPER
+	---help---
+	  Support for IO bounce buffering for systems without an IOMMU.
+	  This allows us to DMA to the full physical address space on
+	  platforms where the size of a physical address is larger
+	  than the bus address.
+

As stated on previous patch, move the bulk of this into 4/5.

Yep.

Quoted 12 lines
Quoted 12 lines

config PPC_NEED_DMA_SYNC_OPS

	def_bool y
	depends on (NOT_COHERENT_CACHE || SWIOTLB)
arch/powerpc/kernel/dma-swiotlb.c +0 -0
index 29a68e6..3065d03 100644
@@ -159,3 +159,5 @@ static int __init setup_bus_notifier(void)
 
Quoted 6 lines

arch/powerpc/kernel/dma-swiotlb.c static int __init setup_bus_notifier(void) · line 163

Quoted 4 lines
arch/powerpc/kernel/dma-swiotlb.c +2 -0
 	return 0;
 }
+
+machine_arch_initcall(mpc86xx_hpcn, setup_bus_notifier);

Hmm, not sure what we chatted about here, but I don't want to have to add every board into this file to register the bus notifiers.

We talked about this, and this was what we decided on - I don't really like the idea, either, but there's a lot of precedent for it. I'd like to do this differently, but I"m not sure what the solution is - we'd need to look into that more (or perhaps someone here will have some sage advice).

Cheers,
B

#10 lore raw

Re: [PATCH 5/5] powerpc: Add 86xx support for SWIOTLB

Quoted 21 lines · Becky Bruce
Quoted 12 lines · Kumar Gala
Quoted 11 lines · Becky Bruce

config PPC_NEED_DMA_SYNC_OPS

	def_bool y
	depends on (NOT_COHERENT_CACHE || SWIOTLB)
arch/powerpc/ renamed from arch/powerpc/kernel/dma-swiotlb.c +0 -0

kernel/dma-swiotlb.c
index 29a68e6..3065d03 100644

arch/powerpc/kernel/dma-swiotlb.c +0 -0
@@ -159,3 +159,5 @@ static int __init setup_bus_notifier(void)
 
Quoted 7 lines

arch/powerpc/kernel/dma-swiotlb.c static int __init setup_bus_notifier(void) · line 163

Quoted 4 lines
arch/powerpc/kernel/dma-swiotlb.c +2 -0
 	return 0;
 }
+
+machine_arch_initcall(mpc86xx_hpcn, setup_bus_notifier);

Hmm, not sure what we chatted about here, but I don't want to have to add every board into this file to register the bus notifiers.

Quoted 5 lines

We talked about this, and this was what we decided on - I don't really like the idea, either, but there's a lot of precedent for it. I'd like to do this differently, but I"m not sure what the solution is - we'd need to look into that more (or perhaps someone here will have some sage advice).

Give it a better name, export it, and call it from the board setup file?

Actually what depends on the board anyway? It's just the dma window config in the pci_controller isn't it? So maybe you can always call the notifier, and if the dma mask isn't 36 bits, and the controller has the window configured then you use swiotlb?

cheers

#11 lore raw

Re: [PATCH 4/5] powerpc: Add support for swiotlb on 32-bit

In reply to Becky Bruce
Quoted 26 lines · Becky Bruce

This patch includes the basic infrastructure to use swiotlb bounce buffering on 32-bit powerpc. It is not yet enabled on any platforms.

---

arch/powerpc/Kconfig                   |    2 +-
arch/powerpc/include/asm/dma-mapping.h |   11 ++
arch/powerpc/include/asm/swiotlb.h     |   24 +++++
arch/powerpc/kernel/Makefile           |    1 +
arch/powerpc/kernel/dma-swiotlb.c      |  161 +++++++++++++++++++++++ 
+++++++++
arch/powerpc/kernel/dma.c              |    2 +-
arch/powerpc/kernel/setup_32.c         |    4 +
7 files changed, 203 insertions(+), 2 deletions(-)

create mode 100644 arch/powerpc/include/asm/swiotlb.h create mode 100644 arch/powerpc/kernel/dma-swiotlb.c

arch/powerpc/Kconfig +0 -0
index 5b50e1a..197f6a3 100644
@@ -294,7 +294,7 @@ config IOMMU_HELPER
 

config PPC_NEED_DMA_SYNC_OPS
def_bool y

arch/powerpc/Kconfig config IOMMU_HELPER · line 297

Quoted 2 lines
arch/powerpc/Kconfig +1 -1
-	depends on NOT_COHERENT_CACHE
+	depends on (NOT_COHERENT_CACHE || SWIOTLB)

This isn't right, since you haven't introduced the SWIOTLB Kconfig.

Why don't we just put the SWIOTLB Kconfig option in here and default it no (and remove the dep on 86xx).

Quoted 24 lines

config HOTPLUG_CPU
bool "Support for enabling/disabling CPUs"

arch/powerpc/kernel/dma-swiotlb.c new file +6 -0
new file mode 100644
index 0000000..29a68e6
@@ -0,0 +1,161 @@
+/*
+ * Contains routines needed to support swiotlb for ppc.
+ *
+ * Copyright (C) 2009 Becky Bruce, Freescale Semiconductor
+ *
+ * This program is free software; you can redistribute  it and/or  

modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */

[snip]

Quoted 4 lines
arch/powerpc/kernel/dma-swiotlb.c new file +3 -0
+
+static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
+				  unsigned long action, void *data)

arch/powerpc/kernel/dma-swiotlb.c line 139

Quoted 10 lines
arch/powerpc/kernel/dma-swiotlb.c new file +10 -0
+{
+	struct device *dev = data;
+
+	/* We are only intereted in device addition */
+	if (action != BUS_NOTIFY_ADD_DEVICE)
+		return 0;
+
+	if (dma_get_mask(dev) < DMA_BIT_MASK(36))
+		set_dma_ops(dev, &swiotlb_dma_ops);
+

this isn't right. Isn't possible for a PCI dev to have a DMA_BIT_MASK(64) but us still not be able to dma to it? Also, I dont like the assumption of 36-bit physical here.

Quoted 23 lines
arch/powerpc/kernel/dma-swiotlb.c new file +22 -0
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block ppc_swiotlb_plat_bus_notifier = {
+	.notifier_call = ppc_swiotlb_bus_notify,
+	.priority = 0,
+};
+
+static struct notifier_block ppc_swiotlb_of_bus_notifier = {
+	.notifier_call = ppc_swiotlb_bus_notify,
+	.priority = 0,
+};
+
+static int __init setup_bus_notifier(void)
+{
+	bus_register_notifier(&platform_bus_type,
+			      &ppc_swiotlb_plat_bus_notifier);
+	bus_register_notifier(&of_platform_bus_type,
+			      &ppc_swiotlb_of_bus_notifier);
+
+	return 0;
+}
#12 lore raw

Re: [PATCH 4/5] powerpc: Add support for swiotlb on 32-bit

Quoted 35 lines · Kumar Gala
Quoted 26 lines · Becky Bruce

This patch includes the basic infrastructure to use swiotlb bounce buffering on 32-bit powerpc. It is not yet enabled on any platforms.

---

arch/powerpc/Kconfig                   |    2 +-
arch/powerpc/include/asm/dma-mapping.h |   11 ++
arch/powerpc/include/asm/swiotlb.h     |   24 +++++
arch/powerpc/kernel/Makefile           |    1 +
arch/powerpc/kernel/dma-swiotlb.c      |  161 ++++++++++++++++++++++ 
++++++++++
arch/powerpc/kernel/dma.c              |    2 +-
arch/powerpc/kernel/setup_32.c         |    4 +
7 files changed, 203 insertions(+), 2 deletions(-)

create mode 100644 arch/powerpc/include/asm/swiotlb.h create mode 100644 arch/powerpc/kernel/dma-swiotlb.c

arch/powerpc/Kconfig +0 -0
index 5b50e1a..197f6a3 100644
@@ -294,7 +294,7 @@ config IOMMU_HELPER
 

config PPC_NEED_DMA_SYNC_OPS
def_bool y

arch/powerpc/Kconfig config IOMMU_HELPER · line 297

Quoted 2 lines
arch/powerpc/Kconfig +1 -1
-	depends on NOT_COHERENT_CACHE
+	depends on (NOT_COHERENT_CACHE || SWIOTLB)

This isn't right, since you haven't introduced the SWIOTLB Kconfig.

Quoted 1 line

Why don't we just put the SWIOTLB Kconfig option in here and default it no (and remove the dep on 86xx).

Sure. I'll probably add a comment or something though so people don't think they can just enable it on anything and expect it to work. Too many people seem to read the config files and decide things are possible that actually aren't :)

Quoted 30 lines
Quoted 26 lines

config HOTPLUG_CPU
bool "Support for enabling/disabling CPUs"

arch/powerpc/kernel/dma-swiotlb.c new file +6 -0
new file mode 100644
index 0000000..29a68e6
@@ -0,0 +1,161 @@
+/*
+ * Contains routines needed to support swiotlb for ppc.
+ *
+ * Copyright (C) 2009 Becky Bruce, Freescale Semiconductor
+ *
+ * This program is free software; you can redistribute  it and/or  

modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */

[snip]

Quoted 1 line
Quoted 15 lines

arch/powerpc/kernel/dma-swiotlb.c line 139

Quoted 13 lines
arch/powerpc/kernel/dma-swiotlb.c new file +13 -0
+
+static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
+				  unsigned long action, void *data)
+{
+	struct device *dev = data;
+
+	/* We are only intereted in device addition */
+	if (action != BUS_NOTIFY_ADD_DEVICE)
+		return 0;
+
+	if (dma_get_mask(dev) < DMA_BIT_MASK(36))
+		set_dma_ops(dev, &swiotlb_dma_ops);
+

this isn't right. Isn't possible for a PCI dev to have a DMA_BIT_MASK(64) but us still not be able to dma to it? Also, I dont like the assumption of 36-bit physical here.

You're right - this is just handling the basic case and for now I'm assuming that we don't bounce 64-bit devices (or any device that can handle 36 bits). We'll need to talk in more detail about a solution to that problem, because knowing if a 64b dev *might* need to bounce (which is all this is really saying) requires more information. We also don't really have infrastructure to deal with holes in the visible dev memory, and I don't know if we want to handle that as well. I don't want to set the dma_ops to swiotlb unless we have to because there's a slight perf hit in running all the checks to see if an address needs to be bounced.

Thanks,
B

#13 lore raw

Re: [PATCH 4/5] powerpc: Add support for swiotlb on 32-bit

Quoted 95 lines · On Mon, 20 Apr 2009 13:03:20 -0500 Becky Bruce <[email protected]>…
Quoted 35 lines · Kumar Gala
Quoted 26 lines · Becky Bruce

This patch includes the basic infrastructure to use swiotlb bounce buffering on 32-bit powerpc. It is not yet enabled on any platforms.

---

arch/powerpc/Kconfig                   |    2 +-
arch/powerpc/include/asm/dma-mapping.h |   11 ++
arch/powerpc/include/asm/swiotlb.h     |   24 +++++
arch/powerpc/kernel/Makefile           |    1 +
arch/powerpc/kernel/dma-swiotlb.c      |  161 ++++++++++++++++++++++ 
++++++++++
arch/powerpc/kernel/dma.c              |    2 +-
arch/powerpc/kernel/setup_32.c         |    4 +
7 files changed, 203 insertions(+), 2 deletions(-)

create mode 100644 arch/powerpc/include/asm/swiotlb.h create mode 100644 arch/powerpc/kernel/dma-swiotlb.c

arch/powerpc/Kconfig +0 -0
index 5b50e1a..197f6a3 100644
@@ -294,7 +294,7 @@ config IOMMU_HELPER
 

config PPC_NEED_DMA_SYNC_OPS
def_bool y

arch/powerpc/Kconfig config IOMMU_HELPER · line 297

Quoted 2 lines
arch/powerpc/Kconfig +1 -1
-	depends on NOT_COHERENT_CACHE
+	depends on (NOT_COHERENT_CACHE || SWIOTLB)

This isn't right, since you haven't introduced the SWIOTLB Kconfig.

Quoted 2 lines

Why don't we just put the SWIOTLB Kconfig option in here and default it no (and remove the dep on 86xx).

Sure. I'll probably add a comment or something though so people don't think they can just enable it on anything and expect it to work. Too many people seem to read the config files and decide things are possible that actually aren't :)

Quoted 40 lines
Quoted 27 lines

config HOTPLUG_CPU
bool "Support for enabling/disabling CPUs"

arch/powerpc/ renamed from arch/powerpc/kernel/dma-swiotlb.c +0 -0

kernel/dma-swiotlb.c
new file mode 100644
index 0000000..29a68e6

arch/powerpc/kernel/dma-swiotlb.c new file +6 -0
@@ -0,0 +1,161 @@
+/*
+ * Contains routines needed to support swiotlb for ppc.
+ *
+ * Copyright (C) 2009 Becky Bruce, Freescale Semiconductor
+ *
+ * This program is free software; you can redistribute  it and/or  

modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */

[snip]

Quoted 10 lines
arch/powerpc/kernel/dma-swiotlb.c new file +9 -0
+
+static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
+				  unsigned long action, void *data)
+{
+	struct device *dev = data;
+
+	/* We are only intereted in device addition */
+	if (action != BUS_NOTIFY_ADD_DEVICE)
+		return 0;
Quoted 8 lines

arch/powerpc/kernel/dma-swiotlb.c line 139

Quoted 4 lines
arch/powerpc/kernel/dma-swiotlb.c new file +4 -0
+
+	if (dma_get_mask(dev) < DMA_BIT_MASK(36))
+		set_dma_ops(dev, &swiotlb_dma_ops);
+

this isn't right. Isn't possible for a PCI dev to have a DMA_BIT_MASK(64) but us still not be able to dma to it? Also, I dont like the assumption of 36-bit physical here.

Quoted 10 lines

You're right - this is just handling the basic case and for now I'm assuming that we don't bounce 64-bit devices (or any device that can
handle 36 bits). We'll need to talk in more detail about a solution
to that problem, because knowing if a 64b dev *might* need to bounce
(which is all this is really saying) requires more information. We
also don't really have infrastructure to deal with holes in the visible dev memory, and I don't know if we want to handle that as well. I don't want to set the dma_ops to swiotlb unless we have to because there's a slight perf hit in running all the checks to see if an address needs to be bounced.

I think that you always just set the dma_ops to swiotlb. It's the cleanest solution. Do you really see the performance drop due to the checking?

#14 lore raw

Re: [PATCH 4/5] powerpc: Add support for swiotlb on 32-bit

In reply to Becky Bruce
Quoted 24 lines · Becky Bruce
arch/powerpc/kernel/dma-swiotlb.c new file +24 -0
+static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
+				  unsigned long action, void *data)
+{
+	struct device *dev = data;
+
+	/* We are only intereted in device addition */
+	if (action != BUS_NOTIFY_ADD_DEVICE)
+		return 0;
+
+	if (dma_get_mask(dev) < DMA_BIT_MASK(36))
+		set_dma_ops(dev, &swiotlb_dma_ops);
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block ppc_swiotlb_plat_bus_notifier = {
+	.notifier_call = ppc_swiotlb_bus_notify,
+	.priority = 0,
+};
+
+static struct notifier_block ppc_swiotlb_of_bus_notifier = {
+	.notifier_call = ppc_swiotlb_bus_notify,
+	.priority = 0,
+};

arch/powerpc/kernel/dma-swiotlb.c line 161

Quoted 10 lines
arch/powerpc/kernel/dma-swiotlb.c new file +10 -0
+
+static int __init setup_bus_notifier(void)
+{
+	bus_register_notifier(&platform_bus_type,
+			      &ppc_swiotlb_plat_bus_notifier);
+	bus_register_notifier(&of_platform_bus_type,
+			      &ppc_swiotlb_of_bus_notifier);
+
+	return 0;
+}

I think we should move all this into the platform code for now. I don't like having to duplicate it but that gives us the proper flexibility for now.

- k

#15 lore raw

Re: [PATCH 4/5] powerpc: Add support for swiotlb on 32-bit

Quoted 31 lines · Kumar Gala
Quoted 28 lines · Becky Bruce
arch/powerpc/kernel/dma-swiotlb.c new file +28 -0
+static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
+				  unsigned long action, void *data)
+{
+	struct device *dev = data;
+
+	/* We are only intereted in device addition */
+	if (action != BUS_NOTIFY_ADD_DEVICE)
+		return 0;
+
+	if (dma_get_mask(dev) < DMA_BIT_MASK(36))
+		set_dma_ops(dev, &swiotlb_dma_ops);
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block ppc_swiotlb_plat_bus_notifier = {
+	.notifier_call = ppc_swiotlb_bus_notify,
+	.priority = 0,
+};
+
+static struct notifier_block ppc_swiotlb_of_bus_notifier = {
+	.notifier_call = ppc_swiotlb_bus_notify,
+	.priority = 0,
+};
+
+static int __init setup_bus_notifier(void)
+{
+	bus_register_notifier(&platform_bus_type,
Quoted 8 lines

arch/powerpc/kernel/dma-swiotlb.c line 161

Quoted 6 lines
arch/powerpc/kernel/dma-swiotlb.c new file +6 -0
+			      &ppc_swiotlb_plat_bus_notifier);
+	bus_register_notifier(&of_platform_bus_type,
+			      &ppc_swiotlb_of_bus_notifier);
+
+	return 0;
+}

I think we should move all this into the platform code for now. I don't like having to duplicate it but that gives us the proper flexibility for now.

Ugh, gross. I'd like to think about this some more.

-B

#16 lore raw

Re: [PATCH 4/5] powerpc: Add support for swiotlb on 32-bit

Quoted 43 lines · Becky Bruce
Quoted 31 lines · Kumar Gala
Quoted 28 lines · Becky Bruce
arch/powerpc/kernel/dma-swiotlb.c new file +28 -0
+static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
+				  unsigned long action, void *data)
+{
+	struct device *dev = data;
+
+	/* We are only intereted in device addition */
+	if (action != BUS_NOTIFY_ADD_DEVICE)
+		return 0;
+
+	if (dma_get_mask(dev) < DMA_BIT_MASK(36))
+		set_dma_ops(dev, &swiotlb_dma_ops);
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block ppc_swiotlb_plat_bus_notifier = {
+	.notifier_call = ppc_swiotlb_bus_notify,
+	.priority = 0,
+};
+
+static struct notifier_block ppc_swiotlb_of_bus_notifier = {
+	.notifier_call = ppc_swiotlb_bus_notify,
+	.priority = 0,
+};
+
+static int __init setup_bus_notifier(void)
+{
+	bus_register_notifier(&platform_bus_type,
Quoted 8 lines

arch/powerpc/kernel/dma-swiotlb.c line 161

Quoted 6 lines
arch/powerpc/kernel/dma-swiotlb.c new file +6 -0
+			      &ppc_swiotlb_plat_bus_notifier);
+	bus_register_notifier(&of_platform_bus_type,
+			      &ppc_swiotlb_of_bus_notifier);
+
+	return 0;
+}

I think we should move all this into the platform code for now. I don't like having to duplicate it but that gives us the proper flexibility for now.

Quoted 1 line

Ugh, gross. I'd like to think about this some more.

I'm suggesting we do it one for FSL in fsl_soc.c, the 4xx guys can do it once, etc. Since the behavior desired is going to be a bit unique to SoCs/chipsets.

- k

#17 lore raw

Re: [PATCH 4/5] powerpc: Add support for swiotlb on 32-bit

Quoted 1 line · Kumar Gala

I'm suggesting we do it one for FSL in fsl_soc.c, the 4xx guys can do it once, etc. Since the behavior desired is going to be a bit unique to SoCs/chipsets.

Perhaps we should have a dma_mask in platform/of_platform device structs? The driver knows best how many bits it can shove into a DMA address register, and it would let us avoid hardcoding 36 bits into this code.

What other platform-specific behavior do you have in mind? Could we supply a default implementation that platforms can override if they need something weird, rather than duplicating it per soc family?

-Scott

#18 lore raw

Re: [PATCH 3/5] powerpc: make dma_window_* in pci_controller struct avail on 32b

In reply to Becky Bruce
Quoted 10 lines · Becky Bruce

Also, convert them to resource_size_t (which is unsigned long on 64-bit, so it's not a change there).

We will be using these on fsl 32b to indicate the start and size address of memory that the pci controller can actually reach - this is needed to determine if an address requires bounce buffering. For now, initialize them to a standard value; in the near future, the value will be calculated based on how the inbound windows are programmed.

Quoted 5 lines

---

arch/powerpc/include/asm/pci-bridge.h |    6 ++++--
arch/powerpc/sysdev/fsl_pci.c         |    4 ++++
2 files changed, 8 insertions(+), 2 deletions(-)

Ben, your ack on this patch would be appreciated as I've got some other FSL PCI patches that I want to fold this into my tree for.

- k

#19 lore raw

Re: [PATCH 2/5] powerpc: Add 36-bit device tree for mpc8641hpcn

In reply to Becky Bruce
Quoted 25 lines · Becky Bruce

The new dts places most of the devices in physical address space above 32-bits, which allows us to have more than 4GB of RAM present.

---
 arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts |  597 ++++++++++++++++++++++++++++
 1 files changed, 597 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts
arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts new file +10 -0
new file mode 100644
index 0000000..baa3dba
@@ -0,0 +1,597 @@
+/*
+ * MPC8641 HPCN Device Tree Source
+ *
+ * Copyright 2006 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */

[snip]

arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts line 108

Quoted 5 lines
arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts new file +5 -0
+	soc8641@fffe00000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		device_type = "soc";
+		compatible = "simple-bus";

Uh, you definitely need something more specific in the compatible property before "simple-bus".

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#20 lore raw

Re: [PATCH 2/5] powerpc: Add 36-bit device tree for mpc8641hpcn

Quoted 32 lines · David Gibson
Quoted 29 lines · Becky Bruce

The new dts places most of the devices in physical address space above 32-bits, which allows us to have more than 4GB of RAM present.

---
arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts | 597 ++++++++++++++++++
++++++++++

1 files changed, 597 insertions(+), 0 deletions(-)

create mode 100644 arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts

arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts new file +6 -0
new file mode 100644
index 0000000..baa3dba
@@ -0,0 +1,597 @@
+/*
+ * MPC8641 HPCN Device Tree Source
+ *
+ * Copyright 2006 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or  

modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */

[snip]

Quoted 8 lines

arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts line 108

Quoted 5 lines
arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts new file +5 -0
+	soc8641@fffe00000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		device_type = "soc";
+		compatible = "simple-bus";

Uh, you definitely need something more specific in the compatible property before "simple-bus".

This is a copy of the existing mpc8641hpcn dts file, with just physical address changes, so if there's a problem here it definitely exists in the current 8641hpcn dts, and possibly other dts files as well. I think the correct solution is for me to go look at that .dts (and any others that may be similar), and put out a followup to fix them all.

Thanks,
Becky

#21 lore raw

Re: [PATCH 2/5] powerpc: Add 36-bit device tree for mpc8641hpcn

Quoted 45 lines · Becky Bruce
Quoted 33 lines · David Gibson
Quoted 30 lines · Becky Bruce

The new dts places most of the devices in physical address space above 32-bits, which allows us to have more than 4GB of RAM present.

---
arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts | 597 ++++++++++++++++++
++++++++++

1 files changed, 597 insertions(+), 0 deletions(-)

create mode 100644 arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts

arch/ renamed from arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts +0 -0

powerpc/boot/dts/mpc8641_hpcn_36b.dts
new file mode 100644
index 0000000..baa3dba

arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts new file +6 -0
@@ -0,0 +1,597 @@
+/*
+ * MPC8641 HPCN Device Tree Source
+ *
+ * Copyright 2006 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or  

modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */

[snip]

Quoted 8 lines

arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts line 108

Quoted 5 lines
arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts new file +5 -0
+	soc8641@fffe00000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		device_type = "soc";
+		compatible = "simple-bus";

Uh, you definitely need something more specific in the compatible property before "simple-bus".

Quoted 5 lines

This is a copy of the existing mpc8641hpcn dts file, with just physical address changes, so if there's a problem here it definitely exists in the current 8641hpcn dts, and possibly other dts files as well. I think the correct solution is for me to go look at that .dts (and any others that may be similar), and put out a followup to fix them all.

Ok, fair enough.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Applied
#22 lore raw

Re: [PATCH 2/5] powerpc: Add 36-bit device tree for mpc8641hpcn

In reply to Becky Bruce
Quoted 9 lines · Becky Bruce

The new dts places most of the devices in physical address space above 32-bits, which allows us to have more than 4GB of RAM present.

---
arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts | 597 +++++++++++++++++++
+++++++++

1 files changed, 597 insertions(+), 0 deletions(-)

create mode 100644 arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts

applied to next. We can deal with any simple-bus issues in a follow up patch.

- k

#23 lore raw

Re: [PATCH 1/5] powerpc: Use sg->dma_length in sg_dma_len() macro on 32-bit

In reply to Becky Bruce
Quoted 17 lines · Becky Bruce

Currently, the 32-bit code uses sg->length instead of sg->dma_lentgh to report sg_dma_len. However, since the default dma code for 32-bit (the dma_direct case) sets dma_length and length to the same thing, we should be able to use dma_length there as well. This gets rid of some 32-vs-64-bit ifdefs, and is needed by the swiotlb code which actually distinguishes between dma_length and length.

---
arch/powerpc/include/asm/scatterlist.h | 6 +-----

1 files changed, 1 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/scatterlist.h +0 -0
index fcf7d55..912bf59 100644

arch/powerpc/include/asm/scatterlist.h struct scatterlist { · line 22

Quoted 2 lines
arch/powerpc/include/asm/scatterlist.h +0 -0
@@ -21,7 +21,7 @@ struct scatterlist {
 	unsigned int offset;
 	unsigned int length;

can we get rid of length?

Quoted 21 lines
arch/powerpc/include/asm/scatterlist.h +1 -5
-	/* For TCE support */
+	/* For TCE or SWIOTLB support */
 	dma_addr_t dma_address;
 	u32 dma_length;
 };
@@ -34,11 +34,7 @@ struct scatterlist {
 * is 0.
 */
 #define sg_dma_address(sg)	((sg)->dma_address)
-#ifdef __powerpc64__
 #define sg_dma_len(sg)		((sg)->dma_length)
-#else
-#define sg_dma_len(sg)		((sg)->length)
-#endif
 
 #ifdef __powerpc64__
 #define ISA_DMA_THRESHOLD	(~0UL)
Signature · 1 line
1.6.0.6

- k

#24 lore raw

Re: [PATCH 1/5] powerpc: Use sg->dma_length in sg_dma_len() macro on 32-bit

Quoted 15 lines · On Mon, 20 Apr 2009 15:06:16 -0500 Kumar Gala <[email protected]> wrote:
Quoted 12 lines · Becky Bruce

Currently, the 32-bit code uses sg->length instead of sg->dma_lentgh to report sg_dma_len. However, since the default dma code for 32-bit (the dma_direct case) sets dma_length and length to the same thing, we should be able to use dma_length there as well. This gets rid of some 32-vs-64-bit ifdefs, and is needed by the swiotlb code which actually distinguishes between dma_length and length.

---
arch/powerpc/include/asm/scatterlist.h | 6 +-----

1 files changed, 1 insertions(+), 5 deletions(-)
Quoted 10 lines

arch/powerpc/include/asm/scatterlist.h struct scatterlist { · line 22

Quoted 8 lines
arch/powerpc/ renamed from arch/powerpc/include/asm/scatterlist.h +0 -0

include/asm/scatterlist.h
index fcf7d55..912bf59 100644

arch/powerpc/include/asm/scatterlist.h +0 -0
@@ -21,7 +21,7 @@ struct scatterlist {
 	unsigned int offset;
 	unsigned int length;

can we get rid of length?

You can't.

Quoted 25 lines
Quoted 21 lines
arch/powerpc/include/asm/scatterlist.h +1 -5
-	/* For TCE support */
+	/* For TCE or SWIOTLB support */
 	dma_addr_t dma_address;
 	u32 dma_length;
 };
@@ -34,11 +34,7 @@ struct scatterlist {
 * is 0.
 */
 #define sg_dma_address(sg)	((sg)->dma_address)
-#ifdef __powerpc64__
 #define sg_dma_len(sg)		((sg)->dma_length)
-#else
-#define sg_dma_len(sg)		((sg)->length)
-#endif
 
 #ifdef __powerpc64__
 #define ISA_DMA_THRESHOLD	(~0UL)
Signature · 1 line
1.6.0.6

- k

#25 lore raw

Re: [PATCH 1/5] powerpc: Use sg->dma_length in sg_dma_len() macro on 32-bit

In reply to Kumar Gala
Quoted 15 lines · Kumar Gala
Quoted 12 lines · Becky Bruce

Currently, the 32-bit code uses sg->length instead of sg->dma_lentgh to report sg_dma_len. However, since the default dma code for 32-bit (the dma_direct case) sets dma_length and length to the same thing, we should be able to use dma_length there as well. This gets rid of some 32-vs-64-bit ifdefs, and is needed by the swiotlb code which actually distinguishes between dma_length and length.

---
arch/powerpc/include/asm/scatterlist.h | 6 +-----

1 files changed, 1 insertions(+), 5 deletions(-)
Quoted 9 lines

arch/powerpc/include/asm/scatterlist.h struct scatterlist { · line 22

Quoted 7 lines
arch/powerpc/include/asm/scatterlist.h +0 -0
index fcf7d55..912bf59 100644
@@ -21,7 +21,7 @@ struct scatterlist {
 	unsigned int offset;
 	unsigned int length;

can we get rid of length?

No - they're both used by the iotlb code and are conceptually different. "dma_length" can get set to less than "length" to indicate that something went wrong with a dma request - the iotlb code sets it to 0 if we can't allocate a bounce buffer, for example. It probably has other uses as well - this is just the one I'm familiar with. In most cases they are equal.

Cheers,
B

#26 lore raw

Re: [PATCH 0/5] Allow swiotlb use on ppc/mpc86xx

In reply to Becky Bruce

FAIL.

Here's the text that should have been there :)

-B

This patch series allows the use of swiotlb on mpc86xx, with 85xx upport soon to follow. The most notable change here is the addition of addr_needs_map to dma_ops. This is used to tell if a device can reach an address without bounce buffering. I believe that patches will be coming out soon to make dma_ops non-arch-specific, and I expect to see something similar there as well.

I've also changed sg_dma_len to be the same on both 32 and 64-bit. We now look at sg->dma_length in both cases (see patch log).

The dma_window* elements in the pci_controller struct are hoisted out of an #ifdef CONFIG_PPC64 so we can use them to store off information about how much memory is mapped via the inbound pci windows.

A dma-swiotlb.c is created in arch/powerpc/kernel to contain all the platform-specific iotlb code.

Finally, hooks are provided to allow enabling of this feature on 86xx via Kconfig, and a 36-bit device tree for 8641hpcn is provided.

Ye Olde Diffstat:

 arch/powerpc/Kconfig                       |    2 +-
 arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts |  597 +++++++++++++++++++ 
+++++++++
 arch/powerpc/include/asm/dma-mapping.h     |   11 +
 arch/powerpc/include/asm/pci-bridge.h      |    6 +-
 arch/powerpc/include/asm/scatterlist.h     |    6 +-
 arch/powerpc/include/asm/swiotlb.h         |   24 ++
 arch/powerpc/kernel/Makefile               |    1 +
 arch/powerpc/kernel/dma-swiotlb.c          |  161 ++++++++
 arch/powerpc/kernel/dma.c                  |    2 +-
 arch/powerpc/kernel/setup_32.c             |    4 +
 arch/powerpc/sysdev/fsl_pci.c              |    4 +
 11 files changed, 809 insertions(+), 9 deletions(-)

Cheers,
Becky