All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/27] Refactor PCI controller operations
@ 2015-03-25  5:35 Daniel Axtens
  2015-03-25  5:35 ` [PATCH 01/27] powerpc: move find_and_init_phbs() to pSeries specific code Daniel Axtens
                   ` (26 more replies)
  0 siblings, 27 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

This patch set moves some PCI controller operations out of ppc_md and
into a new pci_controller_ops struct.

This is desirable for systems with more than one type of PCI
controller. In particular, it's intended that this new interface will
be used by the CXL (aka CAPI) driver.

The design tries to balance a desire to avoid having yet another
abstratction layer with a desire to make it easy for vendor kernels to
pull in as little or as much as they are comfortable with.

To this end, it's in 3 main parts:

 1) Set up the pci_controller_ops structure. For each function we add
 to the structure, set up a shim that calls the controller_ops
 function if it exists, or the ppc_md function otherwise. Modify
 callsites to use the shims.

 2) Move each affected platform over from using ppc_md to using the
 controller_ops structure.

 3) Take out the shims and the ppc_md entries. Modify the callsites to
 use the controller_ops calls.

MSI and some legacy functions have been deliberately deferred, and
will be to be tackled at a later point.

The set has been:

 - Build tested for PowerNV, pSeries, Power Mac, Maple, Cell, PaSemi
 and Corenet 64 (for fsl_pci). It builds at every point in the series.

 - Boot tested on pSeries and PowerNV.

The set depends on mpe's two recent cleanup patches to remove powernv
RTAS support [1] and drop celleb [2].

The full breakdown of the patches is as follows:
Patches  1 - 5: minor necessary cleanups
Patches  6 - 12: Introduce struct and shims
Patches 13 - 20: Platform specific migrations
Patches 21 - 26: Remove shims
Patch        27: Final cleanup

Daniel Axtens (27):
  powerpc: move find_and_init_phbs() to pSeries specific code
  powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
  powerpc/swiotlb: give init call a less misleading name
  powerpc/fsl_pci: Don't change ppc_swiotlb_enable after
    swiotlb_subsys_init
  powerpc: pcibios_enable_device_hook: return bool rather than int
  powerpc: Create the pci_controller_ops struct.
  powerpc: ppc_md.pci_dma_dev_setup -> pci_controller_ops.dma_dev_setup
  powerpc: ppc_md.pci_dma_bus_setup -> pci_controller_ops.dma_bus_setup
  powerpc: ppc_md.pci_probe_mode -> pci_controller_ops.probe_mode
  powerpc: ppc_md.pcibios_enable_device_hook ->
    pci_controller_ops.enable_device_hook
  powerpc: ppc_md.pcibios_window_alignment ->
    pci_controller_ops.window_alignment
  powerpc: ppc_md.pcibios_reset_secondary_bus ->
    pci_controller_ops.reset_secondary_bus
  powerpc: dart_iommu: optionally populate controller_ops on init
  powerpc/powermac: Move controller ops from ppc_md to controller_ops
  powerpc/pseries: Move controller ops from ppc_md to controller_ops
  powerpc/powernv:  Move controller ops from ppc_md to controller_ops
  powerpc/pasemi: Move controller ops from ppc_md to controller_ops
  powerpc/maple: Move controller ops from ppc_md to controller_ops
  powerpc: fsl_pci, swiotlb: Move controller ops from ppc_md to
    controller_ops
  powerpc/cell: Move controller ops from ppc_md to controller_ops
  powerpc: Remove shim for pci_controller_ops.window_alignment
  powerpc: Remove shim for pci_controller_ops.reset_secondary_bus
  powerpc: Remove shim for pci_controller_ops.enable_device_hook
  powerpc: Remove shim for pci_controller_ops.probe_mode
  powerpc: Remove shim for pci_controller_ops.dma_dev_setup
  powerpc: Remove shim for pci_controller_ops.dma_bus_setup
  powerpc: dart_iommu: Remove check for controller_ops == NULL case

 arch/powerpc/include/asm/iommu.h            |  3 +-
 arch/powerpc/include/asm/machdep.h          | 14 --------
 arch/powerpc/include/asm/pci-bridge.h       | 19 +++++++++++
 arch/powerpc/include/asm/pci.h              |  2 +-
 arch/powerpc/include/asm/ppc-pci.h          |  3 --
 arch/powerpc/kernel/dma-swiotlb.c           | 11 +++---
 arch/powerpc/kernel/pci-common.c            | 34 +++++++++++-------
 arch/powerpc/kernel/pci-hotplug.c           |  7 ++--
 arch/powerpc/kernel/pci_of_scan.c           |  7 ++--
 arch/powerpc/kernel/rtas_pci.c              | 47 -------------------------
 arch/powerpc/platforms/cell/cell.h          | 24 +++++++++++++
 arch/powerpc/platforms/cell/iommu.c         |  7 ++--
 arch/powerpc/platforms/cell/setup.c         |  5 +++
 arch/powerpc/platforms/maple/maple.h        |  2 ++
 arch/powerpc/platforms/maple/pci.c          |  4 +++
 arch/powerpc/platforms/maple/setup.c        |  2 +-
 arch/powerpc/platforms/pasemi/iommu.c       |  6 ++--
 arch/powerpc/platforms/pasemi/pasemi.h      |  1 +
 arch/powerpc/platforms/pasemi/pci.c         |  5 +++
 arch/powerpc/platforms/powermac/pci.c       | 38 ++++++++++++++++++---
 arch/powerpc/platforms/powermac/pmac.h      |  3 +-
 arch/powerpc/platforms/powermac/setup.c     | 22 +-----------
 arch/powerpc/platforms/powernv/pci-ioda.c   | 15 ++++----
 arch/powerpc/platforms/powernv/pci-p5ioc2.c |  1 +
 arch/powerpc/platforms/powernv/pci.c        |  5 ++-
 arch/powerpc/platforms/powernv/powernv.h    |  2 ++
 arch/powerpc/platforms/pseries/iommu.c      |  9 ++---
 arch/powerpc/platforms/pseries/pseries.h    |  2 ++
 arch/powerpc/platforms/pseries/setup.c      | 53 ++++++++++++++++++++++++++++-
 arch/powerpc/sysdev/dart_iommu.c            | 10 +++---
 arch/powerpc/sysdev/fsl_pci.c               | 23 +++++++++++--
 31 files changed, 244 insertions(+), 142 deletions(-)
 create mode 100644 arch/powerpc/platforms/cell/cell.h

-- 
2.1.4

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

* [PATCH 01/27] powerpc: move find_and_init_phbs() to pSeries specific code
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  7:40   ` Stephen Rothwell
  2015-03-25  5:35 ` [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c Daniel Axtens
                   ` (25 subsequent siblings)
  26 siblings, 1 reply; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Previously, find_and_init_phbs() was used in both PowerNV and pSeries
setup. However, since RTAS support has been dropped from PowerNV, we
can move it into a platform-specific file.

This patch depends on the patch to drop RTAS support from PowerNV:
http://patchwork.ozlabs.org/patch/449316/

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/ppc-pci.h     |  3 ---
 arch/powerpc/kernel/rtas_pci.c         | 47 ----------------------------------
 arch/powerpc/platforms/pseries/setup.c | 47 ++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 50 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index db1e2b8..83f7e8e 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -23,8 +23,6 @@ extern void pci_setup_phb_io_dynamic(struct pci_controller *hose, int primary);
 
 extern struct list_head hose_list;
 
-extern void find_and_init_phbs(void);
-
 extern struct pci_dev *isa_bridge_pcidev;	/* may be NULL if no ISA bus */
 
 /** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID */
@@ -76,7 +74,6 @@ static inline const char *eeh_driver_name(struct pci_dev *pdev)
 #endif /* CONFIG_EEH */
 
 #else /* CONFIG_PCI */
-static inline void find_and_init_phbs(void) { }
 static inline void init_pci_config_tokens(void) { }
 #endif /* !CONFIG_PCI */
 
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index ce230da..42db314 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -277,50 +277,3 @@ int rtas_setup_phb(struct pci_controller *phb)
 
 	return 0;
 }
-
-void __init find_and_init_phbs(void)
-{
-	struct device_node *node;
-	struct pci_controller *phb;
-	struct device_node *root = of_find_node_by_path("/");
-
-	for_each_child_of_node(root, node) {
-		if (node->type == NULL || (strcmp(node->type, "pci") != 0 &&
-					   strcmp(node->type, "pciex") != 0))
-			continue;
-
-		phb = pcibios_alloc_controller(node);
-		if (!phb)
-			continue;
-		rtas_setup_phb(phb);
-		pci_process_bridge_OF_ranges(phb, node, 0);
-		isa_bridge_find_early(phb);
-	}
-
-	of_node_put(root);
-	pci_devs_phb_init();
-
-	/*
-	 * PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties
-	 * in chosen.
-	 */
-	if (of_chosen) {
-		const int *prop;
-
-		prop = of_get_property(of_chosen,
-				"linux,pci-probe-only", NULL);
-		if (prop) {
-			if (*prop)
-				pci_add_flags(PCI_PROBE_ONLY);
-			else
-				pci_clear_flags(PCI_PROBE_ONLY);
-		}
-
-#ifdef CONFIG_PPC32 /* Will be made generic soon */
-		prop = of_get_property(of_chosen,
-				"linux,pci-assign-all-buses", NULL);
-		if (prop && *prop)
-			pci_add_flags(PCI_REASSIGN_ALL_BUS);
-#endif /* CONFIG_PPC32 */
-	}
-}
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e445b67..1a5f884 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -461,6 +461,53 @@ static long pseries_little_endian_exceptions(void)
 }
 #endif
 
+static void __init find_and_init_phbs(void)
+{
+	struct device_node *node;
+	struct pci_controller *phb;
+	struct device_node *root = of_find_node_by_path("/");
+
+	for_each_child_of_node(root, node) {
+		if (node->type == NULL || (strcmp(node->type, "pci") != 0 &&
+					   strcmp(node->type, "pciex") != 0))
+			continue;
+
+		phb = pcibios_alloc_controller(node);
+		if (!phb)
+			continue;
+		rtas_setup_phb(phb);
+		pci_process_bridge_OF_ranges(phb, node, 0);
+		isa_bridge_find_early(phb);
+	}
+
+	of_node_put(root);
+	pci_devs_phb_init();
+
+	/*
+	 * PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties
+	 * in chosen.
+	 */
+	if (of_chosen) {
+		const int *prop;
+
+		prop = of_get_property(of_chosen,
+				"linux,pci-probe-only", NULL);
+		if (prop) {
+			if (*prop)
+				pci_add_flags(PCI_PROBE_ONLY);
+			else
+				pci_clear_flags(PCI_PROBE_ONLY);
+		}
+
+#ifdef CONFIG_PPC32 /* Will be made generic soon */
+		prop = of_get_property(of_chosen,
+				"linux,pci-assign-all-buses", NULL);
+		if (prop && *prop)
+			pci_add_flags(PCI_REASSIGN_ALL_BUS);
+#endif /* CONFIG_PPC32 */
+	}
+}
+
 static void __init pSeries_setup_arch(void)
 {
 	set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
-- 
2.1.4

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

* [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
  2015-03-25  5:35 ` [PATCH 01/27] powerpc: move find_and_init_phbs() to pSeries specific code Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-30 12:32   ` Michael Ellerman
  2015-03-25  5:35 ` [PATCH 03/27] powerpc/swiotlb: give init call a less misleading name Daniel Axtens
                   ` (24 subsequent siblings)
  26 siblings, 1 reply; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/platforms/powermac/pci.c   | 17 +++++++++++++++++
 arch/powerpc/platforms/powermac/pmac.h  |  4 ++++
 arch/powerpc/platforms/powermac/setup.c | 18 ------------------
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index f4071a6..a792f45 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev)
 	pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0);
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie);
+
+#ifdef CONFIG_PPC64
+int pmac_pci_probe_mode(struct pci_bus *bus)
+{
+	struct device_node *node = pci_bus_to_OF_node(bus);
+
+	/* We need to use normal PCI probing for the AGP bus,
+	 * since the device for the AGP bridge isn't in the tree.
+	 * Same for the PCIe host on U4 and the HT host bridge.
+	 */
+	if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") ||
+				  of_device_is_compatible(node, "u4-pcie") ||
+				  of_device_is_compatible(node, "u3-ht")))
+		return PCI_PROBE_NORMAL;
+	return PCI_PROBE_DEVTREE;
+}
+#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
index 8327cce..46d2193 100644
--- a/arch/powerpc/platforms/powermac/pmac.h
+++ b/arch/powerpc/platforms/powermac/pmac.h
@@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn));
 extern int pmac_nvram_init(void);
 extern void pmac_pic_init(void);
 
+#ifdef CONFIG_PPC64
+extern int pmac_pci_probe_mode(struct pci_bus *bus);
+#endif
+
 #endif /* __PMAC_H__ */
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 713d36d..efe172d 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -637,24 +637,6 @@ static int __init pmac_probe(void)
 	return 1;
 }
 
-#ifdef CONFIG_PPC64
-/* Move that to pci.c */
-static int pmac_pci_probe_mode(struct pci_bus *bus)
-{
-	struct device_node *node = pci_bus_to_OF_node(bus);
-
-	/* We need to use normal PCI probing for the AGP bus,
-	 * since the device for the AGP bridge isn't in the tree.
-	 * Same for the PCIe host on U4 and the HT host bridge.
-	 */
-	if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") ||
-				  of_device_is_compatible(node, "u4-pcie") ||
-				  of_device_is_compatible(node, "u3-ht")))
-		return PCI_PROBE_NORMAL;
-	return PCI_PROBE_DEVTREE;
-}
-#endif /* CONFIG_PPC64 */
-
 define_machine(powermac) {
 	.name			= "PowerMac",
 	.probe			= pmac_probe,
-- 
2.1.4

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

* [PATCH 03/27] powerpc/swiotlb: give init call a less misleading name
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
  2015-03-25  5:35 ` [PATCH 01/27] powerpc: move find_and_init_phbs() to pSeries specific code Daniel Axtens
  2015-03-25  5:35 ` [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-30 12:32   ` Michael Ellerman
  2015-03-25  5:35 ` [PATCH 04/27] powerpc/fsl_pci: Don't change ppc_swiotlb_enable after swiotlb_subsys_init Daniel Axtens
                   ` (23 subsequent siblings)
  26 siblings, 1 reply; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

swiotlb_late_init sets up platform specific hooks. It's not actually
a late initcall, but a subsys initcall, called much earlier.

Ideally we'd call it swiotlb_init, but that's taken.
Call it swiotlb_subsys_init for now.
(It will be refactored and renamed later.)

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/kernel/dma-swiotlb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index 7359797..d06491b 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -116,7 +116,7 @@ void __init swiotlb_detect_4g(void)
 	}
 }
 
-static int __init swiotlb_late_init(void)
+static int __init swiotlb_subsys_init(void)
 {
 	if (ppc_swiotlb_enable) {
 		swiotlb_print_info();
@@ -128,4 +128,4 @@ static int __init swiotlb_late_init(void)
 
 	return 0;
 }
-subsys_initcall(swiotlb_late_init);
+subsys_initcall(swiotlb_subsys_init);
-- 
2.1.4

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

* [PATCH 04/27] powerpc/fsl_pci: Don't change ppc_swiotlb_enable after swiotlb_subsys_init
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (2 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 03/27] powerpc/swiotlb: give init call a less misleading name Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-30 12:32   ` Michael Ellerman
  2015-03-25  5:35 ` [PATCH 05/27] powerpc: pcibios_enable_device_hook: return bool rather than int Daniel Axtens
                   ` (22 subsequent siblings)
  26 siblings, 1 reply; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

The only function that checks ppc_swiotlb_enable is swiotlb_subsys_init.
The code in fsl_pci.c is called well after that, so don't bother
changing it.

(ppc_swiotlb is usually set in swiotlb_detect_4g, which is called by
a number of arch initcalls.)

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/sysdev/fsl_pci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 4b74c27..7071feb 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -376,9 +376,7 @@ static void setup_pci_atmu(struct pci_controller *hose)
 	}
 
 	if (hose->dma_window_size < mem) {
-#ifdef CONFIG_SWIOTLB
-		ppc_swiotlb_enable = 1;
-#else
+#ifndef CONFIG_SWIOTLB
 		pr_err("%s: ERROR: Memory size exceeds PCI ATMU ability to "
 			"map - enable CONFIG_SWIOTLB to avoid dma errors.\n",
 			 name);
-- 
2.1.4

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

* [PATCH 05/27] powerpc: pcibios_enable_device_hook: return bool rather than int
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (3 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 04/27] powerpc/fsl_pci: Don't change ppc_swiotlb_enable after swiotlb_subsys_init Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 06/27] powerpc: Create the pci_controller_ops struct Daniel Axtens
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

pcibios_enable_device_hook returned an int. Every implementation
returned either -EINVAL or 0. The return value wasn't propagated by
the caller: any non-zero return value caused pcibios_enable_device
to return -EINVAL itself. Therefore, make the hook return a bool.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/machdep.h        | 4 ++--
 arch/powerpc/kernel/pci-common.c          | 2 +-
 arch/powerpc/platforms/powermac/pci.c     | 8 ++++----
 arch/powerpc/platforms/powermac/pmac.h    | 2 +-
 arch/powerpc/platforms/powernv/pci-ioda.c | 8 ++++----
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index c8175a3..9d4a067 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -237,9 +237,9 @@ struct machdep_calls {
 	/* Called for each PCI bus in the system when it's probed */
 	void (*pcibios_fixup_bus)(struct pci_bus *);
 
-	/* Called when pci_enable_device() is called. Returns 0 to
+	/* Called when pci_enable_device() is called. Returns true to
 	 * allow assignment/enabling of the device. */
-	int  (*pcibios_enable_device_hook)(struct pci_dev *);
+	bool (*pcibios_enable_device_hook)(struct pci_dev *);
 
 	/* Called after scan and before resource survey */
 	void (*pcibios_fixup_phb)(struct pci_controller *hose);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2a525c9..3d07d81 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1451,7 +1451,7 @@ EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
 int pcibios_enable_device(struct pci_dev *dev, int mask)
 {
 	if (ppc_md.pcibios_enable_device_hook)
-		if (ppc_md.pcibios_enable_device_hook(dev))
+		if (!ppc_md.pcibios_enable_device_hook(dev))
 			return -EINVAL;
 
 	return pci_enable_resources(dev, mask);
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index a792f45..9c89fd2 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -942,7 +942,7 @@ void __init pmac_pci_init(void)
 }
 
 #ifdef CONFIG_PPC32
-int pmac_pci_enable_device_hook(struct pci_dev *dev)
+bool pmac_pci_enable_device_hook(struct pci_dev *dev)
 {
 	struct device_node* node;
 	int updatecfg = 0;
@@ -958,11 +958,11 @@ int pmac_pci_enable_device_hook(struct pci_dev *dev)
 	    && !node) {
 		printk(KERN_INFO "Apple USB OHCI %s disabled by firmware\n",
 		       pci_name(dev));
-		return -EINVAL;
+		return false;
 	}
 
 	if (!node)
-		return 0;
+		return true;
 
 	uninorth_child = node->parent &&
 		of_device_is_compatible(node->parent, "uni-north");
@@ -1003,7 +1003,7 @@ int pmac_pci_enable_device_hook(struct pci_dev *dev)
 				      L1_CACHE_BYTES >> 2);
 	}
 
-	return 0;
+	return true;
 }
 
 void pmac_pci_fixup_ohci(struct pci_dev *dev)
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
index 46d2193..b8d5721 100644
--- a/arch/powerpc/platforms/powermac/pmac.h
+++ b/arch/powerpc/platforms/powermac/pmac.h
@@ -25,7 +25,7 @@ extern void pmac_pci_init(void);
 extern void pmac_nvram_update(void);
 extern unsigned char pmac_nvram_read_byte(int addr);
 extern void pmac_nvram_write_byte(int addr, unsigned char val);
-extern int pmac_pci_enable_device_hook(struct pci_dev *dev);
+extern bool pmac_pci_enable_device_hook(struct pci_dev *dev);
 extern void pmac_pcibios_after_init(void);
 extern int of_show_percpuinfo(struct seq_file *m, int i);
 
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 6c9ff2b..c18e191 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1910,7 +1910,7 @@ static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus,
 /* Prevent enabling devices for which we couldn't properly
  * assign a PE
  */
-static int pnv_pci_enable_device_hook(struct pci_dev *dev)
+static bool pnv_pci_enable_device_hook(struct pci_dev *dev)
 {
 	struct pci_controller *hose = pci_bus_to_host(dev->bus);
 	struct pnv_phb *phb = hose->private_data;
@@ -1922,13 +1922,13 @@ static int pnv_pci_enable_device_hook(struct pci_dev *dev)
 	 * PEs isn't ready.
 	 */
 	if (!phb->initialized)
-		return 0;
+		return true;
 
 	pdn = pci_get_pdn(dev);
 	if (!pdn || pdn->pe_number == IODA_INVALID_PE)
-		return -EINVAL;
+		return false;
 
-	return 0;
+	return true;
 }
 
 static u32 pnv_ioda_bdfn_to_pe(struct pnv_phb *phb, struct pci_bus *bus,
-- 
2.1.4

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

* [PATCH 06/27] powerpc: Create the pci_controller_ops struct.
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (4 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 05/27] powerpc: pcibios_enable_device_hook: return bool rather than int Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-30 12:32   ` Michael Ellerman
  2015-03-25  5:35 ` [PATCH 07/27] powerpc: ppc_md.pci_dma_dev_setup -> pci_controller_ops.dma_dev_setup Daniel Axtens
                   ` (20 subsequent siblings)
  26 siblings, 1 reply; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/pci-bridge.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 546d036..3ab8a2d 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -15,6 +15,12 @@
 struct device_node;
 
 /*
+ * PCI controller operations
+ */
+struct pci_controller_ops {
+};
+
+/*
  * Structure of a PCI controller (host bridge)
  */
 struct pci_controller {
@@ -46,6 +52,7 @@ struct pci_controller {
 	resource_size_t	isa_mem_phys;
 	resource_size_t	isa_mem_size;
 
+	struct pci_controller_ops controller_ops;
 	struct pci_ops *ops;
 	unsigned int __iomem *cfg_addr;
 	void __iomem *cfg_data;
-- 
2.1.4

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

* [PATCH 07/27] powerpc: ppc_md.pci_dma_dev_setup -> pci_controller_ops.dma_dev_setup
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (5 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 06/27] powerpc: Create the pci_controller_ops struct Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-30 12:32   ` Michael Ellerman
  2015-03-25  5:35 ` [PATCH 08/27] powerpc: ppc_md.pci_dma_bus_setup -> pci_controller_ops.dma_bus_setup Daniel Axtens
                   ` (19 subsequent siblings)
  26 siblings, 1 reply; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/pci-bridge.h | 14 ++++++++++++++
 arch/powerpc/kernel/pci-common.c      |  3 +--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 3ab8a2d..2474f29 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -18,6 +18,7 @@ struct device_node;
  * PCI controller operations
  */
 struct pci_controller_ops {
+	void		(*dma_dev_setup)(struct pci_dev *dev);
 };
 
 /*
@@ -265,5 +266,18 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address)
 }
 #endif	/* CONFIG_PCI */
 
+/*
+ * Shims to prefer pci_controller version over ppc_md where available.
+ */
+static inline void dma_dev_setup(struct pci_dev *dev)
+{
+	struct pci_controller *hose = pci_bus_to_host(dev->bus);
+
+	if (hose->controller_ops.dma_dev_setup)
+		hose->controller_ops.dma_dev_setup(dev);
+	else if (ppc_md.pci_dma_dev_setup)
+		ppc_md.pci_dma_dev_setup(dev);
+}
+
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 3d07d81..3ce6d0c 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -969,8 +969,7 @@ static void pcibios_setup_device(struct pci_dev *dev)
 	set_dma_offset(&dev->dev, PCI_DRAM_OFFSET);
 
 	/* Additional platform DMA/iommu setup */
-	if (ppc_md.pci_dma_dev_setup)
-		ppc_md.pci_dma_dev_setup(dev);
+	dma_dev_setup(dev);
 
 	/* Read default IRQs and fixup if necessary */
 	pci_read_irq_line(dev);
-- 
2.1.4

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

* [PATCH 08/27] powerpc: ppc_md.pci_dma_bus_setup -> pci_controller_ops.dma_bus_setup
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (6 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 07/27] powerpc: ppc_md.pci_dma_dev_setup -> pci_controller_ops.dma_dev_setup Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 09/27] powerpc: ppc_md.pci_probe_mode -> pci_controller_ops.probe_mode Daniel Axtens
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/pci-bridge.h | 11 +++++++++++
 arch/powerpc/kernel/pci-common.c      |  3 +--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 2474f29..680a46d 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -19,6 +19,7 @@ struct device_node;
  */
 struct pci_controller_ops {
 	void		(*dma_dev_setup)(struct pci_dev *dev);
+	void		(*dma_bus_setup)(struct pci_bus *bus);
 };
 
 /*
@@ -279,5 +280,15 @@ static inline void dma_dev_setup(struct pci_dev *dev)
 		ppc_md.pci_dma_dev_setup(dev);
 }
 
+static inline void dma_bus_setup(struct pci_bus *bus)
+{
+	struct pci_controller *hose = pci_bus_to_host(bus);
+
+	if (hose->controller_ops.dma_bus_setup)
+		hose->controller_ops.dma_bus_setup(bus);
+	else if (ppc_md.pci_dma_bus_setup)
+		ppc_md.pci_dma_bus_setup(bus);
+}
+
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 3ce6d0c..f5280ec 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -953,8 +953,7 @@ void pcibios_setup_bus_self(struct pci_bus *bus)
 		ppc_md.pcibios_fixup_bus(bus);
 
 	/* Setup bus DMA mappings */
-	if (ppc_md.pci_dma_bus_setup)
-		ppc_md.pci_dma_bus_setup(bus);
+	dma_bus_setup(bus);
 }
 
 static void pcibios_setup_device(struct pci_dev *dev)
-- 
2.1.4

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

* [PATCH 09/27] powerpc: ppc_md.pci_probe_mode -> pci_controller_ops.probe_mode
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (7 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 08/27] powerpc: ppc_md.pci_dma_bus_setup -> pci_controller_ops.dma_bus_setup Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 10/27] powerpc: ppc_md.pcibios_enable_device_hook -> pci_controller_ops.enable_device_hook Daniel Axtens
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

We need to move the probe mode defines to pci-bridge.h from pci.h.
They are required by the shim in order to return a sensible default.
Previously, the were defined in pci.h, but pci.h includes pci-bridge.h
before the relevant #defines. This means the definitions are absent
if pci.h is included before pci-bridge.h. This occurs in some drivers.
So, move the definitons now, and move them back when we remove the shim.

Anything that wants the defines would have had to include pci.h, and
since pci.h includes pci-bridge.h, nothing will lose access to the
defines.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/pci-bridge.h | 18 ++++++++++++++++++
 arch/powerpc/include/asm/pci.h        |  5 -----
 arch/powerpc/kernel/pci-common.c      |  4 ++--
 arch/powerpc/kernel/pci-hotplug.c     |  3 +--
 arch/powerpc/kernel/pci_of_scan.c     |  3 +--
 5 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 680a46d..5d69963c 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -12,6 +12,11 @@
 #include <linux/ioport.h>
 #include <asm-generic/pci-bridge.h>
 
+/* Return values for pci_controller_ops.probe_mode function */
+#define PCI_PROBE_NONE		-1	/* Don't look at this bus at all */
+#define PCI_PROBE_NORMAL	0	/* Do normal PCI probing */
+#define PCI_PROBE_DEVTREE	1	/* Instantiate from device tree */
+
 struct device_node;
 
 /*
@@ -20,6 +25,8 @@ struct device_node;
 struct pci_controller_ops {
 	void		(*dma_dev_setup)(struct pci_dev *dev);
 	void		(*dma_bus_setup)(struct pci_bus *bus);
+
+	int		(*probe_mode)(struct pci_bus *);
 };
 
 /*
@@ -290,5 +297,16 @@ static inline void dma_bus_setup(struct pci_bus *bus)
 		ppc_md.pci_dma_bus_setup(bus);
 }
 
+static inline int probe_mode(struct pci_bus *bus)
+{
+	struct pci_controller *hose = pci_bus_to_host(bus);
+
+	if (hose->controller_ops.probe_mode)
+		return hose->controller_ops.probe_mode(bus);
+	if (ppc_md.pci_probe_mode)
+		return ppc_md.pci_probe_mode(bus);
+	return PCI_PROBE_NORMAL;
+}
+
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 1b0739b..8745067 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -22,11 +22,6 @@
 
 #include <asm-generic/pci-dma-compat.h>
 
-/* Return values for ppc_md.pci_probe_mode function */
-#define PCI_PROBE_NONE		-1	/* Don't look at this bus at all */
-#define PCI_PROBE_NORMAL	0	/* Do normal PCI probing */
-#define PCI_PROBE_DEVTREE	1	/* Instantiate from device tree */
-
 #define PCIBIOS_MIN_IO		0x1000
 #define PCIBIOS_MIN_MEM		0x10000000
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index f5280ec..ff68c61 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1622,8 +1622,8 @@ void pcibios_scan_phb(struct pci_controller *hose)
 
 	/* Get probe mode and perform scan */
 	mode = PCI_PROBE_NORMAL;
-	if (node && ppc_md.pci_probe_mode)
-		mode = ppc_md.pci_probe_mode(bus);
+	if (node)
+		mode = probe_mode(bus);
 	pr_debug("    probe mode: %d\n", mode);
 	if (mode == PCI_PROBE_DEVTREE)
 		of_scan_bus(node, bus);
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c
index 5b78917..504d823 100644
--- a/arch/powerpc/kernel/pci-hotplug.c
+++ b/arch/powerpc/kernel/pci-hotplug.c
@@ -78,8 +78,7 @@ void pcibios_add_pci_devices(struct pci_bus * bus)
 	eeh_add_device_tree_early(dn);
 
 	mode = PCI_PROBE_NORMAL;
-	if (ppc_md.pci_probe_mode)
-		mode = ppc_md.pci_probe_mode(bus);
+	mode = probe_mode(bus);
 
 	if (mode == PCI_PROBE_DEVTREE) {
 		/* use ofdt-based probe */
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index e6245e9..ae1767b 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -287,8 +287,7 @@ void of_scan_pci_bridge(struct pci_dev *dev)
 	pr_debug("    bus name: %s\n", bus->name);
 
 	mode = PCI_PROBE_NORMAL;
-	if (ppc_md.pci_probe_mode)
-		mode = ppc_md.pci_probe_mode(bus);
+	mode = probe_mode(bus);
 	pr_debug("    probe mode: %d\n", mode);
 
 	if (mode == PCI_PROBE_DEVTREE)
-- 
2.1.4

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

* [PATCH 10/27] powerpc: ppc_md.pcibios_enable_device_hook -> pci_controller_ops.enable_device_hook
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (8 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 09/27] powerpc: ppc_md.pci_probe_mode -> pci_controller_ops.probe_mode Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 11/27] powerpc: ppc_md.pcibios_window_alignment -> pci_controller_ops.window_alignment Daniel Axtens
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/pci-bridge.h | 15 +++++++++++++++
 arch/powerpc/kernel/pci-common.c      |  5 ++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 5d69963c..5f7e773 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -27,6 +27,10 @@ struct pci_controller_ops {
 	void		(*dma_bus_setup)(struct pci_bus *bus);
 
 	int		(*probe_mode)(struct pci_bus *);
+
+	/* Called when pci_enable_device() is called. Returns true to
+	 * allow assignment/enabling of the device. */
+	bool		(*enable_device_hook)(struct pci_dev *);
 };
 
 /*
@@ -308,5 +312,16 @@ static inline int probe_mode(struct pci_bus *bus)
 	return PCI_PROBE_NORMAL;
 }
 
+static inline bool enable_device_hook(struct pci_dev *dev)
+{
+	struct pci_controller *hose = pci_bus_to_host(dev->bus);
+
+	if (hose->controller_ops.enable_device_hook)
+		return hose->controller_ops.enable_device_hook(dev);
+	if (ppc_md.pcibios_enable_device_hook)
+		return ppc_md.pcibios_enable_device_hook(dev);
+	return true;
+}
+
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index ff68c61..8f939b0 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1448,9 +1448,8 @@ EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
 
 int pcibios_enable_device(struct pci_dev *dev, int mask)
 {
-	if (ppc_md.pcibios_enable_device_hook)
-		if (!ppc_md.pcibios_enable_device_hook(dev))
-			return -EINVAL;
+	if (!enable_device_hook(dev))
+		return -EINVAL;
 
 	return pci_enable_resources(dev, mask);
 }
-- 
2.1.4

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

* [PATCH 11/27] powerpc: ppc_md.pcibios_window_alignment -> pci_controller_ops.window_alignment
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (9 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 10/27] powerpc: ppc_md.pcibios_enable_device_hook -> pci_controller_ops.enable_device_hook Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 12/27] powerpc: ppc_md.pcibios_reset_secondary_bus -> pci_controller_ops.reset_secondary_bus Daniel Axtens
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Name the shim pci_window_alignment (rather than window_alignment)
to avoid clashing with window_alignment in drivers/pci/setup-bus.c

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/pci-bridge.h | 21 +++++++++++++++++++++
 arch/powerpc/kernel/pci-common.c      | 10 +---------
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 5f7e773..dbd143f 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -31,6 +31,9 @@ struct pci_controller_ops {
 	/* Called when pci_enable_device() is called. Returns true to
 	 * allow assignment/enabling of the device. */
 	bool		(*enable_device_hook)(struct pci_dev *);
+
+	/* Called during PCI resource reassignment */
+	resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type);
 };
 
 /*
@@ -323,5 +326,23 @@ static inline bool enable_device_hook(struct pci_dev *dev)
 	return true;
 }
 
+static inline resource_size_t pci_window_alignment(struct pci_bus *bus,
+						   unsigned long type)
+{
+	struct pci_controller *hose = pci_bus_to_host(bus);
+
+	if (hose->controller_ops.window_alignment)
+		return hose->controller_ops.window_alignment(bus, type);
+	if (ppc_md.pcibios_window_alignment)
+		return ppc_md.pcibios_window_alignment(bus, type);
+
+	/*
+	 * PCI core will figure out the default
+	 * alignment: 4KiB for I/O and 1MiB for
+	 * memory window.
+	 */
+	return 1;
+}
+
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 8f939b0..c2bc023 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -109,15 +109,7 @@ void pcibios_free_controller(struct pci_controller *phb)
 resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 					 unsigned long type)
 {
-	if (ppc_md.pcibios_window_alignment)
-		return ppc_md.pcibios_window_alignment(bus, type);
-
-	/*
-	 * PCI core will figure out the default
-	 * alignment: 4KiB for I/O and 1MiB for
-	 * memory window.
-	 */
-	return 1;
+	return pci_window_alignment(bus, type);
 }
 
 void pcibios_reset_secondary_bus(struct pci_dev *dev)
-- 
2.1.4

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

* [PATCH 12/27] powerpc: ppc_md.pcibios_reset_secondary_bus -> pci_controller_ops.reset_secondary_bus
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (10 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 11/27] powerpc: ppc_md.pcibios_window_alignment -> pci_controller_ops.window_alignment Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 13/27] powerpc: dart_iommu: optionally populate controller_ops on init Daniel Axtens
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/pci-bridge.h | 17 +++++++++++++++++
 arch/powerpc/kernel/pci-common.c      |  7 +------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index dbd143f..ea9496b 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -34,6 +34,7 @@ struct pci_controller_ops {
 
 	/* Called during PCI resource reassignment */
 	resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type);
+	void		(*reset_secondary_bus)(struct pci_dev *dev);
 };
 
 /*
@@ -344,5 +345,21 @@ static inline resource_size_t pci_window_alignment(struct pci_bus *bus,
 	return 1;
 }
 
+static inline void reset_secondary_bus(struct pci_dev *dev)
+{
+	struct pci_controller *hose = pci_bus_to_host(dev->bus);
+
+	if (hose->controller_ops.reset_secondary_bus)
+		hose->controller_ops.reset_secondary_bus(dev);
+	else if (ppc_md.pcibios_reset_secondary_bus)
+		ppc_md.pcibios_reset_secondary_bus(dev);
+	else
+		/*
+		 * Fallback to the generic function if no
+		 * platform-specific one is provided
+		 */
+		pci_reset_secondary_bus(dev);
+}
+
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index c2bc023..67d4dcb 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -114,12 +114,7 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 
 void pcibios_reset_secondary_bus(struct pci_dev *dev)
 {
-	if (ppc_md.pcibios_reset_secondary_bus) {
-		ppc_md.pcibios_reset_secondary_bus(dev);
-		return;
-	}
-
-	pci_reset_secondary_bus(dev);
+	reset_secondary_bus(dev);
 }
 
 static resource_size_t pcibios_io_size(const struct pci_controller *hose)
-- 
2.1.4

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

* [PATCH 13/27] powerpc: dart_iommu: optionally populate controller_ops on init
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (11 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 12/27] powerpc: ppc_md.pcibios_reset_secondary_bus -> pci_controller_ops.reset_secondary_bus Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 14/27] powerpc/powermac: Move controller ops from ppc_md to controller_ops Daniel Axtens
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

If a pci_controller_ops struct is provided to iommu_init_early_dart,
populate that with the DMA setup ops, rather than ppc_md. If NULL is
provided, populate ppc_md as before.

This also patches the call sites for Maple and Power Mac to pass
NULL, so existing behaviour is preserved.

The benefit of making this optional is that it means we don't have
to change dart, Maple and Power Mac over to the controller_ops
system in one fell swoop.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/iommu.h        |  3 ++-
 arch/powerpc/platforms/maple/setup.c    |  2 +-
 arch/powerpc/platforms/powermac/setup.c |  2 +-
 arch/powerpc/sysdev/dart_iommu.c        | 16 ++++++++++++----
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index f1ea597..0be7d9e 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -29,6 +29,7 @@
 #include <linux/bitops.h>
 #include <asm/machdep.h>
 #include <asm/types.h>
+#include <asm/pci-bridge.h>
 
 #define IOMMU_PAGE_SHIFT_4K      12
 #define IOMMU_PAGE_SIZE_4K       (ASM_CONST(1) << IOMMU_PAGE_SHIFT_4K)
@@ -169,7 +170,7 @@ extern void iommu_unmap_page(struct iommu_table *tbl, dma_addr_t dma_handle,
 			     struct dma_attrs *attrs);
 
 extern void iommu_init_early_pSeries(void);
-extern void iommu_init_early_dart(void);
+extern void iommu_init_early_dart(struct pci_controller_ops *controller_ops);
 extern void iommu_init_early_pasemi(void);
 
 extern void alloc_dart_table(void);
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 56b85cd..3bf2e03 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -203,7 +203,7 @@ static void __init maple_init_early(void)
 {
 	DBG(" -> maple_init_early\n");
 
-	iommu_init_early_dart();
+	iommu_init_early_dart(NULL);
 
 	DBG(" <- maple_init_early\n");
 }
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index efe172d..71a353c 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -473,7 +473,7 @@ static void __init pmac_init_early(void)
 	udbg_adb_init(!!strstr(boot_command_line, "btextdbg"));
 
 #ifdef CONFIG_PPC64
-	iommu_init_early_dart();
+	iommu_init_early_dart(NULL);
 #endif
 
 	/* SMP Init has to be done early as we need to patch up
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 9e5353f..120e96a 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -369,7 +369,7 @@ static int dart_dma_set_mask(struct device *dev, u64 dma_mask)
 	return 0;
 }
 
-void __init iommu_init_early_dart(void)
+void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
 {
 	struct device_node *dn;
 
@@ -395,15 +395,23 @@ void __init iommu_init_early_dart(void)
 	if (dart_is_u4)
 		ppc_md.dma_set_mask = dart_dma_set_mask;
 
-	ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_dart;
-	ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart;
-
+	if (controller_ops) {
+		controller_ops->dma_dev_setup = pci_dma_dev_setup_dart;
+		controller_ops->dma_bus_setup = pci_dma_bus_setup_dart;
+	} else {
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_dart;
+		ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart;
+	}
 	/* Setup pci_dma ops */
 	set_pci_dma_ops(&dma_iommu_ops);
 	return;
 
  bail:
 	/* If init failed, use direct iommu and null setup functions */
+	if (controller_ops) {
+		controller_ops->dma_dev_setup = NULL;
+		controller_ops->dma_bus_setup = NULL;
+	}
 	ppc_md.pci_dma_dev_setup = NULL;
 	ppc_md.pci_dma_bus_setup = NULL;
 
-- 
2.1.4

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

* [PATCH 14/27] powerpc/powermac: Move controller ops from ppc_md to controller_ops
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (12 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 13/27] powerpc: dart_iommu: optionally populate controller_ops on init Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 15/27] powerpc/pseries: " Daniel Axtens
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

This moves the Power Mac platform to use the pci_controller_ops
structure rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/platforms/powermac/pci.c   | 17 +++++++++++++++--
 arch/powerpc/platforms/powermac/pmac.h  |  5 +----
 arch/powerpc/platforms/powermac/setup.c |  4 +---
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 9c89fd2..59ab16f 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -27,6 +27,8 @@
 #include <asm/grackle.h>
 #include <asm/ppc-pci.h>
 
+#include "pmac.h"
+
 #undef DEBUG
 
 #ifdef DEBUG
@@ -798,6 +800,7 @@ static int __init pmac_add_bridge(struct device_node *dev)
 		return -ENOMEM;
 	hose->first_busno = bus_range ? bus_range[0] : 0;
 	hose->last_busno = bus_range ? bus_range[1] : 0xff;
+	hose->controller_ops = pmac_pci_controller_ops;
 
 	disp_name = NULL;
 
@@ -942,7 +945,7 @@ void __init pmac_pci_init(void)
 }
 
 #ifdef CONFIG_PPC32
-bool pmac_pci_enable_device_hook(struct pci_dev *dev)
+static bool pmac_pci_enable_device_hook(struct pci_dev *dev)
 {
 	struct device_node* node;
 	int updatecfg = 0;
@@ -1225,7 +1228,7 @@ static void fixup_u4_pcie(struct pci_dev* dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie);
 
 #ifdef CONFIG_PPC64
-int pmac_pci_probe_mode(struct pci_bus *bus)
+static int pmac_pci_probe_mode(struct pci_bus *bus)
 {
 	struct device_node *node = pci_bus_to_OF_node(bus);
 
@@ -1240,3 +1243,13 @@ int pmac_pci_probe_mode(struct pci_bus *bus)
 	return PCI_PROBE_DEVTREE;
 }
 #endif /* CONFIG_PPC64 */
+
+struct pci_controller_ops pmac_pci_controller_ops = {
+#ifdef CONFIG_PPC64
+	.probe_mode		= pmac_pci_probe_mode,
+#endif
+#ifdef CONFIG_PPC32
+	.enable_device_hook	= pmac_pci_enable_device_hook,
+#endif
+};
+
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
index b8d5721..e7f8163 100644
--- a/arch/powerpc/platforms/powermac/pmac.h
+++ b/arch/powerpc/platforms/powermac/pmac.h
@@ -25,7 +25,6 @@ extern void pmac_pci_init(void);
 extern void pmac_nvram_update(void);
 extern unsigned char pmac_nvram_read_byte(int addr);
 extern void pmac_nvram_write_byte(int addr, unsigned char val);
-extern bool pmac_pci_enable_device_hook(struct pci_dev *dev);
 extern void pmac_pcibios_after_init(void);
 extern int of_show_percpuinfo(struct seq_file *m, int i);
 
@@ -39,8 +38,6 @@ extern void low_cpu_die(void) __attribute__((noreturn));
 extern int pmac_nvram_init(void);
 extern void pmac_pic_init(void);
 
-#ifdef CONFIG_PPC64
-extern int pmac_pci_probe_mode(struct pci_bus *bus);
-#endif
+extern struct pci_controller_ops pmac_pci_controller_ops;
 
 #endif /* __PMAC_H__ */
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 71a353c..8dd78f4 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -473,7 +473,7 @@ static void __init pmac_init_early(void)
 	udbg_adb_init(!!strstr(boot_command_line, "btextdbg"));
 
 #ifdef CONFIG_PPC64
-	iommu_init_early_dart(NULL);
+	iommu_init_early_dart(&pmac_pci_controller_ops);
 #endif
 
 	/* SMP Init has to be done early as we need to patch up
@@ -656,12 +656,10 @@ define_machine(powermac) {
 	.feature_call		= pmac_do_feature_call,
 	.progress		= udbg_progress,
 #ifdef CONFIG_PPC64
-	.pci_probe_mode		= pmac_pci_probe_mode,
 	.power_save		= power4_idle,
 	.enable_pmcs		= power4_enable_pmcs,
 #endif /* CONFIG_PPC64 */
 #ifdef CONFIG_PPC32
-	.pcibios_enable_device_hook = pmac_pci_enable_device_hook,
 	.pcibios_after_init	= pmac_pcibios_after_init,
 	.phys_mem_access_prot	= pci_phys_mem_access_prot,
 #endif
-- 
2.1.4

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

* [PATCH 15/27] powerpc/pseries: Move controller ops from ppc_md to controller_ops
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (13 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 14/27] powerpc/powermac: Move controller ops from ppc_md to controller_ops Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 16/27] powerpc/powernv: " Daniel Axtens
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

This moves the pSeries platform to use the pci_controller_ops structure,
rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/platforms/pseries/iommu.c   | 9 +++++----
 arch/powerpc/platforms/pseries/pseries.h | 2 ++
 arch/powerpc/platforms/pseries/setup.c   | 6 +++++-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 7803a19..61d5a17 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -49,6 +49,7 @@
 #include <asm/mmzone.h>
 #include <asm/plpar_wrappers.h>
 
+#include "pseries.h"
 
 static void tce_invalidate_pSeries_sw(struct iommu_table *tbl,
 				      __be64 *startp, __be64 *endp)
@@ -1307,16 +1308,16 @@ void iommu_init_early_pSeries(void)
 			ppc_md.tce_free	 = tce_free_pSeriesLP;
 		}
 		ppc_md.tce_get   = tce_get_pSeriesLP;
-		ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pSeriesLP;
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_pSeriesLP;
+		pseries_pci_controller_ops.dma_bus_setup = pci_dma_bus_setup_pSeriesLP;
+		pseries_pci_controller_ops.dma_dev_setup = pci_dma_dev_setup_pSeriesLP;
 		ppc_md.dma_set_mask = dma_set_mask_pSeriesLP;
 		ppc_md.dma_get_required_mask = dma_get_required_mask_pSeriesLP;
 	} else {
 		ppc_md.tce_build = tce_build_pSeries;
 		ppc_md.tce_free  = tce_free_pSeries;
 		ppc_md.tce_get   = tce_get_pseries;
-		ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pSeries;
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_pSeries;
+		pseries_pci_controller_ops.dma_bus_setup = pci_dma_bus_setup_pSeries;
+		pseries_pci_controller_ops.dma_dev_setup = pci_dma_dev_setup_pSeries;
 	}
 
 
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 1796c54..cd64672 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -65,6 +65,8 @@ extern int dlpar_detach_node(struct device_node *);
 struct pci_host_bridge;
 int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
 
+extern struct pci_controller_ops pseries_pci_controller_ops;
+
 unsigned long pseries_memory_block_size(void);
 
 #endif /* _PSERIES_PSERIES_H */
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 1a5f884..328e318 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -478,6 +478,7 @@ static void __init find_and_init_phbs(void)
 		rtas_setup_phb(phb);
 		pci_process_bridge_OF_ranges(phb, node, 0);
 		isa_bridge_find_early(phb);
+		phb->controller_ops = pseries_pci_controller_ops;
 	}
 
 	of_node_put(root);
@@ -840,6 +841,10 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus)
 void pSeries_final_fixup(void) { }
 #endif
 
+struct pci_controller_ops pseries_pci_controller_ops = {
+	.probe_mode		= pSeries_pci_probe_mode,
+};
+
 define_machine(pseries) {
 	.name			= "pSeries",
 	.probe			= pSeries_probe,
@@ -848,7 +853,6 @@ define_machine(pseries) {
 	.show_cpuinfo		= pSeries_show_cpuinfo,
 	.log_error		= pSeries_log_error,
 	.pcibios_fixup		= pSeries_final_fixup,
-	.pci_probe_mode		= pSeries_pci_probe_mode,
 	.restart		= rtas_restart,
 	.halt			= rtas_halt,
 	.panic			= rtas_os_term,
-- 
2.1.4

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

* [PATCH 16/27] powerpc/powernv: Move controller ops from ppc_md to controller_ops
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (14 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 15/27] powerpc/pseries: " Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 17/27] powerpc/pasemi: " Daniel Axtens
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

This moves the PowerNV platform to use the pci_controller_ops
structure rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/platforms/powernv/pci-ioda.c   | 7 ++++---
 arch/powerpc/platforms/powernv/pci-p5ioc2.c | 1 +
 arch/powerpc/platforms/powernv/pci.c        | 5 ++++-
 arch/powerpc/platforms/powernv/powernv.h    | 2 ++
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index c18e191..b4e46bf 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1988,6 +1988,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
 		hose->last_busno = 0xff;
 	}
 	hose->private_data = phb;
+	hose->controller_ops = pnv_pci_controller_ops;
 	phb->hub_id = hub_id;
 	phb->opal_id = phb_id;
 	phb->type = ioda_type;
@@ -2104,9 +2105,9 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
 	 * the child P2P bridges) can form individual PE.
 	 */
 	ppc_md.pcibios_fixup = pnv_pci_ioda_fixup;
-	ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook;
-	ppc_md.pcibios_window_alignment = pnv_pci_window_alignment;
-	ppc_md.pcibios_reset_secondary_bus = pnv_pci_reset_secondary_bus;
+	pnv_pci_controller_ops.enable_device_hook = pnv_pci_enable_device_hook;
+	pnv_pci_controller_ops.window_alignment = pnv_pci_window_alignment;
+	pnv_pci_controller_ops.reset_secondary_bus = pnv_pci_reset_secondary_bus;
 	pci_add_flags(PCI_REASSIGN_ALL_RSRC);
 
 	/* Reset IODA tables to a clean state */
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
index 6ef6d4d..4729ca7 100644
--- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
+++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
@@ -133,6 +133,7 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id,
 	phb->hose->first_busno = 0;
 	phb->hose->last_busno = 0xff;
 	phb->hose->private_data = phb;
+	phb->hose->controller_ops = pnv_pci_controller_ops;
 	phb->hub_id = hub_id;
 	phb->opal_id = phb_id;
 	phb->type = PNV_PHB_P5IOC2;
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index c8939ad..63518b3 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -761,7 +761,6 @@ void __init pnv_pci_init(void)
 	pci_devs_phb_init();
 
 	/* Configure IOMMU DMA hooks */
-	ppc_md.pci_dma_dev_setup = pnv_pci_dma_dev_setup;
 	ppc_md.tce_build = pnv_tce_build_vm;
 	ppc_md.tce_free = pnv_tce_free_vm;
 	ppc_md.tce_build_rm = pnv_tce_build_rm;
@@ -777,3 +776,7 @@ void __init pnv_pci_init(void)
 }
 
 machine_subsys_initcall_sync(powernv, tce_iommu_bus_notifier_init);
+
+struct pci_controller_ops pnv_pci_controller_ops = {
+	.dma_dev_setup = pnv_pci_dma_dev_setup,
+};
diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
index 604c48e..826d2c9 100644
--- a/arch/powerpc/platforms/powernv/powernv.h
+++ b/arch/powerpc/platforms/powernv/powernv.h
@@ -29,6 +29,8 @@ static inline u64 pnv_pci_dma_get_required_mask(struct pci_dev *pdev)
 }
 #endif
 
+extern struct pci_controller_ops pnv_pci_controller_ops;
+
 extern u32 pnv_get_supported_cpuidle_states(void);
 
 extern void pnv_lpc_init(void);
-- 
2.1.4

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

* [PATCH 17/27] powerpc/pasemi: Move controller ops from ppc_md to controller_ops
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (15 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 16/27] powerpc/powernv: " Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 18/27] powerpc/maple: " Daniel Axtens
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

This moves the PaSemi platform to use the pci_controller_ops
structure rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/platforms/pasemi/iommu.c  | 6 ++++--
 arch/powerpc/platforms/pasemi/pasemi.h | 1 +
 arch/powerpc/platforms/pasemi/pci.c    | 5 +++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 2e576f2..b8f567b 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -27,6 +27,8 @@
 #include <asm/machdep.h>
 #include <asm/firmware.h>
 
+#include "pasemi.h"
+
 #define IOBMAP_PAGE_SHIFT	12
 #define IOBMAP_PAGE_SIZE	(1 << IOBMAP_PAGE_SHIFT)
 #define IOBMAP_PAGE_MASK	(IOBMAP_PAGE_SIZE - 1)
@@ -248,8 +250,8 @@ void __init iommu_init_early_pasemi(void)
 
 	iob_init(NULL);
 
-	ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_pasemi;
-	ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi;
+	pasemi_pci_controller_ops.dma_dev_setup = pci_dma_dev_setup_pasemi;
+	pasemi_pci_controller_ops.dma_bus_setup = pci_dma_bus_setup_pasemi;
 	ppc_md.tce_build = iobmap_build;
 	ppc_md.tce_free  = iobmap_free;
 	set_pci_dma_ops(&dma_iommu_ops);
diff --git a/arch/powerpc/platforms/pasemi/pasemi.h b/arch/powerpc/platforms/pasemi/pasemi.h
index ea65bf0..11f230a 100644
--- a/arch/powerpc/platforms/pasemi/pasemi.h
+++ b/arch/powerpc/platforms/pasemi/pasemi.h
@@ -30,5 +30,6 @@ static inline void restore_astate(int cpu)
 }
 #endif
 
+extern struct pci_controller_ops pasemi_pci_controller_ops;
 
 #endif /* _PASEMI_PASEMI_H */
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index aa86271..f3a68a0 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -31,6 +31,8 @@
 
 #include <asm/ppc-pci.h>
 
+#include "pasemi.h"
+
 #define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off))
 
 static inline int pa_pxp_offset_valid(u8 bus, u8 devfn, int offset)
@@ -199,6 +201,7 @@ static int __init pas_add_bridge(struct device_node *dev)
 
 	hose->first_busno = 0;
 	hose->last_busno = 0xff;
+	hose->controller_ops = pasemi_pci_controller_ops;
 
 	setup_pa_pxp(hose);
 
@@ -239,3 +242,5 @@ void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset)
 
 	return (void __iomem *)pa_pxp_cfg_addr(hose, dev->bus->number, dev->devfn, offset);
 }
+
+struct pci_controller_ops pasemi_pci_controller_ops;
-- 
2.1.4

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

* [PATCH 18/27] powerpc/maple: Move controller ops from ppc_md to controller_ops
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (16 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 17/27] powerpc/pasemi: " Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 19/27] powerpc: fsl_pci, swiotlb: " Daniel Axtens
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

This moves the Maple platform to use the pci_controller_ops
structure rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/platforms/maple/maple.h | 2 ++
 arch/powerpc/platforms/maple/pci.c   | 4 ++++
 arch/powerpc/platforms/maple/setup.c | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/maple/maple.h b/arch/powerpc/platforms/maple/maple.h
index c6911dd..eecfa18 100644
--- a/arch/powerpc/platforms/maple/maple.h
+++ b/arch/powerpc/platforms/maple/maple.h
@@ -10,3 +10,5 @@ extern void maple_calibrate_decr(void);
 extern void maple_pci_init(void);
 extern void maple_pci_irq_fixup(struct pci_dev *dev);
 extern int maple_pci_get_legacy_ide_irq(struct pci_dev *dev, int channel);
+
+extern struct pci_controller_ops maple_pci_controller_ops;
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index d3a1306..a923230 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -510,6 +510,7 @@ static int __init maple_add_bridge(struct device_node *dev)
 		return -ENOMEM;
 	hose->first_busno = bus_range ? bus_range[0] : 0;
 	hose->last_busno = bus_range ? bus_range[1] : 0xff;
+	hose->controller_ops = maple_pci_controller_ops;
 
 	disp_name = NULL;
 	if (of_device_is_compatible(dev, "u3-agp")) {
@@ -660,3 +661,6 @@ static void quirk_ipr_msi(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN,
 			quirk_ipr_msi);
+
+struct pci_controller_ops maple_pci_controller_ops = {
+};
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 3bf2e03..a837188 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -203,7 +203,7 @@ static void __init maple_init_early(void)
 {
 	DBG(" -> maple_init_early\n");
 
-	iommu_init_early_dart(NULL);
+	iommu_init_early_dart(&maple_pci_controller_ops);
 
 	DBG(" <- maple_init_early\n");
 }
-- 
2.1.4

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

* [PATCH 19/27] powerpc: fsl_pci, swiotlb: Move controller ops from ppc_md to controller_ops
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (17 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 18/27] powerpc/maple: " Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 20/27] powerpc/cell: " Daniel Axtens
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

This moves the setup out of swiotlb's subsys init call, and into an

fsl_pci.c is the only thing that checks the ppc_swiotlb_enable global,
so we can be confident that patching it will cover all the PCI
implementations affected by the changes to dma-swiotlb.c.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/kernel/dma-swiotlb.c | 11 ++++-------
 arch/powerpc/sysdev/fsl_pci.c     | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index d06491b..6e8d764 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -116,16 +116,13 @@ void __init swiotlb_detect_4g(void)
 	}
 }
 
-static int __init swiotlb_subsys_init(void)
+static int __init check_swiotlb_enabled(void)
 {
-	if (ppc_swiotlb_enable) {
+	if (ppc_swiotlb_enable)
 		swiotlb_print_info();
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	} else {
+	else
 		swiotlb_free();
-	}
 
 	return 0;
 }
-subsys_initcall(swiotlb_subsys_init);
+subsys_initcall(check_swiotlb_enabled);
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 7071feb..ca13b7f 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -111,6 +111,22 @@ static struct pci_ops fsl_indirect_pcie_ops =
 #define MAX_PHYS_ADDR_BITS	40
 static u64 pci64_dma_offset = 1ull << MAX_PHYS_ADDR_BITS;
 
+#ifdef CONFIG_SWIOTLB
+static struct pci_controller_ops swiotlb_pci_controller_ops = {
+	.dma_dev_setup = pci_dma_dev_setup_swiotlb,
+};
+
+static void setup_swiotlb_ops(struct pci_controller *hose)
+{
+	if (ppc_swiotlb_enable) {
+		hose->controller_ops = swiotlb_pci_controller_ops;
+		set_pci_dma_ops(&swiotlb_dma_ops);
+	}
+}
+#else
+static inline void setup_swiotlb_ops(struct pci_controller *hose) {}
+#endif
+
 static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask)
 {
 	if (!dev->dma_mask || !dma_supported(dev, dma_mask))
@@ -492,6 +508,9 @@ int fsl_add_bridge(struct platform_device *pdev, int is_primary)
 	hose->first_busno = bus_range ? bus_range[0] : 0x0;
 	hose->last_busno = bus_range ? bus_range[1] : 0xff;
 
+	/* Set up controller operations */
+	setup_swiotlb_ops(hose);
+
 	pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n",
 		 (u64)rsrc.start, (u64)resource_size(&rsrc));
 
-- 
2.1.4

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

* [PATCH 20/27] powerpc/cell: Move controller ops from ppc_md to controller_ops
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (18 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 19/27] powerpc: fsl_pci, swiotlb: " Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 21/27] powerpc: Remove shim for pci_controller_ops.window_alignment Daniel Axtens
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

This moves the Cell platform to use the pci_controller_ops
structure rather than ppc_md for PCI controller operations.

This depends on the patch to drop celleb support:
http://patchwork.ozlabs.org/patch/451730/

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/platforms/cell/cell.h  | 24 ++++++++++++++++++++++++
 arch/powerpc/platforms/cell/iommu.c |  7 ++++---
 arch/powerpc/platforms/cell/setup.c |  5 +++++
 3 files changed, 33 insertions(+), 3 deletions(-)
 create mode 100644 arch/powerpc/platforms/cell/cell.h

diff --git a/arch/powerpc/platforms/cell/cell.h b/arch/powerpc/platforms/cell/cell.h
new file mode 100644
index 0000000..ef143df
--- /dev/null
+++ b/arch/powerpc/platforms/cell/cell.h
@@ -0,0 +1,24 @@
+/*
+ * Cell Platform common data structures
+ *
+ * Copyright 2015, Daniel Axtens, IBM Corporation
+ *
+ * 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, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef CELL_H
+#define CELL_H
+
+#include <asm/pci-bridge.h>
+
+extern struct pci_controller_ops cell_pci_controller_ops;
+
+#endif
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 31b1a67..4cb120f 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -39,6 +39,7 @@
 #include <asm/firmware.h>
 #include <asm/cell-regs.h>
 
+#include "cell.h"
 #include "interrupt.h"
 
 /* Define CELL_IOMMU_REAL_UNMAP to actually unmap non-used pages
@@ -857,7 +858,7 @@ static int __init cell_iommu_init_disabled(void)
 	cell_dma_direct_offset += base;
 
 	if (cell_dma_direct_offset != 0)
-		ppc_md.pci_dma_dev_setup = cell_pci_dma_dev_setup;
+		cell_pci_controller_ops.dma_dev_setup = cell_pci_dma_dev_setup;
 
 	printk("iommu: disabled, direct DMA offset is 0x%lx\n",
 	       cell_dma_direct_offset);
@@ -1197,8 +1198,8 @@ static int __init cell_iommu_init(void)
 		if (cell_iommu_init_disabled() == 0)
 			goto bail;
 
-	/* Setup various ppc_md. callbacks */
-	ppc_md.pci_dma_dev_setup = cell_pci_dma_dev_setup;
+	/* Setup various callbacks */
+	cell_pci_controller_ops.dma_dev_setup = cell_pci_dma_dev_setup;
 	ppc_md.dma_get_required_mask = cell_dma_get_required_mask;
 	ppc_md.tce_build = tce_build_cell;
 	ppc_md.tce_free = tce_free_cell;
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index d62aa98..d1be268 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -54,6 +54,7 @@
 #include <asm/cell-regs.h>
 #include <asm/io-workarounds.h>
 
+#include "cell.h"
 #include "interrupt.h"
 #include "pervasive.h"
 #include "ras.h"
@@ -131,6 +132,8 @@ static int cell_setup_phb(struct pci_controller *phb)
 	if (model == NULL || strcmp(np->name, "pci"))
 		return 0;
 
+	phb->controller_ops = cell_pci_controller_ops;
+
 	/* Setup workarounds for spider */
 	if (strcmp(model, "Spider"))
 		return 0;
@@ -279,3 +282,5 @@ define_machine(cell) {
 	.init_IRQ       	= cell_init_irq,
 	.pci_setup_phb		= cell_setup_phb,
 };
+
+struct pci_controller_ops cell_pci_controller_ops;
-- 
2.1.4

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

* [PATCH 21/27] powerpc: Remove shim for pci_controller_ops.window_alignment
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (19 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 20/27] powerpc/cell: " Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 22/27] powerpc: Remove shim for pci_controller_ops.reset_secondary_bus Daniel Axtens
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/machdep.h    |  3 ---
 arch/powerpc/include/asm/pci-bridge.h | 18 ------------------
 arch/powerpc/kernel/pci-common.c      | 12 +++++++++++-
 3 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 9d4a067..f1476b8 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -244,9 +244,6 @@ struct machdep_calls {
 	/* Called after scan and before resource survey */
 	void (*pcibios_fixup_phb)(struct pci_controller *hose);
 
-	/* Called during PCI resource reassignment */
-	resource_size_t (*pcibios_window_alignment)(struct pci_bus *, unsigned long type);
-
 	/* Reset the secondary bus of bridge */
 	void  (*pcibios_reset_secondary_bus)(struct pci_dev *dev);
 
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index ea9496b..b62e043 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -327,24 +327,6 @@ static inline bool enable_device_hook(struct pci_dev *dev)
 	return true;
 }
 
-static inline resource_size_t pci_window_alignment(struct pci_bus *bus,
-						   unsigned long type)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	if (hose->controller_ops.window_alignment)
-		return hose->controller_ops.window_alignment(bus, type);
-	if (ppc_md.pcibios_window_alignment)
-		return ppc_md.pcibios_window_alignment(bus, type);
-
-	/*
-	 * PCI core will figure out the default
-	 * alignment: 4KiB for I/O and 1MiB for
-	 * memory window.
-	 */
-	return 1;
-}
-
 static inline void reset_secondary_bus(struct pci_dev *dev)
 {
 	struct pci_controller *hose = pci_bus_to_host(dev->bus);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 67d4dcb..9edb479 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -109,7 +109,17 @@ void pcibios_free_controller(struct pci_controller *phb)
 resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 					 unsigned long type)
 {
-	return pci_window_alignment(bus, type);
+	struct pci_controller *hose = pci_bus_to_host(bus);
+
+	if (hose->controller_ops.window_alignment)
+		return hose->controller_ops.window_alignment(bus, type);
+
+	/*
+	 * PCI core will figure out the default
+	 * alignment: 4KiB for I/O and 1MiB for
+	 * memory window.
+	 */
+	return 1;
 }
 
 void pcibios_reset_secondary_bus(struct pci_dev *dev)
-- 
2.1.4

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

* [PATCH 22/27] powerpc: Remove shim for pci_controller_ops.reset_secondary_bus
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (20 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 21/27] powerpc: Remove shim for pci_controller_ops.window_alignment Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 23/27] powerpc: Remove shim for pci_controller_ops.enable_device_hook Daniel Axtens
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/machdep.h    |  3 ---
 arch/powerpc/include/asm/pci-bridge.h | 16 ----------------
 arch/powerpc/kernel/pci-common.c      |  9 ++++++++-
 3 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index f1476b8..f178cf1 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -244,9 +244,6 @@ struct machdep_calls {
 	/* Called after scan and before resource survey */
 	void (*pcibios_fixup_phb)(struct pci_controller *hose);
 
-	/* Reset the secondary bus of bridge */
-	void  (*pcibios_reset_secondary_bus)(struct pci_dev *dev);
-
 	/* Called to shutdown machine specific hardware not already controlled
 	 * by other drivers.
 	 */
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index b62e043..b08db93 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -327,21 +327,5 @@ static inline bool enable_device_hook(struct pci_dev *dev)
 	return true;
 }
 
-static inline void reset_secondary_bus(struct pci_dev *dev)
-{
-	struct pci_controller *hose = pci_bus_to_host(dev->bus);
-
-	if (hose->controller_ops.reset_secondary_bus)
-		hose->controller_ops.reset_secondary_bus(dev);
-	else if (ppc_md.pcibios_reset_secondary_bus)
-		ppc_md.pcibios_reset_secondary_bus(dev);
-	else
-		/*
-		 * Fallback to the generic function if no
-		 * platform-specific one is provided
-		 */
-		pci_reset_secondary_bus(dev);
-}
-
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 9edb479..a535d31 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -124,7 +124,14 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 
 void pcibios_reset_secondary_bus(struct pci_dev *dev)
 {
-	reset_secondary_bus(dev);
+	struct pci_controller *hose = pci_bus_to_host(dev->bus);
+
+	if (hose->controller_ops.reset_secondary_bus) {
+		hose->controller_ops.reset_secondary_bus(dev);
+		return;
+	}
+
+	pci_reset_secondary_bus(dev);
 }
 
 static resource_size_t pcibios_io_size(const struct pci_controller *hose)
-- 
2.1.4

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

* [PATCH 23/27] powerpc: Remove shim for pci_controller_ops.enable_device_hook
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (21 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 22/27] powerpc: Remove shim for pci_controller_ops.reset_secondary_bus Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 24/27] powerpc: Remove shim for pci_controller_ops.probe_mode Daniel Axtens
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/machdep.h    |  4 ----
 arch/powerpc/include/asm/pci-bridge.h | 11 -----------
 arch/powerpc/kernel/pci-common.c      |  7 +++++--
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index f178cf1..5549b6c 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -237,10 +237,6 @@ struct machdep_calls {
 	/* Called for each PCI bus in the system when it's probed */
 	void (*pcibios_fixup_bus)(struct pci_bus *);
 
-	/* Called when pci_enable_device() is called. Returns true to
-	 * allow assignment/enabling of the device. */
-	bool (*pcibios_enable_device_hook)(struct pci_dev *);
-
 	/* Called after scan and before resource survey */
 	void (*pcibios_fixup_phb)(struct pci_controller *hose);
 
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index b08db93..029def0 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -316,16 +316,5 @@ static inline int probe_mode(struct pci_bus *bus)
 	return PCI_PROBE_NORMAL;
 }
 
-static inline bool enable_device_hook(struct pci_dev *dev)
-{
-	struct pci_controller *hose = pci_bus_to_host(dev->bus);
-
-	if (hose->controller_ops.enable_device_hook)
-		return hose->controller_ops.enable_device_hook(dev);
-	if (ppc_md.pcibios_enable_device_hook)
-		return ppc_md.pcibios_enable_device_hook(dev);
-	return true;
-}
-
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index a535d31..5b90e99c 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1452,8 +1452,11 @@ EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
 
 int pcibios_enable_device(struct pci_dev *dev, int mask)
 {
-	if (!enable_device_hook(dev))
-		return -EINVAL;
+	struct pci_controller *hose = pci_bus_to_host(dev->bus);
+
+	if (hose->controller_ops.enable_device_hook)
+		if (!hose->controller_ops.enable_device_hook(dev))
+			return -EINVAL;
 
 	return pci_enable_resources(dev, mask);
 }
-- 
2.1.4

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

* [PATCH 24/27] powerpc: Remove shim for pci_controller_ops.probe_mode
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (22 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 23/27] powerpc: Remove shim for pci_controller_ops.enable_device_hook Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:35 ` [PATCH 25/27] powerpc: Remove shim for pci_controller_ops.dma_dev_setup Daniel Axtens
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

This also moves back the defines, as explained in the commit that
created the shim.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/machdep.h    |  1 -
 arch/powerpc/include/asm/pci-bridge.h | 16 ----------------
 arch/powerpc/include/asm/pci.h        |  5 +++++
 arch/powerpc/kernel/pci-common.c      |  4 ++--
 arch/powerpc/kernel/pci-hotplug.c     |  6 +++++-
 arch/powerpc/kernel/pci_of_scan.c     |  6 +++++-
 6 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 5549b6c..dfc8d2b 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -127,7 +127,6 @@ struct machdep_calls {
 	/* PCI stuff */
 	/* Called after scanning the bus, before allocating resources */
 	void		(*pcibios_fixup)(void);
-	int		(*pci_probe_mode)(struct pci_bus *);
 	void		(*pci_irq_fixup)(struct pci_dev *dev);
 	int		(*pcibios_root_bridge_prepare)(struct pci_host_bridge
 				*bridge);
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 029def0..b5d8631 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -12,11 +12,6 @@
 #include <linux/ioport.h>
 #include <asm-generic/pci-bridge.h>
 
-/* Return values for pci_controller_ops.probe_mode function */
-#define PCI_PROBE_NONE		-1	/* Don't look at this bus at all */
-#define PCI_PROBE_NORMAL	0	/* Do normal PCI probing */
-#define PCI_PROBE_DEVTREE	1	/* Instantiate from device tree */
-
 struct device_node;
 
 /*
@@ -305,16 +300,5 @@ static inline void dma_bus_setup(struct pci_bus *bus)
 		ppc_md.pci_dma_bus_setup(bus);
 }
 
-static inline int probe_mode(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	if (hose->controller_ops.probe_mode)
-		return hose->controller_ops.probe_mode(bus);
-	if (ppc_md.pci_probe_mode)
-		return ppc_md.pci_probe_mode(bus);
-	return PCI_PROBE_NORMAL;
-}
-
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 8745067..4aef8d6 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -22,6 +22,11 @@
 
 #include <asm-generic/pci-dma-compat.h>
 
+/* Return values for pci_controller_ops.probe_mode function */
+#define PCI_PROBE_NONE		-1	/* Don't look at this bus at all */
+#define PCI_PROBE_NORMAL	0	/* Do normal PCI probing */
+#define PCI_PROBE_DEVTREE	1	/* Instantiate from device tree */
+
 #define PCIBIOS_MIN_IO		0x1000
 #define PCIBIOS_MIN_MEM		0x10000000
 
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 5b90e99c..a61ecb4 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1628,8 +1628,8 @@ void pcibios_scan_phb(struct pci_controller *hose)
 
 	/* Get probe mode and perform scan */
 	mode = PCI_PROBE_NORMAL;
-	if (node)
-		mode = probe_mode(bus);
+	if (node && hose->controller_ops.probe_mode)
+		mode = hose->controller_ops.probe_mode(bus);
 	pr_debug("    probe mode: %d\n", mode);
 	if (mode == PCI_PROBE_DEVTREE)
 		of_scan_bus(node, bus);
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c
index 504d823..e9b0a4a 100644
--- a/arch/powerpc/kernel/pci-hotplug.c
+++ b/arch/powerpc/kernel/pci-hotplug.c
@@ -73,12 +73,16 @@ void pcibios_add_pci_devices(struct pci_bus * bus)
 {
 	int slotno, mode, pass, max;
 	struct pci_dev *dev;
+	struct pci_controller *hose;
 	struct device_node *dn = pci_bus_to_OF_node(bus);
 
 	eeh_add_device_tree_early(dn);
 
+	hose = pci_bus_to_host(bus);
+
 	mode = PCI_PROBE_NORMAL;
-	mode = probe_mode(bus);
+	if (hose->controller_ops.probe_mode)
+		mode = hose->controller_ops.probe_mode(bus);
 
 	if (mode == PCI_PROBE_DEVTREE) {
 		/* use ofdt-based probe */
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index ae1767b..8312962 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -207,6 +207,7 @@ void of_scan_pci_bridge(struct pci_dev *dev)
 {
 	struct device_node *node = dev->dev.of_node;
 	struct pci_bus *bus;
+	struct pci_controller *hose;
 	const __be32 *busrange, *ranges;
 	int len, i, mode;
 	struct pci_bus_region region;
@@ -286,8 +287,11 @@ void of_scan_pci_bridge(struct pci_dev *dev)
 		bus->number);
 	pr_debug("    bus name: %s\n", bus->name);
 
+	hose = pci_bus_to_host(bus);
+
 	mode = PCI_PROBE_NORMAL;
-	mode = probe_mode(bus);
+	if (hose->controller_ops.probe_mode)
+		mode = hose->controller_ops.probe_mode(bus);
 	pr_debug("    probe mode: %d\n", mode);
 
 	if (mode == PCI_PROBE_DEVTREE)
-- 
2.1.4

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

* [PATCH 25/27] powerpc: Remove shim for pci_controller_ops.dma_dev_setup
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (23 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 24/27] powerpc: Remove shim for pci_controller_ops.probe_mode Daniel Axtens
@ 2015-03-25  5:35 ` Daniel Axtens
  2015-03-25  5:36 ` [PATCH 26/27] powerpc: Remove shim for pci_controller_ops.dma_bus_setup Daniel Axtens
  2015-03-25  5:36 ` [PATCH 27/27] powerpc: dart_iommu: Remove check for controller_ops == NULL case Daniel Axtens
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/machdep.h    | 1 -
 arch/powerpc/include/asm/pci-bridge.h | 9 ---------
 arch/powerpc/kernel/pci-common.c      | 5 ++++-
 arch/powerpc/sysdev/dart_iommu.c      | 2 --
 4 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index dfc8d2b..2f7b319 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -103,7 +103,6 @@ struct machdep_calls {
 #endif
 #endif /* CONFIG_PPC64 */
 
-	void		(*pci_dma_dev_setup)(struct pci_dev *dev);
 	void		(*pci_dma_bus_setup)(struct pci_bus *bus);
 
 	/* Platform set_dma_mask and dma_get_required_mask overrides */
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index b5d8631..e578f67 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -280,15 +280,6 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address)
 /*
  * Shims to prefer pci_controller version over ppc_md where available.
  */
-static inline void dma_dev_setup(struct pci_dev *dev)
-{
-	struct pci_controller *hose = pci_bus_to_host(dev->bus);
-
-	if (hose->controller_ops.dma_dev_setup)
-		hose->controller_ops.dma_dev_setup(dev);
-	else if (ppc_md.pci_dma_dev_setup)
-		ppc_md.pci_dma_dev_setup(dev);
-}
 
 static inline void dma_bus_setup(struct pci_bus *bus)
 {
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index a61ecb4..433b387 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -962,6 +962,7 @@ void pcibios_setup_bus_self(struct pci_bus *bus)
 
 static void pcibios_setup_device(struct pci_dev *dev)
 {
+	struct pci_controller *hose;
 	/* Fixup NUMA node as it may not be setup yet by the generic
 	 * code and is needed by the DMA init
 	 */
@@ -972,7 +973,9 @@ static void pcibios_setup_device(struct pci_dev *dev)
 	set_dma_offset(&dev->dev, PCI_DRAM_OFFSET);
 
 	/* Additional platform DMA/iommu setup */
-	dma_dev_setup(dev);
+	hose = pci_bus_to_host(dev->bus);
+	if (hose->controller_ops.dma_dev_setup)
+		hose->controller_ops.dma_dev_setup(dev);
 
 	/* Read default IRQs and fixup if necessary */
 	pci_read_irq_line(dev);
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 120e96a..ca38b1e 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -399,7 +399,6 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
 		controller_ops->dma_dev_setup = pci_dma_dev_setup_dart;
 		controller_ops->dma_bus_setup = pci_dma_bus_setup_dart;
 	} else {
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_dart;
 		ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart;
 	}
 	/* Setup pci_dma ops */
@@ -412,7 +411,6 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
 		controller_ops->dma_dev_setup = NULL;
 		controller_ops->dma_bus_setup = NULL;
 	}
-	ppc_md.pci_dma_dev_setup = NULL;
 	ppc_md.pci_dma_bus_setup = NULL;
 
 	/* Setup pci_dma ops */
-- 
2.1.4

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

* [PATCH 26/27] powerpc: Remove shim for pci_controller_ops.dma_bus_setup
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (24 preceding siblings ...)
  2015-03-25  5:35 ` [PATCH 25/27] powerpc: Remove shim for pci_controller_ops.dma_dev_setup Daniel Axtens
@ 2015-03-25  5:36 ` Daniel Axtens
  2015-03-25  5:36 ` [PATCH 27/27] powerpc: dart_iommu: Remove check for controller_ops == NULL case Daniel Axtens
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:36 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/include/asm/machdep.h    |  2 --
 arch/powerpc/include/asm/pci-bridge.h | 14 --------------
 arch/powerpc/kernel/pci-common.c      |  5 ++++-
 arch/powerpc/sysdev/dart_iommu.c      |  3 ---
 4 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 2f7b319..92b085b 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -103,8 +103,6 @@ struct machdep_calls {
 #endif
 #endif /* CONFIG_PPC64 */
 
-	void		(*pci_dma_bus_setup)(struct pci_bus *bus);
-
 	/* Platform set_dma_mask and dma_get_required_mask overrides */
 	int		(*dma_set_mask)(struct device *dev, u64 dma_mask);
 	u64		(*dma_get_required_mask)(struct device *dev);
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index e578f67..4f39ef9 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -277,19 +277,5 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address)
 }
 #endif	/* CONFIG_PCI */
 
-/*
- * Shims to prefer pci_controller version over ppc_md where available.
- */
-
-static inline void dma_bus_setup(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	if (hose->controller_ops.dma_bus_setup)
-		hose->controller_ops.dma_bus_setup(bus);
-	else if (ppc_md.pci_dma_bus_setup)
-		ppc_md.pci_dma_bus_setup(bus);
-}
-
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 433b387..7447b10 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -946,6 +946,7 @@ static void pcibios_fixup_bridge(struct pci_bus *bus)
 
 void pcibios_setup_bus_self(struct pci_bus *bus)
 {
+	struct pci_controller *hose;
 	/* Fix up the bus resources for P2P bridges */
 	if (bus->self != NULL)
 		pcibios_fixup_bridge(bus);
@@ -957,7 +958,9 @@ void pcibios_setup_bus_self(struct pci_bus *bus)
 		ppc_md.pcibios_fixup_bus(bus);
 
 	/* Setup bus DMA mappings */
-	dma_bus_setup(bus);
+	hose = pci_bus_to_host(bus);
+	if (hose->controller_ops.dma_bus_setup)
+		hose->controller_ops.dma_bus_setup(bus);
 }
 
 static void pcibios_setup_device(struct pci_dev *dev)
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index ca38b1e..87b8000 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -398,8 +398,6 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
 	if (controller_ops) {
 		controller_ops->dma_dev_setup = pci_dma_dev_setup_dart;
 		controller_ops->dma_bus_setup = pci_dma_bus_setup_dart;
-	} else {
-		ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_dart;
 	}
 	/* Setup pci_dma ops */
 	set_pci_dma_ops(&dma_iommu_ops);
@@ -411,7 +409,6 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
 		controller_ops->dma_dev_setup = NULL;
 		controller_ops->dma_bus_setup = NULL;
 	}
-	ppc_md.pci_dma_bus_setup = NULL;
 
 	/* Setup pci_dma ops */
 	set_pci_dma_ops(&dma_direct_ops);
-- 
2.1.4

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

* [PATCH 27/27] powerpc: dart_iommu: Remove check for controller_ops == NULL case
  2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
                   ` (25 preceding siblings ...)
  2015-03-25  5:36 ` [PATCH 26/27] powerpc: Remove shim for pci_controller_ops.dma_bus_setup Daniel Axtens
@ 2015-03-25  5:36 ` Daniel Axtens
  26 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-25  5:36 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Daniel Axtens

Now that we have ported the calls to iommu_init_early_dart to always
supply a pci_controller_ops struct, we can safely drop the check.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/sysdev/dart_iommu.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 87b8000..d00a566 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -395,20 +395,17 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)
 	if (dart_is_u4)
 		ppc_md.dma_set_mask = dart_dma_set_mask;
 
-	if (controller_ops) {
-		controller_ops->dma_dev_setup = pci_dma_dev_setup_dart;
-		controller_ops->dma_bus_setup = pci_dma_bus_setup_dart;
-	}
+	controller_ops->dma_dev_setup = pci_dma_dev_setup_dart;
+	controller_ops->dma_bus_setup = pci_dma_bus_setup_dart;
+
 	/* Setup pci_dma ops */
 	set_pci_dma_ops(&dma_iommu_ops);
 	return;
 
  bail:
 	/* If init failed, use direct iommu and null setup functions */
-	if (controller_ops) {
-		controller_ops->dma_dev_setup = NULL;
-		controller_ops->dma_bus_setup = NULL;
-	}
+	controller_ops->dma_dev_setup = NULL;
+	controller_ops->dma_bus_setup = NULL;
 
 	/* Setup pci_dma ops */
 	set_pci_dma_ops(&dma_direct_ops);
-- 
2.1.4

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

* Re: [PATCH 01/27] powerpc: move find_and_init_phbs() to pSeries specific code
  2015-03-25  5:35 ` [PATCH 01/27] powerpc: move find_and_init_phbs() to pSeries specific code Daniel Axtens
@ 2015-03-25  7:40   ` Stephen Rothwell
  0 siblings, 0 replies; 38+ messages in thread
From: Stephen Rothwell @ 2015-03-25  7:40 UTC (permalink / raw)
  To: Daniel Axtens; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]

Hi Daniel,

On Wed, 25 Mar 2015 16:35:35 +1100 Daniel Axtens <dja@axtens.net> wrote:
>
> Previously, find_and_init_phbs() was used in both PowerNV and pSeries
> setup. However, since RTAS support has been dropped from PowerNV, we
> can move it into a platform-specific file.
> 
> This patch depends on the patch to drop RTAS support from PowerNV:
> http://patchwork.ozlabs.org/patch/449316/

In the future, you should put this sort of commentary (this last
paragraph) below the "---" line as we don't really want it in the
commit message, right?  This is more instructions to the
reviewers/committer than description of the change.

> 
> Signed-off-by: Daniel Axtens <dja@axtens.net>
> ---
>  arch/powerpc/include/asm/ppc-pci.h     |  3 ---
>  arch/powerpc/kernel/rtas_pci.c         | 47 ----------------------------------
>  arch/powerpc/platforms/pseries/setup.c | 47 ++++++++++++++++++++++++++++++++++
>  3 files changed, 47 insertions(+), 50 deletions(-)
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
  2015-03-25  5:35 ` [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c Daniel Axtens
@ 2015-03-30 12:32   ` Michael Ellerman
  2015-03-30 21:46     ` Benjamin Herrenschmidt
  2015-03-30 22:12     ` Daniel Axtens
  0 siblings, 2 replies; 38+ messages in thread
From: Michael Ellerman @ 2015-03-30 12:32 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev; +Cc: Daniel Axtens

On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote:

Why did we move it? Just for cleanliness?

> Signed-off-by: Daniel Axtens <dja@axtens.net>
> ---
>  arch/powerpc/platforms/powermac/pci.c   | 17 +++++++++++++++++
>  arch/powerpc/platforms/powermac/pmac.h  |  4 ++++
>  arch/powerpc/platforms/powermac/setup.c | 18 ------------------
>  3 files changed, 21 insertions(+), 18 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
> index f4071a6..a792f45 100644
> --- a/arch/powerpc/platforms/powermac/pci.c
> +++ b/arch/powerpc/platforms/powermac/pci.c
> @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev)
>  	pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0);
>  }
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie);
> +
> +#ifdef CONFIG_PPC64
> +int pmac_pci_probe_mode(struct pci_bus *bus)
> +{
> +	struct device_node *node = pci_bus_to_OF_node(bus);
> +
> +	/* We need to use normal PCI probing for the AGP bus,
> +	 * since the device for the AGP bridge isn't in the tree.
> +	 * Same for the PCIe host on U4 and the HT host bridge.
> +	 */
> +	if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") ||
> +				  of_device_is_compatible(node, "u4-pcie") ||
> +				  of_device_is_compatible(node, "u3-ht")))
> +		return PCI_PROBE_NORMAL;
> +	return PCI_PROBE_DEVTREE;
> +}
> +#endif /* CONFIG_PPC64 */
> diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
> index 8327cce..46d2193 100644
> --- a/arch/powerpc/platforms/powermac/pmac.h
> +++ b/arch/powerpc/platforms/powermac/pmac.h
> @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn));
>  extern int pmac_nvram_init(void);
>  extern void pmac_pic_init(void);
>  
> +#ifdef CONFIG_PPC64
> +extern int pmac_pci_probe_mode(struct pci_bus *bus);
> +#endif

You don't need to ifdef declarations, and you don't need extern.

So just:

> +int pmac_pci_probe_mode(struct pci_bus *bus);

Is fine.

cheers

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

* Re: [PATCH 03/27] powerpc/swiotlb: give init call a less misleading name
  2015-03-25  5:35 ` [PATCH 03/27] powerpc/swiotlb: give init call a less misleading name Daniel Axtens
@ 2015-03-30 12:32   ` Michael Ellerman
  0 siblings, 0 replies; 38+ messages in thread
From: Michael Ellerman @ 2015-03-30 12:32 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev; +Cc: Daniel Axtens

On Wed, 2015-25-03 at 05:35:37 UTC, Daniel Axtens wrote:
> swiotlb_late_init sets up platform specific hooks. It's not actually
> a late initcall, but a subsys initcall, called much earlier.
> 
> Ideally we'd call it swiotlb_init, but that's taken.
> Call it swiotlb_subsys_init for now.
> (It will be refactored and renamed later.)

AFAICS you just end up renaming this anyway, so I don't think you need to
bother with this patch.

cheers

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

* Re: [PATCH 04/27] powerpc/fsl_pci: Don't change ppc_swiotlb_enable after swiotlb_subsys_init
  2015-03-25  5:35 ` [PATCH 04/27] powerpc/fsl_pci: Don't change ppc_swiotlb_enable after swiotlb_subsys_init Daniel Axtens
@ 2015-03-30 12:32   ` Michael Ellerman
  2015-03-30 23:57     ` Daniel Axtens
  0 siblings, 1 reply; 38+ messages in thread
From: Michael Ellerman @ 2015-03-30 12:32 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev; +Cc: Daniel Axtens

On Wed, 2015-25-03 at 05:35:38 UTC, Daniel Axtens wrote:
> The only function that checks ppc_swiotlb_enable is swiotlb_subsys_init.

.. which is a subsys initcall.

> The code in fsl_pci.c is called well after that, so don't bother
> changing it.

Hmm, I think we got this wrong. I don't remember exactly but it was probably me
who told you it could be removed, but I probably hadn't had a coffee yet :}

I see setup_pci_atmu() called by fsl_pci_syscore_do_resume(), ie. at runtime ==
late. So ignore that.

But also fsl_add_bridge(), called from fsl_pci_probe(), which is a platform
driver, registered at arch initcall via fsl_pci_init().

arch initcall happens *before* subsys, so in that case this will be effective.

So I think we need to leave it alone.

cheers

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

* Re: [PATCH 06/27] powerpc: Create the pci_controller_ops struct.
  2015-03-25  5:35 ` [PATCH 06/27] powerpc: Create the pci_controller_ops struct Daniel Axtens
@ 2015-03-30 12:32   ` Michael Ellerman
  0 siblings, 0 replies; 38+ messages in thread
From: Michael Ellerman @ 2015-03-30 12:32 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev; +Cc: Daniel Axtens

On Wed, 2015-25-03 at 05:35:40 UTC, Daniel Axtens wrote:
> Signed-off-by: Daniel Axtens <dja@axtens.net>
> ---
>  arch/powerpc/include/asm/pci-bridge.h | 7 +++++++
>  1 file changed, 7 insertions(+)

That's taking splitting patches to the next level :)

Just fold this into the next one where you first need it.

cheers

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

* Re: [PATCH 07/27] powerpc: ppc_md.pci_dma_dev_setup -> pci_controller_ops.dma_dev_setup
  2015-03-25  5:35 ` [PATCH 07/27] powerpc: ppc_md.pci_dma_dev_setup -> pci_controller_ops.dma_dev_setup Daniel Axtens
@ 2015-03-30 12:32   ` Michael Ellerman
  0 siblings, 0 replies; 38+ messages in thread
From: Michael Ellerman @ 2015-03-30 12:32 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev; +Cc: Daniel Axtens

On Wed, 2015-25-03 at 05:35:41 UTC, Daniel Axtens wrote:

Write changelogs!

Also this doesn't do what the subject suggests, it just introduces the ops
version and adds the shim. It doesn't do all the conversions.

> Signed-off-by: Daniel Axtens <dja@axtens.net>
> ---
>  arch/powerpc/include/asm/pci-bridge.h | 14 ++++++++++++++
>  arch/powerpc/kernel/pci-common.c      |  3 +--
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
> index 3ab8a2d..2474f29 100644
> --- a/arch/powerpc/include/asm/pci-bridge.h
> +++ b/arch/powerpc/include/asm/pci-bridge.h
> @@ -18,6 +18,7 @@ struct device_node;
>   * PCI controller operations
>   */
>  struct pci_controller_ops {
> +	void		(*dma_dev_setup)(struct pci_dev *dev);
>  };
>  
>  /*
> @@ -265,5 +266,18 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address)
>  }
>  #endif	/* CONFIG_PCI */
>  
> +/*
> + * Shims to prefer pci_controller version over ppc_md where available.
> + */
> +static inline void dma_dev_setup(struct pci_dev *dev)

This should be called pci_dma_dev_setup() while it exists IMHO.

> +{
> +	struct pci_controller *hose = pci_bus_to_host(dev->bus);

I know historically we've called them "hose", but there's also a lot of code
that uses "phb" and that is a MUCH better name, so please use that.

cheers

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

* Re: [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
  2015-03-30 12:32   ` Michael Ellerman
@ 2015-03-30 21:46     ` Benjamin Herrenschmidt
  2015-03-31  4:23       ` Michael Ellerman
  2015-03-30 22:12     ` Daniel Axtens
  1 sibling, 1 reply; 38+ messages in thread
From: Benjamin Herrenschmidt @ 2015-03-30 21:46 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Daniel Axtens

On Mon, 2015-03-30 at 23:32 +1100, Michael Ellerman wrote:
> On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote:
> 
> Why did we move it? Just for cleanliness?
> 
> > Signed-off-by: Daniel Axtens <dja@axtens.net>
> > ---
> >  arch/powerpc/platforms/powermac/pci.c   | 17 +++++++++++++++++
> >  arch/powerpc/platforms/powermac/pmac.h  |  4 ++++
> >  arch/powerpc/platforms/powermac/setup.c | 18 ------------------
> >  3 files changed, 21 insertions(+), 18 deletions(-)
> > 
> > diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
> > index f4071a6..a792f45 100644
> > --- a/arch/powerpc/platforms/powermac/pci.c
> > +++ b/arch/powerpc/platforms/powermac/pci.c
> > @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev)
> >  	pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0);
> >  }
> >  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie);
> > +
> > +#ifdef CONFIG_PPC64
> > +int pmac_pci_probe_mode(struct pci_bus *bus)
> > +{
> > +	struct device_node *node = pci_bus_to_OF_node(bus);
> > +
> > +	/* We need to use normal PCI probing for the AGP bus,
> > +	 * since the device for the AGP bridge isn't in the tree.
> > +	 * Same for the PCIe host on U4 and the HT host bridge.
> > +	 */
> > +	if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") ||
> > +				  of_device_is_compatible(node, "u4-pcie") ||
> > +				  of_device_is_compatible(node, "u3-ht")))
> > +		return PCI_PROBE_NORMAL;
> > +	return PCI_PROBE_DEVTREE;
> > +}
> > +#endif /* CONFIG_PPC64 */
> > diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
> > index 8327cce..46d2193 100644
> > --- a/arch/powerpc/platforms/powermac/pmac.h
> > +++ b/arch/powerpc/platforms/powermac/pmac.h
> > @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn));
> >  extern int pmac_nvram_init(void);
> >  extern void pmac_pic_init(void);
> >  
> > +#ifdef CONFIG_PPC64
> > +extern int pmac_pci_probe_mode(struct pci_bus *bus);
> > +#endif
> 
> You don't need to ifdef declarations, and you don't need extern.

I like extern :-) If the rest of the file use it, I prefer if he
continues doing so.

> So just:
> 
> > +int pmac_pci_probe_mode(struct pci_bus *bus);
> 
> Is fine.
> 
> cheers

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

* Re: [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
  2015-03-30 12:32   ` Michael Ellerman
  2015-03-30 21:46     ` Benjamin Herrenschmidt
@ 2015-03-30 22:12     ` Daniel Axtens
  1 sibling, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-30 22:12 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 2846 bytes --]

On Mon, 2015-03-30 at 23:32 +1100, Michael Ellerman wrote:
> On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote:
> 
> Why did we move it? Just for cleanliness?
> 

I move it because in (what is currently) patch 14, I want to hook it
into the PCI controller ops structure, which I define in pci.c. In that
patch I make the definition static again and remove the prototype from
the header.

I saw two other options:
 - Move it to pci.c as part of patch 14
 - Keep it in setup.c and just accept that it won't be static and will
need a prototype in the header.

I thought this was the least bad option, but I'm happy to do it another
way. Either way I will explain it better in the next series.

Regards,
Daniel

> > Signed-off-by: Daniel Axtens <dja@axtens.net>
> > ---
> >  arch/powerpc/platforms/powermac/pci.c   | 17 +++++++++++++++++
> >  arch/powerpc/platforms/powermac/pmac.h  |  4 ++++
> >  arch/powerpc/platforms/powermac/setup.c | 18 ------------------
> >  3 files changed, 21 insertions(+), 18 deletions(-)
> > 
> > diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
> > index f4071a6..a792f45 100644
> > --- a/arch/powerpc/platforms/powermac/pci.c
> > +++ b/arch/powerpc/platforms/powermac/pci.c
> > @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev)
> >  	pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0);
> >  }
> >  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie);
> > +
> > +#ifdef CONFIG_PPC64
> > +int pmac_pci_probe_mode(struct pci_bus *bus)
> > +{
> > +	struct device_node *node = pci_bus_to_OF_node(bus);
> > +
> > +	/* We need to use normal PCI probing for the AGP bus,
> > +	 * since the device for the AGP bridge isn't in the tree.
> > +	 * Same for the PCIe host on U4 and the HT host bridge.
> > +	 */
> > +	if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") ||
> > +				  of_device_is_compatible(node, "u4-pcie") ||
> > +				  of_device_is_compatible(node, "u3-ht")))
> > +		return PCI_PROBE_NORMAL;
> > +	return PCI_PROBE_DEVTREE;
> > +}
> > +#endif /* CONFIG_PPC64 */
> > diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
> > index 8327cce..46d2193 100644
> > --- a/arch/powerpc/platforms/powermac/pmac.h
> > +++ b/arch/powerpc/platforms/powermac/pmac.h
> > @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn));
> >  extern int pmac_nvram_init(void);
> >  extern void pmac_pic_init(void);
> >  
> > +#ifdef CONFIG_PPC64
> > +extern int pmac_pci_probe_mode(struct pci_bus *bus);
> > +#endif
> 
> You don't need to ifdef declarations, and you don't need extern.
> 
> So just:
> 
> > +int pmac_pci_probe_mode(struct pci_bus *bus);
> 
> Is fine.
> 
> cheers


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 860 bytes --]

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

* Re: [PATCH 04/27] powerpc/fsl_pci: Don't change ppc_swiotlb_enable after swiotlb_subsys_init
  2015-03-30 12:32   ` Michael Ellerman
@ 2015-03-30 23:57     ` Daniel Axtens
  0 siblings, 0 replies; 38+ messages in thread
From: Daniel Axtens @ 2015-03-30 23:57 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 877 bytes --]


> Hmm, I think we got this wrong. I don't remember exactly but it was probably me
> who told you it could be removed, but I probably hadn't had a coffee yet :}
> 
> I see setup_pci_atmu() called by fsl_pci_syscore_do_resume(), ie. at runtime ==
> late. So ignore that.
> 
> But also fsl_add_bridge(), called from fsl_pci_probe(), which is a platform
> driver, registered at arch initcall via fsl_pci_init().
> 
> arch initcall happens *before* subsys, so in that case this will be effective.
> 
> So I think we need to leave it alone.
> 
OK, yeah you're right. Darn.

It looks like we can keep the general approach here, but drop this patch
and the rename patch. Then if we move the swiotlb hooks to the end of
fsl_add_bridge, everything should happen in the right order.

I'll get that into v2.

Thanks for the detailed checking!

-- d

> cheers


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 860 bytes --]

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

* Re: [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
  2015-03-30 21:46     ` Benjamin Herrenschmidt
@ 2015-03-31  4:23       ` Michael Ellerman
  0 siblings, 0 replies; 38+ messages in thread
From: Michael Ellerman @ 2015-03-31  4:23 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Daniel Axtens

On Tue, 2015-03-31 at 08:46 +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2015-03-30 at 23:32 +1100, Michael Ellerman wrote:
> > On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote:
> > 
> > Why did we move it? Just for cleanliness?
> > 
> > > diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
> > > index 8327cce..46d2193 100644
> > > --- a/arch/powerpc/platforms/powermac/pmac.h
> > > +++ b/arch/powerpc/platforms/powermac/pmac.h
> > > @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn));
> > >  extern int pmac_nvram_init(void);
> > >  extern void pmac_pic_init(void);
> > >  
> > > +#ifdef CONFIG_PPC64
> > > +extern int pmac_pci_probe_mode(struct pci_bus *bus);
> > > +#endif
> > 
> > You don't need to ifdef declarations, and you don't need extern.
> 
> I like extern :-) If the rest of the file use it, I prefer if he
> continues doing so.

I like Ponies.

It's fashionable to not use it, and I expect we'll start seeing treewide
extern-removal series soon enough, but whatever.

cheers

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

end of thread, other threads:[~2015-03-31  4:23 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25  5:35 [PATCH 00/27] Refactor PCI controller operations Daniel Axtens
2015-03-25  5:35 ` [PATCH 01/27] powerpc: move find_and_init_phbs() to pSeries specific code Daniel Axtens
2015-03-25  7:40   ` Stephen Rothwell
2015-03-25  5:35 ` [PATCH 02/27] powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c Daniel Axtens
2015-03-30 12:32   ` Michael Ellerman
2015-03-30 21:46     ` Benjamin Herrenschmidt
2015-03-31  4:23       ` Michael Ellerman
2015-03-30 22:12     ` Daniel Axtens
2015-03-25  5:35 ` [PATCH 03/27] powerpc/swiotlb: give init call a less misleading name Daniel Axtens
2015-03-30 12:32   ` Michael Ellerman
2015-03-25  5:35 ` [PATCH 04/27] powerpc/fsl_pci: Don't change ppc_swiotlb_enable after swiotlb_subsys_init Daniel Axtens
2015-03-30 12:32   ` Michael Ellerman
2015-03-30 23:57     ` Daniel Axtens
2015-03-25  5:35 ` [PATCH 05/27] powerpc: pcibios_enable_device_hook: return bool rather than int Daniel Axtens
2015-03-25  5:35 ` [PATCH 06/27] powerpc: Create the pci_controller_ops struct Daniel Axtens
2015-03-30 12:32   ` Michael Ellerman
2015-03-25  5:35 ` [PATCH 07/27] powerpc: ppc_md.pci_dma_dev_setup -> pci_controller_ops.dma_dev_setup Daniel Axtens
2015-03-30 12:32   ` Michael Ellerman
2015-03-25  5:35 ` [PATCH 08/27] powerpc: ppc_md.pci_dma_bus_setup -> pci_controller_ops.dma_bus_setup Daniel Axtens
2015-03-25  5:35 ` [PATCH 09/27] powerpc: ppc_md.pci_probe_mode -> pci_controller_ops.probe_mode Daniel Axtens
2015-03-25  5:35 ` [PATCH 10/27] powerpc: ppc_md.pcibios_enable_device_hook -> pci_controller_ops.enable_device_hook Daniel Axtens
2015-03-25  5:35 ` [PATCH 11/27] powerpc: ppc_md.pcibios_window_alignment -> pci_controller_ops.window_alignment Daniel Axtens
2015-03-25  5:35 ` [PATCH 12/27] powerpc: ppc_md.pcibios_reset_secondary_bus -> pci_controller_ops.reset_secondary_bus Daniel Axtens
2015-03-25  5:35 ` [PATCH 13/27] powerpc: dart_iommu: optionally populate controller_ops on init Daniel Axtens
2015-03-25  5:35 ` [PATCH 14/27] powerpc/powermac: Move controller ops from ppc_md to controller_ops Daniel Axtens
2015-03-25  5:35 ` [PATCH 15/27] powerpc/pseries: " Daniel Axtens
2015-03-25  5:35 ` [PATCH 16/27] powerpc/powernv: " Daniel Axtens
2015-03-25  5:35 ` [PATCH 17/27] powerpc/pasemi: " Daniel Axtens
2015-03-25  5:35 ` [PATCH 18/27] powerpc/maple: " Daniel Axtens
2015-03-25  5:35 ` [PATCH 19/27] powerpc: fsl_pci, swiotlb: " Daniel Axtens
2015-03-25  5:35 ` [PATCH 20/27] powerpc/cell: " Daniel Axtens
2015-03-25  5:35 ` [PATCH 21/27] powerpc: Remove shim for pci_controller_ops.window_alignment Daniel Axtens
2015-03-25  5:35 ` [PATCH 22/27] powerpc: Remove shim for pci_controller_ops.reset_secondary_bus Daniel Axtens
2015-03-25  5:35 ` [PATCH 23/27] powerpc: Remove shim for pci_controller_ops.enable_device_hook Daniel Axtens
2015-03-25  5:35 ` [PATCH 24/27] powerpc: Remove shim for pci_controller_ops.probe_mode Daniel Axtens
2015-03-25  5:35 ` [PATCH 25/27] powerpc: Remove shim for pci_controller_ops.dma_dev_setup Daniel Axtens
2015-03-25  5:36 ` [PATCH 26/27] powerpc: Remove shim for pci_controller_ops.dma_bus_setup Daniel Axtens
2015-03-25  5:36 ` [PATCH 27/27] powerpc: dart_iommu: Remove check for controller_ops == NULL case Daniel Axtens

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.