powerpc/pci: Add ppc_md.discover_phbs()
Subsystems (4)
RFC PATCH 1/18 powerpc/pci: Add ppc_md.discover_phbs()
On many powerpc platforms the discovery and initalisation of pci_controllers (PHBs) happens inside of setup_arch(). This is very early in boot (pre-initcalls) and means that we're initialising the PHB long before many basic kernel services (slab allocator, debugfs, a real ioremap) are available.
On PowerNV this causes an additional problem since we map the PHB registers with ioremap(). As of commit d538aadc2718 ("powerpc/ioremap: warn on early use of ioremap()") a warning is printed because we're using the "incorrect" API to setup and MMIO mapping in searly boot. The kernel does provide early_ioremap(), but that is not intended to create long-lived MMIO mappings and a seperate warning is printed by generic code if early_ioremap() mappings are "leaked."
This is all fixable with dumb hacks like using early_ioremap() to setup the initial mapping then replacing it with a real ioremap later on in boot, but it does raise the question: Why the hell are we setting up the PHB's this early in boot?
The old and wise claim it's due to "hysterical rasins." Aside from amused grapes there doesn't appear to be any real reason to maintain the current behaviour. Already most of the newer embedded platforms perform PHB discovery in an arch_initcall and between the end of setup_arch() and the start of initcalls none of the generic kernel code does anything PCI related. On powerpc scanning PHBs occurs in a subsys_initcall so it should be possible to move the PHB discovery to a core, postcore or arch initcall.
This patch adds the ppc_md.discover_phbs hook and a core_initcall stub that calls it. The core_initcalls are the earliest to be called so this will any possibly issues with dependency between initcalls. This isn't just an academic issue either since on pseries and PowerNV EEH init occurs in an arch_initcall and depends on the pci_controllers being available, similarly the creation of pci_dns occurs at core_initcall_sync (i.e. between core and postcore initcalls). These problems need to be addressed seperately.
--- arch/powerpc/include/asm/machdep.h | 3 +++ arch/powerpc/kernel/pci-common.c | 10 ++++++++++ 2 files changed, 13 insertions(+)
arch/powerpc/include/asm/machdep.h +3 -0
@@ -59,6 +59,9 @@ struct machdep_calls {int (*pcibios_root_bridge_prepare)(struct pci_host_bridge *bridge); +/* finds all the pci_controllers present at boot */ +void (*discover_phbs)(void ); +/* To setup PHBs when using automatic OF platform driver for PCI */ int (*pci_setup_phb)(struct pci_controller *host);
arch/powerpc/kernel/pci-common.c +10 -0
@@ -1625,3 +1625,13 @@ static void fixup_hide_host_resource_fsl(struct pci_dev *dev) }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MOTOROLA ,PCI_ANY_ID , fixup_hide_host_resource_fsl);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_FREESCALE ,PCI_ANY_ID , fixup_hide_host_resource_fsl); + + +int __init discover_phbs (void ) +{ +if (ppc_md.discover_phbs) + ppc_md.discover_phbs (); + +return 0 ; +} +core_initcall (discover_phbs);
Signature · 1 line
2.26.2
RFC PATCH 2/18 powerpc/{powernv,pseries}: Move PHB discovery
Make powernv and pseries use ppc_mc.discover_phbs. These two platforms need to be done together because they both depends on pci_dn's being created from the DT. The pci_dn contains a pointer to the relevant pci_controller so they need to be created after the pci_controller structures are available, but before and before PCI devices are scanned. Currently this ordering is provided by initcalls and the sequence is:
1. PHBs are discovered (setup_arch) (early boot, pre-initcalls)
2. pci_dn are created from the unflattended DT (core initcall)
3. PHBs are scanned pcibios_init() (subsys initcall)
The new ppc_md.discover_phbs() function is also a core_initcall so we can't guarantee ordering between the creations of pci_controllers and the creation of pci_dn's which require a pci_controller. We could use the postcore, or core_sync initcall levels, but it's cleaner to just move the pci_dn setup into the per-PHB inits which occur inside of .discover_phb() for these platforms. This brings the boot-time path in line with the PHB hotplug path that is used for pseries DLPAR operations too.
--- arch/powerpc/kernel/pci_dn.c | 22 ---------------------- arch/powerpc/platforms/powernv/pci-ioda.c | 3 +++ arch/powerpc/platforms/powernv/setup.c | 4 +--- arch/powerpc/platforms/pseries/setup.c | 7 +++++-- 4 files changed, 9 insertions(+), 27 deletions(-)
arch/powerpc/kernel/pci_dn.c +0 -22
@@ -481,28 +481,6 @@ void pci_devs_phb_init_dynamic(struct pci_controller *phb)pci_traverse_device_nodes (dn, add_pdn, phb); } -/** -* pci_devs_phb_init - Initialize phbs and pci devs under them. -* -* This routine walks over all phb's (pci-host bridges) on the -* system, and sets up assorted pci-related structures -* (including pci info in the device node structs) for each -* pci device found underneath. This routine runs once, -* early in the boot sequence. -*/ -static int __init pci_devs_phb_init (void ) -{ -struct pci_controller *phb, *tmp; - -/* This must be done first so the device nodes have valid pci info! */ -list_for_each_entry_safe (phb, tmp, &hose_list, list_node) -pci_devs_phb_init_dynamic (phb); - -return 0 ; -} - -core_initcall (pci_devs_phb_init); -static void pci_dev_pdn_setup (struct pci_dev *pdev) {struct pci_dn *pdn;
arch/powerpc/platforms/powernv/pci-ioda.c +3 -0
@@ -3184,6 +3184,9 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,/* Remove M64 resource if we can't configure it successfully */ if (!phb->init_m64 || phb->init_m64 (phb)) hose->mem_resources[1 ].flags =0 ; + +/* create pci_dn's for DT nodes under this PHB */ +pci_devs_phb_init_dynamic (hose); }void __init pnv_pci_init_ioda2_phb (struct device_node *np)
arch/powerpc/platforms/powernv/setup.c +1 -3
@@ -140,9 +140,6 @@ static void __init pnv_setup_arch(void)/* Initialize SMP */ pnv_smp_init (); -/* Setup PCI */ -pnv_pci_init (); -/* Setup RTC and NVRAM callbacks */ if (firmware_has_feature (FW_FEATURE_OPAL ))opal_nvram_init ();
@@ -500,6 +497,7 @@ define_machine(powernv) { .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,
arch/powerpc/platforms/pseries/setup.c +5 -2
@@ -463,7 +463,7 @@ void pseries_little_endian_exceptions(void) }#endif -static void __init find_and_init_phbs (void ) +static void __init pSeries_discover_phbs (void ) {struct device_node *node;struct pci_controller *phb;
@@ -481,6 +481,9 @@ static void __init find_and_init_phbs(void)pci_process_bridge_OF_ranges (phb, node,0 );isa_bridge_find_early (phb); phb->controller_ops = pseries_pci_controller_ops; + +/* create pci_dn's for DT nodes under this PHB */ +pci_devs_phb_init_dynamic (phb); }of_node_put (root);
@@ -771,7 +774,6 @@ static void __init pSeries_setup_arch(void)/* Find and initialize PCI host bridges */ init_pci_config_tokens (); -find_and_init_phbs ();of_reconfig_notifier_register (&pci_dn_reconfig_nb);pSeries_nvram_init ();
@@ -1035,6 +1037,7 @@ define_machine(pseries) { .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,
Signature · 1 line
2.26.2
RFC PATCH 3/18 powerpc/maple: Move PHB discovery
In reply to Oliver O'Halloran--- arch/powerpc/platforms/maple/setup.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/platforms/maple/setup.c +1 -3
@@ -179,9 +179,6 @@ static void __init maple_setup_arch(void)#ifdef CONFIG_SMP smp_ops = &maple_smp_ops;#endif -/* Lookup PCI hosts */ -maple_pci_init (); -maple_use_rtas_reboot_and_halt_if_present ();printk (KERN_DEBUG "Using native/NAP idle loop\n" );
@@ -351,6 +348,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 4/18 powerpc/512x: Move PHB discovery
In reply to Oliver O'Halloran---
only compile tested
--- arch/powerpc/platforms/512x/mpc5121_ads.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/powerpc/platforms/512x/mpc5121_ads.c +8 -5
@@ -24,21 +24,23 @@static void __init mpc5121_ads_setup_arch (void ) { -#ifdef CONFIG_PCI -struct device_node *np; -#endif printk (KERN_INFO "MPC5121 ADS board from Freescale Semiconductor\n" );/* * cpld regs are needed early */ mpc5121_ads_cpld_map (); +mpc512x_setup_arch (); +} + +static void __init mpc5121_ads_setup_pci (void ) +{#ifdef CONFIG_PCI +struct device_node *np; +for_each_compatible_node (np,"pci" ,"fsl,mpc5121-pci" )mpc83xx_add_bridge (np);#endif - -mpc512x_setup_arch (); }static void __init mpc5121_ads_init_IRQ (void )
@@ -64,6 +66,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 5/18 powerpc/52xx/efika: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with mpc5200_defconfig
--- arch/powerpc/platforms/52xx/efika.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/platforms/52xx/efika.c +1 -2
@@ -185,8 +185,6 @@ static void __init efika_setup_arch(void)/* Map important registers from the internal memory map */ mpc52xx_map_common_devices (); -efika_pcisetup (); -#ifdef CONFIG_PM mpc52xx_suspend.board_suspend_prepare = efika_suspend_prepare;mpc52xx_pm_init ();
@@ -218,6 +216,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 6/18 powerpc/52xx/lite5200: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with 52xx/lite5200b_defconfig
--- arch/powerpc/platforms/52xx/lite5200.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/platforms/52xx/lite5200.c +1 -2
@@ -165,8 +165,6 @@ static void __init lite5200_setup_arch(void) mpc52xx_suspend.board_resume_finish = lite5200_resume_finish;lite5200_pm_init ();#endif - -mpc52xx_setup_pci (); }static const char *const board[]__initconst = {
@@ -187,6 +185,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 7/18 powerpc/52xx/media5200: Move PHB discovery
In reply to Oliver O'Halloran--- arch/powerpc/platforms/52xx/media5200.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/platforms/52xx/media5200.c +1 -2
@@ -202,8 +202,6 @@ static void __init media5200_setup_arch(void)/* Some mpc5200 & mpc5200b related configuration */ mpc5200_setup_xlb_arbiter (); -mpc52xx_setup_pci (); - np =of_find_matching_node (NULL , mpc5200_gpio_ids); gpio =of_iomap (np,0 );of_node_put (np);
@@ -244,6 +242,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 8/18 powerpc/52xx/mpc5200_simple: Move PHB discovery
In reply to Oliver O'Halloran--- arch/powerpc/platforms/52xx/mpc5200_simple.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/platforms/52xx/mpc5200_simple.c +1 -2
@@ -40,8 +40,6 @@ static void __init mpc5200_simple_setup_arch(void)/* Some mpc5200 & mpc5200b related configuration */ mpc5200_setup_xlb_arbiter (); - -mpc52xx_setup_pci (); }/* list of the supported boards */
@@ -73,6 +71,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 9/18 powerpc/82xx/*: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with pq2fads_defconfig
--- arch/powerpc/platforms/82xx/mpc8272_ads.c | 2 +- arch/powerpc/platforms/82xx/pq2fads.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
arch/powerpc/platforms/82xx/mpc8272_ads.c +1 -1
@@ -171,7 +171,6 @@ static void __init mpc8272_ads_setup_arch(void)iounmap (bcsr);init_ioports (); -pq2_init_pci ();if (ppc_md.progress) ppc_md.progress ("mpc8272_ads_setup_arch(), finish" ,0 );
@@ -205,6 +204,7 @@ 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,
arch/powerpc/platforms/82xx/pq2fads.c +1 -2
@@ -150,8 +150,6 @@ static void __init pq2fads_setup_arch(void)/* Enable external IRQs */ clrbits32 (&cpm2_immr->im_siu_conf.siu_82xx.sc_siumcr,0x0c000000 ); -pq2_init_pci (); -if (ppc_md.progress) ppc_md.progress ("pq2fads_setup_arch(), finish" ,0 ); }
@@ -184,6 +182,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 10/18 powerpc/83xx: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with mpc83xx_defconfig
--- arch/powerpc/platforms/83xx/asp834x.c | 1 + arch/powerpc/platforms/83xx/km83xx.c | 1 + arch/powerpc/platforms/83xx/misc.c | 2 -- arch/powerpc/platforms/83xx/mpc830x_rdb.c | 1 + arch/powerpc/platforms/83xx/mpc831x_rdb.c | 1 + arch/powerpc/platforms/83xx/mpc832x_mds.c | 1 + arch/powerpc/platforms/83xx/mpc832x_rdb.c | 1 + arch/powerpc/platforms/83xx/mpc834x_itx.c | 1 + arch/powerpc/platforms/83xx/mpc834x_mds.c | 1 + arch/powerpc/platforms/83xx/mpc836x_mds.c | 1 + arch/powerpc/platforms/83xx/mpc836x_rdk.c | 1 + arch/powerpc/platforms/83xx/mpc837x_mds.c | 1 + arch/powerpc/platforms/83xx/mpc837x_rdb.c | 1 + 13 files changed, 12 insertions(+), 2 deletions(-)
arch/powerpc/platforms/83xx/asp834x.c +1 -0
@@ -44,6 +44,7 @@ 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,
arch/powerpc/platforms/83xx/km83xx.c +1 -0
@@ -180,6 +180,7 @@ 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,
arch/powerpc/platforms/83xx/misc.c +0 -2
@@ -132,8 +132,6 @@ void __init mpc83xx_setup_arch(void)setbat (-1 , va, immrbase, immrsize,PAGE_KERNEL_NCG );update_bats (); } - -mpc83xx_setup_pci (); }int machine_check_83xx (struct pt_regs *regs)
arch/powerpc/platforms/83xx/mpc830x_rdb.c +1 -0
@@ -48,6 +48,7 @@ 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,
arch/powerpc/platforms/83xx/mpc831x_rdb.c +1 -0
@@ -48,6 +48,7 @@ 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,
arch/powerpc/platforms/83xx/mpc832x_mds.c +1 -0
@@ -101,6 +101,7 @@ define_machine(mpc832x_mds) { .name = "MPC832x MDS", .probe = mpc832x_sys_probe, .setup_arch = mpc832x_sys_setup_arch, + .discover_phbs = mpc83xx_setup_pci, .init_IRQ = mpc83xx_ipic_init_IRQ, .get_irq = ipic_get_irq, .restart = mpc83xx_restart,
arch/powerpc/platforms/83xx/mpc832x_rdb.c +1 -0
@@ -219,6 +219,7 @@ 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,
arch/powerpc/platforms/83xx/mpc834x_itx.c +1 -0
@@ -70,6 +70,7 @@ 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,
arch/powerpc/platforms/83xx/mpc834x_mds.c +1 -0
@@ -91,6 +91,7 @@ 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,
arch/powerpc/platforms/83xx/mpc836x_mds.c +1 -0
@@ -201,6 +201,7 @@ 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,
arch/powerpc/platforms/83xx/mpc836x_rdk.c +1 -0
@@ -41,6 +41,7 @@ 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,
arch/powerpc/platforms/83xx/mpc837x_mds.c +1 -0
@@ -93,6 +93,7 @@ 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,
arch/powerpc/platforms/83xx/mpc837x_rdb.c +1 -0
@@ -73,6 +73,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 11/18 powerpc/amigaone: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with amigaone_defconfig
--- arch/powerpc/platforms/amigaone/setup.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/powerpc/platforms/amigaone/setup.c +7 -3
@@ -65,6 +65,12 @@ static int __init amigaone_add_bridge(struct device_node *dev) }void __init amigaone_setup_arch (void ) +{ +if (ppc_md.progress) + ppc_md.progress ("Linux/PPC " UTS_RELEASE "\n" ,0 ); +} + +void __init amigaone_discover_phbs (void ) {struct device_node *np;int phb = -ENODEV ;
@@ -74,9 +80,6 @@ void __init amigaone_setup_arch(void) phb =amigaone_add_bridge (np);BUG_ON (phb !=0 ); - -if (ppc_md.progress) - ppc_md.progress ("Linux/PPC " UTS_RELEASE "\n" ,0 ); }void __init amigaone_init_IRQ (void )
@@ -159,6 +162,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 12/18 powerpc/chrp: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with chrp32_defconfig
--- arch/powerpc/platforms/chrp/pci.c | 8 ++++++++ arch/powerpc/platforms/chrp/setup.c | 12 +----------- 2 files changed, 9 insertions(+), 11 deletions(-)
arch/powerpc/platforms/chrp/pci.c +8 -0
@@ -314,6 +314,14 @@ chrp_find_bridges(void) } }of_node_put (root); + +/* +* "Temporary" fixes for PCI devices. +* -- Geert +*/ +hydra_init ();/* Mac I/O */ + +pci_create_OF_bus_map (); }/* SL82C105 IDE Control/Status Register */
arch/powerpc/platforms/chrp/setup.c +1 -11
@@ -334,22 +334,11 @@ static void __init chrp_setup_arch(void)/* On pegasos, enable the L2 cache if not already done by OF */ pegasos_set_l2cr (); -/* Lookup PCI host bridges */ -chrp_find_bridges (); - -/* -* Temporary fixes for PCI devices. -* -- Geert -*/ -hydra_init ();/* Mac I/O */ -/* * Fix the Super I/O configuration */ sio_init (); -pci_create_OF_bus_map (); -/* * Print the banner, then scroll down so boot progress * can be printed. -- Cort
@@ -582,6 +571,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 13/18 powerpc/embedded6xx/holly: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with holly_defconfig
--- arch/powerpc/platforms/embedded6xx/holly.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/powerpc/platforms/embedded6xx/holly.c +7 -3
@@ -108,15 +108,13 @@ static void holly_remap_bridge(void)tsi108_write_reg (TSI108_PCI_P2O_BAR2 ,0x0 ); } -static void __init holly_setup_arch (void ) +static void __init holly_init_pci (void ) {struct device_node *np;if (ppc_md.progress) ppc_md.progress ("holly_setup_arch():set_bridge" ,0 ); - tsi108_csr_vir_base =get_vir_csrbase (); -/* setup PCI host bridge */ holly_remap_bridge ();
@@ -127,6 +125,11 @@ static void __init holly_setup_arch(void) ppc_md.pci_exclude_device = holly_exclude_device;if (ppc_md.progress) ppc_md.progress ("tsi108: resources set" ,0x100 ); +} + +static void __init holly_setup_arch (void ) +{ + tsi108_csr_vir_base =get_vir_csrbase ();printk (KERN_INFO "PPC750GX/CL Platform\n" ); }
@@ -259,6 +262,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 14/18 powerpc/embedded6xx/linkstation: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with linkstation_defconfig
--- arch/powerpc/platforms/embedded6xx/linkstation.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/powerpc/platforms/embedded6xx/linkstation.c +7 -3
@@ -63,15 +63,18 @@ static int __init linkstation_add_bridge(struct device_node *dev) }static void __init linkstation_setup_arch (void ) +{ +printk (KERN_INFO "BUFFALO Network Attached Storage Series\n" ); +printk (KERN_INFO "(C) 2002-2005 BUFFALO INC.\n" ); +} + +static void __init linkstation_setup_pci (void ) {struct device_node *np;/* Lookup PCI host bridges */ for_each_compatible_node (np,"pci" ,"mpc10x-pci" )linkstation_add_bridge (np); - -printk (KERN_INFO "BUFFALO Network Attached Storage Series\n" ); -printk (KERN_INFO "(C) 2002-2005 BUFFALO INC.\n" ); }/*
@@ -153,6 +156,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 15/18 powerpc/embedded6xx/mpc7448: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with mpc7448_hpc2_defconfig
--- arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c +9 -5
@@ -58,16 +58,14 @@ int mpc7448_hpc2_exclude_device(struct pci_controller *hose,return PCIBIOS_SUCCESSFUL ; } -static void __init mpc7448_hpc2_setup_arch (void ) +static void __init mpc7448_hpc2_setup_pci (void ) { +#ifdef CONFIG_PCI struct device_node *np;if (ppc_md.progress) - ppc_md.progress ("mpc7448_hpc2_setup_arch():set_bridge" ,0 ); - - tsi108_csr_vir_base =get_vir_csrbase (); + ppc_md.progress ("mpc7448_hpc2_setup_pci():set_bridge" ,0 );/* setup PCI host bridge */ -#ifdef CONFIG_PCI for_each_compatible_node (np,"pci" ,"tsi108-pci" )tsi108_setup_pci (np,MPC7448HPC2_PCI_CFG_PHYS ,0 );
@@ -75,6 +73,11 @@ static void __init mpc7448_hpc2_setup_arch(void)if (ppc_md.progress) ppc_md.progress ("tsi108: resources set" ,0x100 );#endif +} + +static void __init mpc7448_hpc2_setup_arch (void ) +{ + tsi108_csr_vir_base =get_vir_csrbase ();printk (KERN_INFO "MPC7448HPC2 (TAIGA) Platform\n" ); printk(KERN_INFO
@@ -180,6 +183,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 16/18 powerpc/embedded6xx/mve5100: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with mvme5100_defconfig
--- arch/powerpc/platforms/embedded6xx/mvme5100.c | 13 ++++++++----- arch/powerpc/platforms/embedded6xx/storcenter.c | 8 ++++++-- 2 files changed, 14 insertions(+), 7 deletions(-)
arch/powerpc/platforms/embedded6xx/mvme5100.c +8 -5
@@ -154,17 +154,19 @@ static const struct of_device_id mvme5100_of_bus_ids[] __initconst = {*/ static void __init mvme5100_setup_arch (void ) { -struct device_node *np; -if (ppc_md.progress) ppc_md.progress ("mvme5100_setup_arch()" ,0 ); -for_each_compatible_node (np,"pci" ,"hawk-pci" ) -mvme5100_add_bridge (np); - restart =ioremap (BOARD_MODRST_REG ,4 ); } +static void __init mvme5100_setup_pci (void ) +{ +struct device_node *np; + +for_each_compatible_node (np,"pci" ,"hawk-pci" ) +mvme5100_add_bridge (np); +}static void mvme5100_show_cpuinfo (struct seq_file *m) {
@@ -205,6 +207,7 @@ 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,
arch/powerpc/platforms/embedded6xx/storcenter.c +6 -2
@@ -65,14 +65,17 @@ static int __init storcenter_add_bridge(struct device_node *dev) }static void __init storcenter_setup_arch (void ) +{ +printk (KERN_INFO "IOMEGA StorCenter\n" ); +} + +static void __init storcenter_setup_pci (void ) {struct device_node *np;/* Lookup PCI host bridges */ for_each_compatible_node (np,"pci" ,"mpc10x-pci" )storcenter_add_bridge (np); - -printk (KERN_INFO "IOMEGA StorCenter\n" ); }/*
@@ -116,6 +119,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 17/18 powerpc/pasemi: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with pasemi_defconfig
--- arch/powerpc/platforms/pasemi/setup.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/platforms/pasemi/setup.c +1 -2
@@ -144,8 +144,6 @@ static void __init pas_setup_arch(void)/* Setup SMP callback */ smp_ops = &pas_smp_ops;#endif -/* Lookup PCI hosts */ -pas_pci_init ();/* Remap SDC register for doing reset */ /* XXXOJN This should maybe come out of the device tree */
@@ -446,6 +444,7 @@ 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,
Signature · 1 line
2.26.2
RFC PATCH 18/18 powerpc/powermac: Move PHB discovery
In reply to Oliver O'Halloran---
compile tested with pmac32_defconfig and g5_defconfig
--- arch/powerpc/platforms/powermac/setup.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/platforms/powermac/setup.c +1 -3
@@ -298,9 +298,6 @@ static void __init pmac_setup_arch(void)of_node_put (ic); } -/* Lookup PCI hosts */ -pmac_pci_init (); -#ifdef CONFIG_PPC32 ohare_init ();l2cr_init ();
@@ -600,6 +597,7 @@ 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 */
Signature · 1 line
2.26.2
Re: [RFC PATCH 18/18] powerpc/powermac: Move PHB discovery
Le 24/09/2020 à 08:38, Oliver O'Halloran a écrit :
Quoted 1 line
Signed-off-by Oliver O'Halloran <[email protected]>
This series is a really good step forward to the elimination of early support for ioremap(), thanks.
Tested with pmac32_defconfig on QEMU MAC99.
Before the series we have 9000 kbytes mapped as early ioremap
ioremap() called early from pmac_feature_init+0xc8/0xac8. Use early_ioremap() instead ioremap() called early from probe_one_macio+0x170/0x2a8. Use early_ioremap() instead ioremap() called early from udbg_scc_init+0x1d8/0x494. Use early_ioremap() instead ioremap() called early from find_via_cuda+0xa8/0x3f8. Use early_ioremap() instead ioremap() called early from pmac_pci_init+0x214/0x778. Use early_ioremap() instead ioremap() called early from pmac_pci_init+0x228/0x778. Use early_ioremap() instead ioremap() called early from pci_process_bridge_OF_ranges+0x158/0x2d0. Use early_ioremap() instead ioremap() called early from pmac_setup_arch+0x110/0x298. Use early_ioremap() instead ioremap() called early from pmac_nvram_init+0x144/0x534. Use early_ioremap() instead
* 0xfeb36000..0xff400000 : early ioremap
* 0xf1000000..0xfeb36000 : vmalloc & ioremap
After the series we have 800 kbytes mapped as early ioremap
ioremap() called early from pmac_feature_init+0xc8/0xac8. Use early_ioremap() instead ioremap() called early from probe_one_macio+0x170/0x2a8. Use early_ioremap() instead ioremap() called early from udbg_scc_init+0x1d8/0x494. Use early_ioremap() instead ioremap() called early from find_via_cuda+0xa8/0x3f8. Use early_ioremap() instead ioremap() called early from pmac_setup_arch+0x10c/0x294. Use early_ioremap() instead ioremap() called early from pmac_nvram_init+0x144/0x534. Use early_ioremap() instead
* 0xff338000..0xff400000 : early ioremap
* 0xf1000000..0xff338000 : vmalloc & ioremap
Christophe
Quoted 29 lines
---
compile tested withpmac32_defconfigandg5_defconfig--- arch/powerpc/platforms/powermac/setup.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)arch/powerpc/platforms/powermac/setup.c +1
-3@@ -298,9 +298,6 @@ static void __init pmac_setup_arch(void)of_node_put (ic); } -/* Lookup PCI hosts */ -pmac_pci_init (); -#ifdef CONFIG_PPC32 ohare_init ();l2cr_init ();@@ -600,6 +597,7 @@ 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 */
kernel test robot
build bot[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]
Hi Oliver,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.9-rc6 next-20200924]
[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/Oliver-O-Halloran/powerpc-pci-Add-ppc_md-discover_phbs/20200924-151251 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-allmodconfig (attached as .config) compiler: powerpc64-linux-gcc (GCC) 9.3.0
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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> arch/powerpc/kernel/pci-common.c:1744:12: warning: no previous prototype for 'discover_phbs' [-Wmissing-prototypes]
1744 | int __init discover_phbs(void)
| ^~~~~~~~~~~~~# https://github.com/0day-ci/linux/commit/57c22970d6b7bfd937d227edb679716d0dba60de
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Oliver-O-Halloran/powerpc-pci-Add-ppc_md-discover_phbs/20200924-151251 git checkout 57c22970d6b7bfd937d227edb679716d0dba60de
vim +/discover_phbs +1744 arch/powerpc/kernel/pci-common.c
1742
1743
> 1744 int __init discover_phbs(void)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build bot[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]
Hi Oliver,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.9-rc7 next-20200925]
[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/Oliver-O-Halloran/powerpc-pci-Add-ppc_md-discover_phbs/20200924-151251 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-randconfig-r022-20200928 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 6d374cf78c8a80a0bbfc7ce9bc80b3f183f44c80)
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
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/0day-ci/linux/commit/57c22970d6b7bfd937d227edb679716d0dba60de
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Oliver-O-Halloran/powerpc-pci-Add-ppc_md-discover_phbs/20200924-151251 git checkout 57c22970d6b7bfd937d227edb679716d0dba60de
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> arch/powerpc/kernel/pci-common.c:1744:12: warning: no previous prototype for function 'discover_phbs' [-Wmissing-prototypes]
int __init discover_phbs(void)
^ arch/powerpc/kernel/pci-common.c:1744:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __init discover_phbs(void)
^
static
1 warning generated.
vim +/discover_phbs +1744 arch/powerpc/kernel/pci-common.c
1742
1743
> 1744 int __init discover_phbs(void)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org