linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V4 0/3] PCI patch set description
@ 2012-08-02 11:42 Jia Hongtao
  2012-08-02 11:42 ` [PATCH V4 1/3] powerpc/fsl-pci: Only scan PCI bus if configured as a host Jia Hongtao
                   ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Jia Hongtao @ 2012-08-02 11:42 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: B07421, b38951

The first patch fixed a kernel panic when scanning PCI bus if it is working
in agent mode.

In later two patches we unified PCI initialization code by changing fsl_pci
to a platform drvier. The approach will affect swiotlb init and this issue
is addressed in the second patch.

We now just convet IBM 44x, MPC85xxDS and QEMU to this new mechanism. All
other boards will be coverted if this patch set is accepted.

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

* [PATCH V4 1/3] powerpc/fsl-pci: Only scan PCI bus if configured as a host
  2012-08-02 11:42 [PATCH V4 0/3] PCI patch set description Jia Hongtao
@ 2012-08-02 11:42 ` Jia Hongtao
  2012-08-02 11:42 ` [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and disable if not necessary Jia Hongtao
  2012-08-02 11:42 ` [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code Jia Hongtao
  2 siblings, 0 replies; 26+ messages in thread
From: Jia Hongtao @ 2012-08-02 11:42 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: B07421, b38951

We change fsl_add_bridge to return -ENODEV if the controller is working in
agent mode. Then check the return value of fsl_add_bridge to guarantee
that only successfully added host bus will be scanned.

Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/sysdev/fsl_pci.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 50a38b3..6938792 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -465,7 +465,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
 			iounmap(hose->cfg_data);
 		iounmap(hose->cfg_addr);
 		pcibios_free_controller(hose);
-		return 0;
+		return -ENODEV;
 	}
 
 	setup_pci_cmd(hose);
@@ -828,6 +828,7 @@ struct device_node *fsl_pci_primary;
 
 void __devinit fsl_pci_init(void)
 {
+	int ret;
 	struct device_node *node;
 	struct pci_controller *hose;
 	dma_addr_t max = 0xffffffff;
@@ -856,10 +857,12 @@ void __devinit fsl_pci_init(void)
 			if (!fsl_pci_primary)
 				fsl_pci_primary = node;
 
-			fsl_add_bridge(node, fsl_pci_primary == node);
-			hose = pci_find_hose_for_OF_device(node);
-			max = min(max, hose->dma_window_base_cur +
-					hose->dma_window_size);
+			ret = fsl_add_bridge(node, fsl_pci_primary == node);
+			if (ret == 0) {
+				hose = pci_find_hose_for_OF_device(node);
+				max = min(max, hose->dma_window_base_cur +
+						hose->dma_window_size);
+			}
 		}
 	}
 
-- 
1.7.5.1

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

* [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and disable if not necessary
  2012-08-02 11:42 [PATCH V4 0/3] PCI patch set description Jia Hongtao
  2012-08-02 11:42 ` [PATCH V4 1/3] powerpc/fsl-pci: Only scan PCI bus if configured as a host Jia Hongtao
@ 2012-08-02 11:42 ` Jia Hongtao
  2012-08-02 12:54   ` Kumar Gala
  2012-08-02 11:42 ` [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code Jia Hongtao
  2 siblings, 1 reply; 26+ messages in thread
From: Jia Hongtao @ 2012-08-02 11:42 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: B07421, b38951

Remove the dependency on PCI initialization for SWIOTLB initialization.
So that PCI can be initialized at proper time.

SWIOTLB is partly determined by PCI inbound/outbound map which is assigned
in PCI initialization. But swiotlb_init() should be done at the stage of
mem_init() which is much earlier than PCI initialization. So we reserve the
memory for SWIOTLB first and free it if not necessary.

All boards are converted to fit this change.

Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/include/asm/swiotlb.h       |    6 ++++++
 arch/powerpc/kernel/dma-swiotlb.c        |   20 ++++++++++++++++++++
 arch/powerpc/mm/mem.c                    |    3 +--
 arch/powerpc/platforms/44x/currituck.c   |   10 ++--------
 arch/powerpc/platforms/85xx/mpc85xx_ds.c |    1 +
 arch/powerpc/platforms/85xx/qemu_e500.c  |    2 +-
 arch/powerpc/sysdev/fsl_pci.c            |    5 +----
 7 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
index 8979d4c..de99d6e 100644
--- a/arch/powerpc/include/asm/swiotlb.h
+++ b/arch/powerpc/include/asm/swiotlb.h
@@ -22,4 +22,10 @@ int __init swiotlb_setup_bus_notifier(void);
 
 extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev);
 
+#ifdef CONFIG_SWIOTLB
+void swiotlb_detect_4g(void);
+#else
+static inline void swiotlb_detect_4g(void) {}
+#endif
+
 #endif /* __ASM_SWIOTLB_H */
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index 4ab88da..aa85550 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -104,3 +104,23 @@ int __init swiotlb_setup_bus_notifier(void)
 			      &ppc_swiotlb_plat_bus_notifier);
 	return 0;
 }
+
+void swiotlb_detect_4g(void)
+{
+	if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
+		ppc_swiotlb_enable = 1;
+}
+
+static int __init swiotlb_late_init(void)
+{
+	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 {
+		swiotlb_free();
+	}
+
+	return 0;
+}
+subsys_initcall(swiotlb_late_init);
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index baaafde..f23c4e0 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -300,8 +300,7 @@ void __init mem_init(void)
 	unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
 
 #ifdef CONFIG_SWIOTLB
-	if (ppc_swiotlb_enable)
-		swiotlb_init(1);
+	swiotlb_init(0);
 #endif
 
 	num_physpages = memblock_phys_mem_size() >> PAGE_SHIFT;
diff --git a/arch/powerpc/platforms/44x/currituck.c b/arch/powerpc/platforms/44x/currituck.c
index 9f6c33d..6bd89a0 100644
--- a/arch/powerpc/platforms/44x/currituck.c
+++ b/arch/powerpc/platforms/44x/currituck.c
@@ -21,7 +21,6 @@
  */
 
 #include <linux/init.h>
-#include <linux/memblock.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/rtc.h>
@@ -159,13 +158,8 @@ static void __init ppc47x_setup_arch(void)
 
 	/* No need to check the DMA config as we /know/ our windows are all of
  	 * RAM.  Lets hope that doesn't change */
-#ifdef CONFIG_SWIOTLB
-	if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
-		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	}
-#endif
+	swiotlb_detect_4g();
+
 	ppc47x_smp_init();
 }
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 6d3265f..56f8c8f 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -159,6 +159,7 @@ static void __init mpc85xx_ds_setup_arch(void)
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
 
+	swiotlb_detect_4g();
 	mpc85xx_ds_pci_init();
 	mpc85xx_smp_init();
 
diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c b/arch/powerpc/platforms/85xx/qemu_e500.c
index 95a2e53..04260cd 100644
--- a/arch/powerpc/platforms/85xx/qemu_e500.c
+++ b/arch/powerpc/platforms/85xx/qemu_e500.c
@@ -41,7 +41,7 @@ static void __init qemu_e500_setup_arch(void)
 {
 	ppc_md.progress("qemu_e500_setup_arch()", 0);
 
-	fsl_pci_init();
+	swiotlb_detect_4g();
 	mpc85xx_smp_init();
 }
 
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 6938792..da7a3d7 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -872,11 +872,8 @@ void __devinit fsl_pci_init(void)
 	 * we need SWIOTLB to handle buffers located outside of
 	 * dma capable memory region
 	 */
-	if (memblock_end_of_DRAM() - 1 > max) {
+	if (memblock_end_of_DRAM() - 1 > max)
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	}
 #endif
 }
 #endif
-- 
1.7.5.1

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

* [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-02 11:42 [PATCH V4 0/3] PCI patch set description Jia Hongtao
  2012-08-02 11:42 ` [PATCH V4 1/3] powerpc/fsl-pci: Only scan PCI bus if configured as a host Jia Hongtao
  2012-08-02 11:42 ` [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and disable if not necessary Jia Hongtao
@ 2012-08-02 11:42 ` Jia Hongtao
  2012-08-02 12:23   ` Kumar Gala
  2012-08-02 20:18   ` Scott Wood
  2 siblings, 2 replies; 26+ messages in thread
From: Jia Hongtao @ 2012-08-02 11:42 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: B07421, b38951

We unified the Freescale pci/pcie initialization by changing the fsl_pci
to a platform driver. In previous PCI code architecture the initialization
routine is called at board_setup_arch stage. Now the initialization is done
in probe function which is architectural better. Also It's convenient for
adding PM support for PCI controller in later patch.

Now we registered pci controllers as platform devices. So we combine two
initialization code as one platform driver.

Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c |   32 ++--------
 arch/powerpc/sysdev/fsl_pci.c            |  102 ++++++++++++++++++-----------
 arch/powerpc/sysdev/fsl_pci.h            |    6 +-
 drivers/edac/mpc85xx_edac.c              |   43 ++++---------
 4 files changed, 83 insertions(+), 100 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 56f8c8f..f2c7b1c 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -20,7 +20,6 @@
 #include <linux/seq_file.h>
 #include <linux/interrupt.h>
 #include <linux/of_platform.h>
-#include <linux/memblock.h>
 
 #include <asm/time.h>
 #include <asm/machdep.h>
@@ -117,40 +116,16 @@ void __init mpc85xx_ds_pic_init(void)
 extern int uli_exclude_device(struct pci_controller *hose,
 				u_char bus, u_char devfn);
 
-static struct device_node *pci_with_uli;
-
 static int mpc85xx_exclude_device(struct pci_controller *hose,
 				   u_char bus, u_char devfn)
 {
-	if (hose->dn == pci_with_uli)
+	if (hose->dn == fsl_pci_primary)
 		return uli_exclude_device(hose, bus, devfn);
 
 	return PCIBIOS_SUCCESSFUL;
 }
 #endif	/* CONFIG_PCI */
 
-static void __init mpc85xx_ds_pci_init(void)
-{
-#ifdef CONFIG_PCI
-	struct device_node *node;
-
-	fsl_pci_init();
-
-	/* See if we have a ULI under the primary */
-
-	node = of_find_node_by_name(NULL, "uli1575");
-	while ((pci_with_uli = of_get_parent(node))) {
-		of_node_put(node);
-		node = pci_with_uli;
-
-		if (pci_with_uli == fsl_pci_primary) {
-			ppc_md.pci_exclude_device = mpc85xx_exclude_device;
-			break;
-		}
-	}
-#endif
-}
-
 /*
  * Setup the architecture
  */
@@ -159,8 +134,11 @@ static void __init mpc85xx_ds_setup_arch(void)
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
 
+#ifdef CONFIG_PCI
+	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
+#endif
+
 	swiotlb_detect_4g();
-	mpc85xx_ds_pci_init();
 	mpc85xx_smp_init();
 
 	printk("MPC85xx DS board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index da7a3d7..6408d9d 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -826,54 +826,78 @@ static const struct of_device_id pci_ids[] = {
 
 struct device_node *fsl_pci_primary;
 
-void __devinit fsl_pci_init(void)
+/* Checkout if PCI contains ISA node */
+static int of_pci_has_isa(struct device_node *pci_node)
+{
+	struct device_node *np;
+	int ret = 0;
+
+	if (!pci_node)
+		return 0;
+
+	read_lock(&devtree_lock);
+	np = pci_node->allnext;
+
+	/* Only scan the children of PCI node */
+	for (; np != pci_node->sibling; np = np->allnext) {
+		if (np->type && (of_node_cmp(np->type, "isa") == 0)
+		    && of_node_get(np)) {
+			ret = 1;
+			break;
+		}
+	}
+
+	of_node_put(pci_node);
+	read_unlock(&devtree_lock);
+
+	return ret;
+}
+
+static int __devinit fsl_pci_probe(struct platform_device *pdev)
 {
 	int ret;
-	struct device_node *node;
 	struct pci_controller *hose;
-	dma_addr_t max = 0xffffffff;
+	int is_primary = 0;
 
-	/* Callers can specify the primary bus using other means. */
 	if (!fsl_pci_primary) {
-		/* If a PCI host bridge contains an ISA node, it's primary. */
-		node = of_find_node_by_type(NULL, "isa");
-		while ((fsl_pci_primary = of_get_parent(node))) {
-			of_node_put(node);
-			node = fsl_pci_primary;
-
-			if (of_match_node(pci_ids, node))
-				break;
-		}
+		is_primary = of_pci_has_isa(pdev->dev.of_node);
+		if (is_primary)
+			fsl_pci_primary = pdev->dev.of_node;
 	}
 
-	node = NULL;
-	for_each_node_by_type(node, "pci") {
-		if (of_match_node(pci_ids, node)) {
-			/*
-			 * If there's no PCI host bridge with ISA, arbitrarily
-			 * designate one as primary.  This can go away once
-			 * various bugs with primary-less systems are fixed.
-			 */
-			if (!fsl_pci_primary)
-				fsl_pci_primary = node;
-
-			ret = fsl_add_bridge(node, fsl_pci_primary == node);
-			if (ret == 0) {
-				hose = pci_find_hose_for_OF_device(node);
-				max = min(max, hose->dma_window_base_cur +
-						hose->dma_window_size);
-			}
-		}
-	}
+	ret = fsl_add_bridge(pdev->dev.of_node, is_primary);
 
 #ifdef CONFIG_SWIOTLB
-	/*
-	 * if we couldn't map all of DRAM via the dma windows
-	 * we need SWIOTLB to handle buffers located outside of
-	 * dma capable memory region
-	 */
-	if (memblock_end_of_DRAM() - 1 > max)
-		ppc_swiotlb_enable = 1;
+	if (ret == 0) {
+		hose = pci_find_hose_for_OF_device(pdev->dev.of_node);
+
+		/*
+		 * if we couldn't map all of DRAM via the dma windows
+		 * we need SWIOTLB to handle buffers located outside of
+		 * dma capable memory region
+		 */
+		if (memblock_end_of_DRAM() - 1 > hose->dma_window_base_cur +
+				hose->dma_window_size)
+			ppc_swiotlb_enable = 1;
+	}
 #endif
+
+	mpc85xx_pci_err_probe(pdev);
+
+	return 0;
+}
+
+static struct platform_driver fsl_pci_driver = {
+	.driver = {
+		.name = "fsl-pci",
+		.of_match_table = pci_ids,
+	},
+	.probe = fsl_pci_probe,
+};
+
+static int __init fsl_pci_init(void)
+{
+	return platform_driver_register(&fsl_pci_driver);
 }
+arch_initcall(fsl_pci_init);
 #endif
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index baa0fd1..e3fcc6c 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -95,10 +95,10 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose);
 
 extern struct device_node *fsl_pci_primary;
 
-#ifdef CONFIG_FSL_PCI
-void fsl_pci_init(void);
+#ifdef CONFIG_EDAC_MPC85XX
+int mpc85xx_pci_err_probe(struct platform_device *op);
 #else
-static inline void fsl_pci_init(void) {}
+static inline int mpc85xx_pci_err_probe(struct platform_device *op) {}
 #endif
 
 #endif /* __POWERPC_FSL_PCI_H */
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 0e37462..2677883 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -200,7 +200,7 @@ static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
+int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
 {
 	struct edac_pci_ctl_info *pci;
 	struct mpc85xx_pci_pdata *pdata;
@@ -214,6 +214,16 @@ static int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
 	if (!pci)
 		return -ENOMEM;
 
+	/* make sure error reporting method is sane */
+	switch (edac_op_state) {
+	case EDAC_OPSTATE_POLL:
+	case EDAC_OPSTATE_INT:
+		break;
+	default:
+		edac_op_state = EDAC_OPSTATE_INT;
+		break;
+	}
+
 	pdata = pci->pvt_info;
 	pdata->name = "mpc85xx_pci_err";
 	pdata->irq = NO_IRQ;
@@ -303,6 +313,7 @@ err:
 	devres_release_group(&op->dev, mpc85xx_pci_err_probe);
 	return res;
 }
+EXPORT_SYMBOL_GPL(mpc85xx_pci_err_probe);
 
 static int mpc85xx_pci_err_remove(struct platform_device *op)
 {
@@ -326,27 +337,6 @@ static int mpc85xx_pci_err_remove(struct platform_device *op)
 	return 0;
 }
 
-static struct of_device_id mpc85xx_pci_err_of_match[] = {
-	{
-	 .compatible = "fsl,mpc8540-pcix",
-	 },
-	{
-	 .compatible = "fsl,mpc8540-pci",
-	},
-	{},
-};
-MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match);
-
-static struct platform_driver mpc85xx_pci_err_driver = {
-	.probe = mpc85xx_pci_err_probe,
-	.remove = __devexit_p(mpc85xx_pci_err_remove),
-	.driver = {
-		.name = "mpc85xx_pci_err",
-		.owner = THIS_MODULE,
-		.of_match_table = mpc85xx_pci_err_of_match,
-	},
-};
-
 #endif				/* CONFIG_PCI */
 
 /**************************** L2 Err device ***************************/
@@ -1193,12 +1183,6 @@ static int __init mpc85xx_mc_init(void)
 	if (res)
 		printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n");
 
-#ifdef CONFIG_PCI
-	res = platform_driver_register(&mpc85xx_pci_err_driver);
-	if (res)
-		printk(KERN_WARNING EDAC_MOD_STR "PCI fails to register\n");
-#endif
-
 #ifdef CONFIG_FSL_SOC_BOOKE
 	pvr = mfspr(SPRN_PVR);
 
@@ -1235,9 +1219,6 @@ static void __exit mpc85xx_mc_exit(void)
 		on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
 	}
 #endif
-#ifdef CONFIG_PCI
-	platform_driver_unregister(&mpc85xx_pci_err_driver);
-#endif
 	platform_driver_unregister(&mpc85xx_l2_err_driver);
 	platform_driver_unregister(&mpc85xx_mc_err_driver);
 }
-- 
1.7.5.1

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

* Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-02 11:42 ` [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code Jia Hongtao
@ 2012-08-02 12:23   ` Kumar Gala
  2012-08-02 15:59     ` Scott Wood
  2012-08-03  3:39     ` Jia Hongtao-B38951
  2012-08-02 20:18   ` Scott Wood
  1 sibling, 2 replies; 26+ messages in thread
From: Kumar Gala @ 2012-08-02 12:23 UTC (permalink / raw)
  To: Jia Hongtao; +Cc: B07421, linuxppc-dev


On Aug 2, 2012, at 6:42 AM, Jia Hongtao wrote:

> We unified the Freescale pci/pcie initialization by changing the =
fsl_pci
> to a platform driver. In previous PCI code architecture the =
initialization
> routine is called at board_setup_arch stage. Now the initialization is =
done
> in probe function which is architectural better. Also It's convenient =
for
> adding PM support for PCI controller in later patch.
>=20
> Now we registered pci controllers as platform devices. So we combine =
two
> initialization code as one platform driver.
>=20
> Signed-off-by: Jia Hongtao <B38951@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
> arch/powerpc/platforms/85xx/mpc85xx_ds.c |   32 ++--------
> arch/powerpc/sysdev/fsl_pci.c            |  102 =
++++++++++++++++++-----------
> arch/powerpc/sysdev/fsl_pci.h            |    6 +-
> drivers/edac/mpc85xx_edac.c              |   43 ++++---------
> 4 files changed, 83 insertions(+), 100 deletions(-)

You need to convert all boards to use fsl_pci_init before this patch.  =
Otherwise we'll end up with PCI getting initialized twice on boards.

- k=

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

* Re: [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and disable if not necessary
  2012-08-02 11:42 ` [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and disable if not necessary Jia Hongtao
@ 2012-08-02 12:54   ` Kumar Gala
  2012-08-03  2:21     ` Jia Hongtao-B38951
  0 siblings, 1 reply; 26+ messages in thread
From: Kumar Gala @ 2012-08-02 12:54 UTC (permalink / raw)
  To: Jia Hongtao; +Cc: B07421, linuxppc-dev


On Aug 2, 2012, at 6:42 AM, Jia Hongtao wrote:

> Remove the dependency on PCI initialization for SWIOTLB =
initialization.
> So that PCI can be initialized at proper time.
>=20
> SWIOTLB is partly determined by PCI inbound/outbound map which is =
assigned
> in PCI initialization. But swiotlb_init() should be done at the stage =
of
> mem_init() which is much earlier than PCI initialization. So we =
reserve the
> memory for SWIOTLB first and free it if not necessary.
>=20
> All boards are converted to fit this change.
>=20
> Signed-off-by: Jia Hongtao <B38951@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---

This doesn't seem like it addresses our issue w/regards to not being =
able to map all of memory from PCI.


> arch/powerpc/include/asm/swiotlb.h       |    6 ++++++
> arch/powerpc/kernel/dma-swiotlb.c        |   20 ++++++++++++++++++++
> arch/powerpc/mm/mem.c                    |    3 +--
> arch/powerpc/platforms/44x/currituck.c   |   10 ++--------
> arch/powerpc/platforms/85xx/mpc85xx_ds.c |    1 +
> arch/powerpc/platforms/85xx/qemu_e500.c  |    2 +-
> arch/powerpc/sysdev/fsl_pci.c            |    5 +----
> 7 files changed, 32 insertions(+), 15 deletions(-)

Don't we also want to update all these:

arch/powerpc/platforms/85xx/corenet_ds.c:               =
ppc_swiotlb_enable =3D 1;
arch/powerpc/platforms/85xx/ge_imp3a.c:         ppc_swiotlb_enable =3D =
1;
arch/powerpc/platforms/85xx/mpc8536_ds.c:               =
ppc_swiotlb_enable =3D 1;
arch/powerpc/platforms/85xx/mpc85xx_mds.c:              =
ppc_swiotlb_enable =3D 1;
arch/powerpc/platforms/85xx/p1022_ds.c:         ppc_swiotlb_enable =3D =
1;
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c:             =
ppc_swiotlb_enable =3D 1;


>=20
> diff --git a/arch/powerpc/include/asm/swiotlb.h =
b/arch/powerpc/include/asm/swiotlb.h
> index 8979d4c..de99d6e 100644
> --- a/arch/powerpc/include/asm/swiotlb.h
> +++ b/arch/powerpc/include/asm/swiotlb.h
> @@ -22,4 +22,10 @@ int __init swiotlb_setup_bus_notifier(void);
>=20
> extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev);
>=20
> +#ifdef CONFIG_SWIOTLB
> +void swiotlb_detect_4g(void);
> +#else
> +static inline void swiotlb_detect_4g(void) {}
> +#endif
> +
> #endif /* __ASM_SWIOTLB_H */
> diff --git a/arch/powerpc/kernel/dma-swiotlb.c =
b/arch/powerpc/kernel/dma-swiotlb.c
> index 4ab88da..aa85550 100644
> --- a/arch/powerpc/kernel/dma-swiotlb.c
> +++ b/arch/powerpc/kernel/dma-swiotlb.c
> @@ -104,3 +104,23 @@ int __init swiotlb_setup_bus_notifier(void)
> 			      &ppc_swiotlb_plat_bus_notifier);
> 	return 0;
> }
> +
> +void swiotlb_detect_4g(void)
> +{
> +	if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
> +		ppc_swiotlb_enable =3D 1;
> +}
> +
> +static int __init swiotlb_late_init(void)
> +{
> +	if (ppc_swiotlb_enable) {
> +		swiotlb_print_info();
> +		set_pci_dma_ops(&swiotlb_dma_ops);
> +		ppc_md.pci_dma_dev_setup =3D pci_dma_dev_setup_swiotlb;
> +	} else {
> +		swiotlb_free();
> +	}
> +
> +	return 0;
> +}
> +subsys_initcall(swiotlb_late_init);
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index baaafde..f23c4e0 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -300,8 +300,7 @@ void __init mem_init(void)
> 	unsigned long reservedpages =3D 0, codesize, initsize, datasize, =
bsssize;
>=20
> #ifdef CONFIG_SWIOTLB
> -	if (ppc_swiotlb_enable)
> -		swiotlb_init(1);
> +	swiotlb_init(0);
> #endif
>=20
> 	num_physpages =3D memblock_phys_mem_size() >> PAGE_SHIFT;
> diff --git a/arch/powerpc/platforms/44x/currituck.c =
b/arch/powerpc/platforms/44x/currituck.c
> index 9f6c33d..6bd89a0 100644
> --- a/arch/powerpc/platforms/44x/currituck.c
> +++ b/arch/powerpc/platforms/44x/currituck.c
> @@ -21,7 +21,6 @@
>  */
>=20
> #include <linux/init.h>
> -#include <linux/memblock.h>
> #include <linux/of.h>
> #include <linux/of_platform.h>
> #include <linux/rtc.h>
> @@ -159,13 +158,8 @@ static void __init ppc47x_setup_arch(void)
>=20
> 	/* No need to check the DMA config as we /know/ our windows are =
all of
>  	 * RAM.  Lets hope that doesn't change */
> -#ifdef CONFIG_SWIOTLB
> -	if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
> -		ppc_swiotlb_enable =3D 1;
> -		set_pci_dma_ops(&swiotlb_dma_ops);
> -		ppc_md.pci_dma_dev_setup =3D pci_dma_dev_setup_swiotlb;
> -	}
> -#endif
> +	swiotlb_detect_4g();
> +
> 	ppc47x_smp_init();
> }
>=20
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c =
b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> index 6d3265f..56f8c8f 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> @@ -159,6 +159,7 @@ static void __init mpc85xx_ds_setup_arch(void)
> 	if (ppc_md.progress)
> 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
>=20
> +	swiotlb_detect_4g();
> 	mpc85xx_ds_pci_init();
> 	mpc85xx_smp_init();
>=20
> diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c =
b/arch/powerpc/platforms/85xx/qemu_e500.c
> index 95a2e53..04260cd 100644
> --- a/arch/powerpc/platforms/85xx/qemu_e500.c
> +++ b/arch/powerpc/platforms/85xx/qemu_e500.c
> @@ -41,7 +41,7 @@ static void __init qemu_e500_setup_arch(void)
> {
> 	ppc_md.progress("qemu_e500_setup_arch()", 0);
>=20
> -	fsl_pci_init();
> +	swiotlb_detect_4g();

removing fsl_pci_init() seems wrong.

> 	mpc85xx_smp_init();
> }
>=20
> diff --git a/arch/powerpc/sysdev/fsl_pci.c =
b/arch/powerpc/sysdev/fsl_pci.c
> index 6938792..da7a3d7 100644
> --- a/arch/powerpc/sysdev/fsl_pci.c
> +++ b/arch/powerpc/sysdev/fsl_pci.c
> @@ -872,11 +872,8 @@ void __devinit fsl_pci_init(void)
> 	 * we need SWIOTLB to handle buffers located outside of
> 	 * dma capable memory region
> 	 */
> -	if (memblock_end_of_DRAM() - 1 > max) {
> +	if (memblock_end_of_DRAM() - 1 > max)
> 		ppc_swiotlb_enable =3D 1;
> -		set_pci_dma_ops(&swiotlb_dma_ops);
> -		ppc_md.pci_dma_dev_setup =3D pci_dma_dev_setup_swiotlb;
> -	}
> #endif
> }
> #endif
> --=20
> 1.7.5.1
>=20

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

* Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-02 12:23   ` Kumar Gala
@ 2012-08-02 15:59     ` Scott Wood
  2012-08-03  3:39     ` Jia Hongtao-B38951
  1 sibling, 0 replies; 26+ messages in thread
From: Scott Wood @ 2012-08-02 15:59 UTC (permalink / raw)
  To: Kumar Gala; +Cc: B07421, linuxppc-dev, Jia Hongtao

On 08/02/2012 07:23 AM, Kumar Gala wrote:
> You need to convert all boards to use fsl_pci_init before this patch.  Otherwise we'll end up with PCI getting initialized twice on boards.

Alternatively, don't make fsl_pci_init an initcall until all boards have
been converted.

-Scott

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

* Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-02 11:42 ` [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code Jia Hongtao
  2012-08-02 12:23   ` Kumar Gala
@ 2012-08-02 20:18   ` Scott Wood
  2012-08-03  2:20     ` Jia Hongtao-B38951
  1 sibling, 1 reply; 26+ messages in thread
From: Scott Wood @ 2012-08-02 20:18 UTC (permalink / raw)
  To: Jia Hongtao; +Cc: B07421, linuxppc-dev

On 08/02/2012 06:42 AM, Jia Hongtao wrote:
> We unified the Freescale pci/pcie initialization by changing the fsl_pci
> to a platform driver. In previous PCI code architecture the initialization
> routine is called at board_setup_arch stage. Now the initialization is done
> in probe function which is architectural better. Also It's convenient for
> adding PM support for PCI controller in later patch.
> 
> Now we registered pci controllers as platform devices. So we combine two
> initialization code as one platform driver.
> 
> Signed-off-by: Jia Hongtao <B38951@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
>  arch/powerpc/platforms/85xx/mpc85xx_ds.c |   32 ++--------
>  arch/powerpc/sysdev/fsl_pci.c            |  102 ++++++++++++++++++-----------
>  arch/powerpc/sysdev/fsl_pci.h            |    6 +-
>  drivers/edac/mpc85xx_edac.c              |   43 ++++---------
>  4 files changed, 83 insertions(+), 100 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> index 56f8c8f..f2c7b1c 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> @@ -20,7 +20,6 @@
>  #include <linux/seq_file.h>
>  #include <linux/interrupt.h>
>  #include <linux/of_platform.h>
> -#include <linux/memblock.h>
>  
>  #include <asm/time.h>
>  #include <asm/machdep.h>
> @@ -117,40 +116,16 @@ void __init mpc85xx_ds_pic_init(void)
>  extern int uli_exclude_device(struct pci_controller *hose,
>  				u_char bus, u_char devfn);
>  
> -static struct device_node *pci_with_uli;
> -
>  static int mpc85xx_exclude_device(struct pci_controller *hose,
>  				   u_char bus, u_char devfn)
>  {
> -	if (hose->dn == pci_with_uli)
> +	if (hose->dn == fsl_pci_primary)
>  		return uli_exclude_device(hose, bus, devfn);
>  
>  	return PCIBIOS_SUCCESSFUL;
>  }
>  #endif	/* CONFIG_PCI */
>  
> -static void __init mpc85xx_ds_pci_init(void)
> -{
> -#ifdef CONFIG_PCI
> -	struct device_node *node;
> -
> -	fsl_pci_init();
> -
> -	/* See if we have a ULI under the primary */
> -
> -	node = of_find_node_by_name(NULL, "uli1575");
> -	while ((pci_with_uli = of_get_parent(node))) {
> -		of_node_put(node);
> -		node = pci_with_uli;
> -
> -		if (pci_with_uli == fsl_pci_primary) {
> -			ppc_md.pci_exclude_device = mpc85xx_exclude_device;
> -			break;
> -		}
> -	}
> -#endif
> -}
> -
>  /*
>   * Setup the architecture
>   */
> @@ -159,8 +134,11 @@ static void __init mpc85xx_ds_setup_arch(void)
>  	if (ppc_md.progress)
>  		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
>  
> +#ifdef CONFIG_PCI
> +	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
> +#endif

Why are you eliminating the uli lookup?  We don't want to call
uli_exclude_device on boards that don't have a uli.

-Scott

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

* RE: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-02 20:18   ` Scott Wood
@ 2012-08-03  2:20     ` Jia Hongtao-B38951
  2012-08-03 16:09       ` Scott Wood
  0 siblings, 1 reply; 26+ messages in thread
From: Jia Hongtao-B38951 @ 2012-08-03  2:20 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: linuxppc-dev@lists.ozlabs.org, Li Yang-R58472

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogRnJpZGF5LCBBdWd1c3QgMDMsIDIwMTIgNDoxOSBBTQ0KPiBUbzogSmlhIEhv
bmd0YW8tQjM4OTUxDQo+IENjOiBsaW51eHBwYy1kZXZAbGlzdHMub3psYWJzLm9yZzsgZ2FsYWtA
a2VybmVsLmNyYXNoaW5nLm9yZzsgV29vZCBTY290dC0NCj4gQjA3NDIxOyBMaSBZYW5nLVI1ODQ3
Mg0KPiBTdWJqZWN0OiBSZTogW1BBVENIIFY0IDMvM10gcG93ZXJwYy9mc2wtcGNpOiBVbmlmeSBw
Y2kvcGNpZQ0KPiBpbml0aWFsaXphdGlvbiBjb2RlDQo+IA0KPiBPbiAwOC8wMi8yMDEyIDA2OjQy
IEFNLCBKaWEgSG9uZ3RhbyB3cm90ZToNCj4gPiBXZSB1bmlmaWVkIHRoZSBGcmVlc2NhbGUgcGNp
L3BjaWUgaW5p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EkuIEFsc28gaW4gcGxhdGZvcm0gZHJp
dmVyIGZzbF9wY2lfcHJpbWFyeSBpcyBkZXRlcm1pbmVkIGF0IGFyY2hfaW5pdGNhbGwNCndoaWNo
IG1lYW5zIGF0IHRoZSBzdGFnZSBvZiBib2FyZF9zZXR1cF9hcmNoIGZzbF9wY2lfcHJpbWFyeSBp
cyBub3QgcmVhZHkuDQoNCi1Ib25ndGFvLg0KDQo=

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

* RE: [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and disable if not necessary
  2012-08-02 12:54   ` Kumar Gala
@ 2012-08-03  2:21     ` Jia Hongtao-B38951
  2012-08-03 12:38       ` Kumar Gala
  0 siblings, 1 reply; 26+ messages in thread
From: Jia Hongtao-B38951 @ 2012-08-03  2:21 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472


> -----Original Message-----
> From: Kumar Gala [mailto:galak@kernel.crashing.org]
> Sent: Thursday, August 02, 2012 8:55 PM
> To: Jia Hongtao-B38951
> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
> Subject: Re: [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and
> disable if not necessary
>=20
>=20
> On Aug 2, 2012, at 6:42 AM, Jia Hongtao wrote:
>=20
> > Remove the dependency on PCI initialization for SWIOTLB initialization.
> > So that PCI can be initialized at proper time.
> >
> > SWIOTLB is partly determined by PCI inbound/outbound map which is
> assigned
> > in PCI initialization. But swiotlb_init() should be done at the stage
> of
> > mem_init() which is much earlier than PCI initialization. So we reserve
> the
> > memory for SWIOTLB first and free it if not necessary.
> >
> > All boards are converted to fit this change.
> >
> > Signed-off-by: Jia Hongtao <B38951@freescale.com>
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > ---
>=20
> This doesn't seem like it addresses our issue w/regards to not being able
> to map all of memory from PCI.

PCI init will determine ppc_swiotlb_enable due to PCI map. swiotlb_late_ini=
t
will handle all swiotlb things depend on the result of pci init.

>=20
>=20
> > arch/powerpc/include/asm/swiotlb.h       |    6 ++++++
> > arch/powerpc/kernel/dma-swiotlb.c        |   20 ++++++++++++++++++++
> > arch/powerpc/mm/mem.c                    |    3 +--
> > arch/powerpc/platforms/44x/currituck.c   |   10 ++--------
> > arch/powerpc/platforms/85xx/mpc85xx_ds.c |    1 +
> > arch/powerpc/platforms/85xx/qemu_e500.c  |    2 +-
> > arch/powerpc/sysdev/fsl_pci.c            |    5 +----
> > 7 files changed, 32 insertions(+), 15 deletions(-)
>=20
> Don't we also want to update all these:
>=20
> arch/powerpc/platforms/85xx/corenet_ds.c:
> ppc_swiotlb_enable =3D 1;
> arch/powerpc/platforms/85xx/ge_imp3a.c:         ppc_swiotlb_enable =3D 1;
> arch/powerpc/platforms/85xx/mpc8536_ds.c:
> ppc_swiotlb_enable =3D 1;
> arch/powerpc/platforms/85xx/mpc85xx_mds.c:
> ppc_swiotlb_enable =3D 1;
> arch/powerpc/platforms/85xx/p1022_ds.c:         ppc_swiotlb_enable =3D 1;
> arch/powerpc/platforms/86xx/mpc86xx_hpcn.c:
> ppc_swiotlb_enable =3D 1;
>=20

They are works fine at this point.

I will update all these boards after
[PATCH 3/3] Unify pci/pcie initialization code

>=20
> >
> > diff --git a/arch/powerpc/include/asm/swiotlb.h
> b/arch/powerpc/include/asm/swiotlb.h
> > index 8979d4c..de99d6e 100644
> > --- a/arch/powerpc/include/asm/swiotlb.h
> > +++ b/arch/powerpc/include/asm/swiotlb.h
> > @@ -22,4 +22,10 @@ int __init swiotlb_setup_bus_notifier(void);
> >
> > extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev);
> >
> > +#ifdef CONFIG_SWIOTLB
> > +void swiotlb_detect_4g(void);
> > +#else
> > +static inline void swiotlb_detect_4g(void) {}
> > +#endif
> > +
> > #endif /* __ASM_SWIOTLB_H */
> > diff --git a/arch/powerpc/kernel/dma-swiotlb.c
> b/arch/powerpc/kernel/dma-swiotlb.c
> > index 4ab88da..aa85550 100644
> > --- a/arch/powerpc/kernel/dma-swiotlb.c
> > +++ b/arch/powerpc/kernel/dma-swiotlb.c
> > @@ -104,3 +104,23 @@ int __init swiotlb_setup_bus_notifier(void)
> > 			      &ppc_swiotlb_plat_bus_notifier);
> > 	return 0;
> > }
> > +
> > +void swiotlb_detect_4g(void)
> > +{
> > +	if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
> > +		ppc_swiotlb_enable =3D 1;
> > +}
> > +
> > +static int __init swiotlb_late_init(void)
> > +{
> > +	if (ppc_swiotlb_enable) {
> > +		swiotlb_print_info();
> > +		set_pci_dma_ops(&swiotlb_dma_ops);
> > +		ppc_md.pci_dma_dev_setup =3D pci_dma_dev_setup_swiotlb;
> > +	} else {
> > +		swiotlb_free();
> > +	}
> > +
> > +	return 0;
> > +}
> > +subsys_initcall(swiotlb_late_init);
> > diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> > index baaafde..f23c4e0 100644
> > --- a/arch/powerpc/mm/mem.c
> > +++ b/arch/powerpc/mm/mem.c
> > @@ -300,8 +300,7 @@ void __init mem_init(void)
> > 	unsigned long reservedpages =3D 0, codesize, initsize, datasize,
> bsssize;
> >
> > #ifdef CONFIG_SWIOTLB
> > -	if (ppc_swiotlb_enable)
> > -		swiotlb_init(1);
> > +	swiotlb_init(0);
> > #endif
> >
> > 	num_physpages =3D memblock_phys_mem_size() >> PAGE_SHIFT;
> > diff --git a/arch/powerpc/platforms/44x/currituck.c
> b/arch/powerpc/platforms/44x/currituck.c
> > index 9f6c33d..6bd89a0 100644
> > --- a/arch/powerpc/platforms/44x/currituck.c
> > +++ b/arch/powerpc/platforms/44x/currituck.c
> > @@ -21,7 +21,6 @@
> >  */
> >
> > #include <linux/init.h>
> > -#include <linux/memblock.h>
> > #include <linux/of.h>
> > #include <linux/of_platform.h>
> > #include <linux/rtc.h>
> > @@ -159,13 +158,8 @@ static void __init ppc47x_setup_arch(void)
> >
> > 	/* No need to check the DMA config as we /know/ our windows are all
> of
> >  	 * RAM.  Lets hope that doesn't change */
> > -#ifdef CONFIG_SWIOTLB
> > -	if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
> > -		ppc_swiotlb_enable =3D 1;
> > -		set_pci_dma_ops(&swiotlb_dma_ops);
> > -		ppc_md.pci_dma_dev_setup =3D pci_dma_dev_setup_swiotlb;
> > -	}
> > -#endif
> > +	swiotlb_detect_4g();
> > +
> > 	ppc47x_smp_init();
> > }
> >
> > diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> > index 6d3265f..56f8c8f 100644
> > --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> > +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> > @@ -159,6 +159,7 @@ static void __init mpc85xx_ds_setup_arch(void)
> > 	if (ppc_md.progress)
> > 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
> >
> > +	swiotlb_detect_4g();
> > 	mpc85xx_ds_pci_init();
> > 	mpc85xx_smp_init();
> >
> > diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c
> b/arch/powerpc/platforms/85xx/qemu_e500.c
> > index 95a2e53..04260cd 100644
> > --- a/arch/powerpc/platforms/85xx/qemu_e500.c
> > +++ b/arch/powerpc/platforms/85xx/qemu_e500.c
> > @@ -41,7 +41,7 @@ static void __init qemu_e500_setup_arch(void)
> > {
> > 	ppc_md.progress("qemu_e500_setup_arch()", 0);
> >
> > -	fsl_pci_init();
> > +	swiotlb_detect_4g();
>=20
> removing fsl_pci_init() seems wrong.

You are right. I will fix this.
Thanks.

-Hongtao.

>=20
> > 	mpc85xx_smp_init();
> > }
> >
> > diff --git a/arch/powerpc/sysdev/fsl_pci.c
> b/arch/powerpc/sysdev/fsl_pci.c
> > index 6938792..da7a3d7 100644
> > --- a/arch/powerpc/sysdev/fsl_pci.c
> > +++ b/arch/powerpc/sysdev/fsl_pci.c
> > @@ -872,11 +872,8 @@ void __devinit fsl_pci_init(void)
> > 	 * we need SWIOTLB to handle buffers located outside of
> > 	 * dma capable memory region
> > 	 */
> > -	if (memblock_end_of_DRAM() - 1 > max) {
> > +	if (memblock_end_of_DRAM() - 1 > max)
> > 		ppc_swiotlb_enable =3D 1;
> > -		set_pci_dma_ops(&swiotlb_dma_ops);
> > -		ppc_md.pci_dma_dev_setup =3D pci_dma_dev_setup_swiotlb;
> > -	}
> > #endif
> > }
> > #endif
> > --
> > 1.7.5.1
> >
>=20

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

* RE: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-02 12:23   ` Kumar Gala
  2012-08-02 15:59     ` Scott Wood
@ 2012-08-03  3:39     ` Jia Hongtao-B38951
  2012-08-03 16:03       ` Scott Wood
  1 sibling, 1 reply; 26+ messages in thread
From: Jia Hongtao-B38951 @ 2012-08-03  3:39 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472



> -----Original Message-----
> From: Kumar Gala [mailto:galak@kernel.crashing.org]
> Sent: Thursday, August 02, 2012 8:24 PM
> To: Jia Hongtao-B38951
> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
> initialization code
>=20
>=20
> On Aug 2, 2012, at 6:42 AM, Jia Hongtao wrote:
>=20
> > We unified the Freescale pci/pcie initialization by changing the
> fsl_pci
> > to a platform driver. In previous PCI code architecture the
> initialization
> > routine is called at board_setup_arch stage. Now the initialization is
> done
> > in probe function which is architectural better. Also It's convenient
> for
> > adding PM support for PCI controller in later patch.
> >
> > Now we registered pci controllers as platform devices. So we combine
> two
> > initialization code as one platform driver.
> >
> > Signed-off-by: Jia Hongtao <B38951@freescale.com>
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> > ---
> > arch/powerpc/platforms/85xx/mpc85xx_ds.c |   32 ++--------
> > arch/powerpc/sysdev/fsl_pci.c            |  102 ++++++++++++++++++-----
> ------
> > arch/powerpc/sysdev/fsl_pci.h            |    6 +-
> > drivers/edac/mpc85xx_edac.c              |   43 ++++---------
> > 4 files changed, 83 insertions(+), 100 deletions(-)
>=20
> You need to convert all boards to use fsl_pci_init before this patch.
> Otherwise we'll end up with PCI getting initialized twice on boards.
>=20
> - k

If we covert all boards with platform driver in this patch PCI will
be initialized only once without converting all boards to use
fsl_pci_init first.=20

If we convert all boards to use fsl_pci_init before this patch and
convert them to use platform driver again after this patch. Then
between this patch and next pci will be initialized twice too.

So I think convert all boards in this patch is the key not convert
all boards to use fsl_pci_init first before this patch.

-Hongtao.

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

* Re: [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and disable if not necessary
  2012-08-03  2:21     ` Jia Hongtao-B38951
@ 2012-08-03 12:38       ` Kumar Gala
  2012-08-03 14:42         ` Li Yang
  0 siblings, 1 reply; 26+ messages in thread
From: Kumar Gala @ 2012-08-03 12:38 UTC (permalink / raw)
  To: Jia Hongtao-B38951
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472


On Aug 2, 2012, at 9:21 PM, Jia Hongtao-B38951 wrote:

>>=20
>> -----Original Message-----
>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>> Sent: Thursday, August 02, 2012 8:55 PM
>> To: Jia Hongtao-B38951
>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
>> Subject: Re: [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage =
and
>> disable if not necessary
>>=20
>>=20
>> On Aug 2, 2012, at 6:42 AM, Jia Hongtao wrote:
>>=20
>>> Remove the dependency on PCI initialization for SWIOTLB =
initialization.
>>> So that PCI can be initialized at proper time.
>>>=20
>>> SWIOTLB is partly determined by PCI inbound/outbound map which is
>> assigned
>>> in PCI initialization. But swiotlb_init() should be done at the =
stage
>> of
>>> mem_init() which is much earlier than PCI initialization. So we =
reserve
>> the
>>> memory for SWIOTLB first and free it if not necessary.
>>>=20
>>> All boards are converted to fit this change.
>>>=20
>>> Signed-off-by: Jia Hongtao <B38951@freescale.com>
>>> Signed-off-by: Li Yang <leoli@freescale.com>
>>> ---
>>=20
>> This doesn't seem like it addresses our issue w/regards to not being =
able
>> to map all of memory from PCI.
>=20
> PCI init will determine ppc_swiotlb_enable due to PCI map. =
swiotlb_late_init
> will handle all swiotlb things depend on the result of pci init.

Think about the case that we have 4095M of memory & 1G of PCI memory =
mapped space.  The old code would enable swiotlb for this case since we =
would NOT be able to DMA to all 4095M of memory.  The patch does not =
handle this case correctly.

- k

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

* Re: [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and disable if not necessary
  2012-08-03 12:38       ` Kumar Gala
@ 2012-08-03 14:42         ` Li Yang
  2012-08-03 16:15           ` Kumar Gala
  0 siblings, 1 reply; 26+ messages in thread
From: Li Yang @ 2012-08-03 14:42 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472,
	Jia Hongtao-B38951

On Fri, Aug 3, 2012 at 8:38 PM, Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Aug 2, 2012, at 9:21 PM, Jia Hongtao-B38951 wrote:
>
>>>
>>> -----Original Message-----
>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>>> Sent: Thursday, August 02, 2012 8:55 PM
>>> To: Jia Hongtao-B38951
>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
>>> Subject: Re: [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and
>>> disable if not necessary
>>>
>>>
>>> On Aug 2, 2012, at 6:42 AM, Jia Hongtao wrote:
>>>
>>>> Remove the dependency on PCI initialization for SWIOTLB initialization.
>>>> So that PCI can be initialized at proper time.
>>>>
>>>> SWIOTLB is partly determined by PCI inbound/outbound map which is
>>> assigned
>>>> in PCI initialization. But swiotlb_init() should be done at the stage
>>> of
>>>> mem_init() which is much earlier than PCI initialization. So we reserve
>>> the
>>>> memory for SWIOTLB first and free it if not necessary.
>>>>
>>>> All boards are converted to fit this change.
>>>>
>>>> Signed-off-by: Jia Hongtao <B38951@freescale.com>
>>>> Signed-off-by: Li Yang <leoli@freescale.com>
>>>> ---
>>>
>>> This doesn't seem like it addresses our issue w/regards to not being able
>>> to map all of memory from PCI.
>>
>> PCI init will determine ppc_swiotlb_enable due to PCI map. swiotlb_late_init
>> will handle all swiotlb things depend on the result of pci init.
>
> Think about the case that we have 4095M of memory & 1G of PCI memory mapped space.  The old code would enable swiotlb for this case since we would NOT be able to DMA to all 4095M of memory.  The patch does not handle this case correctly.

The patch can handle it.  The ppc_swiotlb_enable is still being set in
 fsl_pci_init() if there is 1G of PCI memory mapped space.  It is
after next patch that the ppc_swiotlb_enable is being set in the PCI
probe() routine.

Leo

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

* Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-03  3:39     ` Jia Hongtao-B38951
@ 2012-08-03 16:03       ` Scott Wood
  2012-08-06  2:39         ` Jia Hongtao-B38951
  0 siblings, 1 reply; 26+ messages in thread
From: Scott Wood @ 2012-08-03 16:03 UTC (permalink / raw)
  To: Jia Hongtao-B38951
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472

On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
> 
> 
>> -----Original Message-----
>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>> Sent: Thursday, August 02, 2012 8:24 PM
>> To: Jia Hongtao-B38951
>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> You need to convert all boards to use fsl_pci_init before this patch.
>> Otherwise we'll end up with PCI getting initialized twice on boards.
>>
>> - k
> 
> If we covert all boards with platform driver in this patch PCI will
> be initialized only once without converting all boards to use
> fsl_pci_init first. 

Then we'd have to pick apart core changes from board changes when reviewing.

> If we convert all boards to use fsl_pci_init before this patch and
> convert them to use platform driver again after this patch. Then
> between this patch and next pci will be initialized twice too.

Why?  That one patch should both create the platform driver and remove
the init from fsl_pci_init() -- except things like primary bus detection
which has to happen globally.

-Scott

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

* Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-03  2:20     ` Jia Hongtao-B38951
@ 2012-08-03 16:09       ` Scott Wood
  2012-08-06  4:11         ` Tabi Timur-B04825
  0 siblings, 1 reply; 26+ messages in thread
From: Scott Wood @ 2012-08-03 16:09 UTC (permalink / raw)
  To: Jia Hongtao-B38951
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472

On 08/02/2012 09:20 PM, Jia Hongtao-B38951 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Friday, August 03, 2012 4:19 AM
>> To: Jia Hongtao-B38951
>> Cc: linuxppc-dev@lists.ozlabs.org; galak@kernel.crashing.org; Wood Scott-
>> B07421; Li Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> Why are you eliminating the uli lookup?  We don't want to call
>> uli_exclude_device on boards that don't have a uli.
>>
>> -Scott
> 
> I found out that all 85xx_ds boards (mpc8572ds, mpc8544ds, p2020ds) have
> ULI.

Perhaps all boards currently handled by this file do, but it's not true
for all mpc85xx_ds boards.  I think we could handle mpc8536ds here if we
didn't hardcode the uli assumption.  Not critical, but would be nice to
make this more device tree driven.

p1022ds OTOH is weird enough that it deserves its own board file.

> Also in platform driver fsl_pci_primary is determined at arch_initcall
> which means at the stage of board_setup_arch fsl_pci_primary is not ready.

You could export the primary detection function so that boards can call
it early if they want.

-Scott

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

* Re: [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and disable if not necessary
  2012-08-03 14:42         ` Li Yang
@ 2012-08-03 16:15           ` Kumar Gala
  0 siblings, 0 replies; 26+ messages in thread
From: Kumar Gala @ 2012-08-03 16:15 UTC (permalink / raw)
  To: Li Yang
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472,
	Jia Hongtao-B38951


On Aug 3, 2012, at 9:42 AM, Li Yang wrote:

> On Fri, Aug 3, 2012 at 8:38 PM, Kumar Gala <galak@kernel.crashing.org> =
wrote:
>>=20
>> On Aug 2, 2012, at 9:21 PM, Jia Hongtao-B38951 wrote:
>>=20
>>>>=20
>>>> -----Original Message-----
>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>>>> Sent: Thursday, August 02, 2012 8:55 PM
>>>> To: Jia Hongtao-B38951
>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li =
Yang-R58472
>>>> Subject: Re: [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage =
and
>>>> disable if not necessary
>>>>=20
>>>>=20
>>>> On Aug 2, 2012, at 6:42 AM, Jia Hongtao wrote:
>>>>=20
>>>>> Remove the dependency on PCI initialization for SWIOTLB =
initialization.
>>>>> So that PCI can be initialized at proper time.
>>>>>=20
>>>>> SWIOTLB is partly determined by PCI inbound/outbound map which is
>>>> assigned
>>>>> in PCI initialization. But swiotlb_init() should be done at the =
stage
>>>> of
>>>>> mem_init() which is much earlier than PCI initialization. So we =
reserve
>>>> the
>>>>> memory for SWIOTLB first and free it if not necessary.
>>>>>=20
>>>>> All boards are converted to fit this change.
>>>>>=20
>>>>> Signed-off-by: Jia Hongtao <B38951@freescale.com>
>>>>> Signed-off-by: Li Yang <leoli@freescale.com>
>>>>> ---
>>>>=20
>>>> This doesn't seem like it addresses our issue w/regards to not =
being able
>>>> to map all of memory from PCI.
>>>=20
>>> PCI init will determine ppc_swiotlb_enable due to PCI map. =
swiotlb_late_init
>>> will handle all swiotlb things depend on the result of pci init.
>>=20
>> Think about the case that we have 4095M of memory & 1G of PCI memory =
mapped space.  The old code would enable swiotlb for this case since we =
would NOT be able to DMA to all 4095M of memory.  The patch does not =
handle this case correctly.
>=20
> The patch can handle it.  The ppc_swiotlb_enable is still being set in
> fsl_pci_init() if there is 1G of PCI memory mapped space.  It is
> after next patch that the ppc_swiotlb_enable is being set in the PCI
> probe() routine.
>=20
> Leo


Gotcha.  I was thinking the swiotlb_init(0) was:

if (ppc_swiotlb_enable)
	swiotlb_init(0)

Now I see, we call it unconditionally, than fixup in swiotlb_late_init

- k=

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

* RE: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-03 16:03       ` Scott Wood
@ 2012-08-06  2:39         ` Jia Hongtao-B38951
  2012-08-06 15:15           ` Scott Wood
  0 siblings, 1 reply; 26+ messages in thread
From: Jia Hongtao-B38951 @ 2012-08-06  2:39 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: linuxppc-dev@lists.ozlabs.org, Li Yang-R58472

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogU2F0dXJkYXksIEF1Z3VzdCAwNCwgMjAxMiAxMjowNCBBTQ0KPiBUbzogSmlh
IEhvbmd0YW8tQjM4OTUxDQo+IENjOiBLdW1hciBHYWxhOyBsaW51eHBwYy1kZXZAbGlzdHMub3ps
YWJzLm9yZzsgV29vZCBTY290dC1CMDc0MjE7IExpDQo+IFlhbmctUjU4NDcyDQo+IFN1YmplY3Q6
IFJlOiBbUEFUQ0ggVjQgMy8zXSBwb3dlcnBjL2ZzbC1wY2k6IFVuaWZ5IHBjaS9wY2ll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vdmUNCmZzbF9wY2lfaW5pdCgpIGZyb20gdGhlIGJvYXJkcyB0aGF0IHVzaW5nIGl0IGFu
ZCBjb252ZXJ0IGFsbCBvdGhlciBib2FyZHMNCnRoYXQgc3RpbGwgdXNpbmcgb2xkIHdheXMuIEkg
dGhpbmsgaXQncyBjbGVhciBhbmQgcmlnaHQuDQoNCi1Ib25ndGFvLg0K

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

* Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-03 16:09       ` Scott Wood
@ 2012-08-06  4:11         ` Tabi Timur-B04825
  2012-08-06 14:03           ` Scott Wood
  0 siblings, 1 reply; 26+ messages in thread
From: Tabi Timur-B04825 @ 2012-08-06  4:11 UTC (permalink / raw)
  To: Wood Scott-B07421
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472,
	Jia Hongtao-B38951

On Fri, Aug 3, 2012 at 11:09 AM, Scott Wood <scottwood@freescale.com> wrote=
:

> p1022ds OTOH is weird enough that it deserves its own board file.

What's so weird about the P1022DS?

Also, why do we need a default PCI bus if one isn't specified in the
device tree?

--=20
Timur Tabi
Linux kernel developer at Freescale=

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

* Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-06  4:11         ` Tabi Timur-B04825
@ 2012-08-06 14:03           ` Scott Wood
  0 siblings, 0 replies; 26+ messages in thread
From: Scott Wood @ 2012-08-06 14:03 UTC (permalink / raw)
  To: Tabi Timur-B04825
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472,
	Jia Hongtao-B38951

On 08/05/2012 11:11 PM, Tabi Timur-B04825 wrote:
> On Fri, Aug 3, 2012 at 11:09 AM, Scott Wood <scottwood@freescale.com> wrote:
> 
>> p1022ds OTOH is weird enough that it deserves its own board file.
> 
> What's so weird about the P1022DS?

The localbus muxing.

> Also, why do we need a default PCI bus if one isn't specified in the
> device tree?

Because there are bugs in the Linux PPC PCI code when you don't have a
primary bus -- see recent upstream linuxppc-dev discussion.

-Scott

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

* Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-06  2:39         ` Jia Hongtao-B38951
@ 2012-08-06 15:15           ` Scott Wood
  2012-08-07  6:23             ` Jia Hongtao-B38951
  0 siblings, 1 reply; 26+ messages in thread
From: Scott Wood @ 2012-08-06 15:15 UTC (permalink / raw)
  To: Jia Hongtao-B38951
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472

On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Saturday, August 04, 2012 12:04 AM
>> To: Jia Hongtao-B38951
>> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>> Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>>>> Sent: Thursday, August 02, 2012 8:24 PM
>>>> To: Jia Hongtao-B38951
>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li Yang-R58472
>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>> initialization code
>>>>
>>>> You need to convert all boards to use fsl_pci_init before this patch.
>>>> Otherwise we'll end up with PCI getting initialized twice on boards.
>>>>
>>>> - k
>>>
>>> If we covert all boards with platform driver in this patch PCI will
>>> be initialized only once without converting all boards to use
>>> fsl_pci_init first.
>>
>> Then we'd have to pick apart core changes from board changes when
>> reviewing.
>>
>>> If we convert all boards to use fsl_pci_init before this patch and
>>> convert them to use platform driver again after this patch. Then
>>> between this patch and next pci will be initialized twice too.
>>
>> Why?  That one patch should both create the platform driver and remove
>> the init from fsl_pci_init() -- except things like primary bus detection
>> which has to happen globally.
>>
>> -Scott
> 
> "One patch both create the platform driver and remove the init from
> fsl_pci_init()" means we should create platform driver and applied to
> all boards. If so why not just directly convert all boards using platform
> driver?

Because it's harder to review when you have a bunch of board code in the
patch in addition to core changes.

Because you might want people to actually test on the boards in question
when converting, especially given the change in how primary buses are
determined, and that some boards may need to provide their own alternative.

-Scott

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

* RE: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-06 15:15           ` Scott Wood
@ 2012-08-07  6:23             ` Jia Hongtao-B38951
  2012-08-07 15:19               ` Scott Wood
  0 siblings, 1 reply; 26+ messages in thread
From: Jia Hongtao-B38951 @ 2012-08-07  6:23 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: linuxppc-dev@lists.ozlabs.org, Li Yang-R58472

PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBXb29kIFNjb3R0LUIwNzQyMQ0K
PiBTZW50OiBNb25kYXksIEF1Z3VzdCAwNiwgMjAxMiAxMToxNiBQTQ0KPiBUbzogSmlhIEhvbmd0
YW8tQjM4OTUxDQo+IENjOiBXb29kIFNjb3R0LUIwNzQyMTsgS3VtYXIgR2FsYTsgbGludXhwcGMt
ZGV2QGxpc3RzLm96bGFicy5vcmc7IExpDQo+IFlhbmctUjU4NDcyDQo+IFN1YmplY3Q6IFJlOiBb
UEFUQ0ggVjQgMy8zXSBwb3dlcnBjL2ZzbC1wY2k6IFVuaWZ5IHBjaS9wY2llDQo+IGluaXRpYWxp
emF0aW9uIGNvZGUNCj4gDQo+IE9uIDA4LzA1LzIwMTIgMDk6MzkgUE0sIEppYSBIb25ndGFvLUIz
ODk1MSB3cm90ZToNCj4gPg0KPiA+DQo+ID4+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tD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0KcGF0Y2hlcyBQQ0kgd2lsbCBiZSBpbml0aWFsaXpl
ZCB0d2ljZS4NCg0KLUhvbmd0YW8uDQoNCg==

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

* Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-07  6:23             ` Jia Hongtao-B38951
@ 2012-08-07 15:19               ` Scott Wood
  2012-08-08  3:57                 ` Jia Hongtao-B38951
  0 siblings, 1 reply; 26+ messages in thread
From: Scott Wood @ 2012-08-07 15:19 UTC (permalink / raw)
  To: Jia Hongtao-B38951
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472

On 08/07/2012 01:23 AM, Jia Hongtao-B38951 wrote:
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Monday, August 06, 2012 11:16 PM
>> To: Jia Hongtao-B38951
>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
>> Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Wood Scott-B07421
>>>> Sent: Saturday, August 04, 2012 12:04 AM
>>>> To: Jia Hongtao-B38951
>>>> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>>>> Yang-R58472
>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>> initialization code
>>>>
>>>> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>>>>>> Sent: Thursday, August 02, 2012 8:24 PM
>>>>>> To: Jia Hongtao-B38951
>>>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>>>>>> Yang-R58472
>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>> initialization code
>>>>>>
>>>>>> You need to convert all boards to use fsl_pci_init before this patch.
>>>>>> Otherwise we'll end up with PCI getting initialized twice on boards.
>>>>>>
>>>>>> - k
>>>>>
>>>>> If we covert all boards with platform driver in this patch PCI will
>>>>> be initialized only once without converting all boards to use
>>>>> fsl_pci_init first.
>>>>
>>>> Then we'd have to pick apart core changes from board changes when
>>>> reviewing.
>>>>
>>>>> If we convert all boards to use fsl_pci_init before this patch and
>>>>> convert them to use platform driver again after this patch. Then
>>>>> between this patch and next pci will be initialized twice too.
>>>>
>>>> Why?  That one patch should both create the platform driver and
>>>> remove the init from fsl_pci_init() -- except things like primary bus
>>>> detection which has to happen globally.
>>>>
>>>> -Scott
>>>
>>> "One patch both create the platform driver and remove the init from
>>> fsl_pci_init()" means we should create platform driver and applied to
>>> all boards. If so why not just directly convert all boards using
>>> platform driver?
>>
>> Because it's harder to review when you have a bunch of board code in the
>> patch in addition to core changes.
>>
>> Because you might want people to actually test on the boards in question
>> when converting, especially given the change in how primary buses are
>> determined, and that some boards may need to provide their own
>> alternative.
>>
>> -Scott
> 
> But if we separate the core changes and the boards update, between this two
> patches PCI will be initialized twice.

As I said earlier, you can remove the initcall and require boards to
manually call fsl_pci_init() until all boards are converted.

-Scott

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

* RE: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-07 15:19               ` Scott Wood
@ 2012-08-08  3:57                 ` Jia Hongtao-B38951
  2012-08-08 15:53                   ` Scott Wood
  0 siblings, 1 reply; 26+ messages in thread
From: Jia Hongtao-B38951 @ 2012-08-08  3:57 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: linuxppc-dev@lists.ozlabs.org, Li Yang-R58472

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogVHV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:57                 ` Jia Hongtao-B38951
@ 2012-08-08 15:53                   ` Scott Wood
  2012-08-09  3:52                     ` Jia Hongtao-B38951
  0 siblings, 1 reply; 26+ messages in thread
From: Scott Wood @ 2012-08-08 15:53 UTC (permalink / raw)
  To: Jia Hongtao-B38951
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472

On 08/07/2012 10:57 PM, Jia Hongtao-B38951 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Tuesday, August 07, 2012 11:20 PM
>> To: Jia Hongtao-B38951
>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
>> Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> On 08/07/2012 01:23 AM, Jia Hongtao-B38951 wrote:
>>>> -----Original Message-----
>>>> From: Wood Scott-B07421
>>>> Sent: Monday, August 06, 2012 11:16 PM
>>>> To: Jia Hongtao-B38951
>>>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
>>>> Yang-R58472
>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>> initialization code
>>>>
>>>> On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Wood Scott-B07421
>>>>>> Sent: Saturday, August 04, 2012 12:04 AM
>>>>>> To: Jia Hongtao-B38951
>>>>>> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>>>>>> Yang-R58472
>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>> initialization code
>>>>>>
>>>>>> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
>>>>>>>
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>>>>>>>> Sent: Thursday, August 02, 2012 8:24 PM
>>>>>>>> To: Jia Hongtao-B38951
>>>>>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>>>>>>>> Yang-R58472
>>>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>>>> initialization code
>>>>>>>>
>>>>>>>> You need to convert all boards to use fsl_pci_init before this
>> patch.
>>>>>>>> Otherwise we'll end up with PCI getting initialized twice on
>> boards.
>>>>>>>>
>>>>>>>> - k
>>>>>>>
>>>>>>> If we covert all boards with platform driver in this patch PCI will
>>>>>>> be initialized only once without converting all boards to use
>>>>>>> fsl_pci_init first.
>>>>>>
>>>>>> Then we'd have to pick apart core changes from board changes when
>>>>>> reviewing.
>>>>>>
>>>>>>> If we convert all boards to use fsl_pci_init before this patch and
>>>>>>> convert them to use platform driver again after this patch. Then
>>>>>>> between this patch and next pci will be initialized twice too.
>>>>>>
>>>>>> Why?  That one patch should both create the platform driver and
>>>>>> remove the init from fsl_pci_init() -- except things like primary
>> bus
>>>>>> detection which has to happen globally.
>>>>>>
>>>>>> -Scott
>>>>>
>>>>> "One patch both create the platform driver and remove the init from
>>>>> fsl_pci_init()" means we should create platform driver and applied to
>>>>> all boards. If so why not just directly convert all boards using
>>>>> platform driver?
>>>>
>>>> Because it's harder to review when you have a bunch of board code in
>> the
>>>> patch in addition to core changes.
>>>>
>>>> Because you might want people to actually test on the boards in
>> question
>>>> when converting, especially given the change in how primary buses are
>>>> determined, and that some boards may need to provide their own
>>>> alternative.
>>>>
>>>> -Scott
>>>
>>> But if we separate the core changes and the boards update, between this
>> two
>>> patches PCI will be initialized twice.
>>
>> As I said earlier, you can remove the initcall and require boards to
>> manually call fsl_pci_init() until all boards are converted.
>>
>> -Scott
> 
> As I said earlier, I can do this but it does not solve the twice-init problem.

I must have missed it.  Why does it not solve the problem?  If a board
doesn't call fsl_pci_init(), the platform driver doesn't get registered.

> If I do this first and then add platform driver we also have to convert all
> boards using platform driver in the same patch.
> 
> We finally using the platform driver so Why do you keep insisting on converting
> all boards using fsl_pci_init() first even it does no improvement.

What we're asking for is bisectability (don't have any intermediate
stages where PCI gets initialized twice), and the ability to have a
smooth transition where boards can be converted as people are able to
test them and look into their individual needs regarding primary bus.

-Scott

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

* RE: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-08 15:53                   ` Scott Wood
@ 2012-08-09  3:52                     ` Jia Hongtao-B38951
  2012-08-10 22:59                       ` Scott Wood
  0 siblings, 1 reply; 26+ messages in thread
From: Jia Hongtao-B38951 @ 2012-08-09  3:52 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: linuxppc-dev@lists.ozlabs.org, Li Yang-R58472

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogV2VkbmVzZGF5LCBBdWd1c3QgMDgsIDIwMTIgMTE6NTQgUE0NCj4gVG86IEpp
YSBIb25ndGFvLUIzODk1MQ0KPiBDYzogV29vZCBTY290dC1CMDc0MjE7IEt1bWFyIEdhbGE7IGxp
bnV4cHBjLWRldkBsaXN0cy5vemxhYnMub3JnOyBMaQ0KPiBZYW5nLVI1ODQ3Mg0KPiBTdWJqZWN0
OiBSZTogW1BBVENIIFY0IDMvM10gcG93ZXJwYy9mc2wtcGNpOiBVbmlmeSBwY2kvcGNpZQ0KPiBp
bml0aWFsaXphdGlvbiBjb2RlDQo+IA0KPiBPbiAwOC8wNy8yMDEyIDEwOjU3IFBNLCBKaWEgSG9u
Z3Rhby1CMzg5NTEgd3JvdGU6DQo+ID4NCj4gPg0KPiA+PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2Ut
LS0tLQ0KPiA+PiBGcm9tOiBXb29kIFNjb3R0LUIwNzQyMQ0KPiA+PiBTZW50OiBUdWVzZGF5LCBB
dWd1c3QgMDcsIDIw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vLg0K

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

* Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code
  2012-08-09  3:52                     ` Jia Hongtao-B38951
@ 2012-08-10 22:59                       ` Scott Wood
  0 siblings, 0 replies; 26+ messages in thread
From: Scott Wood @ 2012-08-10 22:59 UTC (permalink / raw)
  To: Jia Hongtao-B38951
  Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472


On 08/08/2012 10:52 PM, Jia Hongtao-B38951 wrote:
> 
> 
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Wednesday, August 08, 2012 11:54 PM
>> To: Jia Hongtao-B38951
>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
>> Yang-R58472
>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>> initialization code
>>
>> On 08/07/2012 10:57 PM, Jia Hongtao-B38951 wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Wood Scott-B07421
>>>> Sent: Tuesday, August 07, 2012 11:20 PM
>>>> To: Jia Hongtao-B38951
>>>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org; Li
>>>> Yang-R58472
>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>> initialization code
>>>>
>>>> On 08/07/2012 01:23 AM, Jia Hongtao-B38951 wrote:
>>>>>> -----Original Message-----
>>>>>> From: Wood Scott-B07421
>>>>>> Sent: Monday, August 06, 2012 11:16 PM
>>>>>> To: Jia Hongtao-B38951
>>>>>> Cc: Wood Scott-B07421; Kumar Gala; linuxppc-dev@lists.ozlabs.org;
>>>>>> Li
>>>>>> Yang-R58472
>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>> initialization code
>>>>>>
>>>>>> On 08/05/2012 09:39 PM, Jia Hongtao-B38951 wrote:
>>>>>>>
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Wood Scott-B07421
>>>>>>>> Sent: Saturday, August 04, 2012 12:04 AM
>>>>>>>> To: Jia Hongtao-B38951
>>>>>>>> Cc: Kumar Gala; linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421;
>>>>>>>> Li
>>>>>>>> Yang-R58472
>>>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>>>> initialization code
>>>>>>>>
>>>>>>>> On 08/02/2012 10:39 PM, Jia Hongtao-B38951 wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>>>>>>>>>> Sent: Thursday, August 02, 2012 8:24 PM
>>>>>>>>>> To: Jia Hongtao-B38951
>>>>>>>>>> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421; Li
>>>>>>>>>> Yang-R58472
>>>>>>>>>> Subject: Re: [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie
>>>>>>>>>> initialization code
>>>>>>>>>>
>>>>>>>>>> You need to convert all boards to use fsl_pci_init before this
>>>> patch.
>>>>>>>>>> Otherwise we'll end up with PCI getting initialized twice on
>>>> boards.
>>>>>>>>>>
>>>>>>>>>> - k
>>>>>>>>>
>>>>>>>>> If we covert all boards with platform driver in this patch PCI
>>>>>>>>> will be initialized only once without converting all boards to
>>>>>>>>> use fsl_pci_init first.
>>>>>>>>
>>>>>>>> Then we'd have to pick apart core changes from board changes when
>>>>>>>> reviewing.
>>>>>>>>
>>>>>>>>> If we convert all boards to use fsl_pci_init before this patch
>>>>>>>>> and convert them to use platform driver again after this patch.
>>>>>>>>> Then between this patch and next pci will be initialized twice
>> too.
>>>>>>>>
>>>>>>>> Why?  That one patch should both create the platform driver and
>>>>>>>> remove the init from fsl_pci_init() -- except things like primary
>>>> bus
>>>>>>>> detection which has to happen globally.
>>>>>>>>
>>>>>>>> -Scott
>>>>>>>
>>>>>>> "One patch both create the platform driver and remove the init
>>>>>>> from fsl_pci_init()" means we should create platform driver and
>>>>>>> applied to all boards. If so why not just directly convert all
>>>>>>> boards using platform driver?
>>>>>>
>>>>>> Because it's harder to review when you have a bunch of board code
>>>>>> in
>>>> the
>>>>>> patch in addition to core changes.
>>>>>>
>>>>>> Because you might want people to actually test on the boards in
>>>> question
>>>>>> when converting, especially given the change in how primary buses
>>>>>> are determined, and that some boards may need to provide their own
>>>>>> alternative.
>>>>>>
>>>>>> -Scott
>>>>>
>>>>> But if we separate the core changes and the boards update, between
>>>>> this
>>>> two
>>>>> patches PCI will be initialized twice.
>>>>
>>>> As I said earlier, you can remove the initcall and require boards to
>>>> manually call fsl_pci_init() until all boards are converted.
>>>>
>>>> -Scott
>>>
>>> As I said earlier, I can do this but it does not solve the twice-init
>> problem.
>>
>> I must have missed it.  Why does it not solve the problem?  If a board
>> doesn't call fsl_pci_init(), the platform driver doesn't get registered.
>>
>>> If I do this first and then add platform driver we also have to
>>> convert all boards using platform driver in the same patch.
>>>
>>> We finally using the platform driver so Why do you keep insisting on
>>> converting all boards using fsl_pci_init() first even it does no
>> improvement.
>>
>> What we're asking for is bisectability (don't have any intermediate
>> stages where PCI gets initialized twice), and the ability to have a
>> smooth transition where boards can be converted as people are able to
>> test them and look into their individual needs regarding primary bus.
>>
>> -Scott
> 
> In my patch there is no bisectability problem. If you don't think so could
> you please give more details?

You are registering the PCI platform device with an initcall, but you
haven't updated the unconverted boards to not do the init themselves --
and your proposal to fix that breaks the "smooth transition" request.

-Scott

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

end of thread, other threads:[~2012-08-10 22:59 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-02 11:42 [PATCH V4 0/3] PCI patch set description Jia Hongtao
2012-08-02 11:42 ` [PATCH V4 1/3] powerpc/fsl-pci: Only scan PCI bus if configured as a host Jia Hongtao
2012-08-02 11:42 ` [PATCH V4 2/3] powerpc/swiotlb: Enable at early stage and disable if not necessary Jia Hongtao
2012-08-02 12:54   ` Kumar Gala
2012-08-03  2:21     ` Jia Hongtao-B38951
2012-08-03 12:38       ` Kumar Gala
2012-08-03 14:42         ` Li Yang
2012-08-03 16:15           ` Kumar Gala
2012-08-02 11:42 ` [PATCH V4 3/3] powerpc/fsl-pci: Unify pci/pcie initialization code Jia Hongtao
2012-08-02 12:23   ` Kumar Gala
2012-08-02 15:59     ` Scott Wood
2012-08-03  3:39     ` Jia Hongtao-B38951
2012-08-03 16:03       ` Scott Wood
2012-08-06  2:39         ` Jia Hongtao-B38951
2012-08-06 15:15           ` Scott Wood
2012-08-07  6:23             ` Jia Hongtao-B38951
2012-08-07 15:19               ` Scott Wood
2012-08-08  3:57                 ` Jia Hongtao-B38951
2012-08-08 15:53                   ` Scott Wood
2012-08-09  3:52                     ` Jia Hongtao-B38951
2012-08-10 22:59                       ` Scott Wood
2012-08-02 20:18   ` Scott Wood
2012-08-03  2:20     ` Jia Hongtao-B38951
2012-08-03 16:09       ` Scott Wood
2012-08-06  4:11         ` Tabi Timur-B04825
2012-08-06 14:03           ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).