LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v1 10/11] powerpc/platforms: Use ppc_md_update() instead of define_machine()
From: Christophe Leroy @ 2021-09-03 11:18 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <cover.1630667612.git.christophe.leroy@csgroup.eu>

As a preparation of converting ppc_md into static calls, use our
new ppc_md helpers to setup platform functions instead of
define_machine() macro.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/platforms/40x/ppc40x_simple.c    |  20 +-
 arch/powerpc/platforms/44x/canyonlands.c      |  21 +-
 arch/powerpc/platforms/44x/ebony.c            |  11 +-
 arch/powerpc/platforms/44x/fsp2.c             |  11 +-
 arch/powerpc/platforms/44x/iss4xx.c           |  11 +-
 arch/powerpc/platforms/44x/ppc44x_simple.c    |  11 +-
 arch/powerpc/platforms/44x/ppc476.c           |  22 +--
 arch/powerpc/platforms/44x/sam440ep.c         |  11 +-
 arch/powerpc/platforms/44x/warp.c             |  11 +-
 arch/powerpc/platforms/512x/mpc5121_ads.c     |  15 +-
 arch/powerpc/platforms/512x/mpc512x_generic.c |  13 +-
 arch/powerpc/platforms/512x/pdm360ng.c        |  13 +-
 arch/powerpc/platforms/52xx/efika.c           |  33 ++--
 arch/powerpc/platforms/52xx/lite5200.c        |  20 +-
 arch/powerpc/platforms/52xx/media5200.c       |  20 +-
 arch/powerpc/platforms/52xx/mpc5200_simple.c  |  20 +-
 arch/powerpc/platforms/82xx/ep8248e.c         |  18 +-
 arch/powerpc/platforms/82xx/km82xx.c          |  18 +-
 arch/powerpc/platforms/82xx/mpc8272_ads.c     |  20 +-
 arch/powerpc/platforms/82xx/pq2fads.c         |  20 +-
 arch/powerpc/platforms/83xx/asp834x.c         |  22 ++-
 arch/powerpc/platforms/83xx/km83xx.c          |  22 ++-
 arch/powerpc/platforms/83xx/mpc830x_rdb.c     |  22 ++-
 arch/powerpc/platforms/83xx/mpc831x_rdb.c     |  22 ++-
 arch/powerpc/platforms/83xx/mpc832x_mds.c     |  14 +-
 arch/powerpc/platforms/83xx/mpc832x_rdb.c     |  22 ++-
 arch/powerpc/platforms/83xx/mpc834x_itx.c     |  22 ++-
 arch/powerpc/platforms/83xx/mpc834x_mds.c     |  22 ++-
 arch/powerpc/platforms/83xx/mpc836x_mds.c     |  22 ++-
 arch/powerpc/platforms/83xx/mpc836x_rdk.c     |  22 ++-
 arch/powerpc/platforms/83xx/mpc837x_mds.c     |  22 ++-
 arch/powerpc/platforms/83xx/mpc837x_rdb.c     |  22 ++-
 arch/powerpc/platforms/85xx/bsc913x_qds.c     |  22 ++-
 arch/powerpc/platforms/85xx/bsc913x_rdb.c     |  16 +-
 arch/powerpc/platforms/85xx/c293pcie.c        |  18 +-
 arch/powerpc/platforms/85xx/corenet_generic.c |  58 +++---
 arch/powerpc/platforms/85xx/ge_imp3a.c        |  26 +--
 arch/powerpc/platforms/85xx/ksi8560.c         |  18 +-
 arch/powerpc/platforms/85xx/mpc8536_ds.c      |  24 ++-
 arch/powerpc/platforms/85xx/mpc85xx_ads.c     |  18 +-
 arch/powerpc/platforms/85xx/mpc85xx_cds.c     |  26 +--
 arch/powerpc/platforms/85xx/mpc85xx_ds.c      |  72 ++++---
 arch/powerpc/platforms/85xx/mpc85xx_mds.c     |  71 ++++---
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c     | 181 +++++++-----------
 arch/powerpc/platforms/85xx/mvme2500.c        |  24 ++-
 arch/powerpc/platforms/85xx/p1010rdb.c        |  29 +--
 arch/powerpc/platforms/85xx/p1022_ds.c        |  24 ++-
 arch/powerpc/platforms/85xx/p1022_rdk.c       |  24 ++-
 arch/powerpc/platforms/85xx/p1023_rdb.c       |  23 ++-
 arch/powerpc/platforms/85xx/ppa8548.c         |  18 +-
 arch/powerpc/platforms/85xx/qemu_e500.c       |  24 ++-
 arch/powerpc/platforms/85xx/socrates.c        |  17 +-
 arch/powerpc/platforms/85xx/stx_gp3.c         |  18 +-
 arch/powerpc/platforms/85xx/tqm85xx.c         |  18 +-
 arch/powerpc/platforms/85xx/twr_p102x.c       |  22 ++-
 arch/powerpc/platforms/85xx/xes_mpc85xx.c     |  61 +++---
 arch/powerpc/platforms/86xx/gef_ppc9a.c       |  27 +--
 arch/powerpc/platforms/86xx/gef_sbc310.c      |  27 +--
 arch/powerpc/platforms/86xx/gef_sbc610.c      |  27 +--
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c    |  25 +--
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c    |  27 +--
 arch/powerpc/platforms/86xx/mvme7100.c        |  24 ++-
 arch/powerpc/platforms/8xx/adder875.c         |  18 +-
 arch/powerpc/platforms/8xx/ep88xc.c           |  18 +-
 arch/powerpc/platforms/8xx/mpc86xads_setup.c  |  22 ++-
 arch/powerpc/platforms/8xx/mpc885ads_setup.c  |  18 +-
 arch/powerpc/platforms/8xx/tqm8xx_setup.c     |  22 ++-
 arch/powerpc/platforms/amigaone/setup.c       |  42 ++--
 arch/powerpc/platforms/cell/setup.c           |  23 +--
 arch/powerpc/platforms/chrp/setup.c           |  25 +--
 arch/powerpc/platforms/embedded6xx/gamecube.c |  15 +-
 arch/powerpc/platforms/embedded6xx/holly.c    |  20 +-
 .../platforms/embedded6xx/linkstation.c       |  17 +-
 .../platforms/embedded6xx/mpc7448_hpc2.c      |  20 +-
 arch/powerpc/platforms/embedded6xx/mvme5100.c |  22 ++-
 .../platforms/embedded6xx/storcenter.c        |  18 +-
 arch/powerpc/platforms/embedded6xx/wii.c      |  17 +-
 arch/powerpc/platforms/maple/setup.c          |  27 +--
 arch/powerpc/platforms/microwatt/setup.c      |  12 +-
 arch/powerpc/platforms/pasemi/setup.c         |  19 +-
 arch/powerpc/platforms/powermac/setup.c       |  47 ++---
 arch/powerpc/platforms/powernv/setup.c        |  91 ++++-----
 arch/powerpc/platforms/ps3/setup.c            |  53 ++---
 arch/powerpc/platforms/pseries/setup.c        |  49 ++---
 84 files changed, 1217 insertions(+), 1002 deletions(-)

diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index e70b42729322..9a059891e711 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -60,20 +60,20 @@ static const char * const board[] __initconst = {
 
 static int __init ppc40x_probe(void)
 {
-	if (of_device_compatible_match(of_root, board)) {
-		pci_set_flags(PCI_REASSIGN_ALL_RSRC);
-		return 1;
-	}
+	if (!of_device_compatible_match(of_root, board))
+		return 0;
 
-	return 0;
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(init_IRQ, uic_init_tree);
+	ppc_md_update(get_irq, uic_get_irq);
+	ppc_md_update(restart, ppc4xx_reset_system);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
+	pci_set_flags(PCI_REASSIGN_ALL_RSRC);
+	return 1;
 }
 
 define_machine(ppc40x_simple) {
 	.name = "PowerPC 40x Platform",
 	.probe = ppc40x_probe,
-	.progress = udbg_progress,
-	.init_IRQ = uic_init_tree,
-	.get_irq = uic_get_irq,
-	.restart = ppc4xx_reset_system,
-	.calibrate_decr = generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/44x/canyonlands.c b/arch/powerpc/platforms/44x/canyonlands.c
index 807968a755ef..e8ff83d67f46 100644
--- a/arch/powerpc/platforms/44x/canyonlands.c
+++ b/arch/powerpc/platforms/44x/canyonlands.c
@@ -38,11 +38,17 @@ machine_device_initcall(canyonlands, ppc460ex_device_probe);
 
 static int __init ppc460ex_probe(void)
 {
-	if (of_machine_is_compatible("amcc,canyonlands")) {
-		pci_set_flags(PCI_REASSIGN_ALL_RSRC);
-		return 1;
-	}
-	return 0;
+	if (of_machine_is_compatible("amcc,canyonlands"))
+		return 0;
+
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(init_IRQ, uic_init_tree);
+	ppc_md_update(get_irq, uic_get_irq);
+	ppc_md_update(restart, ppc4xx_reset_system);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
+	pci_set_flags(PCI_REASSIGN_ALL_RSRC);
+	return 1;
 }
 
 /* USB PHY fixup code on Canyonlands kit. */
@@ -110,9 +116,4 @@ machine_device_initcall(canyonlands, ppc460ex_canyonlands_fixup);
 define_machine(canyonlands) {
 	.name = "Canyonlands",
 	.probe = ppc460ex_probe,
-	.progress = udbg_progress,
-	.init_IRQ = uic_init_tree,
-	.get_irq = uic_get_irq,
-	.restart = ppc4xx_reset_system,
-	.calibrate_decr = generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 0d8f202bc45f..000184b9401e 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -48,6 +48,12 @@ static int __init ebony_probe(void)
 	if (!of_machine_is_compatible("ibm,ebony"))
 		return 0;
 
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(init_IRQ, uic_init_tree);
+	ppc_md_update(get_irq, uic_get_irq);
+	ppc_md_update(restart, ppc4xx_reset_system);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
 	pci_set_flags(PCI_REASSIGN_ALL_RSRC);
 
 	return 1;
@@ -56,9 +62,4 @@ static int __init ebony_probe(void)
 define_machine(ebony) {
 	.name			= "Ebony",
 	.probe			= ebony_probe,
-	.progress		= udbg_progress,
-	.init_IRQ		= uic_init_tree,
-	.get_irq		= uic_get_irq,
-	.restart		= ppc4xx_reset_system,
-	.calibrate_decr		= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/44x/fsp2.c b/arch/powerpc/platforms/44x/fsp2.c
index b299e43f5ef9..a2a99e94f9a8 100644
--- a/arch/powerpc/platforms/44x/fsp2.c
+++ b/arch/powerpc/platforms/44x/fsp2.c
@@ -245,6 +245,12 @@ static int __init fsp2_probe(void)
 	if (!of_flat_dt_is_compatible(root, "ibm,fsp2"))
 		return 0;
 
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(init_IRQ, fsp2_irq_init);
+	ppc_md_update(get_irq, uic_get_irq);
+	ppc_md_update(restart, ppc4xx_reset_system);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
 	/* Clear BC_ERR and mask snoopable request plb errors. */
 	val = mfdcr(DCRN_PLB6_CR0);
 	val |= 0x20000000;
@@ -307,9 +313,4 @@ static void __init fsp2_irq_init(void)
 define_machine(fsp2) {
 	.name			= "FSP-2",
 	.probe			= fsp2_probe,
-	.progress		= udbg_progress,
-	.init_IRQ		= fsp2_irq_init,
-	.get_irq		= uic_get_irq,
-	.restart		= ppc4xx_reset_system,
-	.calibrate_decr		= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/44x/iss4xx.c b/arch/powerpc/platforms/44x/iss4xx.c
index 37cc6551f0d4..0262815634ac 100644
--- a/arch/powerpc/platforms/44x/iss4xx.c
+++ b/arch/powerpc/platforms/44x/iss4xx.c
@@ -148,15 +148,16 @@ static int __init iss4xx_probe(void)
 	if (!of_machine_is_compatible("ibm,iss-4xx"))
 		return 0;
 
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(init_IRQ, iss4xx_init_irq);
+	ppc_md_update(setup_arch, iss4xx_setup_arch);
+	ppc_md_update(restart, ppc4xx_reset_system);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
 	return 1;
 }
 
 define_machine(iss4xx) {
 	.name			= "ISS-4xx",
 	.probe			= iss4xx_probe,
-	.progress		= udbg_progress,
-	.init_IRQ		= iss4xx_init_irq,
-	.setup_arch		= iss4xx_setup_arch,
-	.restart		= ppc4xx_reset_system,
-	.calibrate_decr		= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/44x/ppc44x_simple.c b/arch/powerpc/platforms/44x/ppc44x_simple.c
index 3dbd8ddd734a..1aee9812a1a6 100644
--- a/arch/powerpc/platforms/44x/ppc44x_simple.c
+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
@@ -68,6 +68,12 @@ static int __init ppc44x_probe(void)
 
 	for (i = 0; i < ARRAY_SIZE(board); i++) {
 		if (of_machine_is_compatible(board[i])) {
+			ppc_md_update(progress, udbg_progress);
+			ppc_md_update(init_IRQ, uic_init_tree);
+			ppc_md_update(get_irq, uic_get_irq);
+			ppc_md_update(restart, ppc4xx_reset_system);
+			ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
 			pci_set_flags(PCI_REASSIGN_ALL_RSRC);
 			return 1;
 		}
@@ -79,9 +85,4 @@ static int __init ppc44x_probe(void)
 define_machine(ppc44x_simple) {
 	.name = "PowerPC 44x Platform",
 	.probe = ppc44x_probe,
-	.progress = udbg_progress,
-	.init_IRQ = uic_init_tree,
-	.get_irq = uic_get_irq,
-	.restart = ppc4xx_reset_system,
-	.calibrate_decr = generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/44x/ppc476.c b/arch/powerpc/platforms/44x/ppc476.c
index f905bed1dadf..22d1659f664e 100644
--- a/arch/powerpc/platforms/44x/ppc476.c
+++ b/arch/powerpc/platforms/44x/ppc476.c
@@ -271,23 +271,23 @@ static void ppc47x_pci_irq_fixup(struct pci_dev *dev)
  */
 static int __init ppc47x_probe(void)
 {
-	if (of_machine_is_compatible("ibm,akebono"))
-		return 1;
+	if (!of_machine_is_compatible("ibm,akebono") &&
+	    !of_machine_is_compatible("ibm,currituck"))
+		return 0;
 
-	if (of_machine_is_compatible("ibm,currituck")) {
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(init_IRQ, ppc47x_init_irq);
+	ppc_md_update(setup_arch, ppc47x_setup_arch);
+	ppc_md_update(restart, ppc4xx_reset_system);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
+	if (of_machine_is_compatible("ibm,currituck"))
 		ppc_md_update(pci_irq_fixup, ppc47x_pci_irq_fixup);
-		return 1;
-	}
 
-	return 0;
+	return 1;
 }
 
 define_machine(ppc47x) {
 	.name			= "PowerPC 47x",
 	.probe			= ppc47x_probe,
-	.progress		= udbg_progress,
-	.init_IRQ		= ppc47x_init_irq,
-	.setup_arch		= ppc47x_setup_arch,
-	.restart		= ppc4xx_reset_system,
-	.calibrate_decr		= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/44x/sam440ep.c b/arch/powerpc/platforms/44x/sam440ep.c
index 68ba4b009da0..04a387164081 100644
--- a/arch/powerpc/platforms/44x/sam440ep.c
+++ b/arch/powerpc/platforms/44x/sam440ep.c
@@ -45,6 +45,12 @@ static int __init sam440ep_probe(void)
 	if (!of_machine_is_compatible("acube,sam440ep"))
 		return 0;
 
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(init_IRQ, uic_init_tree);
+	ppc_md_update(get_irq, uic_get_irq);
+	ppc_md_update(restart, ppc4xx_reset_system);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
 	pci_set_flags(PCI_REASSIGN_ALL_RSRC);
 
 	return 1;
@@ -53,11 +59,6 @@ static int __init sam440ep_probe(void)
 define_machine(sam440ep) {
 	.name 			= "Sam440ep",
 	.probe 			= sam440ep_probe,
-	.progress 		= udbg_progress,
-	.init_IRQ 		= uic_init_tree,
-	.get_irq 		= uic_get_irq,
-	.restart		= ppc4xx_reset_system,
-	.calibrate_decr 	= generic_calibrate_decr,
 };
 
 static struct i2c_board_info sam440ep_rtc_info = {
diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c
index 665f18e37efb..1d1320919950 100644
--- a/arch/powerpc/platforms/44x/warp.c
+++ b/arch/powerpc/platforms/44x/warp.c
@@ -43,17 +43,18 @@ static int __init warp_probe(void)
 	if (!of_machine_is_compatible("pika,warp"))
 		return 0;
 
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(init_IRQ, uic_init_tree);
+	ppc_md_update(get_irq, uic_get_irq);
+	ppc_md_update(restart, ppc4xx_reset_system);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
 	return 1;
 }
 
 define_machine(warp) {
 	.name		= "Warp",
 	.probe 		= warp_probe,
-	.progress 	= udbg_progress,
-	.init_IRQ 	= uic_init_tree,
-	.get_irq 	= uic_get_irq,
-	.restart	= ppc4xx_reset_system,
-	.calibrate_decr = generic_calibrate_decr,
 };
 
 
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
index 9d030c2e0004..5c3839d7fbf5 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -57,6 +57,14 @@ static int __init mpc5121_ads_probe(void)
 	if (!of_machine_is_compatible("fsl,mpc5121ads"))
 		return 0;
 
+	ppc_md_update(setup_arch, mpc5121_ads_setup_arch);
+	ppc_md_update(discover_phbs, mpc5121_ads_setup_pci);
+	ppc_md_update(init, mpc512x_init);
+	ppc_md_update(init_IRQ, mpc5121_ads_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(restart, mpc512x_restart);
+
 	mpc512x_init_early();
 
 	return 1;
@@ -65,11 +73,4 @@ static int __init mpc5121_ads_probe(void)
 define_machine(mpc5121_ads) {
 	.name			= "MPC5121 ADS",
 	.probe			= mpc5121_ads_probe,
-	.setup_arch		= mpc5121_ads_setup_arch,
-	.discover_phbs		= mpc5121_ads_setup_pci,
-	.init			= mpc512x_init,
-	.init_IRQ		= mpc5121_ads_init_IRQ,
-	.get_irq		= ipic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.restart		= mpc512x_restart,
 };
diff --git a/arch/powerpc/platforms/512x/mpc512x_generic.c b/arch/powerpc/platforms/512x/mpc512x_generic.c
index 303bc308b2e6..1a90ca674ff1 100644
--- a/arch/powerpc/platforms/512x/mpc512x_generic.c
+++ b/arch/powerpc/platforms/512x/mpc512x_generic.c
@@ -36,6 +36,13 @@ static int __init mpc512x_generic_probe(void)
 	if (!of_device_compatible_match(of_root, board))
 		return 0;
 
+	ppc_md_update(init, mpc512x_init);
+	ppc_md_update(setup_arch, mpc512x_setup_arch);
+	ppc_md_update(init_IRQ, mpc512x_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(restart, mpc512x_restart);
+
 	mpc512x_init_early();
 
 	return 1;
@@ -44,10 +51,4 @@ static int __init mpc512x_generic_probe(void)
 define_machine(mpc512x_generic) {
 	.name			= "MPC512x generic",
 	.probe			= mpc512x_generic_probe,
-	.init			= mpc512x_init,
-	.setup_arch		= mpc512x_setup_arch,
-	.init_IRQ		= mpc512x_init_IRQ,
-	.get_irq		= ipic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.restart		= mpc512x_restart,
 };
diff --git a/arch/powerpc/platforms/512x/pdm360ng.c b/arch/powerpc/platforms/512x/pdm360ng.c
index 1e911f42697d..a2fe160b8774 100644
--- a/arch/powerpc/platforms/512x/pdm360ng.c
+++ b/arch/powerpc/platforms/512x/pdm360ng.c
@@ -111,6 +111,13 @@ static int __init pdm360ng_probe(void)
 	if (!of_machine_is_compatible("ifm,pdm360ng"))
 		return 0;
 
+	ppc_md_update(setup_arch, mpc512x_setup_arch);
+	ppc_md_update(init, pdm360ng_init);
+	ppc_md_update(init_IRQ, mpc512x_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(restart, mpc512x_restart);
+
 	mpc512x_init_early();
 
 	return 1;
@@ -119,10 +126,4 @@ static int __init pdm360ng_probe(void)
 define_machine(pdm360ng) {
 	.name			= "PDM360NG",
 	.probe			= pdm360ng_probe,
-	.setup_arch		= mpc512x_setup_arch,
-	.init			= pdm360ng_init,
-	.init_IRQ		= mpc512x_init_IRQ,
-	.get_irq		= ipic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.restart		= mpc512x_restart,
 };
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index c3f43da64f68..8480d7a7bcd6 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -202,6 +202,23 @@ static int __init efika_probe(void)
 	if (strcmp(model, "EFIKA5K2"))
 		return 0;
 
+	ppc_md_update(setup_arch, efika_setup_arch);
+	ppc_md_update(discover_phbs, efika_pcisetup);
+	ppc_md_update(init, mpc52xx_declare_of_platform_devices);
+	ppc_md_update(show_cpuinfo, efika_show_cpuinfo);
+	ppc_md_update(init_IRQ, mpc52xx_init_irq);
+	ppc_md_update(get_irq, mpc52xx_get_irq);
+	ppc_md_update(restart, rtas_restart);
+	ppc_md_update(halt, rtas_halt);
+	ppc_md_update(set_rtc_time, rtas_set_rtc_time);
+	ppc_md_update(get_rtc_time, rtas_get_rtc_time);
+	ppc_md_update(progress, rtas_progress);
+	ppc_md_update(get_boot_time, rtas_get_boot_time);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+#ifdef CONFIG_PCI
+	ppc_md_update(phys_mem_access_prot, pci_phys_mem_access_prot);
+#endif
+
 	DMA_MODE_READ = 0x44;
 	DMA_MODE_WRITE = 0x48;
 
@@ -214,21 +231,5 @@ define_machine(efika)
 {
 	.name			= EFIKA_PLATFORM_NAME,
 	.probe			= efika_probe,
-	.setup_arch		= efika_setup_arch,
-	.discover_phbs		= efika_pcisetup,
-	.init			= mpc52xx_declare_of_platform_devices,
-	.show_cpuinfo		= efika_show_cpuinfo,
-	.init_IRQ		= mpc52xx_init_irq,
-	.get_irq		= mpc52xx_get_irq,
-	.restart		= rtas_restart,
-	.halt			= rtas_halt,
-	.set_rtc_time		= rtas_set_rtc_time,
-	.get_rtc_time		= rtas_get_rtc_time,
-	.progress		= rtas_progress,
-	.get_boot_time		= rtas_get_boot_time,
-	.calibrate_decr		= generic_calibrate_decr,
-#ifdef CONFIG_PCI
-	.phys_mem_access_prot	= pci_phys_mem_access_prot,
-#endif
 };
 
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index c39601b995f6..6972f3cbd7c7 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -177,17 +177,21 @@ static const char * const board[] __initconst = {
  */
 static int __init lite5200_probe(void)
 {
-	return of_device_compatible_match(of_root, board);
+	if (!of_device_compatible_match(of_root, board))
+		return 0;
+
+	ppc_md_update(setup_arch, lite5200_setup_arch);
+	ppc_md_update(discover_phbs, mpc52xx_setup_pci);
+	ppc_md_update(init, mpc52xx_declare_of_platform_devices);
+	ppc_md_update(init_IRQ, mpc52xx_init_irq);
+	ppc_md_update(get_irq, mpc52xx_get_irq);
+	ppc_md_update(restart, mpc52xx_restart);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
+	return 1;
 }
 
 define_machine(lite5200) {
 	.name 		= "lite5200",
 	.probe 		= lite5200_probe,
-	.setup_arch 	= lite5200_setup_arch,
-	.discover_phbs	= mpc52xx_setup_pci,
-	.init		= mpc52xx_declare_of_platform_devices,
-	.init_IRQ 	= mpc52xx_init_irq,
-	.get_irq 	= mpc52xx_get_irq,
-	.restart	= mpc52xx_restart,
-	.calibrate_decr	= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c
index dbf32604f1f6..632f72798727 100644
--- a/arch/powerpc/platforms/52xx/media5200.c
+++ b/arch/powerpc/platforms/52xx/media5200.c
@@ -233,17 +233,21 @@ static const char * const board[] __initconst = {
  */
 static int __init media5200_probe(void)
 {
-	return of_device_compatible_match(of_root, board);
+	if (!of_device_compatible_match(of_root, board))
+		return 0;
+
+	ppc_md_update(setup_arch, media5200_setup_arch);
+	ppc_md_update(discover_phbs, mpc52xx_setup_pci);
+	ppc_md_update(init, mpc52xx_declare_of_platform_devices);
+	ppc_md_update(init_IRQ, media5200_init_irq);
+	ppc_md_update(get_irq, mpc52xx_get_irq);
+	ppc_md_update(restart, mpc52xx_restart);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
+	return 1;
 }
 
 define_machine(media5200_platform) {
 	.name		= "media5200-platform",
 	.probe		= media5200_probe,
-	.setup_arch	= media5200_setup_arch,
-	.discover_phbs	= mpc52xx_setup_pci,
-	.init		= mpc52xx_declare_of_platform_devices,
-	.init_IRQ	= media5200_init_irq,
-	.get_irq	= mpc52xx_get_irq,
-	.restart	= mpc52xx_restart,
-	.calibrate_decr	= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/52xx/mpc5200_simple.c b/arch/powerpc/platforms/52xx/mpc5200_simple.c
index 18eb74a323ec..ea5d631312f1 100644
--- a/arch/powerpc/platforms/52xx/mpc5200_simple.c
+++ b/arch/powerpc/platforms/52xx/mpc5200_simple.c
@@ -63,17 +63,21 @@ static const char *board[] __initdata = {
  */
 static int __init mpc5200_simple_probe(void)
 {
-	return of_device_compatible_match(of_root, board);
+	if (!of_device_compatible_match(of_root, board))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc5200_simple_setup_arch);
+	ppc_md_update(discover_phbs, mpc52xx_setup_pci);
+	ppc_md_update(init, mpc52xx_declare_of_platform_devices);
+	ppc_md_update(init_IRQ, mpc52xx_init_irq);
+	ppc_md_update(get_irq, mpc52xx_get_irq);
+	ppc_md_update(restart, mpc52xx_restart);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
+	return 1;
 }
 
 define_machine(mpc5200_simple_platform) {
 	.name		= "mpc5200-simple-platform",
 	.probe		= mpc5200_simple_probe,
-	.setup_arch	= mpc5200_simple_setup_arch,
-	.discover_phbs	= mpc52xx_setup_pci,
-	.init		= mpc52xx_declare_of_platform_devices,
-	.init_IRQ	= mpc52xx_init_irq,
-	.get_irq	= mpc52xx_get_irq,
-	.restart	= mpc52xx_restart,
-	.calibrate_decr	= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index 3ca47f8a212e..23196a4138e4 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -305,17 +305,21 @@ machine_device_initcall(ep8248e, declare_of_platform_devices);
  */
 static int __init ep8248e_probe(void)
 {
-	return of_machine_is_compatible("fsl,ep8248e");
+	if (!of_machine_is_compatible("fsl,ep8248e"))
+		return 0;
+
+	ppc_md_update(setup_arch, ep8248e_setup_arch);
+	ppc_md_update(init_IRQ, ep8248e_pic_init);
+	ppc_md_update(get_irq, cpm2_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(restart, pq2_restart);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(ep8248e)
 {
 	.name = "Embedded Planet EP8248E",
 	.probe = ep8248e_probe,
-	.setup_arch = ep8248e_setup_arch,
-	.init_IRQ = ep8248e_pic_init,
-	.get_irq = cpm2_get_irq,
-	.calibrate_decr = generic_calibrate_decr,
-	.restart = pq2_restart,
-	.progress = udbg_progress,
 };
diff --git a/arch/powerpc/platforms/82xx/km82xx.c b/arch/powerpc/platforms/82xx/km82xx.c
index 31fd4a5be0ee..74f75032439d 100644
--- a/arch/powerpc/platforms/82xx/km82xx.c
+++ b/arch/powerpc/platforms/82xx/km82xx.c
@@ -192,17 +192,21 @@ machine_device_initcall(km82xx, declare_of_platform_devices);
  */
 static int __init km82xx_probe(void)
 {
-	return of_machine_is_compatible("keymile,km82xx");
+	if (!of_machine_is_compatible("keymile,km82xx"))
+		return 0;
+
+	ppc_md_update(setup_arch, km82xx_setup_arch);
+	ppc_md_update(init_IRQ, km82xx_pic_init);
+	ppc_md_update(get_irq, cpm2_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(restart, pq2_restart);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(km82xx)
 {
 	.name = "Keymile km82xx",
 	.probe = km82xx_probe,
-	.setup_arch = km82xx_setup_arch,
-	.init_IRQ = km82xx_pic_init,
-	.get_irq = cpm2_get_irq,
-	.calibrate_decr = generic_calibrate_decr,
-	.restart = pq2_restart,
-	.progress = udbg_progress,
 };
diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
index deacb2fa84f4..e4608ac9742b 100644
--- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -194,18 +194,22 @@ machine_device_initcall(mpc8272_ads, declare_of_platform_devices);
  */
 static int __init mpc8272_ads_probe(void)
 {
-	return of_machine_is_compatible("fsl,mpc8272ads");
+	if (!of_machine_is_compatible("fsl,mpc8272ads"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc8272_ads_setup_arch);
+	ppc_md_update(discover_phbs, pq2_init_pci);
+	ppc_md_update(init_IRQ, mpc8272_ads_pic_init);
+	ppc_md_update(get_irq, cpm2_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(restart, pq2_restart);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc8272_ads)
 {
 	.name = "Freescale MPC8272 ADS",
 	.probe = mpc8272_ads_probe,
-	.setup_arch = mpc8272_ads_setup_arch,
-	.discover_phbs = pq2_init_pci,
-	.init_IRQ = mpc8272_ads_pic_init,
-	.get_irq = cpm2_get_irq,
-	.calibrate_decr = generic_calibrate_decr,
-	.restart = pq2_restart,
-	.progress = udbg_progress,
 };
diff --git a/arch/powerpc/platforms/82xx/pq2fads.c b/arch/powerpc/platforms/82xx/pq2fads.c
index 794349c53f59..2ce3466a30b0 100644
--- a/arch/powerpc/platforms/82xx/pq2fads.c
+++ b/arch/powerpc/platforms/82xx/pq2fads.c
@@ -157,7 +157,18 @@ static void __init pq2fads_setup_arch(void)
  */
 static int __init pq2fads_probe(void)
 {
-	return of_machine_is_compatible("fsl,pq2fads");
+	if (!of_machine_is_compatible("fsl,pq2fads"))
+		return 0;
+
+	ppc_md_update(setup_arch, pq2fads_setup_arch);
+	ppc_md_update(discover_phbs, pq2_init_pci);
+	ppc_md_update(init_IRQ, pq2fads_pic_init);
+	ppc_md_update(get_irq, cpm2_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(restart, pq2_restart);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 static const struct of_device_id of_bus_ids[] __initconst = {
@@ -179,11 +190,4 @@ define_machine(pq2fads)
 {
 	.name = "Freescale PQ2FADS",
 	.probe = pq2fads_probe,
-	.setup_arch = pq2fads_setup_arch,
-	.discover_phbs = pq2_init_pci,
-	.init_IRQ = pq2fads_pic_init,
-	.get_irq = cpm2_get_irq,
-	.calibrate_decr = generic_calibrate_decr,
-	.restart = pq2_restart,
-	.progress = udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/asp834x.c b/arch/powerpc/platforms/83xx/asp834x.c
index 68061c2a57c1..1aafb506b1b0 100644
--- a/arch/powerpc/platforms/83xx/asp834x.c
+++ b/arch/powerpc/platforms/83xx/asp834x.c
@@ -37,18 +37,22 @@ machine_device_initcall(asp834x, mpc83xx_declare_of_platform_devices);
  */
 static int __init asp834x_probe(void)
 {
-	return of_machine_is_compatible("analogue-and-micro,asp8347e");
+	if (!of_machine_is_compatible("analogue-and-micro,asp8347e"))
+		return 0;
+
+	ppc_md_update(setup_arch, asp834x_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(asp834x) {
 	.name			= "ASP8347E",
 	.probe			= asp834x_probe,
-	.setup_arch		= asp834x_setup_arch,
-	.discover_phbs		= mpc83xx_setup_pci,
-	.init_IRQ		= mpc83xx_ipic_init_IRQ,
-	.get_irq		= ipic_get_irq,
-	.restart		= mpc83xx_restart,
-	.time_init		= mpc83xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/km83xx.c b/arch/powerpc/platforms/83xx/km83xx.c
index 108e1e4d2683..949b7a776853 100644
--- a/arch/powerpc/platforms/83xx/km83xx.c
+++ b/arch/powerpc/platforms/83xx/km83xx.c
@@ -173,18 +173,22 @@ static int __init mpc83xx_km_probe(void)
 			break;
 		i++;
 	}
-	return (board[i] != NULL);
+	if (!board[i])
+		return 0;
+
+	ppc_md_update(setup_arch, mpc83xx_km_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc83xx_km) {
 	.name		= "mpc83xx-km-platform",
 	.probe		= mpc83xx_km_probe,
-	.setup_arch	= mpc83xx_km_setup_arch,
-	.discover_phbs	= mpc83xx_setup_pci,
-	.init_IRQ	= mpc83xx_ipic_init_IRQ,
-	.get_irq	= ipic_get_irq,
-	.restart	= mpc83xx_restart,
-	.time_init	= mpc83xx_time_init,
-	.calibrate_decr	= generic_calibrate_decr,
-	.progress	= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/mpc830x_rdb.c b/arch/powerpc/platforms/83xx/mpc830x_rdb.c
index 956d4389effa..a4d7b0b29dd1 100644
--- a/arch/powerpc/platforms/83xx/mpc830x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc830x_rdb.c
@@ -39,7 +39,19 @@ static const char *board[] __initdata = {
  */
 static int __init mpc830x_rdb_probe(void)
 {
-	return of_device_compatible_match(of_root, board);
+	if (!of_device_compatible_match(of_root, board))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc830x_rdb_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 machine_device_initcall(mpc830x_rdb, mpc83xx_declare_of_platform_devices);
@@ -47,12 +59,4 @@ machine_device_initcall(mpc830x_rdb, mpc83xx_declare_of_platform_devices);
 define_machine(mpc830x_rdb) {
 	.name			= "MPC830x RDB",
 	.probe			= mpc830x_rdb_probe,
-	.setup_arch		= mpc830x_rdb_setup_arch,
-	.discover_phbs		= mpc83xx_setup_pci,
-	.init_IRQ		= mpc83xx_ipic_init_IRQ,
-	.get_irq		= ipic_get_irq,
-	.restart		= mpc83xx_restart,
-	.time_init		= mpc83xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/mpc831x_rdb.c b/arch/powerpc/platforms/83xx/mpc831x_rdb.c
index 3b578f080e3b..52b1facb2c45 100644
--- a/arch/powerpc/platforms/83xx/mpc831x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc831x_rdb.c
@@ -39,7 +39,19 @@ static const char *board[] __initdata = {
  */
 static int __init mpc831x_rdb_probe(void)
 {
-	return of_device_compatible_match(of_root, board);
+	if (!of_device_compatible_match(of_root, board))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc831x_rdb_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 machine_device_initcall(mpc831x_rdb, mpc83xx_declare_of_platform_devices);
@@ -47,12 +59,4 @@ machine_device_initcall(mpc831x_rdb, mpc83xx_declare_of_platform_devices);
 define_machine(mpc831x_rdb) {
 	.name			= "MPC831x RDB",
 	.probe			= mpc831x_rdb_probe,
-	.setup_arch		= mpc831x_rdb_setup_arch,
-	.discover_phbs		= mpc83xx_setup_pci,
-	.init_IRQ		= mpc83xx_ipic_init_IRQ,
-	.get_irq		= ipic_get_irq,
-	.restart		= mpc83xx_restart,
-	.time_init		= mpc83xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 850d566ef900..1ab1874b448b 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -94,7 +94,19 @@ machine_device_initcall(mpc832x_mds, mpc83xx_declare_of_platform_devices);
  */
 static int __init mpc832x_sys_probe(void)
 {
-	return of_machine_is_compatible("MPC832xMDS");
+	if (!of_machine_is_compatible("MPC832xMDS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc831x_rdb_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc832x_mds) {
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index b6133a237a70..42399b438f8e 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -212,18 +212,22 @@ machine_device_initcall(mpc832x_rdb, mpc83xx_declare_of_platform_devices);
  */
 static int __init mpc832x_rdb_probe(void)
 {
-	return of_machine_is_compatible("MPC832xRDB");
+	if (!of_machine_is_compatible("MPC832xRDB"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc832x_rdb_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc832x_rdb) {
 	.name		= "MPC832x RDB",
 	.probe		= mpc832x_rdb_probe,
-	.setup_arch	= mpc832x_rdb_setup_arch,
-	.discover_phbs  = mpc83xx_setup_pci,
-	.init_IRQ	= mpc83xx_ipic_init_IRQ,
-	.get_irq	= ipic_get_irq,
-	.restart	= mpc83xx_restart,
-	.time_init	= mpc83xx_time_init,
-	.calibrate_decr	= generic_calibrate_decr,
-	.progress	= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 9630f3aa4d9c..cbfd35273b24 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -63,18 +63,22 @@ static void __init mpc834x_itx_setup_arch(void)
  */
 static int __init mpc834x_itx_probe(void)
 {
-	return of_machine_is_compatible("MPC834xMITX");
+	if (!of_machine_is_compatible("MPC834xMITX"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc834x_itx_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc834x_itx) {
 	.name			= "MPC834x ITX",
 	.probe			= mpc834x_itx_probe,
-	.setup_arch		= mpc834x_itx_setup_arch,
-	.discover_phbs  	= mpc83xx_setup_pci,
-	.init_IRQ		= mpc83xx_ipic_init_IRQ,
-	.get_irq		= ipic_get_irq,
-	.restart		= mpc83xx_restart,
-	.time_init		= mpc83xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index 6d91bdce0a18..d5829a90cbad 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -84,18 +84,22 @@ machine_device_initcall(mpc834x_mds, mpc83xx_declare_of_platform_devices);
  */
 static int __init mpc834x_mds_probe(void)
 {
-	return of_machine_is_compatible("MPC834xMDS");
+	if (!of_machine_is_compatible("MPC834xMDS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc834x_mds_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc834x_mds) {
 	.name			= "MPC834x MDS",
 	.probe			= mpc834x_mds_probe,
-	.setup_arch		= mpc834x_mds_setup_arch,
-	.discover_phbs  	= mpc83xx_setup_pci,
-	.init_IRQ		= mpc83xx_ipic_init_IRQ,
-	.get_irq		= ipic_get_irq,
-	.restart		= mpc83xx_restart,
-	.time_init		= mpc83xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index da4cf52cb55b..5091f53f558c 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -194,18 +194,22 @@ machine_arch_initcall(mpc836x_mds, mpc836x_usb_cfg);
  */
 static int __init mpc836x_mds_probe(void)
 {
-	return of_machine_is_compatible("MPC836xMDS");
+	if (!of_machine_is_compatible("MPC836xMDS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc836x_mds_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc836x_mds) {
 	.name		= "MPC836x MDS",
 	.probe		= mpc836x_mds_probe,
-	.setup_arch	= mpc836x_mds_setup_arch,
-	.discover_phbs  = mpc83xx_setup_pci,
-	.init_IRQ	= mpc83xx_ipic_init_IRQ,
-	.get_irq	= ipic_get_irq,
-	.restart	= mpc83xx_restart,
-	.time_init	= mpc83xx_time_init,
-	.calibrate_decr	= generic_calibrate_decr,
-	.progress	= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/mpc836x_rdk.c b/arch/powerpc/platforms/83xx/mpc836x_rdk.c
index 3427ad0d9d38..19a86612c579 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_rdk.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_rdk.c
@@ -34,18 +34,22 @@ static void __init mpc836x_rdk_setup_arch(void)
  */
 static int __init mpc836x_rdk_probe(void)
 {
-	return of_machine_is_compatible("fsl,mpc8360rdk");
+	if (!of_machine_is_compatible("fsl,mpc8360rdk"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc836x_rdk_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc836x_rdk) {
 	.name		= "MPC836x RDK",
 	.probe		= mpc836x_rdk_probe,
-	.setup_arch	= mpc836x_rdk_setup_arch,
-	.discover_phbs  = mpc83xx_setup_pci,
-	.init_IRQ	= mpc83xx_ipic_init_IRQ,
-	.get_irq	= ipic_get_irq,
-	.restart	= mpc83xx_restart,
-	.time_init	= mpc83xx_time_init,
-	.calibrate_decr	= generic_calibrate_decr,
-	.progress	= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c
index f28d166ea7db..dab4343b8a19 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c
@@ -86,18 +86,22 @@ machine_device_initcall(mpc837x_mds, mpc83xx_declare_of_platform_devices);
  */
 static int __init mpc837x_mds_probe(void)
 {
-	return of_machine_is_compatible("fsl,mpc837xmds");
+	if (!of_machine_is_compatible("fsl,mpc837xmds"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc837x_mds_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc837x_mds) {
 	.name			= "MPC837x MDS",
 	.probe			= mpc837x_mds_probe,
-	.setup_arch		= mpc837x_mds_setup_arch,
-	.discover_phbs  	= mpc83xx_setup_pci,
-	.init_IRQ		= mpc83xx_ipic_init_IRQ,
-	.get_irq		= ipic_get_irq,
-	.restart		= mpc83xx_restart,
-	.time_init		= mpc83xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
index 7fb7684c256b..a542cb240c3e 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
@@ -66,18 +66,22 @@ static const char * const board[] __initconst = {
  */
 static int __init mpc837x_rdb_probe(void)
 {
-	return of_device_compatible_match(of_root, board);
+	if (!of_device_compatible_match(of_root, board))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc837x_rdb_setup_arch);
+	ppc_md_update(discover_phbs, mpc83xx_setup_pci);
+	ppc_md_update(init_IRQ, mpc83xx_ipic_init_IRQ);
+	ppc_md_update(get_irq, ipic_get_irq);
+	ppc_md_update(restart, mpc83xx_restart);
+	ppc_md_update(time_init, mpc83xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc837x_rdb) {
 	.name			= "MPC837x RDB/WLAN",
 	.probe			= mpc837x_rdb_probe,
-	.setup_arch		= mpc837x_rdb_setup_arch,
-	.discover_phbs  	= mpc83xx_setup_pci,
-	.init_IRQ		= mpc83xx_ipic_init_IRQ,
-	.get_irq		= ipic_get_irq,
-	.restart		= mpc83xx_restart,
-	.time_init		= mpc83xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/bsc913x_qds.c b/arch/powerpc/platforms/85xx/bsc913x_qds.c
index bad1423d012d..bdb148d96d9a 100644
--- a/arch/powerpc/platforms/85xx/bsc913x_qds.c
+++ b/arch/powerpc/platforms/85xx/bsc913x_qds.c
@@ -55,18 +55,22 @@ machine_arch_initcall(bsc9132_qds, mpc85xx_common_publish_devices);
 
 static int __init bsc9132_qds_probe(void)
 {
-	return of_machine_is_compatible("fsl,bsc9132qds");
+	if (!of_machine_is_compatible("fsl,bsc9132qds"))
+		return 0;
+
+	ppc_md_update(setup_arch, bsc913x_qds_setup_arch);
+	ppc_md_update(init_IRQ, bsc913x_qds_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(bsc9132_qds) {
 	.name			= "BSC9132 QDS",
 	.probe			= bsc9132_qds_probe,
-	.setup_arch		= bsc913x_qds_setup_arch,
-	.init_IRQ		= bsc913x_qds_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/bsc913x_rdb.c b/arch/powerpc/platforms/85xx/bsc913x_rdb.c
index 6dc34569a940..5c66df5c4cc5 100644
--- a/arch/powerpc/platforms/85xx/bsc913x_rdb.c
+++ b/arch/powerpc/platforms/85xx/bsc913x_rdb.c
@@ -45,15 +45,19 @@ machine_device_initcall(bsc9131_rdb, mpc85xx_common_publish_devices);
 
 static int __init bsc9131_rdb_probe(void)
 {
-	return of_machine_is_compatible("fsl,bsc9131rdb");
+	if (!of_machine_is_compatible("fsl,bsc9131rdb"))
+		return 0;
+
+	ppc_md_update(setup_arch, bsc913x_rdb_setup_arch);
+	ppc_md_update(init_IRQ, bsc913x_rdb_pic_init);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(bsc9131_rdb) {
 	.name			= "BSC9131 RDB",
 	.probe			= bsc9131_rdb_probe,
-	.setup_arch		= bsc913x_rdb_setup_arch,
-	.init_IRQ		= bsc913x_rdb_pic_init,
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/c293pcie.c b/arch/powerpc/platforms/85xx/c293pcie.c
index 8c59eeb92507..1f4eca71624d 100644
--- a/arch/powerpc/platforms/85xx/c293pcie.c
+++ b/arch/powerpc/platforms/85xx/c293pcie.c
@@ -49,17 +49,19 @@ machine_arch_initcall(c293_pcie, mpc85xx_common_publish_devices);
  */
 static int __init c293_pcie_probe(void)
 {
-	if (of_machine_is_compatible("fsl,C293PCIE"))
-		return 1;
-	return 0;
+	if (!of_machine_is_compatible("fsl,C293PCIE"))
+		return 0;
+
+	ppc_md_update(setup_arch, c293_pcie_setup_arch);
+	ppc_md_update(init_IRQ, c293_pcie_pic_init);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(c293_pcie) {
 	.name			= "C293 PCIE",
 	.probe			= c293_pcie_probe,
-	.setup_arch		= c293_pcie_setup_arch,
-	.init_IRQ		= c293_pcie_pic_init,
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index f2da4d23da23..28cbf45398fe 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -139,6 +139,34 @@ static const char * const boards[] __initconst = {
 	NULL
 };
 
+static void __init corenet_generic_populate(void)
+{
+	ppc_md_update(setup_arch, corenet_gen_setup_arch);
+	ppc_md_update(init_IRQ, corenet_gen_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+/*
+ * Core reset may cause issues if using the proxy mode of MPICppc_md_update(
+ * So); use the mixed mode of MPIC if enabling CPU hotplugppc_md_update(
+ *
+ * Likewise); problems have been seen with kexec when coreint is enabledppc_md_update(
+ */
+#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_KEXEC_CORE)
+	ppc_md_update(get_irq, mpic_get_irq);
+#else
+	ppc_md_update(get_irq, mpic_get_coreint_irq);
+#endif
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PPC64
+	ppc_md_update(power_save, book3e_idle);
+#else
+	ppc_md_update(power_save, e500_idle);
+#endif
+}
+
 /*
  * Called very early, device-tree isn't unflattened
  */
@@ -150,13 +178,17 @@ static int __init corenet_generic_probe(void)
 	extern struct smp_ops_t smp_85xx_ops;
 #endif
 
-	if (of_device_compatible_match(of_root, boards))
+	if (of_device_compatible_match(of_root, boards)) {
+		corenet_generic_populate();
 		return 1;
+	}
 
 	/* Check if we're running under the Freescale hypervisor */
 	for (i = 0; boards[i]; i++) {
 		snprintf(hv_compat, sizeof(hv_compat), "%s-hv", boards[i]);
 		if (of_machine_is_compatible(hv_compat)) {
+			corenet_generic_populate();
+
 			ppc_md_update(init_IRQ, ehv_pic_init);
 
 			ppc_md_update(get_irq, ehv_pic_get_irq);
@@ -182,28 +214,4 @@ static int __init corenet_generic_probe(void)
 define_machine(corenet_generic) {
 	.name			= "CoreNet Generic",
 	.probe			= corenet_generic_probe,
-	.setup_arch		= corenet_gen_setup_arch,
-	.init_IRQ		= corenet_gen_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-/*
- * Core reset may cause issues if using the proxy mode of MPIC.
- * So, use the mixed mode of MPIC if enabling CPU hotplug.
- *
- * Likewise, problems have been seen with kexec when coreint is enabled.
- */
-#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_KEXEC_CORE)
-	.get_irq		= mpic_get_irq,
-#else
-	.get_irq		= mpic_get_coreint_irq,
-#endif
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-#ifdef CONFIG_PPC64
-	.power_save		= book3e_idle,
-#else
-	.power_save		= e500_idle,
-#endif
 };
diff --git a/arch/powerpc/platforms/85xx/ge_imp3a.c b/arch/powerpc/platforms/85xx/ge_imp3a.c
index 24a16c29c4a5..3df4339125a8 100644
--- a/arch/powerpc/platforms/85xx/ge_imp3a.c
+++ b/arch/powerpc/platforms/85xx/ge_imp3a.c
@@ -192,7 +192,21 @@ static void ge_imp3a_show_cpuinfo(struct seq_file *m)
  */
 static int __init ge_imp3a_probe(void)
 {
-	return of_machine_is_compatible("ge,IMP3A");
+	if (!of_machine_is_compatible("ge,IMP3A"))
+		return 0;
+
+	ppc_md_update(setup_arch, ge_imp3a_setup_arch);
+	ppc_md_update(init_IRQ, ge_imp3a_pic_init);
+	ppc_md_update(show_cpuinfo, ge_imp3a_show_cpuinfo);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 machine_arch_initcall(ge_imp3a, mpc85xx_common_publish_devices);
@@ -200,14 +214,4 @@ machine_arch_initcall(ge_imp3a, mpc85xx_common_publish_devices);
 define_machine(ge_imp3a) {
 	.name			= "GE_IMP3A",
 	.probe			= ge_imp3a_probe,
-	.setup_arch		= ge_imp3a_setup_arch,
-	.init_IRQ		= ge_imp3a_pic_init,
-	.show_cpuinfo		= ge_imp3a_show_cpuinfo,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/ksi8560.c b/arch/powerpc/platforms/85xx/ksi8560.c
index 67b6cdad925b..b5eccfc1a81c 100644
--- a/arch/powerpc/platforms/85xx/ksi8560.c
+++ b/arch/powerpc/platforms/85xx/ksi8560.c
@@ -175,16 +175,20 @@ machine_device_initcall(ksi8560, mpc85xx_common_publish_devices);
  */
 static int __init ksi8560_probe(void)
 {
-	return of_machine_is_compatible("emerson,KSI8560");
+	if (!of_machine_is_compatible("emerson,KSI8560"))
+		return 0;
+
+	ppc_md_update(setup_arch, ksi8560_setup_arch);
+	ppc_md_update(init_IRQ, ksi8560_pic_init);
+	ppc_md_update(show_cpuinfo, ksi8560_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(restart, machine_restart);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
+	return 1;
 }
 
 define_machine(ksi8560) {
 	.name			= "KSI8560",
 	.probe			= ksi8560_probe,
-	.setup_arch		= ksi8560_setup_arch,
-	.init_IRQ		= ksi8560_pic_init,
-	.show_cpuinfo		= ksi8560_show_cpuinfo,
-	.get_irq		= mpic_get_irq,
-	.restart		= machine_restart,
-	.calibrate_decr		= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index 78ce62e645e6..66b7bf93a935 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -57,19 +57,23 @@ machine_arch_initcall(mpc8536_ds, mpc85xx_common_publish_devices);
  */
 static int __init mpc8536_ds_probe(void)
 {
-	return of_machine_is_compatible("fsl,mpc8536ds");
+	if (!of_machine_is_compatible("fsl,mpc8536ds"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc8536_ds_setup_arch);
+	ppc_md_update(init_IRQ, mpc8536_ds_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc8536_ds) {
 	.name			= "MPC8536 DS",
 	.probe			= mpc8536_ds_probe,
-	.setup_arch		= mpc8536_ds_setup_arch,
-	.init_IRQ		= mpc8536_ds_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index e1d24b78725b..52e98a5b06eb 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -155,16 +155,20 @@ machine_arch_initcall(mpc85xx_ads, mpc85xx_common_publish_devices);
  */
 static int __init mpc85xx_ads_probe(void)
 {
-	return of_machine_is_compatible("MPC85xxADS");
+	if (!of_machine_is_compatible("MPC85xxADS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc85xx_ads_setup_arch);
+	ppc_md_update(init_IRQ, mpc85xx_ads_pic_init);
+	ppc_md_update(show_cpuinfo, mpc85xx_ads_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc85xx_ads) {
 	.name			= "MPC85xx ADS",
 	.probe			= mpc85xx_ads_probe,
-	.setup_arch		= mpc85xx_ads_setup_arch,
-	.init_IRQ		= mpc85xx_ads_pic_init,
-	.show_cpuinfo		= mpc85xx_ads_show_cpuinfo,
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index bc7bdf0cab6e..14bb9e9c1637 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -373,7 +373,21 @@ static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)
  */
 static int __init mpc85xx_cds_probe(void)
 {
-	return of_machine_is_compatible("MPC85xxCDS");
+	if (!of_machine_is_compatible("MPC85xxCDS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc85xx_cds_setup_arch);
+	ppc_md_update(init_IRQ, mpc85xx_cds_pic_init);
+	ppc_md_update(show_cpuinfo, mpc85xx_cds_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, mpc85xx_cds_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 machine_arch_initcall(mpc85xx_cds, mpc85xx_common_publish_devices);
@@ -381,14 +395,4 @@ machine_arch_initcall(mpc85xx_cds, mpc85xx_common_publish_devices);
 define_machine(mpc85xx_cds) {
 	.name		= "MPC85xx CDS",
 	.probe		= mpc85xx_cds_probe,
-	.setup_arch	= mpc85xx_cds_setup_arch,
-	.init_IRQ	= mpc85xx_cds_pic_init,
-	.show_cpuinfo	= mpc85xx_cds_show_cpuinfo,
-	.get_irq	= mpic_get_irq,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= mpc85xx_cds_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.calibrate_decr = generic_calibrate_decr,
-	.progress	= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 960203bd83cd..6d541f43b58f 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -162,7 +162,20 @@ static void __init mpc85xx_ds_setup_arch(void)
  */
 static int __init mpc8544_ds_probe(void)
 {
-	return !!of_machine_is_compatible("MPC8544DS");
+	if (!of_machine_is_compatible("MPC8544DS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc85xx_ds_setup_arch);
+	ppc_md_update(init_IRQ, mpc85xx_ds_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 machine_arch_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
@@ -174,7 +187,20 @@ machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices);
  */
 static int __init mpc8572_ds_probe(void)
 {
-	return !!of_machine_is_compatible("fsl,MPC8572DS");
+	if (!of_machine_is_compatible("fsl,MPC8572DS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc85xx_ds_setup_arch);
+	ppc_md_update(init_IRQ, mpc85xx_ds_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 /*
@@ -182,47 +208,33 @@ static int __init mpc8572_ds_probe(void)
  */
 static int __init p2020_ds_probe(void)
 {
-	return !!of_machine_is_compatible("fsl,P2020DS");
+	if (!of_machine_is_compatible("fsl,P2020DS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc85xx_ds_setup_arch);
+	ppc_md_update(init_IRQ, mpc85xx_ds_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mpc8544_ds) {
 	.name			= "MPC8544 DS",
 	.probe			= mpc8544_ds_probe,
-	.setup_arch		= mpc85xx_ds_setup_arch,
-	.init_IRQ		= mpc85xx_ds_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(mpc8572_ds) {
 	.name			= "MPC8572 DS",
 	.probe			= mpc8572_ds_probe,
-	.setup_arch		= mpc85xx_ds_setup_arch,
-	.init_IRQ		= mpc85xx_ds_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(p2020_ds) {
 	.name			= "P2020 DS",
 	.probe			= p2020_ds_probe,
-	.setup_arch		= mpc85xx_ds_setup_arch,
-	.init_IRQ		= mpc85xx_ds_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index a74c1e9520f7..6aeaaea305b4 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -341,58 +341,69 @@ static void __init mpc85xx_mds_pic_init(void)
 
 static int __init mpc85xx_mds_probe(void)
 {
-	return of_machine_is_compatible("MPC85xxMDS");
+	if (!of_machine_is_compatible("MPC85xxMDS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc85xx_mds_setup_arch);
+	ppc_md_update(init_IRQ, mpc85xx_mds_pic_init);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+	#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+	#endif
+
+	return 1;
 }
 
 define_machine(mpc8568_mds) {
 	.name		= "MPC8568 MDS",
 	.probe		= mpc85xx_mds_probe,
-	.setup_arch	= mpc85xx_mds_setup_arch,
-	.init_IRQ	= mpc85xx_mds_pic_init,
-	.get_irq	= mpic_get_irq,
-	.calibrate_decr	= generic_calibrate_decr,
-	.progress	= udbg_progress,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
 };
 
 static int __init mpc8569_mds_probe(void)
 {
-	return of_machine_is_compatible("fsl,MPC8569EMDS");
+	if (!of_machine_is_compatible("fsl,MPC8569EMDS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc85xx_mds_setup_arch);
+	ppc_md_update(init_IRQ, mpc85xx_mds_pic_init);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+
+	return 1;
 }
 
 define_machine(mpc8569_mds) {
 	.name		= "MPC8569 MDS",
 	.probe		= mpc8569_mds_probe,
-	.setup_arch	= mpc85xx_mds_setup_arch,
-	.init_IRQ	= mpc85xx_mds_pic_init,
-	.get_irq	= mpic_get_irq,
-	.calibrate_decr	= generic_calibrate_decr,
-	.progress	= udbg_progress,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
 };
 
 static int __init p1021_mds_probe(void)
 {
-	return of_machine_is_compatible("fsl,P1021MDS");
+	if (!of_machine_is_compatible("fsl,P1021MDS"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc85xx_mds_setup_arch);
+	ppc_md_update(init_IRQ, mpc85xx_mds_pic_init);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
 
+	return 1;
 }
 
 define_machine(p1021_mds) {
 	.name		= "P1021 MDS",
 	.probe		= p1021_mds_probe,
-	.setup_arch	= mpc85xx_mds_setup_arch,
-	.init_IRQ	= mpc85xx_mds_pic_init,
-	.get_irq	= mpic_get_irq,
-	.calibrate_decr	= generic_calibrate_decr,
-	.progress	= udbg_progress,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
 };
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index 14cad0505d82..a0976c5f834c 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -119,203 +119,168 @@ machine_arch_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices);
 machine_arch_initcall(p1025_rdb, mpc85xx_common_publish_devices);
 machine_arch_initcall(p1024_rdb, mpc85xx_common_publish_devices);
 
+static void __init mpc85xx_rdb_populate(void)
+{
+	ppc_md_update(setup_arch, mpc85xx_rdb_setup_arch);
+	ppc_md_update(init_IRQ, mpc85xx_rdb_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+}
+
 /*
  * Called very early, device-tree isn't unflattened
  */
 static int __init p2020_rdb_probe(void)
 {
-	if (of_machine_is_compatible("fsl,P2020RDB"))
-		return 1;
-	return 0;
+	if (!of_machine_is_compatible("fsl,P2020RDB"))
+		return 0;
+
+	mpc85xx_rdb_populate();
+
+	return 1;
 }
 
 static int __init p1020_rdb_probe(void)
 {
-	if (of_machine_is_compatible("fsl,P1020RDB"))
-		return 1;
-	return 0;
+	if (!of_machine_is_compatible("fsl,P1020RDB"))
+		return 0;
+
+	mpc85xx_rdb_populate();
+
+	return 1;
 }
 
 static int __init p1020_rdb_pc_probe(void)
 {
-	return of_machine_is_compatible("fsl,P1020RDB-PC");
+	if (!of_machine_is_compatible("fsl,P1020RDB-PC"))
+		return 0;
+
+	mpc85xx_rdb_populate();
+
+	return 1;
 }
 
 static int __init p1020_rdb_pd_probe(void)
 {
-	return of_machine_is_compatible("fsl,P1020RDB-PD");
+	if (!of_machine_is_compatible("fsl,P1020RDB-PD"))
+		return 0;
+
+	mpc85xx_rdb_populate();
+
+	return 1;
 }
 
 static int __init p1021_rdb_pc_probe(void)
 {
-	if (of_machine_is_compatible("fsl,P1021RDB-PC"))
-		return 1;
-	return 0;
+	if (!of_machine_is_compatible("fsl,P1021RDB-PC"))
+		return 0;
+
+	mpc85xx_rdb_populate();
+
+	return 1;
 }
 
 static int __init p2020_rdb_pc_probe(void)
 {
-	if (of_machine_is_compatible("fsl,P2020RDB-PC"))
-		return 1;
-	return 0;
+	if (!of_machine_is_compatible("fsl,P2020RDB-PC"))
+		return 0;
+
+	mpc85xx_rdb_populate();
+
+	return 1;
 }
 
 static int __init p1025_rdb_probe(void)
 {
-	return of_machine_is_compatible("fsl,P1025RDB");
+	if (!of_machine_is_compatible("fsl,P1025RDB"))
+		return 0;
+
+	mpc85xx_rdb_populate();
+
+	return 1;
 }
 
 static int __init p1020_mbg_pc_probe(void)
 {
-	return of_machine_is_compatible("fsl,P1020MBG-PC");
+	if (!of_machine_is_compatible("fsl,P1020MBG-PC"))
+		return 0;
+
+	mpc85xx_rdb_populate();
+
+	return 1;
 }
 
 static int __init p1020_utm_pc_probe(void)
 {
-	return of_machine_is_compatible("fsl,P1020UTM-PC");
+	if (!of_machine_is_compatible("fsl,P1020UTM-PC"))
+		return 0;
+
+	mpc85xx_rdb_populate();
+
+	return 1;
 }
 
 static int __init p1024_rdb_probe(void)
 {
-	return of_machine_is_compatible("fsl,P1024RDB");
+	if (!of_machine_is_compatible("fsl,P1024RDB"))
+		return 0;
+
+	mpc85xx_rdb_populate();
+
+	return 1;
 }
 
 define_machine(p2020_rdb) {
 	.name			= "P2020 RDB",
 	.probe			= p2020_rdb_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(p1020_rdb) {
 	.name			= "P1020 RDB",
 	.probe			= p1020_rdb_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(p1021_rdb_pc) {
 	.name			= "P1021 RDB-PC",
 	.probe			= p1021_rdb_pc_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(p2020_rdb_pc) {
 	.name			= "P2020RDB-PC",
 	.probe			= p2020_rdb_pc_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(p1025_rdb) {
 	.name			= "P1025 RDB",
 	.probe			= p1025_rdb_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(p1020_mbg_pc) {
 	.name			= "P1020 MBG-PC",
 	.probe			= p1020_mbg_pc_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(p1020_utm_pc) {
 	.name			= "P1020 UTM-PC",
 	.probe			= p1020_utm_pc_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(p1020_rdb_pc) {
 	.name			= "P1020RDB-PC",
 	.probe			= p1020_rdb_pc_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(p1020_rdb_pd) {
 	.name			= "P1020RDB-PD",
 	.probe			= p1020_rdb_pd_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(p1024_rdb) {
 	.name			= "P1024 RDB",
 	.probe			= p1024_rdb_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/mvme2500.c b/arch/powerpc/platforms/85xx/mvme2500.c
index 1dc98fb60c1a..115e0c5f5fb6 100644
--- a/arch/powerpc/platforms/85xx/mvme2500.c
+++ b/arch/powerpc/platforms/85xx/mvme2500.c
@@ -47,19 +47,23 @@ machine_arch_initcall(mvme2500, mpc85xx_common_publish_devices);
  */
 static int __init mvme2500_probe(void)
 {
-	return of_machine_is_compatible("artesyn,MVME2500");
+	if (!of_machine_is_compatible("artesyn,MVME2500"))
+		return 0;
+
+	ppc_md_update(setup_arch, mvme2500_setup_arch);
+	ppc_md_update(init_IRQ, mvme2500_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(mvme2500) {
 	.name			= "MVME2500",
 	.probe			= mvme2500_probe,
-	.setup_arch		= mvme2500_setup_arch,
-	.init_IRQ		= mvme2500_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/p1010rdb.c b/arch/powerpc/platforms/85xx/p1010rdb.c
index 7ec9ced12eb3..187b78fb298b 100644
--- a/arch/powerpc/platforms/85xx/p1010rdb.c
+++ b/arch/powerpc/platforms/85xx/p1010rdb.c
@@ -56,23 +56,24 @@ machine_arch_initcall(p1010_rdb, mpc85xx_common_publish_devices);
  */
 static int __init p1010_rdb_probe(void)
 {
-	if (of_machine_is_compatible("fsl,P1010RDB"))
-		return 1;
-	if (of_machine_is_compatible("fsl,P1010RDB-PB"))
-		return 1;
-	return 0;
+	if (!of_machine_is_compatible("fsl,P1010RDB") &&
+	    !of_machine_is_compatible("fsl,P1010RDB-PB"))
+		return 0;
+
+	ppc_md_update(setup_arch, p1010_rdb_setup_arch);
+	ppc_md_update(init_IRQ, p1010_rdb_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(p1010_rdb) {
 	.name			= "P1010 RDB",
 	.probe			= p1010_rdb_probe,
-	.setup_arch		= p1010_rdb_setup_arch,
-	.init_IRQ		= p1010_rdb_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index 0fc89543235d..82a32a36114c 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -552,19 +552,23 @@ machine_arch_initcall(p1022_ds, mpc85xx_common_publish_devices);
  */
 static int __init p1022_ds_probe(void)
 {
-	return of_machine_is_compatible("fsl,p1022ds");
+	if (!of_machine_is_compatible("fsl,p1022ds"))
+		return 0;
+
+	ppc_md_update(setup_arch, p1022_ds_setup_arch);
+	ppc_md_update(init_IRQ, p1022_ds_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(p1022_ds) {
 	.name			= "P1022 DS",
 	.probe			= p1022_ds_probe,
-	.setup_arch		= p1022_ds_setup_arch,
-	.init_IRQ		= p1022_ds_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb	= fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/p1022_rdk.c b/arch/powerpc/platforms/85xx/p1022_rdk.c
index c3a9ca9a216b..e22b26ef2d7d 100644
--- a/arch/powerpc/platforms/85xx/p1022_rdk.c
+++ b/arch/powerpc/platforms/85xx/p1022_rdk.c
@@ -132,19 +132,23 @@ machine_arch_initcall(p1022_rdk, mpc85xx_common_publish_devices);
  */
 static int __init p1022_rdk_probe(void)
 {
-	return of_machine_is_compatible("fsl,p1022rdk");
+	if (!of_machine_is_compatible("fsl,p1022rdk"))
+		return 0;
+
+	ppc_md_update(setup_arch, p1022_rdk_setup_arch);
+	ppc_md_update(init_IRQ, p1022_rdk_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+		
+	return 1;
 }
 
 define_machine(p1022_rdk) {
 	.name			= "P1022 RDK",
 	.probe			= p1022_rdk_probe,
-	.setup_arch		= p1022_rdk_setup_arch,
-	.init_IRQ		= p1022_rdk_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/p1023_rdb.c b/arch/powerpc/platforms/85xx/p1023_rdb.c
index 8189838a5343..fd651ba84d43 100644
--- a/arch/powerpc/platforms/85xx/p1023_rdb.c
+++ b/arch/powerpc/platforms/85xx/p1023_rdb.c
@@ -95,20 +95,23 @@ static void __init mpc85xx_rdb_pic_init(void)
 
 static int __init p1023_rdb_probe(void)
 {
-	return of_machine_is_compatible("fsl,P1023RDB");
+	if (!of_machine_is_compatible("fsl,P1023RDB"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc85xx_rdb_setup_arch);
+	ppc_md_update(init_IRQ, mpc85xx_rdb_pic_init);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
 
+	return 1;
 }
 
 define_machine(p1023_rdb) {
 	.name			= "P1023 RDB",
 	.probe			= p1023_rdb_probe,
-	.setup_arch		= mpc85xx_rdb_setup_arch,
-	.init_IRQ		= mpc85xx_rdb_pic_init,
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
 };
diff --git a/arch/powerpc/platforms/85xx/ppa8548.c b/arch/powerpc/platforms/85xx/ppa8548.c
index 70df147419fa..cdb556523fb2 100644
--- a/arch/powerpc/platforms/85xx/ppa8548.c
+++ b/arch/powerpc/platforms/85xx/ppa8548.c
@@ -76,16 +76,20 @@ machine_device_initcall(ppa8548, declare_of_platform_devices);
  */
 static int __init ppa8548_probe(void)
 {
-	return of_machine_is_compatible("ppa8548");
+	if (!of_machine_is_compatible("ppa8548"))
+		return 0;
+
+	ppc_md_update(setup_arch, ppa8548_setup_arch);
+	ppc_md_update(init_IRQ, ppa8548_pic_init);
+	ppc_md_update(show_cpuinfo, ppa8548_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(ppa8548) {
 	.name		= "ppa8548",
 	.probe		= ppa8548_probe,
-	.setup_arch	= ppa8548_setup_arch,
-	.init_IRQ	= ppa8548_pic_init,
-	.show_cpuinfo	= ppa8548_show_cpuinfo,
-	.get_irq	= mpic_get_irq,
-	.calibrate_decr = generic_calibrate_decr,
-	.progress	= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c b/arch/powerpc/platforms/85xx/qemu_e500.c
index 873a27a384a3..04aed233a31b 100644
--- a/arch/powerpc/platforms/85xx/qemu_e500.c
+++ b/arch/powerpc/platforms/85xx/qemu_e500.c
@@ -50,7 +50,20 @@ static void __init qemu_e500_setup_arch(void)
  */
 static int __init qemu_e500_probe(void)
 {
-	return !!of_machine_is_compatible("fsl,qemu-e500");
+	if (!of_machine_is_compatible("fsl,qemu-e500"))
+		return 0;
+
+	ppc_md_update(setup_arch, qemu_e500_setup_arch);
+	ppc_md_update(init_IRQ, qemu_e500_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_coreint_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 machine_arch_initcall(qemu_e500, mpc85xx_common_publish_devices);
@@ -58,13 +71,4 @@ machine_arch_initcall(qemu_e500, mpc85xx_common_publish_devices);
 define_machine(qemu_e500) {
 	.name			= "QEMU e500",
 	.probe			= qemu_e500_probe,
-	.setup_arch		= qemu_e500_setup_arch,
-	.init_IRQ		= qemu_e500_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_coreint_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/socrates.c b/arch/powerpc/platforms/85xx/socrates.c
index 8bdd925f936c..382488abc067 100644
--- a/arch/powerpc/platforms/85xx/socrates.c
+++ b/arch/powerpc/platforms/85xx/socrates.c
@@ -74,18 +74,19 @@ machine_arch_initcall(socrates, mpc85xx_common_publish_devices);
  */
 static int __init socrates_probe(void)
 {
-	if (of_machine_is_compatible("abb,socrates"))
-		return 1;
+	if (!of_machine_is_compatible("abb,socrates"))
+		return 0;
 
-	return 0;
+	ppc_md_update(setup_arch, socrates_setup_arch);
+	ppc_md_update(init_IRQ, socrates_pic_init);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(socrates) {
 	.name			= "Socrates",
 	.probe			= socrates_probe,
-	.setup_arch		= socrates_setup_arch,
-	.init_IRQ		= socrates_pic_init,
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/stx_gp3.c b/arch/powerpc/platforms/85xx/stx_gp3.c
index 1d943461955e..188272917b94 100644
--- a/arch/powerpc/platforms/85xx/stx_gp3.c
+++ b/arch/powerpc/platforms/85xx/stx_gp3.c
@@ -88,16 +88,20 @@ machine_arch_initcall(stx_gp3, mpc85xx_common_publish_devices);
  */
 static int __init stx_gp3_probe(void)
 {
-	return of_machine_is_compatible("stx,gp3-8560");
+	if (!of_machine_is_compatible("stx,gp3-8560"))
+		return 0;
+
+	ppc_md_update(setup_arch, stx_gp3_setup_arch);
+	ppc_md_update(init_IRQ, stx_gp3_pic_init);
+	ppc_md_update(show_cpuinfo, stx_gp3_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(stx_gp3) {
 	.name			= "STX GP3",
 	.probe			= stx_gp3_probe,
-	.setup_arch		= stx_gp3_setup_arch,
-	.init_IRQ		= stx_gp3_pic_init,
-	.show_cpuinfo		= stx_gp3_show_cpuinfo,
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c
index 70c1ec342092..d5af4ed66923 100644
--- a/arch/powerpc/platforms/85xx/tqm85xx.c
+++ b/arch/powerpc/platforms/85xx/tqm85xx.c
@@ -117,16 +117,20 @@ static const char * const board[] __initconst = {
  */
 static int __init tqm85xx_probe(void)
 {
-	return of_device_compatible_match(of_root, board);
+	if (!of_device_compatible_match(of_root, board))
+		return 0;
+
+	ppc_md_update(setup_arch, tqm85xx_setup_arch);
+	ppc_md_update(init_IRQ, tqm85xx_pic_init);
+	ppc_md_update(show_cpuinfo, tqm85xx_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(tqm85xx) {
 	.name			= "TQM85xx",
 	.probe			= tqm85xx_probe,
-	.setup_arch		= tqm85xx_setup_arch,
-	.init_IRQ		= tqm85xx_pic_init,
-	.show_cpuinfo		= tqm85xx_show_cpuinfo,
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/twr_p102x.c b/arch/powerpc/platforms/85xx/twr_p102x.c
index 03d76552aa19..b24c4bcd5430 100644
--- a/arch/powerpc/platforms/85xx/twr_p102x.c
+++ b/arch/powerpc/platforms/85xx/twr_p102x.c
@@ -104,18 +104,22 @@ machine_arch_initcall(twr_p1025, mpc85xx_common_publish_devices);
 
 static int __init twr_p1025_probe(void)
 {
-	return of_machine_is_compatible("fsl,TWR-P1025");
+	if (!of_machine_is_compatible("fsl,TWR-P1025"))
+		return 0;
+
+	ppc_md_update(setup_arch, twr_p1025_setup_arch);
+	ppc_md_update(init_IRQ, twr_p1025_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 define_machine(twr_p1025) {
 	.name			= "TWR-P1025",
 	.probe			= twr_p1025_probe,
-	.setup_arch		= twr_p1025_setup_arch,
-	.init_IRQ		= twr_p1025_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/85xx/xes_mpc85xx.c b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
index d54e1ae56997..3193ba517575 100644
--- a/arch/powerpc/platforms/85xx/xes_mpc85xx.c
+++ b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
@@ -136,62 +136,63 @@ machine_arch_initcall(xes_mpc8572, mpc85xx_common_publish_devices);
 machine_arch_initcall(xes_mpc8548, mpc85xx_common_publish_devices);
 machine_arch_initcall(xes_mpc8540, mpc85xx_common_publish_devices);
 
+static void __init xes_mpc85xx_populate(void)
+{
+	ppc_md_update(setup_arch, xes_mpc85xx_setup_arch);
+	ppc_md_update(init_IRQ, xes_mpc85xx_pic_init);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+	ppc_md_update(pcibios_fixup_phb, fsl_pcibios_fixup_phb);
+#endif
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+}
+
 /*
  * Called very early, device-tree isn't unflattened
  */
 static int __init xes_mpc8572_probe(void)
 {
-	return of_machine_is_compatible("xes,MPC8572");
+	if (!of_machine_is_compatible("xes,MPC8572"))
+		return 0;
+
+	xes_mpc85xx_populate();
+
+	return 1;
 }
 
 static int __init xes_mpc8548_probe(void)
 {
-	return of_machine_is_compatible("xes,MPC8548");
+	if (!of_machine_is_compatible("xes,MPC8548"))
+		return 0;
+
+	xes_mpc85xx_populate();
+
+	return 1;
 }
 
 static int __init xes_mpc8540_probe(void)
 {
-	return of_machine_is_compatible("xes,MPC8540");
+	if (!of_machine_is_compatible("xes,MPC8540"))
+		return 0;
+
+	xes_mpc85xx_populate();
+
+	return 1;
 }
 
 define_machine(xes_mpc8572) {
 	.name			= "X-ES MPC8572",
 	.probe			= xes_mpc8572_probe,
-	.setup_arch		= xes_mpc85xx_setup_arch,
-	.init_IRQ		= xes_mpc85xx_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(xes_mpc8548) {
 	.name			= "X-ES MPC8548",
 	.probe			= xes_mpc8548_probe,
-	.setup_arch		= xes_mpc85xx_setup_arch,
-	.init_IRQ		= xes_mpc85xx_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
 
 define_machine(xes_mpc8540) {
 	.name			= "X-ES MPC8540",
 	.probe			= xes_mpc8540_probe,
-	.setup_arch		= xes_mpc85xx_setup_arch,
-	.init_IRQ		= xes_mpc85xx_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/86xx/gef_ppc9a.c b/arch/powerpc/platforms/86xx/gef_ppc9a.c
index 44bbbc535e1d..897be72b49c2 100644
--- a/arch/powerpc/platforms/86xx/gef_ppc9a.c
+++ b/arch/powerpc/platforms/86xx/gef_ppc9a.c
@@ -185,10 +185,21 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
  */
 static int __init gef_ppc9a_probe(void)
 {
-	if (of_machine_is_compatible("gef,ppc9a"))
-		return 1;
+	if (!of_machine_is_compatible("gef,ppc9a"))
+		return 0;
+
+	ppc_md_update(setup_arch, gef_ppc9a_setup_arch);
+	ppc_md_update(init_IRQ, gef_ppc9a_init_irq);
+	ppc_md_update(show_cpuinfo, gef_ppc9a_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(time_init, mpc86xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+#endif
 
-	return 0;
+	return 1;
 }
 
 machine_arch_initcall(gef_ppc9a, mpc86xx_common_publish_devices);
@@ -196,14 +207,4 @@ machine_arch_initcall(gef_ppc9a, mpc86xx_common_publish_devices);
 define_machine(gef_ppc9a) {
 	.name			= "GE PPC9A",
 	.probe			= gef_ppc9a_probe,
-	.setup_arch		= gef_ppc9a_setup_arch,
-	.init_IRQ		= gef_ppc9a_init_irq,
-	.show_cpuinfo		= gef_ppc9a_show_cpuinfo,
-	.get_irq		= mpic_get_irq,
-	.time_init		= mpc86xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-#endif
 };
diff --git a/arch/powerpc/platforms/86xx/gef_sbc310.c b/arch/powerpc/platforms/86xx/gef_sbc310.c
index 46d6d3d4957a..b4d3b4346192 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc310.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc310.c
@@ -172,10 +172,21 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
  */
 static int __init gef_sbc310_probe(void)
 {
-	if (of_machine_is_compatible("gef,sbc310"))
-		return 1;
+	if (!of_machine_is_compatible("gef,sbc310"))
+		return 0;
+
+	ppc_md_update(setup_arch, gef_sbc310_setup_arch);
+	ppc_md_update(init_IRQ, gef_sbc310_init_irq);
+	ppc_md_update(show_cpuinfo, gef_sbc310_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(time_init, mpc86xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+#endif
 
-	return 0;
+	return 1;
 }
 
 machine_arch_initcall(gef_sbc310, mpc86xx_common_publish_devices);
@@ -183,14 +194,4 @@ machine_arch_initcall(gef_sbc310, mpc86xx_common_publish_devices);
 define_machine(gef_sbc310) {
 	.name			= "GE SBC310",
 	.probe			= gef_sbc310_probe,
-	.setup_arch		= gef_sbc310_setup_arch,
-	.init_IRQ		= gef_sbc310_init_irq,
-	.show_cpuinfo		= gef_sbc310_show_cpuinfo,
-	.get_irq		= mpic_get_irq,
-	.time_init		= mpc86xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-#endif
 };
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
index acf2c6c3c1eb..6d051877963c 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc610.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -162,10 +162,21 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
  */
 static int __init gef_sbc610_probe(void)
 {
-	if (of_machine_is_compatible("gef,sbc610"))
-		return 1;
+	if (!of_machine_is_compatible("gef,sbc610"))
+		return 0;
+
+	ppc_md_update(setup_arch, gef_sbc610_setup_arch);
+	ppc_md_update(init_IRQ, gef_sbc610_init_irq);
+	ppc_md_update(show_cpuinfo, gef_sbc610_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(time_init, mpc86xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+#endif
 
-	return 0;
+	return 1;
 }
 
 machine_arch_initcall(gef_sbc610, mpc86xx_common_publish_devices);
@@ -173,14 +184,4 @@ machine_arch_initcall(gef_sbc610, mpc86xx_common_publish_devices);
 define_machine(gef_sbc610) {
 	.name			= "GE SBC610",
 	.probe			= gef_sbc610_probe,
-	.setup_arch		= gef_sbc610_setup_arch,
-	.init_IRQ		= gef_sbc610_init_irq,
-	.show_cpuinfo		= gef_sbc610_show_cpuinfo,
-	.get_irq		= mpic_get_irq,
-	.time_init		= mpc86xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-#endif
 };
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index f3aa916ace73..a83cfaefbd9c 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -310,22 +310,23 @@ static void __init mpc86xx_hpcd_setup_arch(void)
  */
 static int __init mpc86xx_hpcd_probe(void)
 {
-	if (of_machine_is_compatible("fsl,MPC8610HPCD"))
-		return 1;	/* Looks good */
+	if (!of_machine_is_compatible("fsl,MPC8610HPCD"))
+		return 0;	/* Looks good */
+
+	ppc_md_update(setup_arch, mpc86xx_hpcd_setup_arch);
+	ppc_md_update(init_IRQ, mpc86xx_init_irq);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(time_init, mpc86xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+#endif
 
-	return 0;
+	return 1;
 }
 
 define_machine(mpc86xx_hpcd) {
 	.name			= "MPC86xx HPCD",
 	.probe			= mpc86xx_hpcd_probe,
-	.setup_arch		= mpc86xx_hpcd_setup_arch,
-	.init_IRQ		= mpc86xx_init_irq,
-	.get_irq		= mpic_get_irq,
-	.time_init		= mpc86xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-#endif
 };
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index caa47e2c9313..c8316ffec569 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -91,10 +91,21 @@ mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
  */
 static int __init mpc86xx_hpcn_probe(void)
 {
-	if (of_machine_is_compatible("fsl,mpc8641hpcn"))
-		return 1;	/* Looks good */
+	if (!of_machine_is_compatible("fsl,mpc8641hpcn"))
+		return 0;	/* Looks good */
+
+	ppc_md_update(setup_arch, mpc86xx_hpcn_setup_arch);
+	ppc_md_update(init_IRQ, mpc86xx_init_irq);
+	ppc_md_update(show_cpuinfo, mpc86xx_hpcn_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(time_init, mpc86xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+#endif
 
-	return 0;
+	return 1;
 }
 
 static const struct of_device_id of_bus_ids[] __initconst = {
@@ -114,14 +125,4 @@ machine_arch_initcall(mpc86xx_hpcn, declare_of_platform_devices);
 define_machine(mpc86xx_hpcn) {
 	.name			= "MPC86xx HPCN",
 	.probe			= mpc86xx_hpcn_probe,
-	.setup_arch		= mpc86xx_hpcn_setup_arch,
-	.init_IRQ		= mpc86xx_init_irq,
-	.show_cpuinfo		= mpc86xx_hpcn_show_cpuinfo,
-	.get_irq		= mpic_get_irq,
-	.time_init		= mpc86xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-#endif
 };
diff --git a/arch/powerpc/platforms/86xx/mvme7100.c b/arch/powerpc/platforms/86xx/mvme7100.c
index c6af6e333e2e..598068326ec2 100644
--- a/arch/powerpc/platforms/86xx/mvme7100.c
+++ b/arch/powerpc/platforms/86xx/mvme7100.c
@@ -77,7 +77,20 @@ static int __init mvme7100_probe(void)
 {
 	unsigned long root = of_get_flat_dt_root();
 
-	return of_flat_dt_is_compatible(root, "artesyn,MVME7100");
+	if (!of_flat_dt_is_compatible(root, "artesyn,MVME7100"))
+		return 0;
+
+	ppc_md_update(setup_arch, mvme7100_setup_arch);
+	ppc_md_update(init_IRQ, mpc86xx_init_irq);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(time_init, mpc86xx_time_init);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PCI
+	ppc_md_update(pcibios_fixup_bus, fsl_pcibios_fixup_bus);
+#endif
+
+	return 1;
 }
 
 static void mvme7100_usb_host_fixup(struct pci_dev *pdev)
@@ -102,13 +115,4 @@ machine_arch_initcall(mvme7100, mpc86xx_common_publish_devices);
 define_machine(mvme7100) {
 	.name			= "MVME7100",
 	.probe			= mvme7100_probe,
-	.setup_arch		= mvme7100_setup_arch,
-	.init_IRQ		= mpc86xx_init_irq,
-	.get_irq		= mpic_get_irq,
-	.time_init		= mpc86xx_time_init,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-#endif
 };
diff --git a/arch/powerpc/platforms/8xx/adder875.c b/arch/powerpc/platforms/8xx/adder875.c
index 651486acb896..bb626adcc1d3 100644
--- a/arch/powerpc/platforms/8xx/adder875.c
+++ b/arch/powerpc/platforms/8xx/adder875.c
@@ -85,7 +85,17 @@ static void __init adder875_setup(void)
 
 static int __init adder875_probe(void)
 {
-	return of_machine_is_compatible("analogue-and-micro,adder875");
+	if (!of_machine_is_compatible("analogue-and-micro,adder875"))
+		return 0;
+
+	ppc_md_update(setup_arch, adder875_setup);
+	ppc_md_update(init_IRQ, mpc8xx_pics_init);
+	ppc_md_update(get_irq, mpc8xx_get_irq);
+	ppc_md_update(restart, mpc8xx_restart);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 static const struct of_device_id of_bus_ids[] __initconst = {
@@ -103,10 +113,4 @@ machine_device_initcall(adder875, declare_of_platform_devices);
 define_machine(adder875) {
 	.name = "Adder MPC875",
 	.probe = adder875_probe,
-	.setup_arch = adder875_setup,
-	.init_IRQ = mpc8xx_pics_init,
-	.get_irq = mpc8xx_get_irq,
-	.restart = mpc8xx_restart,
-	.calibrate_decr = generic_calibrate_decr,
-	.progress = udbg_progress,
 };
diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c
index ebcf34a14789..ff898f966d75 100644
--- a/arch/powerpc/platforms/8xx/ep88xc.c
+++ b/arch/powerpc/platforms/8xx/ep88xc.c
@@ -143,7 +143,17 @@ static void __init ep88xc_setup_arch(void)
 
 static int __init ep88xc_probe(void)
 {
-	return of_machine_is_compatible("fsl,ep88xc");
+	if (!of_machine_is_compatible("fsl,ep88xc"))
+		return 0;
+
+	ppc_md_update(setup_arch, ep88xc_setup_arch);
+	ppc_md_update(init_IRQ, mpc8xx_pics_init);
+	ppc_md_update(get_irq, mpc8xx_get_irq);
+	ppc_md_update(restart, mpc8xx_restart);
+	ppc_md_update(calibrate_decr, mpc8xx_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 static const struct of_device_id of_bus_ids[] __initconst = {
@@ -165,10 +175,4 @@ machine_device_initcall(ep88xc, declare_of_platform_devices);
 define_machine(ep88xc) {
 	.name = "Embedded Planet EP88xC",
 	.probe = ep88xc_probe,
-	.setup_arch = ep88xc_setup_arch,
-	.init_IRQ = mpc8xx_pics_init,
-	.get_irq	= mpc8xx_get_irq,
-	.restart = mpc8xx_restart,
-	.calibrate_decr = mpc8xx_calibrate_decr,
-	.progress = udbg_progress,
 };
diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
index 8d02f5ff4481..26d6358a83c4 100644
--- a/arch/powerpc/platforms/8xx/mpc86xads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
@@ -118,7 +118,19 @@ static void __init mpc86xads_setup_arch(void)
 
 static int __init mpc86xads_probe(void)
 {
-	return of_machine_is_compatible("fsl,mpc866ads");
+	if (!of_machine_is_compatible("fsl,mpc866ads"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc86xads_setup_arch);
+	ppc_md_update(init_IRQ, mpc8xx_pics_init);
+	ppc_md_update(get_irq, mpc8xx_get_irq);
+	ppc_md_update(restart, mpc8xx_restart);
+	ppc_md_update(calibrate_decr, mpc8xx_calibrate_decr);
+	ppc_md_update(set_rtc_time, mpc8xx_set_rtc_time);
+	ppc_md_update(get_rtc_time, mpc8xx_get_rtc_time);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 static const struct of_device_id of_bus_ids[] __initconst = {
@@ -139,12 +151,4 @@ machine_device_initcall(mpc86x_ads, declare_of_platform_devices);
 define_machine(mpc86x_ads) {
 	.name			= "MPC86x ADS",
 	.probe			= mpc86xads_probe,
-	.setup_arch		= mpc86xads_setup_arch,
-	.init_IRQ		= mpc8xx_pics_init,
-	.get_irq		= mpc8xx_get_irq,
-	.restart		= mpc8xx_restart,
-	.calibrate_decr		= mpc8xx_calibrate_decr,
-	.set_rtc_time		= mpc8xx_set_rtc_time,
-	.get_rtc_time		= mpc8xx_get_rtc_time,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
index a0c83c1905c6..2c137412f4db 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -193,7 +193,17 @@ static void __init mpc885ads_setup_arch(void)
 
 static int __init mpc885ads_probe(void)
 {
-	return of_machine_is_compatible("fsl,mpc885ads");
+	if (!of_machine_is_compatible("fsl,mpc885ads"))
+		return 0;
+
+	ppc_md_update(setup_arch, mpc885ads_setup_arch);
+	ppc_md_update(init_IRQ, mpc8xx_pics_init);
+	ppc_md_update(get_irq, mpc8xx_get_irq);
+	ppc_md_update(restart, mpc8xx_restart);
+	ppc_md_update(calibrate_decr, mpc8xx_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 static const struct of_device_id of_bus_ids[] __initconst = {
@@ -215,10 +225,4 @@ machine_device_initcall(mpc885_ads, declare_of_platform_devices);
 define_machine(mpc885_ads) {
 	.name			= "Freescale MPC885 ADS",
 	.probe			= mpc885ads_probe,
-	.setup_arch		= mpc885ads_setup_arch,
-	.init_IRQ		= mpc8xx_pics_init,
-	.get_irq		= mpc8xx_get_irq,
-	.restart		= mpc8xx_restart,
-	.calibrate_decr		= mpc8xx_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
index 4cea8b1afa44..e9ebe66a2ab9 100644
--- a/arch/powerpc/platforms/8xx/tqm8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
@@ -119,7 +119,19 @@ static void __init tqm8xx_setup_arch(void)
 
 static int __init tqm8xx_probe(void)
 {
-	return of_machine_is_compatible("tqc,tqm8xx");
+	if (!of_machine_is_compatible("tqc,tqm8xx"))
+		return 0;
+
+	ppc_md_update(setup_arch, tqm8xx_setup_arch);
+	ppc_md_update(init_IRQ, mpc8xx_pics_init);
+	ppc_md_update(get_irq, mpc8xx_get_irq);
+	ppc_md_update(restart, mpc8xx_restart);
+	ppc_md_update(calibrate_decr, mpc8xx_calibrate_decr);
+	ppc_md_update(set_rtc_time, mpc8xx_set_rtc_time);
+	ppc_md_update(get_rtc_time, mpc8xx_get_rtc_time);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 static const struct of_device_id of_bus_ids[] __initconst = {
@@ -141,12 +153,4 @@ machine_device_initcall(tqm8xx, declare_of_platform_devices);
 define_machine(tqm8xx) {
 	.name			= "TQM8xx",
 	.probe			= tqm8xx_probe,
-	.setup_arch		= tqm8xx_setup_arch,
-	.init_IRQ		= mpc8xx_pics_init,
-	.get_irq		= mpc8xx_get_irq,
-	.restart		= mpc8xx_restart,
-	.calibrate_decr		= mpc8xx_calibrate_decr,
-	.set_rtc_time		= mpc8xx_set_rtc_time,
-	.get_rtc_time		= mpc8xx_get_rtc_time,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/amigaone/setup.c b/arch/powerpc/platforms/amigaone/setup.c
index dc09a0d99e43..324e256a61e2 100644
--- a/arch/powerpc/platforms/amigaone/setup.c
+++ b/arch/powerpc/platforms/amigaone/setup.c
@@ -141,30 +141,30 @@ void __noreturn amigaone_restart(char *cmd)
 
 static int __init amigaone_probe(void)
 {
-	if (of_machine_is_compatible("eyetech,amigaone")) {
-		/*
-		 * Coherent memory access cause complete system lockup! Thus
-		 * disable this CPU feature, even if the CPU needs it.
-		 */
-		cur_cpu_spec->cpu_features &= ~CPU_FTR_NEED_COHERENT;
-
-		DMA_MODE_READ = 0x44;
-		DMA_MODE_WRITE = 0x48;
-
-		return 1;
-	}
-
-	return 0;
+	if (!of_machine_is_compatible("eyetech,amigaone"))
+		return 0;
+
+	ppc_md_update(setup_arch, amigaone_setup_arch);
+	ppc_md_update(discover_phbs, amigaone_discover_phbs);
+	ppc_md_update(show_cpuinfo, amigaone_show_cpuinfo);
+	ppc_md_update(init_IRQ, amigaone_init_IRQ);
+	ppc_md_update(restart, amigaone_restart);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	/*
+	 * Coherent memory access cause complete system lockup! Thus
+	 * disable this CPU feature, even if the CPU needs it.
+	 */
+	cur_cpu_spec->cpu_features &= ~CPU_FTR_NEED_COHERENT;
+
+	DMA_MODE_READ = 0x44;
+	DMA_MODE_WRITE = 0x48;
+
+	return 1;
 }
 
 define_machine(amigaone) {
 	.name			= "AmigaOne",
 	.probe			= amigaone_probe,
-	.setup_arch		= amigaone_setup_arch,
-	.discover_phbs		= amigaone_discover_phbs,
-	.show_cpuinfo		= amigaone_show_cpuinfo,
-	.init_IRQ		= amigaone_init_IRQ,
-	.restart		= amigaone_restart,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index edefa785d2ef..ffd50587e327 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -249,6 +249,18 @@ static int __init cell_probe(void)
 	    !of_machine_is_compatible("IBM,CPBW-1.0"))
 		return 0;
 
+	ppc_md_update(setup_arch, cell_setup_arch);
+	ppc_md_update(show_cpuinfo, cell_show_cpuinfo);
+	ppc_md_update(restart, rtas_restart);
+	ppc_md_update(halt, rtas_halt);
+	ppc_md_update(get_boot_time, rtas_get_boot_time);
+	ppc_md_update(get_rtc_time, rtas_get_rtc_time);
+	ppc_md_update(set_rtc_time, rtas_set_rtc_time);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, cell_progress);
+	ppc_md_update(init_IRQ, cell_init_irq);
+	ppc_md_update(pci_setup_phb, cell_setup_phb);
+
 	pm_power_off = rtas_power_off;
 
 	return 1;
@@ -257,17 +269,6 @@ static int __init cell_probe(void)
 define_machine(cell) {
 	.name			= "Cell",
 	.probe			= cell_probe,
-	.setup_arch		= cell_setup_arch,
-	.show_cpuinfo		= cell_show_cpuinfo,
-	.restart		= rtas_restart,
-	.halt			= rtas_halt,
-	.get_boot_time		= rtas_get_boot_time,
-	.get_rtc_time		= rtas_get_rtc_time,
-	.set_rtc_time		= rtas_set_rtc_time,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= cell_progress,
-	.init_IRQ       	= cell_init_irq,
-	.pci_setup_phb		= cell_setup_phb,
 };
 
 struct pci_controller_ops cell_pci_controller_ops;
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 6fad19201f5b..f33535b03d50 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -556,6 +556,19 @@ static int __init chrp_probe(void)
  	if (strcmp(dtype, "chrp"))
 		return 0;
 
+	ppc_md_update(setup_arch, chrp_setup_arch);
+	ppc_md_update(discover_phbs, chrp_find_bridges);
+	ppc_md_update(init, chrp_init2);
+	ppc_md_update(show_cpuinfo, chrp_show_cpuinfo);
+	ppc_md_update(init_IRQ, chrp_init_IRQ);
+	ppc_md_update(restart, rtas_restart);
+	ppc_md_update(halt, rtas_halt);
+	ppc_md_update(time_init, chrp_time_init);
+	ppc_md_update(set_rtc_time, chrp_set_rtc_time);
+	ppc_md_update(get_rtc_time, chrp_get_rtc_time);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(phys_mem_access_prot, pci_phys_mem_access_prot);
+
 	DMA_MODE_READ = 0x44;
 	DMA_MODE_WRITE = 0x48;
 
@@ -569,16 +582,4 @@ static int __init chrp_probe(void)
 define_machine(chrp) {
 	.name			= "CHRP",
 	.probe			= chrp_probe,
-	.setup_arch		= chrp_setup_arch,
-	.discover_phbs		= chrp_find_bridges,
-	.init			= chrp_init2,
-	.show_cpuinfo		= chrp_show_cpuinfo,
-	.init_IRQ		= chrp_init_IRQ,
-	.restart		= rtas_restart,
-	.halt			= rtas_halt,
-	.time_init		= chrp_time_init,
-	.set_rtc_time		= chrp_set_rtc_time,
-	.get_rtc_time		= chrp_get_rtc_time,
-	.calibrate_decr		= generic_calibrate_decr,
-	.phys_mem_access_prot	= pci_phys_mem_access_prot,
 };
diff --git a/arch/powerpc/platforms/embedded6xx/gamecube.c b/arch/powerpc/platforms/embedded6xx/gamecube.c
index ade928f7ea73..6d493e3f5f68 100644
--- a/arch/powerpc/platforms/embedded6xx/gamecube.c
+++ b/arch/powerpc/platforms/embedded6xx/gamecube.c
@@ -54,6 +54,14 @@ static int __init gamecube_probe(void)
 	if (!of_machine_is_compatible("nintendo,gamecube"))
 		return 0;
 
+	ppc_md_update(restart, gamecube_restart);
+	ppc_md_update(halt, gamecube_halt);
+	ppc_md_update(init_IRQ, flipper_pic_probe);
+	ppc_md_update(get_irq, flipper_pic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(machine_shutdown, gamecube_shutdown);
+
 	pm_power_off = gamecube_power_off;
 
 	ug_udbg_init();
@@ -69,13 +77,6 @@ static void gamecube_shutdown(void)
 define_machine(gamecube) {
 	.name			= "gamecube",
 	.probe			= gamecube_probe,
-	.restart		= gamecube_restart,
-	.halt			= gamecube_halt,
-	.init_IRQ		= flipper_pic_probe,
-	.get_irq		= flipper_pic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-	.machine_shutdown	= gamecube_shutdown,
 };
 
 
diff --git a/arch/powerpc/platforms/embedded6xx/holly.c b/arch/powerpc/platforms/embedded6xx/holly.c
index 5dac4067a3a0..248dbcb12e17 100644
--- a/arch/powerpc/platforms/embedded6xx/holly.c
+++ b/arch/powerpc/platforms/embedded6xx/holly.c
@@ -239,6 +239,17 @@ static int __init holly_probe(void)
 {
 	if (!of_machine_is_compatible("ibm,holly"))
 		return 0;
+
+	ppc_md_update(setup_arch, holly_setup_arch);
+	ppc_md_update(discover_phbs, holly_init_pci);
+	ppc_md_update(init_IRQ, holly_init_IRQ);
+	ppc_md_update(show_cpuinfo, holly_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(restart, holly_restart);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(machine_check_exception, ppc750_machine_check_exception);
+	ppc_md_update(progress, udbg_progress);
+
 	return 1;
 }
 
@@ -259,13 +270,4 @@ static int ppc750_machine_check_exception(struct pt_regs *regs)
 define_machine(holly){
 	.name                   	= "PPC750 GX/CL TSI",
 	.probe                  	= holly_probe,
-	.setup_arch             	= holly_setup_arch,
-	.discover_phbs			= holly_init_pci,
-	.init_IRQ               	= holly_init_IRQ,
-	.show_cpuinfo           	= holly_show_cpuinfo,
-	.get_irq                	= mpic_get_irq,
-	.restart                	= holly_restart,
-	.calibrate_decr         	= generic_calibrate_decr,
-	.machine_check_exception	= ppc750_machine_check_exception,
-	.progress               	= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index eb8342e7f84e..a81f30897087 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -147,6 +147,15 @@ static int __init linkstation_probe(void)
 	if (!of_machine_is_compatible("linkstation"))
 		return 0;
 
+	ppc_md_update(setup_arch , linkstation_setup_arch);
+	ppc_md_update(discover_phbs, linkstation_setup_pci);
+	ppc_md_update(init_IRQ, linkstation_init_IRQ);
+	ppc_md_update(show_cpuinfo, linkstation_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(restart, linkstation_restart);
+	ppc_md_update(halt, linkstation_halt);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
 	pm_power_off = linkstation_power_off;
 
 	return 1;
@@ -155,12 +164,4 @@ static int __init linkstation_probe(void)
 define_machine(linkstation){
 	.name 			= "Buffalo Linkstation",
 	.probe 			= linkstation_probe,
-	.setup_arch 		= linkstation_setup_arch,
-	.discover_phbs		= linkstation_setup_pci,
-	.init_IRQ 		= linkstation_init_IRQ,
-	.show_cpuinfo 		= linkstation_show_cpuinfo,
-	.get_irq 		= mpic_get_irq,
-	.restart 		= linkstation_restart,
-	.halt	 		= linkstation_halt,
-	.calibrate_decr 	= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index f833624a8532..26e86c974315 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -162,6 +162,17 @@ static int __init mpc7448_hpc2_probe(void)
 {
 	if (!of_machine_is_compatible("mpc74xx"))
 		return 0;
+
+	ppc_md_update(setup_arch, mpc7448_hpc2_setup_arch);
+	ppc_md_update(discover_phbs, mpc7448_hpc2_setup_pci);
+	ppc_md_update(init_IRQ, mpc7448_hpc2_init_IRQ);
+	ppc_md_update(show_cpuinfo, mpc7448_hpc2_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(restart, mpc7448_hpc2_restart);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(machine_check_exception, mpc7448_machine_check_exception);
+	ppc_md_update(progress, udbg_progress);
+
 	return 1;
 }
 
@@ -182,13 +193,4 @@ static int mpc7448_machine_check_exception(struct pt_regs *regs)
 define_machine(mpc7448_hpc2){
 	.name 			= "MPC7448 HPC2",
 	.probe 			= mpc7448_hpc2_probe,
-	.setup_arch 		= mpc7448_hpc2_setup_arch,
-	.discover_phbs		= mpc7448_hpc2_setup_pci,
-	.init_IRQ 		= mpc7448_hpc2_init_IRQ,
-	.show_cpuinfo 		= mpc7448_hpc2_show_cpuinfo,
-	.get_irq 		= mpic_get_irq,
-	.restart 		= mpc7448_hpc2_restart,
-	.calibrate_decr 	= generic_calibrate_decr,
-	.machine_check_exception= mpc7448_machine_check_exception,
-	.progress 		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/embedded6xx/mvme5100.c b/arch/powerpc/platforms/embedded6xx/mvme5100.c
index 04a98cb1c53c..22cb6d732989 100644
--- a/arch/powerpc/platforms/embedded6xx/mvme5100.c
+++ b/arch/powerpc/platforms/embedded6xx/mvme5100.c
@@ -190,7 +190,19 @@ static void __noreturn mvme5100_restart(char *cmd)
  */
 static int __init mvme5100_probe(void)
 {
-	return of_machine_is_compatible("MVME5100");
+	if (!of_machine_is_compatible("MVME5100"))
+		return 0;
+
+	ppc_md_update(setup_arch, mvme5100_setup_arch);
+	ppc_md_update(discover_phbs, mvme5100_setup_pci);
+	ppc_md_update(init_IRQ, mvme5100_pic_init);
+	ppc_md_update(show_cpuinfo, mvme5100_show_cpuinfo);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(restart, mvme5100_restart);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+
+	return 1;
 }
 
 static int __init probe_of_platform_devices(void)
@@ -205,12 +217,4 @@ machine_device_initcall(mvme5100, probe_of_platform_devices);
 define_machine(mvme5100) {
 	.name			= "MVME5100",
 	.probe			= mvme5100_probe,
-	.setup_arch		= mvme5100_setup_arch,
-	.discover_phbs		= mvme5100_setup_pci,
-	.init_IRQ		= mvme5100_pic_init,
-	.show_cpuinfo		= mvme5100_show_cpuinfo,
-	.get_irq		= mpic_get_irq,
-	.restart		= mvme5100_restart,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
 };
diff --git a/arch/powerpc/platforms/embedded6xx/storcenter.c b/arch/powerpc/platforms/embedded6xx/storcenter.c
index e188b90f7016..66a99612517e 100644
--- a/arch/powerpc/platforms/embedded6xx/storcenter.c
+++ b/arch/powerpc/platforms/embedded6xx/storcenter.c
@@ -113,16 +113,20 @@ static void __noreturn storcenter_restart(char *cmd)
 
 static int __init storcenter_probe(void)
 {
-	return of_machine_is_compatible("iomega,storcenter");
+	if (!of_machine_is_compatible("iomega,storcenter"))
+		return 0;
+
+	ppc_md_update(setup_arch, storcenter_setup_arch);
+	ppc_md_update(discover_phbs, storcenter_setup_pci);
+	ppc_md_update(init_IRQ, storcenter_init_IRQ);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(restart, storcenter_restart);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
+	return 1;
 }
 
 define_machine(storcenter){
 	.name 			= "IOMEGA StorCenter",
 	.probe 			= storcenter_probe,
-	.setup_arch 		= storcenter_setup_arch,
-	.discover_phbs 		= storcenter_setup_pci,
-	.init_IRQ 		= storcenter_init_IRQ,
-	.get_irq 		= mpic_get_irq,
-	.restart 		= storcenter_restart,
-	.calibrate_decr 	= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index d8b005d7ef79..53d927e7b463 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -158,6 +158,15 @@ static int __init wii_probe(void)
 	if (!of_machine_is_compatible("nintendo,wii"))
 		return 0;
 
+	ppc_md_update(setup_arch, wii_setup_arch);
+	ppc_md_update(restart, wii_restart);
+	ppc_md_update(halt, wii_halt);
+	ppc_md_update(init_IRQ, wii_pic_probe);
+	ppc_md_update(get_irq, flipper_pic_get_irq);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(machine_shutdown, wii_shutdown);
+
 	pm_power_off = wii_power_off;
 
 	ug_udbg_init();
@@ -189,12 +198,4 @@ device_initcall(wii_device_probe);
 define_machine(wii) {
 	.name			= "wii",
 	.probe			= wii_probe,
-	.setup_arch		= wii_setup_arch,
-	.restart		= wii_restart,
-	.halt			= wii_halt,
-	.init_IRQ		= wii_pic_probe,
-	.get_irq		= flipper_pic_get_irq,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-	.machine_shutdown	= wii_shutdown,
 };
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index a60aaa13b265..0c6a400cd7fd 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -280,6 +280,20 @@ static int __init maple_probe(void)
 	    !of_machine_is_compatible("Momentum,Apache"))
 		return 0;
 
+	ppc_md_update(setup_arch, maple_setup_arch);
+	ppc_md_update(discover_phbs, maple_pci_init);
+	ppc_md_update(init_IRQ, maple_init_IRQ);
+	ppc_md_update(pci_irq_fixup, maple_pci_irq_fixup);
+	ppc_md_update(pci_get_legacy_ide_irq, maple_pci_get_legacy_ide_irq);
+	ppc_md_update(restart, maple_restart);
+	ppc_md_update(halt, maple_halt);
+	ppc_md_update(get_boot_time, maple_get_boot_time);
+	ppc_md_update(set_rtc_time, maple_set_rtc_time);
+	ppc_md_update(get_rtc_time, maple_get_rtc_time);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, maple_progress);
+	ppc_md_update(power_save, power4_idle);
+
 	pm_power_off = maple_power_off;
 
 	iommu_init_early_dart(&maple_pci_controller_ops);
@@ -347,17 +361,4 @@ machine_device_initcall(maple, maple_cpc925_edac_setup);
 define_machine(maple) {
 	.name			= "Maple",
 	.probe			= maple_probe,
-	.setup_arch		= maple_setup_arch,
-	.discover_phbs		= maple_pci_init,
-	.init_IRQ		= maple_init_IRQ,
-	.pci_irq_fixup		= maple_pci_irq_fixup,
-	.pci_get_legacy_ide_irq	= maple_pci_get_legacy_ide_irq,
-	.restart		= maple_restart,
-	.halt			= maple_halt,
-	.get_boot_time		= maple_get_boot_time,
-	.set_rtc_time		= maple_set_rtc_time,
-	.get_rtc_time		= maple_get_rtc_time,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= maple_progress,
-	.power_save		= power4_idle,
 };
diff --git a/arch/powerpc/platforms/microwatt/setup.c b/arch/powerpc/platforms/microwatt/setup.c
index 0b02603bdb74..4347bd4fb320 100644
--- a/arch/powerpc/platforms/microwatt/setup.c
+++ b/arch/powerpc/platforms/microwatt/setup.c
@@ -23,7 +23,14 @@ static void __init microwatt_init_IRQ(void)
 
 static int __init microwatt_probe(void)
 {
-	return of_machine_is_compatible("microwatt-soc");
+	if (!of_machine_is_compatible("microwatt-soc"))
+		return 0;
+
+	ppc_md_update(init_IRQ, microwatt_init_IRQ);
+	ppc_md_update(progress, udbg_progress);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+
+	return 1;
 }
 
 static int __init microwatt_populate(void)
@@ -35,7 +42,4 @@ machine_arch_initcall(microwatt, microwatt_populate);
 define_machine(microwatt) {
 	.name			= "microwatt",
 	.probe			= microwatt_probe,
-	.init_IRQ		= microwatt_init_IRQ,
-	.progress		= udbg_progress,
-	.calibrate_decr		= generic_calibrate_decr,
 };
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 376797eb7894..66e909029eb7 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -424,6 +424,16 @@ static int __init pas_probe(void)
 	    !of_machine_is_compatible("pasemi,pwrficient"))
 		return 0;
 
+	ppc_md_update(setup_arch, pas_setup_arch);
+	ppc_md_update(discover_phbs, pas_pci_init);
+	ppc_md_update(init_IRQ, pas_init_IRQ);
+	ppc_md_update(get_irq, mpic_get_irq);
+	ppc_md_update(restart, pas_restart);
+	ppc_md_update(get_boot_time, pas_get_boot_time);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, pas_progress);
+	ppc_md_update(machine_check_exception , pas_machine_check_handler);
+
 #ifdef CONFIG_PPC_PASEMI_NEMO
 	/*
 	 * Check for the Nemo motherboard here, if we are running on one
@@ -443,13 +453,4 @@ static int __init pas_probe(void)
 define_machine(pasemi) {
 	.name			= "PA Semi PWRficient",
 	.probe			= pas_probe,
-	.setup_arch		= pas_setup_arch,
-	.discover_phbs		= pas_pci_init,
-	.init_IRQ		= pas_init_IRQ,
-	.get_irq		= mpic_get_irq,
-	.restart		= pas_restart,
-	.get_boot_time		= pas_get_boot_time,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= pas_progress,
-	.machine_check_exception = pas_machine_check_handler,
 };
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 86aee3f2483f..93d763a0b6d0 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -580,6 +580,30 @@ static int __init pmac_probe(void)
 	    !of_machine_is_compatible("MacRISC"))
 		return 0;
 
+	ppc_md_update(setup_arch, pmac_setup_arch);
+	ppc_md_update(discover_phbs, pmac_pci_init);
+	ppc_md_update(show_cpuinfo, pmac_show_cpuinfo);
+	ppc_md_update(init_IRQ, pmac_pic_init);
+	ppc_md_update(get_irq, NULL);/* changed later */
+	ppc_md_update(pci_irq_fixup, pmac_pci_irq_fixup);
+	ppc_md_update(restart, pmac_restart);
+	ppc_md_update(halt, pmac_halt);
+	ppc_md_update(time_init, pmac_time_init);
+	ppc_md_update(get_boot_time, pmac_get_boot_time);
+	ppc_md_update(set_rtc_time, pmac_set_rtc_time);
+	ppc_md_update(get_rtc_time, pmac_get_rtc_time);
+	ppc_md_update(calibrate_decr, pmac_calibrate_decr);
+	ppc_md_update(feature_call, pmac_do_feature_call);
+	ppc_md_update(progress, udbg_progress);
+#ifdef CONFIG_PPC64
+	ppc_md_update(power_save, power4_idle);
+	ppc_md_update(enable_pmcs, power4_enable_pmcs);
+#endif /* CONFIG_PPC64 */
+#ifdef CONFIG_PPC32
+	ppc_md_update(pcibios_after_init, pmac_pcibios_after_init);
+	ppc_md_update(phys_mem_access_prot, pci_phys_mem_access_prot);
+#endif
+
 #ifdef CONFIG_PPC32
 	/* isa_io_base gets set in pmac_pci_init */
 	DMA_MODE_READ = 1;
@@ -596,27 +620,4 @@ static int __init pmac_probe(void)
 define_machine(powermac) {
 	.name			= "PowerMac",
 	.probe			= pmac_probe,
-	.setup_arch		= pmac_setup_arch,
-	.discover_phbs		= pmac_pci_init,
-	.show_cpuinfo		= pmac_show_cpuinfo,
-	.init_IRQ		= pmac_pic_init,
-	.get_irq		= NULL,	/* changed later */
-	.pci_irq_fixup		= pmac_pci_irq_fixup,
-	.restart		= pmac_restart,
-	.halt			= pmac_halt,
-	.time_init		= pmac_time_init,
-	.get_boot_time		= pmac_get_boot_time,
-	.set_rtc_time		= pmac_set_rtc_time,
-	.get_rtc_time		= pmac_get_rtc_time,
-	.calibrate_decr		= pmac_calibrate_decr,
-	.feature_call		= pmac_do_feature_call,
-	.progress		= udbg_progress,
-#ifdef CONFIG_PPC64
-	.power_save		= power4_idle,
-	.enable_pmcs		= power4_enable_pmcs,
-#endif /* CONFIG_PPC64 */
-#ifdef CONFIG_PPC32
-	.pcibios_after_init	= pmac_pcibios_after_init,
-	.phys_mem_access_prot	= pci_phys_mem_access_prot,
-#endif
 };
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 6f6ceef2a9f5..ba0ac4738488 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -471,11 +471,57 @@ static void __init pnv_setup_machdep_opal(void)
 	ppc_md_update(handle_hmi_exception, opal_handle_hmi_exception);
 }
 
+/*
+ * Returns the cpu frequency for 'cpu' in Hz. This is used by
+ * /proc/cpuinfo
+ */
+static unsigned long pnv_get_proc_freq(unsigned int cpu)
+{
+	unsigned long ret_freq;
+
+	ret_freq = cpufreq_get(cpu) * 1000ul;
+
+	/*
+	 * If the backend cpufreq driver does not exist,
+         * then fallback to old way of reporting the clockrate.
+	 */
+	if (!ret_freq)
+		ret_freq = ppc_proc_freq;
+	return ret_freq;
+}
+
+static long pnv_machine_check_early(struct pt_regs *regs)
+{
+	long handled = 0;
+
+	if (cur_cpu_spec && cur_cpu_spec->machine_check_early)
+		handled = cur_cpu_spec->machine_check_early(regs);
+
+	return handled;
+}
+
 static int __init pnv_probe(void)
 {
 	if (!of_machine_is_compatible("ibm,powernv"))
 		return 0;
 
+	ppc_md_update(setup_arch, pnv_setup_arch);
+	ppc_md_update(init_IRQ, pnv_init_IRQ);
+	ppc_md_update(show_cpuinfo, pnv_show_cpuinfo);
+	ppc_md_update(get_proc_freq, pnv_get_proc_freq);
+	ppc_md_update(discover_phbs, pnv_pci_init);
+	ppc_md_update(progress, pnv_progress);
+	ppc_md_update(machine_shutdown, pnv_shutdown);
+	ppc_md_update(power_save, NULL);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(machine_check_early, pnv_machine_check_early);
+#ifdef CONFIG_KEXEC_CORE
+	ppc_md_update(kexec_cpu_down, pnv_kexec_cpu_down);
+#endif
+#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
+	ppc_md_update(memory_block_size, pnv_memory_block_size);
+#endif
+
 	if (firmware_has_feature(FW_FEATURE_OPAL))
 		pnv_setup_machdep_opal();
 
@@ -508,52 +554,7 @@ void __init pnv_tm_init(void)
 }
 #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
 
-/*
- * Returns the cpu frequency for 'cpu' in Hz. This is used by
- * /proc/cpuinfo
- */
-static unsigned long pnv_get_proc_freq(unsigned int cpu)
-{
-	unsigned long ret_freq;
-
-	ret_freq = cpufreq_get(cpu) * 1000ul;
-
-	/*
-	 * If the backend cpufreq driver does not exist,
-         * then fallback to old way of reporting the clockrate.
-	 */
-	if (!ret_freq)
-		ret_freq = ppc_proc_freq;
-	return ret_freq;
-}
-
-static long pnv_machine_check_early(struct pt_regs *regs)
-{
-	long handled = 0;
-
-	if (cur_cpu_spec && cur_cpu_spec->machine_check_early)
-		handled = cur_cpu_spec->machine_check_early(regs);
-
-	return handled;
-}
-
 define_machine(powernv) {
 	.name			= "PowerNV",
 	.probe			= pnv_probe,
-	.setup_arch		= pnv_setup_arch,
-	.init_IRQ		= pnv_init_IRQ,
-	.show_cpuinfo		= pnv_show_cpuinfo,
-	.get_proc_freq          = pnv_get_proc_freq,
-	.discover_phbs		= pnv_pci_init,
-	.progress		= pnv_progress,
-	.machine_shutdown	= pnv_shutdown,
-	.power_save             = NULL,
-	.calibrate_decr		= generic_calibrate_decr,
-	.machine_check_early	= pnv_machine_check_early,
-#ifdef CONFIG_KEXEC_CORE
-	.kexec_cpu_down		= pnv_kexec_cpu_down,
-#endif
-#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
-	.memory_block_size	= pnv_memory_block_size,
-#endif
 };
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 04c037ec8b79..57d89c741bb4 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -260,6 +260,20 @@ void __init ps3_early_mm_init(void)
 	ps3_hpte_init(htab_size);
 }
 
+#if defined(CONFIG_KEXEC_CORE)
+static void ps3_kexec_cpu_down(int crash_shutdown, int secondary)
+{
+	int cpu = smp_processor_id();
+
+	DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu);
+
+	ps3_smp_cleanup_cpu(cpu);
+	ps3_shutdown_IRQ(cpu);
+
+	DBG(" <- %s:%d\n", __func__, __LINE__);
+}
+#endif
+
 static int __init ps3_probe(void)
 {
 	DBG(" -> %s:%d\n", __func__, __LINE__);
@@ -267,6 +281,19 @@ static int __init ps3_probe(void)
 	if (!of_machine_is_compatible("sony,ps3"))
 		return 0;
 
+	ppc_md_update(setup_arch, ps3_setup_arch);
+	ppc_md_update(init_IRQ, ps3_init_IRQ);
+	ppc_md_update(panic, ps3_panic);
+	ppc_md_update(get_boot_time, ps3_get_boot_time);
+	ppc_md_update(set_dabr, ps3_set_dabr);
+	ppc_md_update(calibrate_decr, ps3_calibrate_decr);
+	ppc_md_update(progress, ps3_progress);
+	ppc_md_update(restart, ps3_restart);
+	ppc_md_update(halt, ps3_halt);
+#if defined(CONFIG_KEXEC_CORE)
+	ppc_md_update(kexec_cpu_down, ps3_kexec_cpu_down);
+#endif
+
 	ps3_os_area_save_params();
 
 	pm_power_off = ps3_power_off;
@@ -275,33 +302,7 @@ static int __init ps3_probe(void)
 	return 1;
 }
 
-#if defined(CONFIG_KEXEC_CORE)
-static void ps3_kexec_cpu_down(int crash_shutdown, int secondary)
-{
-	int cpu = smp_processor_id();
-
-	DBG(" -> %s:%d: (%d)\n", __func__, __LINE__, cpu);
-
-	ps3_smp_cleanup_cpu(cpu);
-	ps3_shutdown_IRQ(cpu);
-
-	DBG(" <- %s:%d\n", __func__, __LINE__);
-}
-#endif
-
 define_machine(ps3) {
 	.name				= "PS3",
 	.probe				= ps3_probe,
-	.setup_arch			= ps3_setup_arch,
-	.init_IRQ			= ps3_init_IRQ,
-	.panic				= ps3_panic,
-	.get_boot_time			= ps3_get_boot_time,
-	.set_dabr			= ps3_set_dabr,
-	.calibrate_decr			= ps3_calibrate_decr,
-	.progress			= ps3_progress,
-	.restart			= ps3_restart,
-	.halt				= ps3_halt,
-#if defined(CONFIG_KEXEC_CORE)
-	.kexec_cpu_down			= ps3_kexec_cpu_down,
-#endif
 };
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e14abc326a49..7a96dc1388ca 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -1041,6 +1041,31 @@ static int __init pSeries_probe(void)
 	    of_machine_is_compatible("IBM,CBEA"))
 		return 0;
 
+	ppc_md_update(setup_arch, pSeries_setup_arch);
+	ppc_md_update(init_IRQ, pseries_init_irq);
+	ppc_md_update(show_cpuinfo, pSeries_show_cpuinfo);
+	ppc_md_update(log_error, pSeries_log_error);
+	ppc_md_update(discover_phbs, pSeries_discover_phbs);
+	ppc_md_update(pcibios_fixup, pSeries_final_fixup);
+	ppc_md_update(restart, rtas_restart);
+	ppc_md_update(halt, rtas_halt);
+	ppc_md_update(panic, pseries_panic);
+	ppc_md_update(get_boot_time, rtas_get_boot_time);
+	ppc_md_update(get_rtc_time, rtas_get_rtc_time);
+	ppc_md_update(set_rtc_time, rtas_set_rtc_time);
+	ppc_md_update(calibrate_decr, generic_calibrate_decr);
+	ppc_md_update(progress, rtas_progress);
+	ppc_md_update(system_reset_exception , pSeries_system_reset_exception);
+	ppc_md_update(machine_check_early, pseries_machine_check_realmode);
+	ppc_md_update(machine_check_exception , pSeries_machine_check_exception);
+#ifdef CONFIG_KEXEC_CORE
+	ppc_md_update(machine_kexec, pSeries_machine_kexec);
+	ppc_md_update(kexec_cpu_down, pseries_kexec_cpu_down);
+#endif
+#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
+	ppc_md_update(memory_block_size, pseries_memory_block_size);
+#endif
+
 	pm_power_off = pseries_power_off;
 
 	pr_debug("Machine is%s LPAR !\n",
@@ -1065,28 +1090,4 @@ struct pci_controller_ops pseries_pci_controller_ops = {
 define_machine(pseries) {
 	.name			= "pSeries",
 	.probe			= pSeries_probe,
-	.setup_arch		= pSeries_setup_arch,
-	.init_IRQ		= pseries_init_irq,
-	.show_cpuinfo		= pSeries_show_cpuinfo,
-	.log_error		= pSeries_log_error,
-	.discover_phbs		= pSeries_discover_phbs,
-	.pcibios_fixup		= pSeries_final_fixup,
-	.restart		= rtas_restart,
-	.halt			= rtas_halt,
-	.panic			= pseries_panic,
-	.get_boot_time		= rtas_get_boot_time,
-	.get_rtc_time		= rtas_get_rtc_time,
-	.set_rtc_time		= rtas_set_rtc_time,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= rtas_progress,
-	.system_reset_exception = pSeries_system_reset_exception,
-	.machine_check_early	= pseries_machine_check_realmode,
-	.machine_check_exception = pSeries_machine_check_exception,
-#ifdef CONFIG_KEXEC_CORE
-	.machine_kexec          = pSeries_machine_kexec,
-	.kexec_cpu_down         = pseries_kexec_cpu_down,
-#endif
-#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
-	.memory_block_size	= pseries_memory_block_size,
-#endif
 };
-- 
2.25.0


^ permalink raw reply related

* Re: [RESEND PATCH v4 2/4] drivers/nvdimm: Add perf interface to expose nvdimm performance stats
From: kernel test robot @ 2021-09-03 12:32 UTC (permalink / raw)
  To: Kajol Jain, mpe, linuxppc-dev, nvdimm, linux-kernel,
	dan.j.williams, ira.weiny, vishal.l.verma
  Cc: santosh, llvm, kbuild-all, maddy
In-Reply-To: <20210903050914.273525-3-kjain@linux.ibm.com>

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

Hi Kajol,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linux-nvdimm/libnvdimm-for-next]
[also build test WARNING on powerpc/next linus/master v5.14 next-20210903]
[cannot apply to mpe/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Kajol-Jain/Add-perf-interface-to-expose-nvdimm/20210903-131212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
config: x86_64-randconfig-a005-20210903 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1104e3258b5064e7110cc297e2cec60ac9acfc0a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/f841601cc058e6033761bd2157b886a30190fc3a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kajol-Jain/Add-perf-interface-to-expose-nvdimm/20210903-131212
        git checkout f841601cc058e6033761bd2157b886a30190fc3a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/nvdimm/nd_perf.c:159:6: warning: no previous prototype for function 'nvdimm_pmu_free_hotplug_memory' [-Wmissing-prototypes]
   void nvdimm_pmu_free_hotplug_memory(struct nvdimm_pmu *nd_pmu)
        ^
   drivers/nvdimm/nd_perf.c:159:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void nvdimm_pmu_free_hotplug_memory(struct nvdimm_pmu *nd_pmu)
   ^
   static 
   1 warning generated.


vim +/nvdimm_pmu_free_hotplug_memory +159 drivers/nvdimm/nd_perf.c

   158	
 > 159	void nvdimm_pmu_free_hotplug_memory(struct nvdimm_pmu *nd_pmu)
   160	{
   161		cpuhp_state_remove_instance_nocalls(nd_pmu->cpuhp_state, &nd_pmu->node);
   162		cpuhp_remove_multi_state(nd_pmu->cpuhp_state);
   163	
   164		if (nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR])
   165			kfree(nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR]->attrs);
   166		kfree(nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR]);
   167	}
   168	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35422 bytes --]

^ permalink raw reply

* [PATCH v3 2/2] selftests/powerpc: Add scv versions of the basic TM syscall tests
From: Nicholas Piggin @ 2021-09-03 12:57 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Eirik Fuller, Nicholas Piggin
In-Reply-To: <20210903125707.1601269-1-npiggin@gmail.com>

The basic TM vs syscall test code hard codes an sc instruction for the
system call, which fails to cover scv even when the userspace libc has
support for it.

Duplicate the tests with hard coded scv variants so both are tested
when possible.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 .../selftests/powerpc/tm/tm-syscall-asm.S     | 32 ++++++++++++++++-
 .../testing/selftests/powerpc/tm/tm-syscall.c | 36 +++++++++++++++----
 2 files changed, 60 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/powerpc/tm/tm-syscall-asm.S b/tools/testing/selftests/powerpc/tm/tm-syscall-asm.S
index bd1ca25febe4..e59e93aad2cf 100644
--- a/tools/testing/selftests/powerpc/tm/tm-syscall-asm.S
+++ b/tools/testing/selftests/powerpc/tm/tm-syscall-asm.S
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-#include <ppc-asm.h>
+#include <basic_asm.h>
 #include <asm/unistd.h>
 
 	.text
@@ -26,3 +26,33 @@ FUNC_START(getppid_tm_suspended)
 1:
 	li	r3, -1
 	blr
+
+FUNC_START(getppid_scv_tm_active)
+	PUSH_BASIC_STACK(0)
+	tbegin.
+	beq 1f
+	li	r0, __NR_getppid
+	scv	0
+	tend.
+	POP_BASIC_STACK(0)
+	blr
+1:
+	li	r3, -1
+	POP_BASIC_STACK(0)
+	blr
+
+FUNC_START(getppid_scv_tm_suspended)
+	PUSH_BASIC_STACK(0)
+	tbegin.
+	beq 1f
+	li	r0, __NR_getppid
+	tsuspend.
+	scv	0
+	tresume.
+	tend.
+	POP_BASIC_STACK(0)
+	blr
+1:
+	li	r3, -1
+	POP_BASIC_STACK(0)
+	blr
diff --git a/tools/testing/selftests/powerpc/tm/tm-syscall.c b/tools/testing/selftests/powerpc/tm/tm-syscall.c
index becb8207b432..9a822208680e 100644
--- a/tools/testing/selftests/powerpc/tm/tm-syscall.c
+++ b/tools/testing/selftests/powerpc/tm/tm-syscall.c
@@ -19,24 +19,37 @@
 #include "utils.h"
 #include "tm.h"
 
+#ifndef PPC_FEATURE2_SCV
+#define PPC_FEATURE2_SCV               0x00100000 /* scv syscall */
+#endif
+
 extern int getppid_tm_active(void);
 extern int getppid_tm_suspended(void);
+extern int getppid_scv_tm_active(void);
+extern int getppid_scv_tm_suspended(void);
 
 unsigned retries = 0;
 
 #define TEST_DURATION 10 /* seconds */
 #define TM_RETRIES 100
 
-pid_t getppid_tm(bool suspend)
+pid_t getppid_tm(bool scv, bool suspend)
 {
 	int i;
 	pid_t pid;
 
 	for (i = 0; i < TM_RETRIES; i++) {
-		if (suspend)
-			pid = getppid_tm_suspended();
-		else
-			pid = getppid_tm_active();
+		if (suspend) {
+			if (scv)
+				pid = getppid_scv_tm_suspended();
+			else
+				pid = getppid_tm_suspended();
+		} else {
+			if (scv)
+				pid = getppid_scv_tm_active();
+			else
+				pid = getppid_tm_active();
+		}
 
 		if (pid >= 0)
 			return pid;
@@ -82,15 +95,24 @@ int tm_syscall(void)
 		 * Test a syscall within a suspended transaction and verify
 		 * that it succeeds.
 		 */
-		FAIL_IF(getppid_tm(true) == -1); /* Should succeed. */
+		FAIL_IF(getppid_tm(false, true) == -1); /* Should succeed. */
 
 		/*
 		 * Test a syscall within an active transaction and verify that
 		 * it fails with the correct failure code.
 		 */
-		FAIL_IF(getppid_tm(false) != -1);  /* Should fail... */
+		FAIL_IF(getppid_tm(false, false) != -1);  /* Should fail... */
 		FAIL_IF(!failure_is_persistent()); /* ...persistently... */
 		FAIL_IF(!failure_is_syscall());    /* ...with code syscall. */
+
+		/* Now do it all again with scv if it is available. */
+		if (have_hwcap2(PPC_FEATURE2_SCV)) {
+			FAIL_IF(getppid_tm(true, true) == -1); /* Should succeed. */
+			FAIL_IF(getppid_tm(true, false) != -1);  /* Should fail... */
+			FAIL_IF(!failure_is_persistent()); /* ...persistently... */
+			FAIL_IF(!failure_is_syscall());    /* ...with code syscall. */
+		}
+
 		gettimeofday(&now, 0);
 	}
 
-- 
2.23.0


^ permalink raw reply related

* [PATCH v3 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state
From: Nicholas Piggin @ 2021-09-03 12:57 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Eirik Fuller, Nicholas Piggin

If a system call is made with a transaction active, the kernel
immediately aborts it and returns. scv system calls disable irqs even
earlier in their interrupt handler, and tabort_syscall does not fix this
up.

This can result in irq soft-mask state being messed up on the next
kernel entry, and crashing at BUG_ON(arch_irq_disabled_regs(regs)) in
the kernel exit handlers, or possibly worse.

This can't easily be fixed in asm because at this point an async irq may
have hit, which is soft-masked and marked pending. The pending interrupt
has to be replayed before returning to userspace. The fix is to move the
tabort_syscall code to C in the main syscall handler, and just skip the
system call but otherwise return as usual, which will take care of the
pending irqs. This also does a bunch of other things including possible
signal delivery to the process, but the doomed transaction should still
be aborted when it is eventually returned to.

The sc system call path is changed to use the new C function as well to
reduce code and path differences. This slows down how quickly system
calls are aborted when called while a transaction is active, which could
potentially impact TM performance. But making any system call is already
bad for performance, and TM is on the way out, so go with simpler over
faster.

Reported-by: Eirik Fuller <efuller@redhat.com>
Fixes: 7fa95f9adaee7 ("powerpc/64s: system call support for scv/rfscv instructions")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---

v2 of this fix had a bug where an irq could be soft masked and pending
before we hard disable interrupts in tabort_syscall for the case of
scv (because it enters the kernel with EE enabled). So this actually
requires a pretty large change to fix because we can't replay interrupts
just from this early asm context.

Thanks,
Nick

 arch/powerpc/kernel/interrupt.c    | 29 +++++++++++++++++++++
 arch/powerpc/kernel/interrupt_64.S | 41 ------------------------------
 2 files changed, 29 insertions(+), 41 deletions(-)

diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
index 21bbd615ca41..c77c80214ad3 100644
--- a/arch/powerpc/kernel/interrupt.c
+++ b/arch/powerpc/kernel/interrupt.c
@@ -19,6 +19,7 @@
 #include <asm/switch_to.h>
 #include <asm/syscall.h>
 #include <asm/time.h>
+#include <asm/tm.h>
 #include <asm/unistd.h>
 
 #if defined(CONFIG_PPC_ADV_DEBUG_REGS) && defined(CONFIG_PPC32)
@@ -138,6 +139,34 @@ notrace long system_call_exception(long r3, long r4, long r5,
 	 */
 	irq_soft_mask_regs_set_state(regs, IRQS_ENABLED);
 
+	/*
+	 * If the system call was made with a transaction active, doom it and
+	 * return without performing the system call. Unless it was an
+	 * unsupported scv vector, in which case it's treated like an illegal
+	 * instruction.
+	 */
+	if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) &&
+			unlikely(MSR_TM_TRANSACTIONAL(regs->msr)) &&
+			!trap_is_unsupported_scv(regs)) {
+		/* Enable TM in the kernel, and disable EE (for scv) */
+		hard_irq_disable();
+		mtmsr(mfmsr() | MSR_TM);
+
+		/* tabort, this dooms the transaction, nothing else */
+		asm volatile(".long 0x7c00071d | ((%0) << 16)"
+				:: "r"(TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT));
+
+		/*
+		 * Userspace will never see the return value. Execution will
+		 * resume after the tbegin. of the aborted transaction with the
+		 * checkpointed register state. A context switch could occur
+		 * or signal delivered to the process before resuming the
+		 * doomed transaction context, but that should all be handled
+		 * as expected.
+		 */
+		return -ENOSYS;
+	}
+
 	local_irq_enable();
 
 	if (unlikely(current_thread_info()->flags & _TIF_SYSCALL_DOTRACE)) {
diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S
index d4212d2ff0b5..ec950b08a8dc 100644
--- a/arch/powerpc/kernel/interrupt_64.S
+++ b/arch/powerpc/kernel/interrupt_64.S
@@ -12,7 +12,6 @@
 #include <asm/mmu.h>
 #include <asm/ppc_asm.h>
 #include <asm/ptrace.h>
-#include <asm/tm.h>
 
 	.section	".toc","aw"
 SYS_CALL_TABLE:
@@ -55,12 +54,6 @@ COMPAT_SYS_CALL_TABLE:
 	.globl system_call_vectored_\name
 system_call_vectored_\name:
 _ASM_NOKPROBE_SYMBOL(system_call_vectored_\name)
-#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
-BEGIN_FTR_SECTION
-	extrdi.	r10, r12, 1, (63-MSR_TS_T_LG) /* transaction active? */
-	bne	tabort_syscall
-END_FTR_SECTION_IFSET(CPU_FTR_TM)
-#endif
 	SCV_INTERRUPT_TO_KERNEL
 	mr	r10,r1
 	ld	r1,PACAKSAVE(r13)
@@ -247,12 +240,6 @@ _ASM_NOKPROBE_SYMBOL(system_call_common_real)
 	.globl system_call_common
 system_call_common:
 _ASM_NOKPROBE_SYMBOL(system_call_common)
-#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
-BEGIN_FTR_SECTION
-	extrdi.	r10, r12, 1, (63-MSR_TS_T_LG) /* transaction active? */
-	bne	tabort_syscall
-END_FTR_SECTION_IFSET(CPU_FTR_TM)
-#endif
 	mr	r10,r1
 	ld	r1,PACAKSAVE(r13)
 	std	r10,0(r1)
@@ -425,34 +412,6 @@ SOFT_MASK_TABLE(.Lsyscall_rst_start, 1b)
 RESTART_TABLE(.Lsyscall_rst_start, .Lsyscall_rst_end, syscall_restart)
 #endif
 
-#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
-tabort_syscall:
-_ASM_NOKPROBE_SYMBOL(tabort_syscall)
-	/* Firstly we need to enable TM in the kernel */
-	mfmsr	r10
-	li	r9, 1
-	rldimi	r10, r9, MSR_TM_LG, 63-MSR_TM_LG
-	mtmsrd	r10, 0
-
-	/* tabort, this dooms the transaction, nothing else */
-	li	r9, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT)
-	TABORT(R9)
-
-	/*
-	 * Return directly to userspace. We have corrupted user register state,
-	 * but userspace will never see that register state. Execution will
-	 * resume after the tbegin of the aborted transaction with the
-	 * checkpointed register state.
-	 */
-	li	r9, MSR_RI
-	andc	r10, r10, r9
-	mtmsrd	r10, 1
-	mtspr	SPRN_SRR0, r11
-	mtspr	SPRN_SRR1, r12
-	RFI_TO_USER
-	b	.	/* prevent speculative execution */
-#endif
-
 	/*
 	 * If MSR EE/RI was never enabled, IRQs not reconciled, NVGPRs not
 	 * touched, no exit work created, then this can be used.
-- 
2.23.0


^ permalink raw reply related

* [GIT PULL] Please pull powerpc/linux.git powerpc-5.15-1 tag
From: Michael Ellerman @ 2021-09-03 13:36 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: ego, srikar, parth, aik, jniethe5, bigeasy, psampat,
	paul.gortmaker, leobras.c, wanjiabing, lkp, maskray, linkmauve,
	aneesh.kumar, masahiroy, joel, lukas.bulwahn, kjain, npiggin,
	nathan, clg, Thomas Gleixner, ldufour, hbathini, oss, msuchanek,
	fthain, farosas, sxwjean, rdunlap, linux-kernel, Marc Zyngier,
	zhengyongjun3, linuxppc-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Linus,

Please pull powerpc updates for 5.15.

A bit of a small batch this time.

There was one conflict against my own fixes branch, and the resolution was a little bit
messy, so I just did a merge of fixes myself to resolve the conflict. I didn't think there
was any value in having you resolve a conflict between two of my own branches.

Notable out of area changes:
  scripts/mod/modpost.c		# 1e688dd2a3d6 powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto
  kernel/irq/irqdomain.c	# 51be9e51a800 KVM: PPC: Book3S HV: XIVE: Fix mapping of passthrough interrupts

That second one generated a bit of discussion[1] with tglx and maz, who asked if we could
avoid adding the export of irq_get_default_host(). Cédric replied explaining that we don't
really have good way to avoid it, but we never heard back from them, so in the end I
decided to merge it.

[1]: https://lore.kernel.org/all/878s4g5lfs.wl-maz@kernel.org/

cheers


The following changes since commit e1ab9a730b426fadc018f91b7c98412473e542fb:

  Merge branch 'fixes' into next (2021-07-26 20:37:53 +1000)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.15-1

for you to fetch changes up to a3314262eede9c909a0c797f16f25f941d12c78d:

  Merge branch 'fixes' into next (2021-09-03 22:54:12 +1000)

- ------------------------------------------------------------------
powerpc updates for 5.15

 - Convert pseries & powernv to use MSI IRQ domains.

 - Rework the pseries CPU numbering so that CPUs that are removed, and later re-added, are
   given a CPU number on the same node as previously, when possible.

 - Add support for a new more flexible device-tree format for specifying NUMA distances.

 - Convert powerpc to GENERIC_PTDUMP.

 - Retire sbc8548 and sbc8641d board support.

 - Various other small features and fixes.

Thanks to: Alexey Kardashevskiy, Aneesh Kumar K.V, Anton Blanchard, Cédric Le Goater,
Christophe Leroy, Emmanuel Gil Peyrot, Fabiano Rosas, Fangrui Song, Finn Thain, Gautham R.
Shenoy, Hari Bathini, Joel Stanley, Jordan Niethe, Kajol Jain, Laurent Dufour, Leonardo
Bras, Lukas Bulwahn, Marc Zyngier, Masahiro Yamada, Michal Suchanek, Nathan Chancellor,
Nicholas Piggin, Parth Shah, Paul Gortmaker, Pratik R. Sampat, Randy Dunlap, Sebastian
Andrzej Siewior, Srikar Dronamraju, Wan Jiabing, Xiongwei Song, Zheng Yongjun.

- ------------------------------------------------------------------
Alexey Kardashevskiy (2):
      KVM: PPC: Use arch_get_random_seed_long instead of powernv variant
      KVM: PPC: Fix clearing never mapped TCEs in realmode

Aneesh Kumar K.V (8):
      powerpc/book3s64/radix: make tlb_single_page_flush_ceiling a debugfs entry
      powerpc: rename powerpc_debugfs_root to arch_debugfs_dir
      powerpc/pseries: rename min_common_depth to primary_domain_index
      powerpc/pseries: Rename TYPE1_AFFINITY to FORM1_AFFINITY
      powerpc/pseries: Consolidate different NUMA distance update code paths
      powerpc/pseries: Add a helper for form1 cpu distance
      powerpc/pseries: Add support for FORM2 associativity
      powerpc/doc: Fix htmldocs errors

Anton Blanchard (1):
      powerpc/configs: Disable legacy ptys on microwatt defconfig

Christophe Leroy (21):
      powerpc: Remove in_kernel_text()
      powerpc/non-smp: Unconditionaly call smp_mb() on switch_mm
      powerpc/bug: Remove specific powerpc BUG_ON() and WARN_ON() on PPC32
      powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto
      powerpc/32: Remove unneccessary calculations in load_up_{fpu/altivec}
      powerpc/audit: Avoid unneccessary #ifdef in syscall_get_arguments()
      powerpc/audit: Simplify syscall_get_arch()
      powerpc/syscalls: Remove __NR__exit
      powerpc/32: indirect function call use bctrl rather than blrl in ret_from_kernel_thread
      powerpc/booke: Avoid link stack corruption in several places
      powerpc: Avoid link stack corruption in misc asm functions
      powerpc/ptdump: Use DEFINE_SHOW_ATTRIBUTE()
      powerpc/ptdump: Remove unused 'page_size' parameter
      powerpc/ptdump: Reduce level numbers by 1 in note_page() and add p4d level
      powerpc/ptdump: Convert powerpc to GENERIC_PTDUMP
      powerpc/syscalls: Simplify do_mmap2()
      powerpc/ptrace: Make user_mode() common to PPC32 and PPC64
      powerpc: Use lwarx/ldarx directly instead of PPC_LWARX/LDARX macros
      powerpc: Remove MSR_PR check in interrupt_exit_{user/kernel}_prepare()
      powerpc: Refactor verification of MSR_RI
      powerpc: Redefine HMT_xxx macros as empty on PPC32

Cédric Le Goater (39):
      powerpc/pseries/pci: Introduce __find_pe_total_msi()
      powerpc/pseries/pci: Introduce rtas_prepare_msi_irqs()
      powerpc/xive: Add support for IRQ domain hierarchy
      powerpc/xive: Ease debugging of xive_irq_set_affinity()
      powerpc/pseries/pci: Add MSI domains
      powerpc/xive: Drop unmask of MSIs at startup
      powerpc/xive: Remove irqd_is_started() check when setting the affinity
      powerpc/pseries/pci: Add a domain_free_irqs() handler
      powerpc/pseries/pci: Add a msi_free() handler to clear XIVE data
      powerpc/pseries/pci: Add support of MSI domains to PHB hotplug
      powerpc/powernv/pci: Introduce __pnv_pci_ioda_msi_setup()
      powerpc/powernv/pci: Add MSI domains
      KVM: PPC: Book3S HV: Use the new IRQ chip to detect passthrough interrupts
      KVM: PPC: Book3S HV: XIVE: Change interface of passthrough interrupt routines
      KVM: PPC: Book3S HV: XIVE: Fix mapping of passthrough interrupts
      powerpc/xics: Remove ICS list
      powerpc/xics: Rename the map handler in a check handler
      powerpc/xics: Give a name to the default XICS IRQ domain
      powerpc/xics: Add debug logging to the set_irq_affinity handlers
      powerpc/xics: Add support for IRQ domain hierarchy
      powerpc/powernv/pci: Customize the MSI EOI handler to support PHB3
      powerpc/pci: Drop XIVE restriction on MSI domains
      powerpc/xics: Drop unmask of MSIs at startup
      powerpc/pseries/pci: Drop unused MSI code
      powerpc/powernv/pci: Drop unused MSI code
      powerpc/powernv/pci: Adapt is_pnv_opal_msi() to detect passthrough interrupt
      powerpc/xics: Fix IRQ migration
      powerpc/powernv/pci: Set the IRQ chip data for P8/CXL devices
      powerpc/powernv/pci: Rework pnv_opal_pci_msi_eoi()
      KVM: PPC: Book3S HV: XICS: Fix mapping of passthrough interrupts
      powerpc/xive: Use XIVE domain under xmon and debugfs
      powerpc: use IRQF_NO_DEBUG for IPIs
      KVM: PPC: Book3S HV: XIVE: Add a 'flags' field
      KVM: PPC: Book3S HV: XIVE: Add support for automatic save-restore
      powerpc/pseries/vas: Declare pseries_vas_fault_thread_fn() as static
      KVM: PPC: Book3S PR: Declare kvmppc_handle_exit_pr()
      KVM: PPC: Book3S PR: Remove unused variable
      powerpc/prom: Fix unused variable ‘reserve_map’ when CONFIG_PPC32 is not set
      powerpc/compat_sys: Declare syscalls

Emmanuel Gil Peyrot (3):
      powerpc: wii.dts: Reduce the size of the control area
      powerpc: wii.dts: Expose the OTP on this platform
      powerpc: wii_defconfig: Enable OTP by default

Fabiano Rosas (6):
      KVM: PPC: Book3S HV: Fix copy_tofrom_guest routines
      KVM: PPC: Book3S HV: Add sanity check to copy_tofrom_guest
      KVM: PPC: Book3S HV: Stop exporting symbols from book3s_64_mmu_radix
      KVM: PPC: Book3S HV Nested: Sanitise vcpu registers
      KVM: PPC: Book3S HV Nested: Stop forwarding all HFUs to L1
      KVM: PPC: Book3S HV Nested: save_hv_return_state does not require trap argument

Fangrui Song (1):
      powerpc: Add "-z notext" flag to disable diagnostic

Finn Thain (1):
      powerpc/tau: Add 'static' storage qualifier to 'tau_work' definition

Gautham R. Shenoy (4):
      cpuidle: pseries: Fixup CEDE0 latency only for POWER10 onwards
      cpuidle: pseries: Do not cap the CEDE0 latency in fixup_cede0_latency()
      powerpc/cacheinfo: Lookup cache by dt node and thread-group id
      powerpc/cacheinfo: Remove the redundant get_shared_cpu_map()

Hari Bathini (1):
      powerpc/kexec: blacklist functions called in real mode for kprobe

Joel Stanley (6):
      powerpc/config: Fix IPV6 warning in mpc855_ads
      powerpc/config: Renable MTD_PHYSMAP_OF
      powerpc/configs: Regenerate mpc885_ads_defconfig
      powerpc/microwatt: Add Ethernet to device tree
      powerpc/configs/microwattt: Enable Liteeth
      powerpc/configs/microwatt: Enable options for systemd

Jordan Niethe (3):
      powerpc: Always inline radix_enabled() to fix build failure
      selftests/powerpc: Add missing clobbered register to to ptrace TM tests
      selftests: Skip TM tests on synthetic TM implementations

Kajol Jain (4):
      powerpc/perf/hv-gpci: Fix counter value parsing
      powerpc/perf: Use stack siar instead of mfspr
      powerpc/perf: Drop the case of returning 0 as instruction pointer
      powerpc/perf: Fix the check for SIAR value

Laurent Dufour (3):
      powerpc/numa: Consider the max NUMA node for migratable LPAR
      pseries/drmem: update LMBs after LPM
      powerpc/pseries: Prevent free CPU ids being reused on another node

Leonardo Bras (11):
      powerpc/pseries/iommu: Replace hard-coded page shift
      powerpc/kernel/iommu: Add new iommu_table_in_use() helper
      powerpc/pseries/iommu: Add iommu_pseries_alloc_table() helper
      powerpc/pseries/iommu: Add ddw_list_new_entry() helper
      powerpc/pseries/iommu: Allow DDW windows starting at 0x00
      powerpc/pseries/iommu: Add ddw_property_create() and refactor enable_ddw()
      powerpc/pseries/iommu: Reorganize iommu_table_setparms*() with new helper
      powerpc/pseries/iommu: Update remove_dma_window() to accept property name
      powerpc/pseries/iommu: Find existing DDW with given property name
      powerpc/pseries/iommu: Make use of DDW for indirect mapping
      powerpc/pseries/iommu: Rename "direct window" to "dma window"

Lukas Bulwahn (1):
      powerpc/kvm: Remove obsolete and unneeded select

Marc Zyngier (1):
      powerpc: Bulk conversion to generic_handle_domain_irq()

Masahiro Yamada (3):
      powerpc: remove unused zInstall target from arch/powerpc/boot/Makefile
      powerpc: make the install target not depend on any build artifact
      powerpc: move the install rule to arch/powerpc/Makefile

Michael Ellerman (7):
      powerpc/pseries: Fix build error when NUMA=n
      powerpc/head_check: Fix shellcheck errors
      Merge branch 'topic/ppc-kvm' into next
      Merge changes from Paul Gortmaker
      powerpc/ptdump: Fix generic ptdump for 64-bit
      powerpc/bug: Cast to unsigned long before passing to inline asm
      Merge branch 'fixes' into next

Michal Suchanek (1):
      powerpc/stacktrace: Include linux/delay.h

Nathan Chancellor (1):
      cpuidle: pseries: Mark pseries_idle_proble() as __init

Nicholas Piggin (8):
      powerpc/64s/perf: Always use SIAR for kernel interrupts
      KVM: PPC: Book3S HV: Initialise vcpu MSR with MSR_ME
      KVM: PPC: Book3S HV: Remove TM emulation from POWER7/8 path
      KVM: PPC: Book3S HV P9: Fixes for TM softpatch interrupt NIP
      KVM: PPC: Book3S HV Nested: Fix TM softpatch HFAC interrupt emulation
      KVM: PPC: Book3S HV Nested: Make nested HFSCR state accessible
      KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest SPRs are live
      powerpc/64s: Remove WORT SPR from POWER9/10

Parth Shah (1):
      powerpc/smp: Use existing L2 cache_map cpumask to find L3 cache siblings

Paul Gortmaker (3):
      powerpc: retire sbc8548 board support
      powerpc: retire sbc8641d board support
      MAINTAINERS: update for Paul Gortmaker

Pratik R. Sampat (1):
      cpufreq: powernv: Fix init_chip_info initialization in numa=off

Randy Dunlap (1):
      powerpc/head_check: use stdout for error messages

Sebastian Andrzej Siewior (1):
      powerpc: Replace deprecated CPU-hotplug functions.

Srikar Dronamraju (7):
      powerpc/smp: Fix a crash while booting kvm guest with nr_cpus=2
      powerpc/smp: Update cpu_core_map on all PowerPc systems
      powerpc/smp: Enable CACHE domain for shared processor
      powerpc/numa: Drop dbg in favour of pr_debug
      powerpc/numa: convert printk to pr_xxx
      powerpc/numa: Print debug statements only when required
      powerpc/numa: Update cpu_cpu_map on CPU online/offline

Wan Jiabing (1):
      powerpc: Remove duplicate includes

Xiongwei Song (4):
      powerpc: Add esr as a synonym for pt_regs.dsisr
      powerpc/64e: Get esr offset with _ESR macro
      powerpc: Add dear as a synonym for pt_regs.dar register
      powerpc/64e: Get dear offset with _DEAR macro

Zheng Yongjun (1):
      selftests/powerpc: Remove duplicated include from tm-poison.c

kernel test robot (1):
      powerpc/kexec: fix for_each_child.cocci warning


 Documentation/powerpc/associativity.rst                        | 105 ++++
 Documentation/powerpc/index.rst                                |   1 +
 MAINTAINERS                                                    |   1 -
 arch/powerpc/Kconfig                                           |   2 +
 arch/powerpc/Kconfig.debug                                     |  30 --
 arch/powerpc/Makefile                                          |   4 +-
 arch/powerpc/boot/Makefile                                     |  11 -
 arch/powerpc/boot/dts/fsl/sbc8641d.dts                         | 176 -------
 arch/powerpc/boot/dts/microwatt.dts                            |  12 +
 arch/powerpc/boot/dts/sbc8548-altflash.dts                     | 111 -----
 arch/powerpc/boot/dts/sbc8548-post.dtsi                        | 289 -----------
 arch/powerpc/boot/dts/sbc8548-pre.dtsi                         |  48 --
 arch/powerpc/boot/dts/sbc8548.dts                              | 106 ----
 arch/powerpc/boot/dts/wii.dts                                  |  13 +-
 arch/powerpc/boot/install.sh                                   |  27 +-
 arch/powerpc/boot/wrapper                                      |   2 +-
 arch/powerpc/configs/85xx/sbc8548_defconfig                    |  50 --
 arch/powerpc/configs/microwatt_defconfig                       |   7 +-
 arch/powerpc/configs/mpc85xx_base.config                       |   1 -
 arch/powerpc/configs/mpc86xx_base.config                       |   1 -
 arch/powerpc/configs/mpc885_ads_defconfig                      |  49 +-
 arch/powerpc/configs/ppc6xx_defconfig                          |   1 -
 arch/powerpc/configs/wii_defconfig                             |   1 +
 arch/powerpc/include/asm/asm-compat.h                          |   4 +-
 arch/powerpc/include/asm/atomic.h                              |   4 +-
 arch/powerpc/include/asm/bitops.h                              |   8 +-
 arch/powerpc/include/asm/book3s/64/kup.h                       |   2 +-
 arch/powerpc/include/asm/bug.h                                 |  62 ++-
 arch/powerpc/include/asm/debugfs.h                             |  13 -
 arch/powerpc/include/asm/drmem.h                               |   1 +
 arch/powerpc/include/asm/extable.h                             |  14 +
 arch/powerpc/include/asm/firmware.h                            |   7 +-
 arch/powerpc/include/asm/iommu.h                               |   1 +
 arch/powerpc/include/asm/kvm_book3s_64.h                       |   1 +
 arch/powerpc/include/asm/kvm_host.h                            |   2 +
 arch/powerpc/include/asm/kvm_ppc.h                             |   4 +-
 arch/powerpc/include/asm/membarrier.h                          |   3 +-
 arch/powerpc/include/asm/mmu.h                                 |   2 +-
 arch/powerpc/include/asm/pci-bridge.h                          |   5 +
 arch/powerpc/include/asm/pmc.h                                 |   7 +
 arch/powerpc/include/asm/pnv-pci.h                             |   2 +-
 arch/powerpc/include/asm/ppc-opcode.h                          |   2 -
 arch/powerpc/include/asm/ppc_asm.h                             |  13 +-
 arch/powerpc/include/asm/prom.h                                |   3 +-
 arch/powerpc/include/asm/ptrace.h                              |  37 +-
 arch/powerpc/include/asm/reg.h                                 |   3 +-
 arch/powerpc/include/asm/sections.h                            |   8 -
 arch/powerpc/include/asm/simple_spinlock.h                     |   6 +-
 arch/powerpc/include/asm/smp.h                                 |   6 +
 arch/powerpc/include/asm/syscall.h                             |  20 +-
 arch/powerpc/include/asm/syscalls.h                            |  30 ++
 arch/powerpc/include/asm/tce.h                                 |   8 -
 arch/powerpc/include/asm/topology.h                            |  19 +-
 arch/powerpc/include/asm/unistd.h                              |   2 -
 arch/powerpc/include/asm/vdso/processor.h                      |   9 +
 arch/powerpc/include/asm/xics.h                                |   3 +-
 arch/powerpc/include/asm/xive-regs.h                           |   3 +
 arch/powerpc/include/asm/xive.h                                |   2 +
 arch/powerpc/kernel/Makefile                                   |   3 +-
 arch/powerpc/kernel/asm-offsets.c                              |  15 +-
 arch/powerpc/kernel/cacheinfo.c                                | 124 ++---
 arch/powerpc/kernel/dawr.c                                     |   3 +-
 arch/powerpc/kernel/eeh.c                                      |  16 +-
 arch/powerpc/kernel/eeh_cache.c                                |   4 +-
 arch/powerpc/kernel/entry_32.S                                 |   4 +-
 arch/powerpc/kernel/entry_64.S                                 |   2 +-
 arch/powerpc/kernel/exceptions-64e.S                           |  24 +-
 arch/powerpc/kernel/fadump.c                                   |   4 +-
 arch/powerpc/kernel/fpu.S                                      |   3 +-
 arch/powerpc/kernel/fsl_booke_entry_mapping.S                  |   8 +-
 arch/powerpc/kernel/head_44x.S                                 |   6 +-
 arch/powerpc/kernel/head_64.S                                  |   2 +
 arch/powerpc/kernel/head_fsl_booke.S                           |   6 +-
 arch/powerpc/kernel/hw_breakpoint.c                            |   1 -
 arch/powerpc/kernel/interrupt.c                                |  12 +-
 arch/powerpc/kernel/iommu.c                                    |  61 +--
 arch/powerpc/kernel/kdebugfs.c                                 |  14 +
 arch/powerpc/kernel/misc.S                                     |   2 +-
 arch/powerpc/kernel/misc_32.S                                  |   4 +-
 arch/powerpc/kernel/misc_64.S                                  |   2 +-
 arch/powerpc/kernel/pci-common.c                               |   6 +
 arch/powerpc/kernel/process.c                                  |   2 +-
 arch/powerpc/kernel/prom.c                                     |   5 +-
 arch/powerpc/kernel/prom_init.c                                |   3 +-
 arch/powerpc/kernel/ptrace/ptrace.c                            |   4 +
 arch/powerpc/kernel/reloc_32.S                                 |   2 +-
 arch/powerpc/kernel/rtasd.c                                    |   4 +-
 arch/powerpc/kernel/security.c                                 |  16 +-
 arch/powerpc/kernel/setup-common.c                             |  13 -
 arch/powerpc/kernel/setup_64.c                                 |   1 -
 arch/powerpc/kernel/smp.c                                      |  88 ++--
 arch/powerpc/kernel/stacktrace.c                               |   1 +
 arch/powerpc/kernel/syscalls.c                                 |  15 +-
 arch/powerpc/kernel/tau_6xx.c                                  |   2 +-
 arch/powerpc/kernel/time.c                                     |   3 +-
 arch/powerpc/kernel/traps.c                                    |  23 +-
 arch/powerpc/kernel/vector.S                                   |   4 +-
 arch/powerpc/kexec/core_64.c                                   |  10 +-
 arch/powerpc/kexec/relocate_32.S                               |  12 +-
 arch/powerpc/kvm/Kconfig                                       |   1 -
 arch/powerpc/kvm/book3s.h                                      |   3 +-
 arch/powerpc/kvm/book3s_64_mmu.c                               |   3 +-
 arch/powerpc/kvm/book3s_64_mmu_radix.c                         |  12 +-
 arch/powerpc/kvm/book3s_64_vio_hv.c                            |   9 +-
 arch/powerpc/kvm/book3s_hv.c                                   | 108 +++-
 arch/powerpc/kvm/book3s_hv_builtin.c                           |  10 +-
 arch/powerpc/kvm/book3s_hv_nested.c                            | 101 ++--
 arch/powerpc/kvm/book3s_hv_rm_xics.c                           |   8 +-
 arch/powerpc/kvm/book3s_hv_rmhandlers.S                        |  42 --
 arch/powerpc/kvm/book3s_hv_tm.c                                |  61 ++-
 arch/powerpc/kvm/book3s_xics.c                                 |   6 +-
 arch/powerpc/kvm/book3s_xive.c                                 |  74 ++-
 arch/powerpc/kvm/book3s_xive.h                                 |  11 +-
 arch/powerpc/kvm/book3s_xive_native.c                          |  24 +-
 arch/powerpc/mm/Makefile                                       |   2 +-
 arch/powerpc/mm/book3s64/hash_native.c                         |   2 +-
 arch/powerpc/mm/book3s64/hash_utils.c                          |   4 +-
 arch/powerpc/mm/book3s64/pgtable.c                             |   8 +-
 arch/powerpc/mm/book3s64/radix_pgtable.c                       |   3 +-
 arch/powerpc/mm/book3s64/radix_tlb.c                           |  16 +-
 arch/powerpc/mm/book3s64/slb.c                                 |   2 +-
 arch/powerpc/mm/drmem.c                                        |  46 ++
 arch/powerpc/mm/mmu_decl.h                                     |   2 +-
 arch/powerpc/mm/nohash/tlb_low.S                               |   4 +-
 arch/powerpc/mm/numa.c                                         | 491 ++++++++++++++-----
 arch/powerpc/mm/ptdump/8xx.c                                   |   6 +-
 arch/powerpc/mm/ptdump/Makefile                                |   9 +-
 arch/powerpc/mm/ptdump/bats.c                                  |  18 +-
 arch/powerpc/mm/ptdump/book3s64.c                              |   6 +-
 arch/powerpc/mm/ptdump/hashpagetable.c                         |  12 +-
 arch/powerpc/mm/ptdump/ptdump.c                                | 178 ++-----
 arch/powerpc/mm/ptdump/segment_regs.c                          |  16 +-
 arch/powerpc/mm/ptdump/shared.c                                |   6 +-
 arch/powerpc/perf/core-book3s.c                                |  21 +-
 arch/powerpc/perf/hv-gpci.c                                    |   2 +-
 arch/powerpc/platforms/44x/machine_check.c                     |   4 +-
 arch/powerpc/platforms/4xx/machine_check.c                     |   2 +-
 arch/powerpc/platforms/85xx/Kconfig                            |   6 -
 arch/powerpc/platforms/85xx/Makefile                           |   1 -
 arch/powerpc/platforms/85xx/sbc8548.c                          | 134 -----
 arch/powerpc/platforms/86xx/Kconfig                            |   8 +-
 arch/powerpc/platforms/86xx/Makefile                           |   1 -
 arch/powerpc/platforms/86xx/sbc8641d.c                         |  87 ----
 arch/powerpc/platforms/cell/axon_msi.c                         |   4 +-
 arch/powerpc/platforms/embedded6xx/holly.c                     |   2 +-
 arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c              |   2 +-
 arch/powerpc/platforms/pasemi/idle.c                           |   2 +-
 arch/powerpc/platforms/powernv/idle.c                          |   6 +-
 arch/powerpc/platforms/powernv/memtrace.c                      |   3 +-
 arch/powerpc/platforms/powernv/opal-imc.c                      |  12 +-
 arch/powerpc/platforms/powernv/opal-lpc.c                      |   4 +-
 arch/powerpc/platforms/powernv/opal-xscom.c                    |   4 +-
 arch/powerpc/platforms/powernv/opal.c                          |   2 +-
 arch/powerpc/platforms/powernv/pci-ioda.c                      | 260 +++++++++-
 arch/powerpc/platforms/powernv/pci.c                           |  67 ---
 arch/powerpc/platforms/powernv/pci.h                           |   6 -
 arch/powerpc/platforms/ps3/htab.c                              |   3 +-
 arch/powerpc/platforms/ps3/mm.c                                |   8 +-
 arch/powerpc/platforms/pseries/dtl.c                           |   4 +-
 arch/powerpc/platforms/pseries/firmware.c                      |   3 +-
 arch/powerpc/platforms/pseries/hotplug-cpu.c                   | 173 +++++--
 arch/powerpc/platforms/pseries/hotplug-memory.c                |   6 +
 arch/powerpc/platforms/pseries/iommu.c                         | 514 ++++++++++++--------
 arch/powerpc/platforms/pseries/lpar.c                          |  18 +-
 arch/powerpc/platforms/pseries/msi.c                           | 296 ++++++++---
 arch/powerpc/platforms/pseries/pci_dlpar.c                     |   4 +
 arch/powerpc/platforms/pseries/pseries.h                       |   2 +
 arch/powerpc/platforms/pseries/ras.c                           |   2 +-
 arch/powerpc/platforms/pseries/setup.c                         |   2 +
 arch/powerpc/platforms/pseries/vas.c                           |   2 +-
 arch/powerpc/sysdev/fsl_rio.c                                  |   2 +-
 arch/powerpc/sysdev/xics/ics-native.c                          |  13 +-
 arch/powerpc/sysdev/xics/ics-opal.c                            |  40 +-
 arch/powerpc/sysdev/xics/ics-rtas.c                            |  40 +-
 arch/powerpc/sysdev/xics/xics-common.c                         | 131 +++--
 arch/powerpc/sysdev/xive/common.c                              | 103 +++-
 arch/powerpc/sysdev/xive/native.c                              |  10 +
 arch/powerpc/tools/head_check.sh                               |  24 +-
 arch/powerpc/xmon/xmon.c                                       |  22 +-
 drivers/cpufreq/powernv-cpufreq.c                              |  16 +-
 drivers/cpuidle/cpuidle-pseries.c                              |  77 +--
 kernel/irq/irqdomain.c                                         |   1 +
 scripts/mod/modpost.c                                          |   2 +-
 tools/testing/selftests/powerpc/primitives/asm/extable.h       |   1 +
 tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c         |   3 +-
 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c     |   3 +-
 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-tar.c     |   1 +
 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c     |   1 +
 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c         |   1 +
 tools/testing/selftests/powerpc/ptrace/ptrace-tm-tar.c         |   1 +
 tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c         |   1 +
 tools/testing/selftests/powerpc/signal/signal_tm.c             |   1 +
 tools/testing/selftests/powerpc/tm/tm-exec.c                   |   1 +
 tools/testing/selftests/powerpc/tm/tm-fork.c                   |   1 +
 tools/testing/selftests/powerpc/tm/tm-poison.c                 |   2 +-
 tools/testing/selftests/powerpc/tm/tm-resched-dscr.c           |   1 +
 tools/testing/selftests/powerpc/tm/tm-signal-context-chk-fpu.c |   1 +
 tools/testing/selftests/powerpc/tm/tm-signal-context-chk-gpr.c |   1 +
 tools/testing/selftests/powerpc/tm/tm-signal-context-chk-vmx.c |   1 +
 tools/testing/selftests/powerpc/tm/tm-signal-context-chk-vsx.c |   1 +
 tools/testing/selftests/powerpc/tm/tm-signal-pagefault.c       |   1 +
 tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c    |   1 +
 tools/testing/selftests/powerpc/tm/tm-signal-stack.c           |   1 +
 tools/testing/selftests/powerpc/tm/tm-sigreturn.c              |   1 +
 tools/testing/selftests/powerpc/tm/tm-syscall.c                |   2 +-
 tools/testing/selftests/powerpc/tm/tm-tar.c                    |   1 +
 tools/testing/selftests/powerpc/tm/tm-tmspr.c                  |   1 +
 tools/testing/selftests/powerpc/tm/tm-trap.c                   |   1 +
 tools/testing/selftests/powerpc/tm/tm-unavailable.c            |   1 +
 tools/testing/selftests/powerpc/tm/tm-vmx-unavail.c            |   1 +
 tools/testing/selftests/powerpc/tm/tm-vmxcopy.c                |   1 +
 tools/testing/selftests/powerpc/tm/tm.h                        |  36 ++
 212 files changed, 2814 insertions(+), 2616 deletions(-)
 create mode 100644 Documentation/powerpc/associativity.rst
 delete mode 100644 arch/powerpc/boot/dts/fsl/sbc8641d.dts
 delete mode 100644 arch/powerpc/boot/dts/sbc8548-altflash.dts
 delete mode 100644 arch/powerpc/boot/dts/sbc8548-post.dtsi
 delete mode 100644 arch/powerpc/boot/dts/sbc8548-pre.dtsi
 delete mode 100644 arch/powerpc/boot/dts/sbc8548.dts
 delete mode 100644 arch/powerpc/configs/85xx/sbc8548_defconfig
 delete mode 100644 arch/powerpc/include/asm/debugfs.h
 create mode 100644 arch/powerpc/kernel/kdebugfs.c
 delete mode 100644 arch/powerpc/platforms/85xx/sbc8548.c
 delete mode 100644 arch/powerpc/platforms/86xx/sbc8641d.c
 create mode 120000 tools/testing/selftests/powerpc/primitives/asm/extable.h
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmEyJC4ACgkQUevqPMjh
pYBfNw//arvzXcFd8WvnogaR4X/oCo5kYIOTsP/5zfVNX+PUe0k65BgXjAr+NoNG
XYZn9/LXpzhi6q05lzJPvAE1jmn7XF2S5muv6OfWcLwDACq1/vOY9scwT+WtaZQ1
hDqKueC3k7ds4IAicfUh8liXd58QzWPSClhzjSHApHtx0Upb9w5W0yAwG+Y+DLpm
pvTsScbymvFJUEe9HVXkGUGP3YNciHNN68cHqhOPN4ha/B9SZ/vOGGtRu8JOa+lj
Aev6g5eQDiHK+9UgXnqXzteG9eMcpu3gF6VtUUEDZZRNo++GTNZ38hlBkJacwfOO
hCj3BiauEJP/G1jM2BlrHolgZoMt+jVnuYnaZWFxe5uifrFhK5j/CysTkZR5NEmQ
3OLutbFrJ8C6r8o/kuiA6wt63JzR0Ya8+o8g2GjBdUpepIook6NyfqE7W4o7Qw5U
pWefvwTJaebejMjxp42nyRQ8EitWz/U/2kZY1JdreEAlPF0MOzldTZwIRDgDCnhe
CFIUKjRHXf43CseUryA2iK5UyJ6oJ6Yl1A04v5Z8HYlXtMMKBXjwRwSilQq9RUb9
+k8uj44ChtwNs3Dgjov9NtZDBBcBa/fO6u/LjMvRwtN5KmEUby0/KW1nq/aQfoCh
Ek3sk9rGnr4u4DnOPaCNx7Km0XgcnzHQgeg72k0GBNhUxtwevv8=
=9/Eq
-----END PGP SIGNATURE-----

^ permalink raw reply

* Re: [PATCH kernel] KVM: PPC: Book3S: Merge powerpc's debugfs entry content into generic entry
From: Fabiano Rosas @ 2021-09-03 14:28 UTC (permalink / raw)
  To: Alexey Kardashevskiy, linuxppc-dev
  Cc: Alexey Kardashevskiy, Paolo Bonzini, kvm-ppc, kvm
In-Reply-To: <20210903052257.2348036-1-aik@ozlabs.ru>

Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> At the moment the generic KVM code creates an "%pid-%fd" entry per a KVM
> instance; and the PPC HV KVM creates its own at "vm%pid".
>
> The rproblems with the PPC entries are:
> 1. they do not allow multiple VMs in the same process (which is extremely
> rare case mostly used by syzkaller fuzzer);
> 2. prone to race bugs like the generic KVM code had fixed in
> commit 85cd39af14f4 ("KVM: Do not leak memory for duplicate debugfs
> directories").
>
> This defines kvm_arch_create_kvm_debugfs() similar to one for vcpus.

I think kvm_arch_create_vm_debugfs is a bit mode accurate?
                        ^
> This defines 2 hooks in kvmppc_ops for allowing specific KVM
> implementations to add necessary entries.
>
> This makes use of already existing kvm_arch_create_vcpu_debugfs.
>
> This removes no more used debugfs_dir pointers from PPC kvm_arch structs.
>
> Suggested-by: Fabiano Rosas <farosas@linux.ibm.com>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

...

> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index c8f12b056968..325b388c725a 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -2771,19 +2771,14 @@ static const struct file_operations debugfs_timings_ops = {
>  };
>  
>  /* Create a debugfs directory for the vcpu */
> -static void debugfs_vcpu_init(struct kvm_vcpu *vcpu, unsigned int id)
> +static void kvmppc_arch_create_vcpu_debugfs_hv(struct kvm_vcpu *vcpu, struct dentry *debugfs_dentry)

This could lose the 'arch' since it is already inside our code and
accessed only via ops. I see that we already have a
kvmppc_create_vcpu_debugfs that's used for some BookE processor, this
would make:

kvmppc_create_vcpu_debugfs
kvmppc_create_vcpu_debugfs_hv
kvmppc_create_vcpu_debugfs_pr (possibly)

which perhaps is more consistent.

>  {
> -	char buf[16];
> -	struct kvm *kvm = vcpu->kvm;
> -
> -	snprintf(buf, sizeof(buf), "vcpu%u", id);
> -	vcpu->arch.debugfs_dir = debugfs_create_dir(buf, kvm->arch.debugfs_dir);
> -	debugfs_create_file("timings", 0444, vcpu->arch.debugfs_dir, vcpu,
> +	debugfs_create_file("timings", 0444, debugfs_dentry, vcpu,
>  			    &debugfs_timings_ops);
>  }
>  
>  #else /* CONFIG_KVM_BOOK3S_HV_EXIT_TIMING */
> -static void debugfs_vcpu_init(struct kvm_vcpu *vcpu, unsigned int id)
> +static void kvmppc_arch_create_vcpu_debugfs_hv(struct kvm_vcpu *vcpu, struct dentry *debugfs_dentry)
>  {
>  }
>  #endif /* CONFIG_KVM_BOOK3S_HV_EXIT_TIMING */

^ permalink raw reply

* Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.15-1 tag
From: Marc Zyngier @ 2021-09-03 14:30 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: ego, srikar, parth, aik, jniethe5, bigeasy, psampat,
	paul.gortmaker, leobras.c, wanjiabing, lkp, maskray, linkmauve,
	aneesh.kumar, masahiroy, joel, lukas.bulwahn, kjain, npiggin,
	nathan, clg, Thomas Gleixner, ldufour, hbathini, oss, msuchanek,
	fthain, farosas, sxwjean, Linus Torvalds, rdunlap, linux-kernel,
	zhengyongjun3, linuxppc-dev
In-Reply-To: <87pmtppypy.fsf@mpe.ellerman.id.au>

Hi Michael,

On Fri, 03 Sep 2021 14:36:57 +0100,
Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> Hi Linus,
> 
> Please pull powerpc updates for 5.15.
> 
> A bit of a small batch this time.
> 
> There was one conflict against my own fixes branch, and the resolution was a little bit
> messy, so I just did a merge of fixes myself to resolve the conflict. I didn't think there
> was any value in having you resolve a conflict between two of my own branches.
> 
> Notable out of area changes:
>   scripts/mod/modpost.c		# 1e688dd2a3d6 powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto
>   kernel/irq/irqdomain.c	# 51be9e51a800 KVM: PPC: Book3S HV: XIVE: Fix mapping of passthrough interrupts
> 
> That second one generated a bit of discussion[1] with tglx and maz,
> who asked if we could avoid adding the export of
> irq_get_default_host(). Cédric replied explaining that we don't
> really have good way to avoid it, but we never heard back from them,
> so in the end I decided to merge it.

Apologies for this, I clearly have lost track of it.

It clearly isn't pretty, but it isn't a deal breaker either. In the
end, it will be easier to address with the code being in the tree.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply

* [RFC PATCH] drivers/nvdimm: nvdimm_pmu_free_hotplug_memory() can be static
From: kernel test robot @ 2021-09-03 15:19 UTC (permalink / raw)
  To: Kajol Jain, mpe, linuxppc-dev, nvdimm, linux-kernel, peterz,
	dan.j.williams, ira.weiny, vishal.l.verma
  Cc: santosh, maddy, kbuild-all
In-Reply-To: <20210903050914.273525-3-kjain@linux.ibm.com>

drivers/nvdimm/nd_perf.c:159:6: warning: symbol 'nvdimm_pmu_free_hotplug_memory' was not declared. Should it be static?

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---
 nd_perf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvdimm/nd_perf.c b/drivers/nvdimm/nd_perf.c
index 4c49d1bc2a3c6..b129e5e702d59 100644
--- a/drivers/nvdimm/nd_perf.c
+++ b/drivers/nvdimm/nd_perf.c
@@ -156,7 +156,7 @@ static int nvdimm_pmu_cpu_hotplug_init(struct nvdimm_pmu *nd_pmu)
 	return 0;
 }
 
-void nvdimm_pmu_free_hotplug_memory(struct nvdimm_pmu *nd_pmu)
+static void nvdimm_pmu_free_hotplug_memory(struct nvdimm_pmu *nd_pmu)
 {
 	cpuhp_state_remove_instance_nocalls(nd_pmu->cpuhp_state, &nd_pmu->node);
 	cpuhp_remove_multi_state(nd_pmu->cpuhp_state);

^ permalink raw reply related

* Re: [RESEND PATCH v4 2/4] drivers/nvdimm: Add perf interface to expose nvdimm performance stats
From: kernel test robot @ 2021-09-03 15:19 UTC (permalink / raw)
  To: Kajol Jain, mpe, linuxppc-dev, nvdimm, linux-kernel, peterz,
	dan.j.williams, ira.weiny, vishal.l.verma
  Cc: santosh, maddy, kbuild-all
In-Reply-To: <20210903050914.273525-3-kjain@linux.ibm.com>

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

Hi Kajol,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linux-nvdimm/libnvdimm-for-next]
[also build test WARNING on powerpc/next linus/master v5.14 next-20210903]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Kajol-Jain/Add-perf-interface-to-expose-nvdimm/20210903-131212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
config: x86_64-randconfig-s021-20210903 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-rc1-dirty
        # https://github.com/0day-ci/linux/commit/f841601cc058e6033761bd2157b886a30190fc3a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kajol-Jain/Add-perf-interface-to-expose-nvdimm/20210903-131212
        git checkout f841601cc058e6033761bd2157b886a30190fc3a
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/nvdimm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/nvdimm/nd_perf.c:159:6: sparse: sparse: symbol 'nvdimm_pmu_free_hotplug_memory' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35068 bytes --]

^ permalink raw reply

* Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.15-1 tag
From: pr-tracker-bot @ 2021-09-03 18:45 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: ego, srikar, parth, aik, jniethe5, bigeasy, psampat,
	paul.gortmaker, leobras.c, wanjiabing, lkp, maskray, linkmauve,
	aneesh.kumar, masahiroy, joel, lukas.bulwahn, kjain, npiggin,
	nathan, clg, Thomas Gleixner, ldufour, hbathini, oss, msuchanek,
	fthain, farosas, sxwjean, Linus Torvalds, rdunlap, linux-kernel,
	Marc Zyngier, zhengyongjun3, linuxppc-dev
In-Reply-To: <87pmtppypy.fsf@mpe.ellerman.id.au>

The pull request you sent on Fri, 03 Sep 2021 23:36:57 +1000:

> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.15-1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/7cca308cfdc0725363ac5943dca9dcd49cc1d2d5

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

^ permalink raw reply

* Re: [PATCH] powerpc/ptdump: Fix generic ptdump for 64-bit
From: Michael Ellerman @ 2021-09-04  1:01 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman; +Cc: nathan
In-Reply-To: <20210831135151.886620-1-mpe@ellerman.id.au>

On Tue, 31 Aug 2021 23:51:51 +1000, Michael Ellerman wrote:
> Since the conversion to generic ptdump we see crashes on 64-bit:
> 
>   BUG: Unable to handle kernel data access on read at 0xc0eeff7f00000000
>   Faulting instruction address: 0xc00000000045e5fc
>   Oops: Kernel access of bad area, sig: 11 [#1]
>   ...
>   NIP __walk_page_range+0x2bc/0xce0
>   LR  __walk_page_range+0x240/0xce0
>   Call Trace:
>     __walk_page_range+0x240/0xce0 (unreliable)
>     walk_page_range_novma+0x74/0xb0
>     ptdump_walk_pgd+0x98/0x170
>     ptdump_check_wx+0x88/0xd0
>     mark_rodata_ro+0x48/0x80
>     kernel_init+0x74/0x1a0
>     ret_from_kernel_thread+0x5c/0x64
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/ptdump: Fix generic ptdump for 64-bit
      https://git.kernel.org/powerpc/c/b14b8b1ed0e15b8f43fba9c25654278a31ee3c2f

cheers

^ permalink raw reply

* Re: [PATCH v2] powerpc/bug: Cast to unsigned long before passing to inline asm
From: Michael Ellerman @ 2021-09-04  1:01 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman; +Cc: nathan
In-Reply-To: <20210901112522.1085134-1-mpe@ellerman.id.au>

On Wed, 1 Sep 2021 21:25:22 +1000, Michael Ellerman wrote:
> In commit 1e688dd2a3d6 ("powerpc/bug: Provide better flexibility to
> WARN_ON/__WARN_FLAGS() with asm goto") we changed WARN_ON(). Previously
> it would take the warning condition, x, and double negate it before
> converting the result to int, and passing that int to the underlying
> inline asm. ie:
> 
>   #define WARN_ON(x) ({
>   	int __ret_warn_on = !!(x);
>   	if (__builtin_constant_p(__ret_warn_on)) {
>   	...
>   	} else {
>   		BUG_ENTRY(PPC_TLNEI " %4, 0",
>   			  BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN),
>   			  "r" (__ret_warn_on));
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/bug: Cast to unsigned long before passing to inline asm
      https://git.kernel.org/powerpc/c/e432fe97f3e5de325b40021e505cce53877586c5

cheers

^ permalink raw reply

* Re: [PATCH kernel] KVM: PPC: Fix clearing never mapped TCEs in realmode
From: Michael Ellerman @ 2021-09-04  1:01 UTC (permalink / raw)
  To: linuxppc-dev, Alexey Kardashevskiy; +Cc: Leonardo Bras, kvm-ppc
In-Reply-To: <20210827040706.517652-1-aik@ozlabs.ru>

On Fri, 27 Aug 2021 14:07:06 +1000, Alexey Kardashevskiy wrote:
> Since e1a1ef84cd07, pages for TCE tables for KVM guests are allocated
> only when needed. This allows skipping any update when clearing TCEs.
> This works mostly fine as TCE updates are handled when MMU is enabled.
> The realmode handlers fail with H_TOO_HARD when pages are not yet
> allocated except when clearing a TCE in which case KVM prints a warning
> but proceeds to dereference a NULL pointer which crashes the host OS.
> 
> [...]

Applied to powerpc/next.

[1/1] KVM: PPC: Fix clearing never mapped TCEs in realmode
      https://git.kernel.org/powerpc/c/1d78dfde33a02da1d816279c2e3452978b7abd39

cheers

^ permalink raw reply

* [powerpc:next] BUILD SUCCESS a3314262eede9c909a0c797f16f25f941d12c78d
From: kernel test robot @ 2021-09-04  1:58 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
branch HEAD: a3314262eede9c909a0c797f16f25f941d12c78d  Merge branch 'fixes' into next

elapsed time: 721m

configs tested: 155
configs skipped: 4

The following configs have been built successfully.
More configs may be tested in the coming days.

gcc tested configs:
arm                                 defconfig
arm64                            allyesconfig
arm64                               defconfig
arm                              allyesconfig
arm                              allmodconfig
i386                 randconfig-c001-20210904
arm                         axm55xx_defconfig
powerpc                 mpc834x_itx_defconfig
powerpc                     rainier_defconfig
mips                         tb0226_defconfig
m68k                        m5272c3_defconfig
mips                        bcm63xx_defconfig
arm                         socfpga_defconfig
arm                        spear6xx_defconfig
powerpc                 mpc8560_ads_defconfig
m68k                         amcore_defconfig
sparc                       sparc64_defconfig
sh                   sh7770_generic_defconfig
arm                  colibri_pxa270_defconfig
arm                          simpad_defconfig
arc                     haps_hs_smp_defconfig
powerpc                    klondike_defconfig
powerpc                     tqm8548_defconfig
powerpc                        cell_defconfig
h8300                     edosk2674_defconfig
powerpc                      pasemi_defconfig
s390                             allmodconfig
powerpc                     mpc83xx_defconfig
powerpc                      makalu_defconfig
arm                  colibri_pxa300_defconfig
sh                          polaris_defconfig
arm                       imx_v6_v7_defconfig
mips                    maltaup_xpa_defconfig
sh                          urquell_defconfig
microblaze                      mmu_defconfig
xtensa                  nommu_kc705_defconfig
arm                         at91_dt_defconfig
ia64                        generic_defconfig
powerpc                      katmai_defconfig
arm                         nhk8815_defconfig
mips                malta_qemu_32r6_defconfig
powerpc                     asp8347_defconfig
arm                       versatile_defconfig
mips                        nlm_xlr_defconfig
sh                             shx3_defconfig
arm                        clps711x_defconfig
um                                  defconfig
m68k                             allyesconfig
mips                         rt305x_defconfig
mips                        maltaup_defconfig
arm                         s5pv210_defconfig
arm                           viper_defconfig
powerpc                  mpc866_ads_defconfig
powerpc                 mpc8313_rdb_defconfig
arm                      pxa255-idp_defconfig
ia64                         bigsur_defconfig
arm                            lart_defconfig
powerpc                      ppc64e_defconfig
mips                           ci20_defconfig
sh                     magicpanelr2_defconfig
arm                    vt8500_v6_v7_defconfig
sh                         ecovec24_defconfig
sh                   rts7751r2dplus_defconfig
nios2                         3c120_defconfig
mips                       capcella_defconfig
arm                        cerfcube_defconfig
riscv                               defconfig
powerpc               mpc834x_itxgp_defconfig
m68k                        mvme16x_defconfig
mips                      bmips_stb_defconfig
mips                      maltaaprp_defconfig
powerpc                     akebono_defconfig
sh                         microdev_defconfig
powerpc                 mpc85xx_cds_defconfig
xtensa                generic_kc705_defconfig
parisc                generic-32bit_defconfig
arm                          exynos_defconfig
sh                          rsk7264_defconfig
powerpc                     tqm5200_defconfig
xtensa                       common_defconfig
arm                  randconfig-c002-20210904
x86_64                            allnoconfig
ia64                             allmodconfig
ia64                                defconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                                defconfig
nios2                               defconfig
arc                              allyesconfig
nds32                             allnoconfig
nds32                               defconfig
nios2                            allyesconfig
csky                                defconfig
alpha                               defconfig
alpha                            allyesconfig
xtensa                           allyesconfig
h8300                            allyesconfig
arc                                 defconfig
sh                               allmodconfig
parisc                              defconfig
s390                             allyesconfig
parisc                           allyesconfig
s390                                defconfig
i386                             allyesconfig
sparc                            allyesconfig
sparc                               defconfig
i386                                defconfig
mips                             allyesconfig
mips                             allmodconfig
powerpc                          allyesconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
x86_64               randconfig-a006-20210904
x86_64               randconfig-a004-20210904
x86_64               randconfig-a003-20210904
x86_64               randconfig-a005-20210904
x86_64               randconfig-a001-20210904
x86_64               randconfig-a002-20210904
i386                 randconfig-a005-20210904
i386                 randconfig-a004-20210904
i386                 randconfig-a006-20210904
i386                 randconfig-a002-20210904
i386                 randconfig-a003-20210904
i386                 randconfig-a001-20210904
arc                  randconfig-r043-20210904
riscv                    nommu_k210_defconfig
riscv                            allyesconfig
riscv                    nommu_virt_defconfig
riscv                             allnoconfig
riscv                          rv32_defconfig
riscv                            allmodconfig
x86_64                    rhel-8.3-kselftests
um                           x86_64_defconfig
um                             i386_defconfig
x86_64                               rhel-8.3
x86_64                           allyesconfig
x86_64                              defconfig
x86_64                                  kexec

clang tested configs:
s390                 randconfig-c005-20210904
mips                 randconfig-c004-20210904
powerpc              randconfig-c003-20210904
x86_64               randconfig-c007-20210904
i386                 randconfig-c001-20210904
arm                  randconfig-c002-20210904
riscv                randconfig-c006-20210904
x86_64               randconfig-a011-20210904
x86_64               randconfig-a016-20210904
x86_64               randconfig-a012-20210904
x86_64               randconfig-a015-20210904
x86_64               randconfig-a014-20210904
x86_64               randconfig-a013-20210904
i386                 randconfig-a012-20210904
i386                 randconfig-a015-20210904
i386                 randconfig-a011-20210904
i386                 randconfig-a013-20210904
i386                 randconfig-a014-20210904
i386                 randconfig-a016-20210904

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply

* [powerpc:merge] BUILD SUCCESS 8d4e8a236506000f4802d83e507c2e61cfabc69a
From: kernel test robot @ 2021-09-04  3:38 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git merge
branch HEAD: 8d4e8a236506000f4802d83e507c2e61cfabc69a  powerpc/ci: Disable corenet32_smp_defconfig on clang / GCC 4.9

elapsed time: 927m

configs tested: 104
configs skipped: 3

The following configs have been built successfully.
More configs may be tested in the coming days.

gcc tested configs:
arm                                 defconfig
arm64                            allyesconfig
arm64                               defconfig
arm                              allyesconfig
arm                              allmodconfig
powerpc                     tqm5200_defconfig
sh                   sh7770_generic_defconfig
arm                  colibri_pxa270_defconfig
arm                          simpad_defconfig
sh                          urquell_defconfig
microblaze                      mmu_defconfig
xtensa                  nommu_kc705_defconfig
powerpc                  mpc866_ads_defconfig
powerpc                 mpc8313_rdb_defconfig
arm                      pxa255-idp_defconfig
ia64                         bigsur_defconfig
powerpc                     akebono_defconfig
powerpc                      pasemi_defconfig
sh                         microdev_defconfig
mips                      maltaaprp_defconfig
powerpc                 mpc85xx_cds_defconfig
x86_64                            allnoconfig
ia64                             allmodconfig
ia64                                defconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                                defconfig
m68k                             allyesconfig
nios2                               defconfig
arc                              allyesconfig
nds32                             allnoconfig
nds32                               defconfig
nios2                            allyesconfig
csky                                defconfig
alpha                               defconfig
alpha                            allyesconfig
h8300                            allyesconfig
arc                                 defconfig
sh                               allmodconfig
xtensa                           allyesconfig
parisc                              defconfig
s390                             allyesconfig
s390                             allmodconfig
parisc                           allyesconfig
s390                                defconfig
i386                             allyesconfig
sparc                            allyesconfig
sparc                               defconfig
i386                                defconfig
mips                             allyesconfig
mips                             allmodconfig
powerpc                          allyesconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
x86_64               randconfig-a006-20210904
x86_64               randconfig-a004-20210904
x86_64               randconfig-a003-20210904
x86_64               randconfig-a005-20210904
x86_64               randconfig-a001-20210904
x86_64               randconfig-a002-20210904
x86_64               randconfig-a016-20210903
x86_64               randconfig-a011-20210903
x86_64               randconfig-a012-20210903
x86_64               randconfig-a015-20210903
x86_64               randconfig-a014-20210903
x86_64               randconfig-a013-20210903
arc                  randconfig-r043-20210904
riscv                randconfig-r042-20210903
s390                 randconfig-r044-20210903
arc                  randconfig-r043-20210903
riscv                    nommu_k210_defconfig
riscv                            allyesconfig
riscv                    nommu_virt_defconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                          rv32_defconfig
riscv                            allmodconfig
um                           x86_64_defconfig
um                             i386_defconfig
x86_64                              defconfig
x86_64                               rhel-8.3
x86_64                                  kexec
x86_64                           allyesconfig
x86_64                    rhel-8.3-kselftests

clang tested configs:
i386                 randconfig-a005-20210903
i386                 randconfig-a004-20210903
i386                 randconfig-a006-20210903
i386                 randconfig-a002-20210903
i386                 randconfig-a001-20210903
i386                 randconfig-a003-20210903
x86_64               randconfig-a011-20210904
x86_64               randconfig-a016-20210904
x86_64               randconfig-a012-20210904
x86_64               randconfig-a015-20210904
x86_64               randconfig-a014-20210904
x86_64               randconfig-a013-20210904
i386                 randconfig-a012-20210904
i386                 randconfig-a015-20210904
i386                 randconfig-a011-20210904
i386                 randconfig-a013-20210904
i386                 randconfig-a014-20210904
i386                 randconfig-a016-20210904
hexagon              randconfig-r045-20210903
hexagon              randconfig-r041-20210903

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply

* Re: [RESEND PATCH v4 2/4] drivers/nvdimm: Add perf interface to expose nvdimm performance stats
From: kajoljain @ 2021-09-04  6:38 UTC (permalink / raw)
  To: kernel test robot, mpe, linuxppc-dev, nvdimm, linux-kernel,
	peterz, dan.j.williams, ira.weiny, vishal.l.verma
  Cc: santosh, maddy, kbuild-all
In-Reply-To: <202109032341.mgqAHURT-lkp@intel.com>



On 9/3/21 8:49 PM, kernel test robot wrote:
> Hi Kajol,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on linux-nvdimm/libnvdimm-for-next]
> [also build test WARNING on powerpc/next linus/master v5.14 next-20210903]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Kajol-Jain/Add-perf-interface-to-expose-nvdimm/20210903-131212
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
> config: x86_64-randconfig-s021-20210903 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> reproduce:
>         # apt-get install sparse
>         # sparse version: v0.6.4-rc1-dirty
>         # https://github.com/0day-ci/linux/commit/f841601cc058e6033761bd2157b886a30190fc3a
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Kajol-Jain/Add-perf-interface-to-expose-nvdimm/20210903-131212
>         git checkout f841601cc058e6033761bd2157b886a30190fc3a
>         # save the attached .config to linux build tree
>         make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/nvdimm/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> sparse warnings: (new ones prefixed by >>)
>>> drivers/nvdimm/nd_perf.c:159:6: sparse: sparse: symbol 'nvdimm_pmu_free_hotplug_memory' was not declared. Should it be static?
> 
> Please review and possibly fold the followup patch.

Hi,
  Sure I will correct it and send follow-up patchset.

Thanks,
Kajol Jain

> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 

^ permalink raw reply

* Re: [RFC PATCH] drivers/nvdimm: nvdimm_pmu_free_hotplug_memory() can be static
From: kajoljain @ 2021-09-04  6:39 UTC (permalink / raw)
  To: kernel test robot, mpe, linuxppc-dev, nvdimm, linux-kernel,
	peterz, dan.j.williams, ira.weiny, vishal.l.verma
  Cc: santosh, maddy, kbuild-all
In-Reply-To: <20210903151941.GA23182@a0af9ae1a611>



On 9/3/21 8:49 PM, kernel test robot wrote:
> drivers/nvdimm/nd_perf.c:159:6: warning: symbol 'nvdimm_pmu_free_hotplug_memory' was not declared. Should it be static?
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> ---
>  nd_perf.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvdimm/nd_perf.c b/drivers/nvdimm/nd_perf.c
> index 4c49d1bc2a3c6..b129e5e702d59 100644
> --- a/drivers/nvdimm/nd_perf.c
> +++ b/drivers/nvdimm/nd_perf.c
> @@ -156,7 +156,7 @@ static int nvdimm_pmu_cpu_hotplug_init(struct nvdimm_pmu *nd_pmu)
>  	return 0;
>  }
>  
> -void nvdimm_pmu_free_hotplug_memory(struct nvdimm_pmu *nd_pmu)
> +static void nvdimm_pmu_free_hotplug_memory(struct nvdimm_pmu *nd_pmu)
>  {
>  	cpuhp_state_remove_instance_nocalls(nd_pmu->cpuhp_state, &nd_pmu->node);
>  	cpuhp_remove_multi_state(nd_pmu->cpuhp_state);
> 

Hi,
   Thanks for reporting this issue, I will merge it in my followup patchset.

Thanks,
Kajol Jain

^ permalink raw reply

* [PATCH 1/3] perf: Add macros to specify onchip L2/L3 accesses
From: Kajol Jain @ 2021-09-04  6:49 UTC (permalink / raw)
  To: mpe, linuxppc-dev, linux-kernel, peterz, mingo, acme, jolsa,
	namhyung, linux-perf-users, ak
  Cc: mark.rutland, songliubraving, atrajeev, daniel, rnsastry,
	alexander.shishkin, kjain, ast, yao.jin, maddy, paulus, kan.liang

Add couple of new macros to represent onchip L2 and onchip L3 accesses.

Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
 include/uapi/linux/perf_event.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index f92880a15645..030b3e990ac3 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -1265,7 +1265,9 @@ union perf_mem_data_src {
 #define PERF_MEM_LVLNUM_L2	0x02 /* L2 */
 #define PERF_MEM_LVLNUM_L3	0x03 /* L3 */
 #define PERF_MEM_LVLNUM_L4	0x04 /* L4 */
-/* 5-0xa available */
+#define PERF_MEM_LVLNUM_OC_L2	0x05 /* On Chip L2 */
+#define PERF_MEM_LVLNUM_OC_L3	0x06 /* On Chip L3 */
+/* 7-0xa available */
 #define PERF_MEM_LVLNUM_ANY_CACHE 0x0b /* Any cache */
 #define PERF_MEM_LVLNUM_LFB	0x0c /* LFB */
 #define PERF_MEM_LVLNUM_RAM	0x0d /* RAM */
-- 
2.26.2


^ permalink raw reply related

* [PATCH 2/3] perf: Add macros to specify onchip L2/L3 accesses
From: Kajol Jain @ 2021-09-04  6:49 UTC (permalink / raw)
  To: mpe, linuxppc-dev, linux-kernel, peterz, mingo, acme, jolsa,
	namhyung, linux-perf-users, ak
  Cc: mark.rutland, songliubraving, atrajeev, daniel, rnsastry,
	alexander.shishkin, kjain, ast, yao.jin, maddy, paulus, kan.liang
In-Reply-To: <20210904064932.307610-1-kjain@linux.ibm.com>

Add couple of new macros to represent onchip L2 and onchip L3 accesses.
Patch also adds the decoding strings in the mem_lvlnum data structure.

Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
 tools/include/uapi/linux/perf_event.h | 4 +++-
 tools/perf/util/mem-events.c          | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h
index f92880a15645..030b3e990ac3 100644
--- a/tools/include/uapi/linux/perf_event.h
+++ b/tools/include/uapi/linux/perf_event.h
@@ -1265,7 +1265,9 @@ union perf_mem_data_src {
 #define PERF_MEM_LVLNUM_L2	0x02 /* L2 */
 #define PERF_MEM_LVLNUM_L3	0x03 /* L3 */
 #define PERF_MEM_LVLNUM_L4	0x04 /* L4 */
-/* 5-0xa available */
+#define PERF_MEM_LVLNUM_OC_L2	0x05 /* On Chip L2 */
+#define PERF_MEM_LVLNUM_OC_L3	0x06 /* On Chip L3 */
+/* 7-0xa available */
 #define PERF_MEM_LVLNUM_ANY_CACHE 0x0b /* Any cache */
 #define PERF_MEM_LVLNUM_LFB	0x0c /* LFB */
 #define PERF_MEM_LVLNUM_RAM	0x0d /* RAM */
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index f0e75df72b80..f846a91220c2 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -294,6 +294,8 @@ static const char * const mem_lvl[] = {
 };
 
 static const char * const mem_lvlnum[] = {
+	[PERF_MEM_LVLNUM_OC_L2] = "OnChip L2",
+	[PERF_MEM_LVLNUM_OC_L3] = "OnChip L3",
 	[PERF_MEM_LVLNUM_ANY_CACHE] = "Any cache",
 	[PERF_MEM_LVLNUM_LFB] = "LFB",
 	[PERF_MEM_LVLNUM_RAM] = "RAM",
-- 
2.26.2


^ permalink raw reply related

* [PATCH 3/3] powerpc/perf: Fix data source encodings for power10
From: Kajol Jain @ 2021-09-04  6:49 UTC (permalink / raw)
  To: mpe, linuxppc-dev, linux-kernel, peterz, mingo, acme, jolsa,
	namhyung, linux-perf-users, ak
  Cc: mark.rutland, songliubraving, atrajeev, daniel, rnsastry,
	alexander.shishkin, kjain, ast, yao.jin, maddy, paulus, kan.liang
In-Reply-To: <20210904064932.307610-1-kjain@linux.ibm.com>

Fix the data source encodings for power10 to represent
onchip L2/L3 accesses properly.

Fixes: 79e96f8f930d ("powerpc/perf: Export memory hierarchy info to user
space")
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
 arch/powerpc/perf/isa207-common.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c
index f92bf5f6b74f..9630a17c5da4 100644
--- a/arch/powerpc/perf/isa207-common.c
+++ b/arch/powerpc/perf/isa207-common.c
@@ -238,11 +238,22 @@ static inline u64 isa207_find_source(u64 idx, u32 sub_idx)
 		ret |= P(SNOOP, HIT);
 		break;
 	case 5:
-		ret = PH(LVL, REM_CCE1);
-		if ((sub_idx == 0) || (sub_idx == 2) || (sub_idx == 4))
-			ret |= P(SNOOP, HIT);
-		else if ((sub_idx == 1) || (sub_idx == 3) || (sub_idx == 5))
-			ret |= P(SNOOP, HITM);
+		if (cpu_has_feature(CPU_FTR_ARCH_31)) {
+			if (sub_idx == 0 || sub_idx == 4)
+				ret = PH(LVLNUM, OC_L2) | P(SNOOP, HIT);
+			else if (sub_idx == 1 || sub_idx == 5)
+				ret = PH(LVLNUM, OC_L2) | P(SNOOP, HITM);
+			else if (sub_idx == 2 || sub_idx == 6)
+				ret = PH(LVLNUM, OC_L3) | P(SNOOP, HIT);
+			else if (sub_idx == 3 || sub_idx == 7)
+				ret = PH(LVLNUM, OC_L3) | P(SNOOP, HITM);
+		} else {
+			ret = PH(LVL, REM_CCE1);
+			if ((sub_idx == 0) || (sub_idx == 2) || (sub_idx == 4))
+				ret |= P(SNOOP, HIT);
+			else if ((sub_idx == 1) || (sub_idx == 3) || (sub_idx == 5))
+				ret |= P(SNOOP, HITM);
+		}
 		break;
 	case 6:
 		ret = PH(LVL, REM_CCE2);
-- 
2.26.2


^ permalink raw reply related

* Re: [PATCH -next] powerpc/mm: check base flags in ioremap_prot
From: Nanyong Sun @ 2021-09-04  6:38 UTC (permalink / raw)
  To: Christophe Leroy, mpe, benh, paulus, akpm, npiggin,
	christophe.leroy
  Cc: wangkefeng 00584194, linuxppc-dev, linux-kernel
In-Reply-To: <90aa2b67-24c8-4a5f-d91a-b562054d5c5d@csgroup.eu>

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


On 2021/9/3 17:16, Christophe Leroy wrote:
>
>
> Le 03/09/2021 à 11:03, Nanyong Sun a écrit :
>> Some drivers who call ioremap_prot without setting base flags like
>> ioremap_prot(addr, len, 0) may work well before
>> commit 56f3c1413f5c ("powerpc/mm: properly set PAGE_KERNEL flags in
>> ioremap()"), but now they will get a virtual address "successfully"
>> from ioremap_prot and badly fault on memory access later because that
>> patch also dropped the hack adding of base flags for ioremap_prot.
>>
>> So return NULL and throw a warning if the caller of ioremap_prot did
>> not set base flags properly. Why not just hack adding PAGE_KERNEL flags
>> in the ioremap_prot, because most scenarios can be covered by high level
>> functions like ioremap(), ioremap_coherent(), ioremap_cache()...
>> so it is better to keep max flexibility for this low level api.
>
> As far as I can see, there is no user of this fonction that sets flags 
> to 0 in the kernel tree.
>
> Did you find any ? If you did, I think it is better to fix the caller.
>
> Christophe
>
I see some vendor's drivers which are not on upstream has used 
ioremap_prot like

ioremap_prot(addr,len, _PAGE_NO_CACHE | _PAGE_GUARDED) or

ioremap_prot(addr,len, 0), and they worked well on old kernel versions 
before commit

56f3c1413f5c ("powerpc/mm: properly set PAGE_KERNEL flags in ioremap()").

Actually, in the commit( git show 56f3c1413f5c ), you can see that in old

kernel versions, the implementations of ioremap_xxx just set flags as 
_PAGE_xxx or 0,

Code examples of the commit:

In arch/powerpc/mm/pgtable_32.c

ioremap(phys_addr_t addr, unsigned long size)
  {
-       return __ioremap_caller(addr, size, _PAGE_NO_CACHE | _PAGE_GUARDED,
-                               __builtin_return_address(0));
+       unsigned long flags = pgprot_val(pgprot_noncached(PAGE_KERNEL));
+
+       return __ioremap_caller(addr, size, flags, 
__builtin_return_address(0));
  }

In arch/powerpc/mm/pgtable_64.c

void __iomem * ioremap(phys_addr_t addr, unsigned long size)
  {
-       unsigned long flags = pgprot_val(pgprot_noncached(__pgprot(0)));
+       unsigned long flags = pgprot_val(pgprot_noncached(PAGE_KERNEL));
         void *caller = __builtin_return_address(0);


They rely on the low level functions to add base flags.

So, these driver codes like 'ioremap_prot(addr,len, _PAGE_NO_CACHE) '

in old kernel version is**not very improper.

Ofcourse, when porting new kernel versions, they need to change because the

api implementation has changed, but it's difficult for driver developer 
to find out what

happend and how to change, because they still get a virtual address 
"successfully"

from ioremap_prot without base flags and then page fault on memory 
access later.

So, it is necessary to check and report base flags missing in 
ioremap_prot() timely.

Secondly, the commit 56f3c1413f5c ("powerpc/mm: properly set PAGE_KERNEL

flags in ioremap()") delete the hack adding of PAGE_KERNEL flags in low 
level

implementation and add flags properly for all ioremap_xx() APIs except 
ioreamp_prot,

for ioreamp_prot, it not only loss the hack adding, but also loss the 
basic flags check

which is necessary.

So we need add this basic check for this API.

Nanyong

>>
>> Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
>> ---
>>   arch/powerpc/mm/ioremap.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/powerpc/mm/ioremap.c b/arch/powerpc/mm/ioremap.c
>> index 57342154d2b0..b7eda0f0d04d 100644
>> --- a/arch/powerpc/mm/ioremap.c
>> +++ b/arch/powerpc/mm/ioremap.c
>> @@ -46,6 +46,10 @@ void __iomem *ioremap_prot(phys_addr_t addr, 
>> unsigned long size, unsigned long f
>>       pte_t pte = __pte(flags);
>>       void *caller = __builtin_return_address(0);
>>   +    /* The caller should set base page flags properly */
>> +    if (WARN_ON((flags & _PAGE_PRESENT) == 0))
>
> This probably doesn't work for some plateforms like book3s/64. You 
> should use helpers like pte_present().
>
> See the comment at 
> https://elixir.bootlin.com/linux/v5.14/source/arch/powerpc/include/asm/book3s/64/pgtable.h#L591
>
I'm afraid that pte_present() is not ok for book3s/64, because it also 
check _PAGE_PTE which will be set in the bottom

half of ioremap, so it would always return fail because the caller of 
ioremap_prot wouldn't set _PAGE_PTE. I think it's ok that

not check _PAGE_INVALID here because we intend to create a new valid PTE 
here.

And I think check _PAGE_PRESENT is ok  because in kernel version before 
commit 56f3c1413f5c , the function __ioremap_at()

and __ioremap_caller() used _PAGE_PRESENT to check base flags, book3s/64 
was also present by then.

Nanyong

>> +        return NULL;
>> +
>>       /* writeable implies dirty for kernel addresses */
>>       if (pte_write(pte))
>>           pte = pte_mkdirty(pte);
>>
> .

[-- Attachment #2: Type: text/html, Size: 7409 bytes --]

^ permalink raw reply

* Re: [PATCH kernel] KVM: PPC: Book3S: Merge powerpc's debugfs entry content into generic entry
From: Alexey Kardashevskiy @ 2021-09-04  7:57 UTC (permalink / raw)
  To: Fabiano Rosas, linuxppc-dev; +Cc: Paolo Bonzini, kvm-ppc, kvm
In-Reply-To: <87v93hens6.fsf@linux.ibm.com>



On 04/09/2021 00:28, Fabiano Rosas wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
> 
>> At the moment the generic KVM code creates an "%pid-%fd" entry per a KVM
>> instance; and the PPC HV KVM creates its own at "vm%pid".
>>
>> The rproblems with the PPC entries are:
>> 1. they do not allow multiple VMs in the same process (which is extremely
>> rare case mostly used by syzkaller fuzzer);
>> 2. prone to race bugs like the generic KVM code had fixed in
>> commit 85cd39af14f4 ("KVM: Do not leak memory for duplicate debugfs
>> directories").
>>
>> This defines kvm_arch_create_kvm_debugfs() similar to one for vcpus.
> 
> I think kvm_arch_create_vm_debugfs is a bit mode accurate?


ah yes, it is better.

>                          ^
>> This defines 2 hooks in kvmppc_ops for allowing specific KVM
>> implementations to add necessary entries.
>>
>> This makes use of already existing kvm_arch_create_vcpu_debugfs.
>>
>> This removes no more used debugfs_dir pointers from PPC kvm_arch structs.
>>
>> Suggested-by: Fabiano Rosas <farosas@linux.ibm.com>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> 
> ...
> 
>> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
>> index c8f12b056968..325b388c725a 100644
>> --- a/arch/powerpc/kvm/book3s_hv.c
>> +++ b/arch/powerpc/kvm/book3s_hv.c
>> @@ -2771,19 +2771,14 @@ static const struct file_operations debugfs_timings_ops = {
>>   };
>>   
>>   /* Create a debugfs directory for the vcpu */
>> -static void debugfs_vcpu_init(struct kvm_vcpu *vcpu, unsigned int id)
>> +static void kvmppc_arch_create_vcpu_debugfs_hv(struct kvm_vcpu *vcpu, struct dentry *debugfs_dentry)
> 
> This could lose the 'arch' since it is already inside our code and
> accessed only via ops. I see that we already have a
> kvmppc_create_vcpu_debugfs that's used for some BookE processor, this

Ouch, missed kvmppc_create_vcpu_debugfs(). Good eye :)


> would make:
> 
> kvmppc_create_vcpu_debugfs
> kvmppc_create_vcpu_debugfs_hv
> kvmppc_create_vcpu_debugfs_pr (possibly)
> 
> which perhaps is more consistent.


Or  kvm_arch_vm_ioctl_hv(). I really like having "arch" in the name, 
tells right away what it is about. "kvmppc" might be excessive. Thanks,



>>   {
>> -	char buf[16];
>> -	struct kvm *kvm = vcpu->kvm;
>> -
>> -	snprintf(buf, sizeof(buf), "vcpu%u", id);
>> -	vcpu->arch.debugfs_dir = debugfs_create_dir(buf, kvm->arch.debugfs_dir);
>> -	debugfs_create_file("timings", 0444, vcpu->arch.debugfs_dir, vcpu,
>> +	debugfs_create_file("timings", 0444, debugfs_dentry, vcpu,
>>   			    &debugfs_timings_ops);
>>   }
>>   
>>   #else /* CONFIG_KVM_BOOK3S_HV_EXIT_TIMING */
>> -static void debugfs_vcpu_init(struct kvm_vcpu *vcpu, unsigned int id)
>> +static void kvmppc_arch_create_vcpu_debugfs_hv(struct kvm_vcpu *vcpu, struct dentry *debugfs_dentry)
>>   {
>>   }
>>   #endif /* CONFIG_KVM_BOOK3S_HV_EXIT_TIMING */

-- 
Alexey

^ permalink raw reply

* Re: [PATCH] ftrace: Cleanup ftrace_dyn_arch_init()
From: Weizhao Ouyang @ 2021-09-04 10:48 UTC (permalink / raw)
  To: rostedt, mingo
  Cc: dalias, linux-ia64, linux-sh, linux-mips, James.Bottomley, guoren,
	hpa, sparclinux, linux-riscv, deanbo422, will, linux-s390, ysato,
	deller, x86, linux, linux-csky, borntraeger, catalin.marinas, aou,
	gor, hca, bp, green.hu, paul.walmsley, tglx, linux-arm-kernel,
	Michal Simek, tsbogend, linux-parisc, nickhu, linux-kernel,
	Palmer Dabbelt, paulus, linuxppc-dev, davem
In-Reply-To: <20210903071817.1162938-1-o451686892@gmail.com>

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

On Fri, Sep 3, 2021 at 3:18 PM Weizhao Ouyang <o451686892@gmail.com> wrote:

> Most ARCHs use empty ftrace_dyn_arch_init(), introduce a weak common
> ftrace_dyn_arch_init() to cleanup them.
>
> Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
> ---
>  arch/arm/kernel/ftrace.c          | 5 -----
>  arch/arm64/kernel/ftrace.c        | 5 -----
>  arch/csky/kernel/ftrace.c         | 5 -----
>  arch/ia64/kernel/ftrace.c         | 6 ------
>  arch/microblaze/kernel/ftrace.c   | 5 -----
>  arch/mips/include/asm/ftrace.h    | 2 ++
>  arch/nds32/kernel/ftrace.c        | 5 -----
>  arch/parisc/kernel/ftrace.c       | 5 -----
>  arch/powerpc/include/asm/ftrace.h | 4 ++++
>  arch/riscv/kernel/ftrace.c        | 5 -----
>  arch/s390/kernel/ftrace.c         | 5 -----
>  arch/sh/kernel/ftrace.c           | 5 -----
>  arch/sparc/kernel/ftrace.c        | 5 -----
>  arch/x86/kernel/ftrace.c          | 5 -----
>  include/linux/ftrace.h            | 1 -
>  kernel/trace/ftrace.c             | 5 +++++
>  16 files changed, 11 insertions(+), 62 deletions(-)
>
> diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
> index 3c83b5d29697..a006585e1c09 100644
> --- a/arch/arm/kernel/ftrace.c
> +++ b/arch/arm/kernel/ftrace.c
> @@ -193,11 +193,6 @@ int ftrace_make_nop(struct module *mod,
>
>         return ret;
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
>  #endif /* CONFIG_DYNAMIC_FTRACE */
>
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> index 7f467bd9db7a..fc62dfe73f93 100644
> --- a/arch/arm64/kernel/ftrace.c
> +++ b/arch/arm64/kernel/ftrace.c
> @@ -236,11 +236,6 @@ void arch_ftrace_update_code(int command)
>         command |= FTRACE_MAY_SLEEP;
>         ftrace_modify_all_code(command);
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
>  #endif /* CONFIG_DYNAMIC_FTRACE */
>
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> diff --git a/arch/csky/kernel/ftrace.c b/arch/csky/kernel/ftrace.c
> index b4a7ec1517ff..50bfcf129078 100644
> --- a/arch/csky/kernel/ftrace.c
> +++ b/arch/csky/kernel/ftrace.c
> @@ -133,11 +133,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
>                                 (unsigned long)func, true, true);
>         return ret;
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
>  #endif /* CONFIG_DYNAMIC_FTRACE */
>
>  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> diff --git a/arch/ia64/kernel/ftrace.c b/arch/ia64/kernel/ftrace.c
> index b2ab2d58fb30..d6360fd404ab 100644
> --- a/arch/ia64/kernel/ftrace.c
> +++ b/arch/ia64/kernel/ftrace.c
> @@ -194,9 +194,3 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
>         flush_icache_range(addr, addr + 16);
>         return 0;
>  }
> -
> -/* run from kstop_machine */
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
> diff --git a/arch/microblaze/kernel/ftrace.c
> b/arch/microblaze/kernel/ftrace.c
> index 224eea40e1ee..188749d62709 100644
> --- a/arch/microblaze/kernel/ftrace.c
> +++ b/arch/microblaze/kernel/ftrace.c
> @@ -163,11 +163,6 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned
> long addr)
>         return ret;
>  }
>
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
> -
>  int ftrace_update_ftrace_func(ftrace_func_t func)
>  {
>         unsigned long ip = (unsigned long)(&ftrace_call);
> diff --git a/arch/mips/include/asm/ftrace.h
> b/arch/mips/include/asm/ftrace.h
> index b463f2aa5a61..ed013e767390 100644
> --- a/arch/mips/include/asm/ftrace.h
> +++ b/arch/mips/include/asm/ftrace.h
> @@ -76,6 +76,8 @@ do {                                          \
>
>
>  #ifdef CONFIG_DYNAMIC_FTRACE
> +int __init ftrace_dyn_arch_init(void);
> +
>  static inline unsigned long ftrace_call_adjust(unsigned long addr)
>  {
>         return addr;
> diff --git a/arch/nds32/kernel/ftrace.c b/arch/nds32/kernel/ftrace.c
> index 0e23e3a8df6b..f0ef4842d191 100644
> --- a/arch/nds32/kernel/ftrace.c
> +++ b/arch/nds32/kernel/ftrace.c
> @@ -84,11 +84,6 @@ void _ftrace_caller(unsigned long parent_ip)
>         /* restore all state needed by the compiler epilogue */
>  }
>
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
> -
>  static unsigned long gen_sethi_insn(unsigned long addr)
>  {
>         unsigned long opcode = 0x46000000;
> diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c
> index 0a1e75af5382..01581f715737 100644
> --- a/arch/parisc/kernel/ftrace.c
> +++ b/arch/parisc/kernel/ftrace.c
> @@ -94,11 +94,6 @@ int ftrace_disable_ftrace_graph_caller(void)
>  #endif
>
>  #ifdef CONFIG_DYNAMIC_FTRACE
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
>  int ftrace_update_ftrace_func(ftrace_func_t func)
>  {
>         return 0;
> diff --git a/arch/powerpc/include/asm/ftrace.h
> b/arch/powerpc/include/asm/ftrace.h
> index debe8c4f7062..4db83cf4283f 100644
> --- a/arch/powerpc/include/asm/ftrace.h
> +++ b/arch/powerpc/include/asm/ftrace.h
> @@ -61,6 +61,10 @@ struct dyn_arch_ftrace {
>  };
>  #endif /* __ASSEMBLY__ */
>
> +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> +int __init ftrace_dyn_arch_init(void);
> +#endif
> +
>

Sorry there is a mistake CONFIG, I will send a v2 patch later.


>  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
>  #define ARCH_SUPPORTS_FTRACE_OPS 1
>  #endif
> diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c
> index 7f1e5203de88..4716f4cdc038 100644
> --- a/arch/riscv/kernel/ftrace.c
> +++ b/arch/riscv/kernel/ftrace.c
> @@ -154,11 +154,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
>
>         return ret;
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
>  #endif
>
>  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
> index 0a464d328467..3fd80397ff52 100644
> --- a/arch/s390/kernel/ftrace.c
> +++ b/arch/s390/kernel/ftrace.c
> @@ -262,11 +262,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
>         return 0;
>  }
>
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
> -
>  void arch_ftrace_update_code(int command)
>  {
>         if (ftrace_shared_hotpatch_trampoline(NULL))
> diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c
> index 295c43315bbe..930001bb8c6a 100644
> --- a/arch/sh/kernel/ftrace.c
> +++ b/arch/sh/kernel/ftrace.c
> @@ -252,11 +252,6 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned
> long addr)
>
>         return ftrace_modify_code(rec->ip, old, new);
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
>  #endif /* CONFIG_DYNAMIC_FTRACE */
>
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> diff --git a/arch/sparc/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c
> index 684b84ce397f..eaead3da8e03 100644
> --- a/arch/sparc/kernel/ftrace.c
> +++ b/arch/sparc/kernel/ftrace.c
> @@ -82,11 +82,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
>         new = ftrace_call_replace(ip, (unsigned long)func);
>         return ftrace_modify_code(ip, old, new);
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
>  #endif
>
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
> index 1b3ce3b4a2a2..23d221a9a3cd 100644
> --- a/arch/x86/kernel/ftrace.c
> +++ b/arch/x86/kernel/ftrace.c
> @@ -252,11 +252,6 @@ void arch_ftrace_update_code(int command)
>         ftrace_modify_all_code(command);
>  }
>
> -int __init ftrace_dyn_arch_init(void)
> -{
> -       return 0;
> -}
> -
>  /* Currently only x86_64 supports dynamic trampolines */
>  #ifdef CONFIG_X86_64
>
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index 832e65f06754..f1eca123d89d 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -573,7 +573,6 @@ ftrace_set_early_filter(struct ftrace_ops *ops, char
> *buf, int enable);
>
>  /* defined in arch */
>  extern int ftrace_ip_converted(unsigned long ip);
> -extern int ftrace_dyn_arch_init(void);
>  extern void ftrace_replace_code(int enable);
>  extern int ftrace_update_ftrace_func(ftrace_func_t func);
>  extern void ftrace_caller(void);
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 7efbc8aaf7f6..4c090323198d 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -6846,6 +6846,11 @@ void __init ftrace_free_init_mem(void)
>         ftrace_free_mem(NULL, start, end);
>  }
>
> +int __init __weak ftrace_dyn_arch_init(void)
> +{
> +       return 0;
> +}
> +
>  void __init ftrace_init(void)
>  {
>         extern unsigned long __start_mcount_loc[];
> --
> 2.30.2
>
>
Thanks.

[-- Attachment #2: Type: text/html, Size: 10327 bytes --]

^ permalink raw reply

* Re: [PATCH -next] powerpc/mm: check base flags in ioremap_prot
From: Michael Ellerman @ 2021-09-04 11:20 UTC (permalink / raw)
  To: Nanyong Sun, Christophe Leroy, benh, paulus, akpm, npiggin,
	christophe.leroy
  Cc: wangkefeng 00584194, linuxppc-dev, linux-kernel
In-Reply-To: <e27f8786-7d43-4191-9b65-5a55a64cf158@huawei.com>

Nanyong Sun <sunnanyong@huawei.com> writes:
> On 2021/9/3 17:16, Christophe Leroy wrote:
>> Le 03/09/2021 à 11:03, Nanyong Sun a écrit :
>>> Some drivers who call ioremap_prot without setting base flags like
>>> ioremap_prot(addr, len, 0) may work well before
>>> commit 56f3c1413f5c ("powerpc/mm: properly set PAGE_KERNEL flags in
>>> ioremap()"), but now they will get a virtual address "successfully"
>>> from ioremap_prot and badly fault on memory access later because that
>>> patch also dropped the hack adding of base flags for ioremap_prot.
>>>
>>> So return NULL and throw a warning if the caller of ioremap_prot did
>>> not set base flags properly. Why not just hack adding PAGE_KERNEL flags
>>> in the ioremap_prot, because most scenarios can be covered by high level
>>> functions like ioremap(), ioremap_coherent(), ioremap_cache()...
>>> so it is better to keep max flexibility for this low level api.
>>
>> As far as I can see, there is no user of this fonction that sets flags 
>> to 0 in the kernel tree.
>>
>> Did you find any ? If you did, I think it is better to fix the caller.
>>
>> Christophe
>>
> I see some vendor's drivers which are not on upstream ...

Sorry, but we don't carry extraneous checks in upstream for the sake of
out-of-tree drivers.

cheers

^ permalink raw reply

* Re: [PATCH] ftrace: Cleanup ftrace_dyn_arch_init()
From: Weizhao Ouyang @ 2021-09-04 11:59 UTC (permalink / raw)
  To: rostedt, mingo
  Cc: dalias, linux-ia64, linux-sh, linux-mips, James.Bottomley, guoren,
	hpa, sparclinux, linux-riscv, deanbo422, will, linux-s390, ysato,
	deller, x86, linux, linux-csky, borntraeger, catalin.marinas, aou,
	gor, hca, bp, green.hu, paul.walmsley, tglx, linux-arm-kernel,
	monstr, tsbogend, linux-parisc, nickhu, linux-kernel, palmer,
	paulus, linuxppc-dev, davem
In-Reply-To: <20210903071817.1162938-1-o451686892@gmail.com>


On 2021/9/3 15:18, Weizhao Ouyang wrote:
> Most ARCHs use empty ftrace_dyn_arch_init(), introduce a weak common
> ftrace_dyn_arch_init() to cleanup them.
>
> Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
> ---
>  arch/arm/kernel/ftrace.c          | 5 -----
>  arch/arm64/kernel/ftrace.c        | 5 -----
>  arch/csky/kernel/ftrace.c         | 5 -----
>  arch/ia64/kernel/ftrace.c         | 6 ------
>  arch/microblaze/kernel/ftrace.c   | 5 -----
>  arch/mips/include/asm/ftrace.h    | 2 ++
>  arch/nds32/kernel/ftrace.c        | 5 -----
>  arch/parisc/kernel/ftrace.c       | 5 -----
>  arch/powerpc/include/asm/ftrace.h | 4 ++++
>  arch/riscv/kernel/ftrace.c        | 5 -----
>  arch/s390/kernel/ftrace.c         | 5 -----
>  arch/sh/kernel/ftrace.c           | 5 -----
>  arch/sparc/kernel/ftrace.c        | 5 -----
>  arch/x86/kernel/ftrace.c          | 5 -----
>  include/linux/ftrace.h            | 1 -
>  kernel/trace/ftrace.c             | 5 +++++
>  16 files changed, 11 insertions(+), 62 deletions(-)
>
> diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
> index 3c83b5d29697..a006585e1c09 100644
> --- a/arch/arm/kernel/ftrace.c
> +++ b/arch/arm/kernel/ftrace.c
> @@ -193,11 +193,6 @@ int ftrace_make_nop(struct module *mod,
>  
>  	return ret;
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
>  #endif /* CONFIG_DYNAMIC_FTRACE */
>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> index 7f467bd9db7a..fc62dfe73f93 100644
> --- a/arch/arm64/kernel/ftrace.c
> +++ b/arch/arm64/kernel/ftrace.c
> @@ -236,11 +236,6 @@ void arch_ftrace_update_code(int command)
>  	command |= FTRACE_MAY_SLEEP;
>  	ftrace_modify_all_code(command);
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
>  #endif /* CONFIG_DYNAMIC_FTRACE */
>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> diff --git a/arch/csky/kernel/ftrace.c b/arch/csky/kernel/ftrace.c
> index b4a7ec1517ff..50bfcf129078 100644
> --- a/arch/csky/kernel/ftrace.c
> +++ b/arch/csky/kernel/ftrace.c
> @@ -133,11 +133,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
>  				(unsigned long)func, true, true);
>  	return ret;
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
>  #endif /* CONFIG_DYNAMIC_FTRACE */
>  
>  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> diff --git a/arch/ia64/kernel/ftrace.c b/arch/ia64/kernel/ftrace.c
> index b2ab2d58fb30..d6360fd404ab 100644
> --- a/arch/ia64/kernel/ftrace.c
> +++ b/arch/ia64/kernel/ftrace.c
> @@ -194,9 +194,3 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
>  	flush_icache_range(addr, addr + 16);
>  	return 0;
>  }
> -
> -/* run from kstop_machine */
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
> diff --git a/arch/microblaze/kernel/ftrace.c b/arch/microblaze/kernel/ftrace.c
> index 224eea40e1ee..188749d62709 100644
> --- a/arch/microblaze/kernel/ftrace.c
> +++ b/arch/microblaze/kernel/ftrace.c
> @@ -163,11 +163,6 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
>  	return ret;
>  }
>  
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
> -
>  int ftrace_update_ftrace_func(ftrace_func_t func)
>  {
>  	unsigned long ip = (unsigned long)(&ftrace_call);
> diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h
> index b463f2aa5a61..ed013e767390 100644
> --- a/arch/mips/include/asm/ftrace.h
> +++ b/arch/mips/include/asm/ftrace.h
> @@ -76,6 +76,8 @@ do {						\
>  
>  
>  #ifdef CONFIG_DYNAMIC_FTRACE
> +int __init ftrace_dyn_arch_init(void);
> +
>  static inline unsigned long ftrace_call_adjust(unsigned long addr)
>  {
>  	return addr;
> diff --git a/arch/nds32/kernel/ftrace.c b/arch/nds32/kernel/ftrace.c
> index 0e23e3a8df6b..f0ef4842d191 100644
> --- a/arch/nds32/kernel/ftrace.c
> +++ b/arch/nds32/kernel/ftrace.c
> @@ -84,11 +84,6 @@ void _ftrace_caller(unsigned long parent_ip)
>  	/* restore all state needed by the compiler epilogue */
>  }
>  
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
> -
>  static unsigned long gen_sethi_insn(unsigned long addr)
>  {
>  	unsigned long opcode = 0x46000000;
> diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c
> index 0a1e75af5382..01581f715737 100644
> --- a/arch/parisc/kernel/ftrace.c
> +++ b/arch/parisc/kernel/ftrace.c
> @@ -94,11 +94,6 @@ int ftrace_disable_ftrace_graph_caller(void)
>  #endif
>  
>  #ifdef CONFIG_DYNAMIC_FTRACE
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
>  int ftrace_update_ftrace_func(ftrace_func_t func)
>  {
>  	return 0;
> diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
> index debe8c4f7062..4db83cf4283f 100644
> --- a/arch/powerpc/include/asm/ftrace.h
> +++ b/arch/powerpc/include/asm/ftrace.h
> @@ -61,6 +61,10 @@ struct dyn_arch_ftrace {
>  };
>  #endif /* __ASSEMBLY__ */
>  
> +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> +int __init ftrace_dyn_arch_init(void);
> +#endif
> +

Sorry there is a mistake CONFIG, I will send a v2 patch later.

>  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
>  #define ARCH_SUPPORTS_FTRACE_OPS 1
>  #endif
> diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c
> index 7f1e5203de88..4716f4cdc038 100644
> --- a/arch/riscv/kernel/ftrace.c
> +++ b/arch/riscv/kernel/ftrace.c
> @@ -154,11 +154,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
>  
>  	return ret;
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
>  #endif
>  
>  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
> index 0a464d328467..3fd80397ff52 100644
> --- a/arch/s390/kernel/ftrace.c
> +++ b/arch/s390/kernel/ftrace.c
> @@ -262,11 +262,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
>  	return 0;
>  }
>  
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
> -
>  void arch_ftrace_update_code(int command)
>  {
>  	if (ftrace_shared_hotpatch_trampoline(NULL))
> diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c
> index 295c43315bbe..930001bb8c6a 100644
> --- a/arch/sh/kernel/ftrace.c
> +++ b/arch/sh/kernel/ftrace.c
> @@ -252,11 +252,6 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
>  
>  	return ftrace_modify_code(rec->ip, old, new);
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
>  #endif /* CONFIG_DYNAMIC_FTRACE */
>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> diff --git a/arch/sparc/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c
> index 684b84ce397f..eaead3da8e03 100644
> --- a/arch/sparc/kernel/ftrace.c
> +++ b/arch/sparc/kernel/ftrace.c
> @@ -82,11 +82,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
>  	new = ftrace_call_replace(ip, (unsigned long)func);
>  	return ftrace_modify_code(ip, old, new);
>  }
> -
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
>  #endif
>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
> index 1b3ce3b4a2a2..23d221a9a3cd 100644
> --- a/arch/x86/kernel/ftrace.c
> +++ b/arch/x86/kernel/ftrace.c
> @@ -252,11 +252,6 @@ void arch_ftrace_update_code(int command)
>  	ftrace_modify_all_code(command);
>  }
>  
> -int __init ftrace_dyn_arch_init(void)
> -{
> -	return 0;
> -}
> -
>  /* Currently only x86_64 supports dynamic trampolines */
>  #ifdef CONFIG_X86_64
>  
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index 832e65f06754..f1eca123d89d 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -573,7 +573,6 @@ ftrace_set_early_filter(struct ftrace_ops *ops, char *buf, int enable);
>  
>  /* defined in arch */
>  extern int ftrace_ip_converted(unsigned long ip);
> -extern int ftrace_dyn_arch_init(void);
>  extern void ftrace_replace_code(int enable);
>  extern int ftrace_update_ftrace_func(ftrace_func_t func);
>  extern void ftrace_caller(void);
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 7efbc8aaf7f6..4c090323198d 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -6846,6 +6846,11 @@ void __init ftrace_free_init_mem(void)
>  	ftrace_free_mem(NULL, start, end);
>  }
>  
> +int __init __weak ftrace_dyn_arch_init(void)
> +{
> +	return 0;
> +}
> +
>  void __init ftrace_init(void)
>  {
>  	extern unsigned long __start_mcount_loc[];

Thanks.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox