diff --git a/drivers/dma/adma-spacemit.c b/drivers/dma/adma-spacemit.c index 1cf54992f232..ac55a0df1b08 100644 --- a/drivers/dma/adma-spacemit.c +++ b/drivers/dma/adma-spacemit.c @@ -610,6 +610,9 @@ static struct platform_driver adma_driver = { .driver = { .name = "k1x-adma", .of_match_table = adma_id_table, +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_FORCE_SYNCHRONOUS, +#endif }, .probe = adma_probe, .remove = adma_remove, @@ -688,6 +691,9 @@ static void rpmsg_adma_client_remove(struct rpmsg_device *rpdev) static struct rpmsg_driver rpmsg_adma_client = { .drv.name = KBUILD_MODNAME, +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .drv.probe_type = PROBE_FORCE_SYNCHRONOUS, +#endif .id_table = rpmsg_driver_adma_id_table, .probe = rpmsg_adma_client_probe, .callback = rpmsg_adma_client_cb, diff --git a/drivers/gpu/drm/spacemit/spacemit_hdmi.c b/drivers/gpu/drm/spacemit/spacemit_hdmi.c index 7531fe51cb45..f14904f079be 100644 --- a/drivers/gpu/drm/spacemit/spacemit_hdmi.c +++ b/drivers/gpu/drm/spacemit/spacemit_hdmi.c @@ -1095,11 +1095,12 @@ struct platform_driver spacemit_hdmi_driver = { .name = "spacemit-hdmi-drv", .of_match_table = spacemit_hdmi_dt_ids, .pm = &hdmi_pm_ops, +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_PREFER_ASYNCHRONOUS, +#endif }, }; -// module_platform_driver(spacemit_hdmi_driver); - static int spacemit_hdmi_driver_init(void) { return platform_driver_register(&spacemit_hdmi_driver); diff --git a/drivers/i2c/busses/i2c-k1x.c b/drivers/i2c/busses/i2c-k1x.c index f1761704f182..6a85118e2906 100644 --- a/drivers/i2c/busses/i2c-k1x.c +++ b/drivers/i2c/busses/i2c-k1x.c @@ -2078,6 +2078,9 @@ static struct platform_driver spacemit_i2c_driver = { .name = "i2c-spacemit-k1x", /* .pm = &spacemit_i2c_pm_ops, */ .of_match_table = spacemit_i2c_dt_match, +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_PREFER_ASYNCHRONOUS, +#endif }, }; @@ -2118,6 +2121,9 @@ static struct platform_driver r_spacemit_i2c_driver = { .name = "ri2c-spacemit-k1x", /* .pm = &spacemit_i2c_pm_ops, */ .of_match_table = r_spacemit_i2c_dt_match, +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_PREFER_ASYNCHRONOUS, +#endif }, }; diff --git a/drivers/media/platform/spacemit/camera/cam_ccic/ccic_drv.c b/drivers/media/platform/spacemit/camera/cam_ccic/ccic_drv.c index 2bcaa1a9f834..b6efdd34659e 100644 --- a/drivers/media/platform/spacemit/camera/cam_ccic/ccic_drv.c +++ b/drivers/media/platform/spacemit/camera/cam_ccic/ccic_drv.c @@ -1264,6 +1264,9 @@ struct platform_driver k1x_ccic_driver = { .driver = { .name = K1X_CCIC_DRV_NAME, .of_match_table = of_match_ptr(k1x_ccic_dt_match), +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_PREFER_ASYNCHRONOUS, +#endif }, .probe = k1x_ccic_probe, .remove = k1x_ccic_remove, diff --git a/drivers/mmc/host/sdhci-of-k1x.c b/drivers/mmc/host/sdhci-of-k1x.c index 1c91e1a73431..604c6599d027 100644 --- a/drivers/mmc/host/sdhci-of-k1x.c +++ b/drivers/mmc/host/sdhci-of-k1x.c @@ -1896,6 +1896,9 @@ static struct platform_driver spacemit_sdhci_driver = { .name = "sdhci-spacemit", .of_match_table = of_match_ptr(sdhci_spacemit_of_match), .pm = SDHCI_SPACEMIT_PMOPS, +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_PREFER_ASYNCHRONOUS, +#endif }, .probe = spacemit_sdhci_probe, .remove_new = spacemit_sdhci_remove, diff --git a/drivers/net/ethernet/spacemit/k1x-emac.c b/drivers/net/ethernet/spacemit/k1x-emac.c index 8932171243b4..935b7267a0a5 100644 --- a/drivers/net/ethernet/spacemit/k1x-emac.c +++ b/drivers/net/ethernet/spacemit/k1x-emac.c @@ -2875,6 +2875,9 @@ static struct platform_driver emac_driver = { .name = DRIVER_NAME, .of_match_table = of_match_ptr(emac_of_match), .pm = &k1x_emac_pm_qos, +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_PREFER_ASYNCHRONOUS, +#endif }, }; diff --git a/drivers/pci/controller/dwc/pcie-k1x.c b/drivers/pci/controller/dwc/pcie-k1x.c index fe1281ad2629..e21284b66ba2 100644 --- a/drivers/pci/controller/dwc/pcie-k1x.c +++ b/drivers/pci/controller/dwc/pcie-k1x.c @@ -1861,11 +1861,21 @@ static const struct dev_pm_ops k1x_pcie_pm_ops = { }; static struct platform_driver k1x_pcie_driver = { +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe = k1x_pcie_probe, +#endif .driver = { .name = "k1x-dwc-pcie", .of_match_table = of_k1x_pcie_match, .suppress_bind_attrs = true, .pm = &k1x_pcie_pm_ops, +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_PREFER_ASYNCHRONOUS, +#endif }, }; +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING +module_platform_driver(k1x_pcie_driver); +#else builtin_platform_driver_probe(k1x_pcie_driver, k1x_pcie_probe); +#endif diff --git a/drivers/remoteproc/k1x-rproc.c b/drivers/remoteproc/k1x-rproc.c index c878912c3f56..f363e7b84cb7 100644 --- a/drivers/remoteproc/k1x-rproc.c +++ b/drivers/remoteproc/k1x-rproc.c @@ -679,6 +679,9 @@ static struct platform_driver spacemit_rproc_driver = { .pm = &spacemit_rproc_pm_ops, #endif .of_match_table = spacemit_rproc_of_match, +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_FORCE_SYNCHRONOUS, +#endif }, }; diff --git a/drivers/tty/serial/pxa_k1x.c b/drivers/tty/serial/pxa_k1x.c index af1d2d0cad70..f84b39260216 100644 --- a/drivers/tty/serial/pxa_k1x.c +++ b/drivers/tty/serial/pxa_k1x.c @@ -2369,6 +2369,9 @@ static struct platform_driver serial_pxa_driver = { #endif .suppress_bind_attrs = true, .of_match_table = serial_pxa_dt_ids, +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_PREFER_ASYNCHRONOUS, +#endif }, }; diff --git a/init/Kconfig b/init/Kconfig index 6054ba684c53..a12dfb072267 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1469,6 +1469,13 @@ menuconfig EXPERT environments which can tolerate a "non-standard" kernel. Only use this if you really know what you are doing. +config SPACEMIT_PARALLEL_BOOTING + bool "Enable SPACEMIT parallel booting of kernel modules" if EXPERT + default n + help + Enable parallel booting of kernel modules under SPACEMIT to improve boot speed. + Enabling this option may cause boot deadlocks in certain conditions. + config UID16 bool "Enable 16-bit UID system calls" if EXPERT depends on HAVE_UID16 && MULTIUSER diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c index 0ec534faf019..270e16fcdd12 100644 --- a/lib/raid6/algos.c +++ b/lib/raid6/algos.c @@ -22,7 +22,11 @@ const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256))); EXPORT_SYMBOL(raid6_empty_zero_page); #endif - +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING +#include +#include +#include +#endif struct raid6_calls raid6_call; EXPORT_SYMBOL_GPL(raid6_call); @@ -289,7 +293,22 @@ static void raid6_exit(void) do { } while (0); } +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING +static void raid6_select_algo_wrapper(void *data, long long unsigned int arg) +{ + raid6_select_algo(); +} + +static int __init raid6_select_algo_async_init(void) +{ + async_schedule(raid6_select_algo_wrapper, NULL); + return 0; +} + +subsys_initcall(raid6_select_algo_async_init); +#else subsys_initcall(raid6_select_algo); +#endif module_exit(raid6_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("RAID6 Q-syndrome calculations"); diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 3feff7f738a4..dee3e96da9d1 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -121,6 +121,9 @@ #include #include +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING +#include +#endif /* The inetsw table contains everything that inet_create needs to * build a new socket. @@ -2080,7 +2083,21 @@ out_unregister_tcp_proto: goto out; } +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING +static void __init inet_init_async(void *data, async_cookie_t cookie) +{ + inet_init(); +} + +static int __init inet_async_init(void) +{ + async_schedule(inet_init_async, NULL); + return 0; +} +subsys_initcall(inet_async_init); +#else fs_initcall(inet_init); +#endif /* ------------------------------------------------------------------------ */ diff --git a/sound/soc/spacemit/spacemit-snd-pcm-dma.c b/sound/soc/spacemit/spacemit-snd-pcm-dma.c index b3be4a60842f..61c7a8d7ae3b 100644 --- a/sound/soc/spacemit/spacemit-snd-pcm-dma.c +++ b/sound/soc/spacemit/spacemit-snd-pcm-dma.c @@ -1382,6 +1382,9 @@ static struct platform_driver spacemit_snd_dma_pdrv = { .driver = { .name = "spacemit-snd-dma", .of_match_table = of_match_ptr(spacemit_snd_dma_ids), +#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING + .probe_type = PROBE_FORCE_SYNCHRONOUS, +#endif }, .probe = spacemit_snd_dma_pdev_probe, .remove = spacemit_snd_dma_pdev_remove,