SMP support for Armada 375 and 38x
Subsystems (5)
v3 cover SMP support for Armada 375 and 38x
Jason, Andrew, Gregory, Sebastian,
This patch series adds SMP support for the Armada 375 and 38x. Read the bottom of the e-mail for details about the patches. Note that this patch series applies on *top* of the 375/38x coherency and PMSU rework series.
Changes since v2:
* Rebased on top of v3.15-rc1. From my side, the patches are ready to apply, so unless review comments are made, I will not resend a new version of this patch series.
Changes since v1:
* Use the CPU_METHOD_OF_DECLARE() and the enable-method DT property to associate SoCs and the SMP implementation. This avoids the need for a .smp_ops field in DT_MACHINE_START. Note that the .smp_ops field is avoided on Armada 375 and 38x, but is kept on Armada XP in order to remain compatible with old Device Trees.
* Remove the cpu-reset changes for Armada 375 and Armada 38x, since we now have a single compatible string to cover all SOCs.
This branch is also available at:
https://github.com/MISL-EBU-System-SW/mainline-public/tree/3.15-mvebu/smp
Most of the patches are fairly straight-forward, but here is a short overview of what's going on:
* Patches 1 to 5 make some preparatory clean-ups in the Armada XP SMP support.
* Patches 6 and 7 add a few bits needed for the SMP support of Armada 375 and 38x.
* Patch 8 is adding the SMP support itself. Since both Armada 375 and 38x are Cortex-A9, their SMP logic is fairly similar, the only difference being how to define the boot address of the secondary CPU. Therefore, we've used a single smp_operations implementation.
* Patch 9 add a workaround for a SMP booting bug affecting Armada 375 Z1 stepping. It requires using the Crypto SRAM loaded with a few instructions of code as a replacement of the BootROM for booting the secondary processor. For now, the workaround is unconditionally applied on all Armada 375 platforms, but as soon as we get access to more recent platforms, we'll add a mvebu-soc-id based test to only enable the workaround if needed.
* Patch 10 and 11 add the necessary Device Tree bits to enable SMP on Armada 375 and 38x.
In terms of dependencies, we will have 4 interconnected patch series:
Armada 375/38x coherency support, the PMSU rework series, the cpuidle series, and this Armada 375/38x SMP support series. The relations are as follows
--------------- ---------------------
| pmsu-rework | | 375/38x coherency |
--------------- ---------------------
|| || ||
|| \\____________ ||
\/ \/ \/
--------------- ---------------
| cpuidle | | 375/38x SMP |
--------------- ---------------In other words, this 375/38x SMP support series needs *both* the 375/38x coherency patch series to be applied, and the pmsu-rework to be applied.
If needed, I can merge the 375/38x coherency and 375/38x SMP support together, but I believe shorter patch series are easier to review. Just let me know what works best for you.
Thanks!
Thomas
Gregory CLEMENT (4):
ARM: mvebu: add function to set the resume boot address for Armada 375
ARM: mvebu: add SMP support for Armada 375 and Armada 38x
ARM: mvebu: add workaround for SMP support for Armada 375 stepping Z1
ARM: mvebu: add SMP support in the Armada 375 device tree
Thomas Petazzoni (7):
ARM: mvebu: move Armada XP specific SMP initialization to platsmp.c
ARM: mvebu: use CPU_METHOD_OF_DECLARE for SMP on Armada XP
ARM: mvebu: add enable-method property for CPUs
irqchip: irq-armada-370-xp: do the set_smp_cross_call() in the driver
irqchip: irq-armada-370-xp: use cpu notifier to initialize secondary
CPUs
ARM: mvebu: add Armada 38x compatible string to pmsu
ARM: mvebu: add SMP support in the Armada 38x device tree
.../devicetree/bindings/arm/armada-370-xp-pmsu.txt | 9 +- Documentation/devicetree/bindings/arm/cpus.txt | 3 + arch/arm/boot/dts/armada-375.dtsi | 7 ++ arch/arm/boot/dts/armada-380.dtsi | 2 + arch/arm/boot/dts/armada-385.dtsi | 2 + arch/arm/boot/dts/armada-38x.dtsi | 10 +++ arch/arm/boot/dts/armada-xp-mv78230.dtsi | 1 + arch/arm/boot/dts/armada-xp-mv78260.dtsi | 1 + arch/arm/boot/dts/armada-xp-mv78460.dtsi | 1 + arch/arm/mach-mvebu/Kconfig | 4 + arch/arm/mach-mvebu/Makefile | 2 +- arch/arm/mach-mvebu/armada-370-xp.h | 2 - arch/arm/mach-mvebu/common.h | 2 + arch/arm/mach-mvebu/headsmp-a9.S | 34 +++++++ arch/arm/mach-mvebu/platsmp-a9.c | 100 +++++++++++++++++++++ arch/arm/mach-mvebu/platsmp.c | 21 +++-- arch/arm/mach-mvebu/pmsu.c | 27 +----- arch/arm/mach-mvebu/system-controller.c | 15 +++- drivers/irqchip/irq-armada-370-xp.c | 24 ++++- 19 files changed, 224 insertions(+), 43 deletions(-) create mode 100644 arch/arm/mach-mvebu/headsmp-a9.S create mode 100644 arch/arm/mach-mvebu/platsmp-a9.c
Signature · 1 line
1.8.3.2
PATCH v3 1/11 ARM: mvebu: move Armada XP specific SMP initialization to platsmp.c
The pmsu.c driver contained an armada_xp_boot_cpu() function that sets the boot address of a secondary CPUs and deasserts the reset. However, the Armada 375 needs a slightly different logic, so it makes more sense to move this code into the Armada XP specific platsmp.c.
In order to achieve this, the mvebu_pmsu_set_cpu_boot_addr() function is exported. It will be needed for both the Armada XP and Armada 38x SMP implementations.
--- arch/arm/mach-mvebu/common.h | 1 + arch/arm/mach-mvebu/platsmp.c | 10 +++++++++- arch/arm/mach-mvebu/pmsu.c | 26 +------------------------- 3 files changed, 11 insertions(+), 26 deletions(-)
arch/arm/mach-mvebu/common.h +1 -0
@@ -19,6 +19,7 @@void mvebu_restart (enum reboot_mode mode,const char *cmd);int mvebu_cpu_reset_deassert (int cpu); +void mvebu_pmsu_set_cpu_boot_addr (int hw_cpu,void *boot_addr);void armada_xp_cpu_die (unsigned int cpu);
arch/arm/mach-mvebu/platsmp.c +9 -1
@@ -77,9 +77,17 @@ static void armada_xp_secondary_init(unsigned int cpu)static int armada_xp_boot_secondary (unsigned int cpu,struct task_struct *idle) { +int ret, hw_cpu; +pr_info ("Booting CPU %d\n" , cpu); -armada_xp_boot_cpu (cpu, armada_xp_secondary_startup); + hw_cpu =cpu_logical_map (cpu); +mvebu_pmsu_set_cpu_boot_addr (hw_cpu, armada_xp_secondary_startup); + ret =mvebu_cpu_reset_deassert (hw_cpu); +if (ret) { +pr_warn ("unable to boot CPU: %d\n" , ret); +return ret; + }return 0 ; }
arch/arm/mach-mvebu/pmsu.c +1 -25
@@ -41,36 +41,12 @@ static struct of_device_id of_pmsu_table[] = { { /* end of list */ }, }; -static void mvebu_pmsu_set_cpu_boot_addr (int hw_cpu,void *boot_addr) +void mvebu_pmsu_set_cpu_boot_addr (int hw_cpu,void *boot_addr) {writel (virt_to_phys (boot_addr), pmsu_mp_base +PMSU_BOOT_ADDR_REDIRECT_OFFSET (hw_cpu)); } -#ifdef CONFIG_SMP -int armada_xp_boot_cpu (unsigned int cpu_id,void *boot_addr) -{ -int hw_cpu, ret; - -if (!pmsu_mp_base) { -pr_warn ("Can't boot CPU. PMSU is uninitialized\n" ); -return -ENODEV ; - } - - hw_cpu =cpu_logical_map (cpu_id); - -mvebu_pmsu_set_cpu_boot_addr (hw_cpu, boot_addr); - - ret =mvebu_cpu_reset_deassert (hw_cpu); -if (ret) { -pr_warn ("unable to boot CPU: %d\n" , ret); -return ret; - } - -return 0 ; -} -#endif -static int __init armada_370_xp_pmsu_init (void ) {struct device_node *np;
Signature · 1 line
1.8.3.2
PATCH v3 2/11 ARM: mvebu: use CPU_METHOD_OF_DECLARE for SMP on Armada XP
In reply to Thomas PetazzoniThis commit adds the CPU_METHOD_OF_DECLARE declaration for the Armada XP SMP operations. Note that the .smp_ops field of Armada XP DT_MACHINE structure is kept, in order to ensure we remain compatible with older Device Trees that do not include the "enable-method" property for the CPUs.
--- Documentation/devicetree/bindings/arm/cpus.txt | 1 + arch/arm/mach-mvebu/platsmp.c | 3 +++ 2 files changed, 4 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +1 -0
@@ -185,6 +185,7 @@ nodes to be present and contain the properties described below. "qcom,gcc-msm8660" "qcom,kpss-acc-v1" "qcom,kpss-acc-v2" + "marvell,armada-xp-smp" - cpu-release-addr Usage: required for systems that have an "enable-method"
arch/arm/mach-mvebu/platsmp.c +3 -0
@@ -138,3 +138,6 @@ struct smp_operations armada_xp_smp_ops __initdata = { .cpu_die = armada_xp_cpu_die,#endif }; + +CPU_METHOD_OF_DECLARE (armada_xp_smp,"marvell,armada-xp-smp" , + &armada_xp_smp_ops);
Signature · 1 line
1.8.3.2
PATCH v3 3/11 ARM: mvebu: add enable-method property for CPUs
In reply to Thomas PetazzoniThis commit updates the Armada XP Device Trees (for the three variants of Armada XP) to declare the "enable-method" property for the CPUs, which helps operating systems find the appropriate logic to manage the CPUs, especially to boot secondary CPUs.
--- arch/arm/boot/dts/armada-xp-mv78230.dtsi | 1 + arch/arm/boot/dts/armada-xp-mv78260.dtsi | 1 + arch/arm/boot/dts/armada-xp-mv78460.dtsi | 1 + 3 files changed, 3 insertions(+)
arch/arm/boot/dts/armada-xp-mv78230.dtsi +1 -0
@@ -27,6 +27,7 @@ cpus { #address-cells = <1>; #size-cells = <0>; + enable-method = "marvell,armada-xp-smp"; cpu at 0 { device_type = "cpu";
arch/arm/boot/dts/armada-xp-mv78260.dtsi +1 -0
@@ -29,6 +29,7 @@ cpus { #address-cells = <1>; #size-cells = <0>; + enable-method = "marvell,armada-xp-smp"; cpu at 0 { device_type = "cpu";
arch/arm/boot/dts/armada-xp-mv78460.dtsi +1 -0
@@ -30,6 +30,7 @@ cpus { #address-cells = <1>; #size-cells = <0>; + enable-method = "marvell,armada-xp-smp"; cpu at 0 { device_type = "cpu";
Signature · 1 line
1.8.3.2
PATCH v3 4/11 irqchip: irq-armada-370-xp: do the set_smp_cross_call() in the driver
In reply to Thomas PetazzoniInstead of having the SoC code in arch/arm/mach-mvebu/platsmp.c do the set_smp_cross_call() to register the IPI-triggering function, it makes more sense to do exactly what the GIC driver is doing: let the irqchip driver do it. This way, it avoids having to expose the armada_mpic_send_doorbell() function between the irqchip driver and the SoC code.
--- arch/arm/mach-mvebu/armada-370-xp.h | 1 - arch/arm/mach-mvebu/platsmp.c | 2 -- drivers/irqchip/irq-armada-370-xp.c | 6 +++++- 3 files changed, 5 insertions(+), 4 deletions(-)
arch/arm/mach-mvebu/armada-370-xp.h +0 -1
@@ -20,7 +20,6 @@#define ARMADA_XP_MAX_CPUS 4 -void armada_mpic_send_doorbell (const struct cpumask *mask,unsigned int irq);void armada_xp_mpic_smp_cpu_init (void );void armada_xp_secondary_startup (void );extern struct smp_operations armada_xp_smp_ops;
arch/arm/mach-mvebu/platsmp.c +0 -2
@@ -98,8 +98,6 @@ static void __init armada_xp_smp_init_cpus(void)if (ncores ==0 || ncores >ARMADA_XP_MAX_CPUS )panic ("Invalid number of CPUs in DT\n" ); - -set_smp_cross_call (armada_mpic_send_doorbell); }static void __init armada_xp_smp_prepare_cpus (unsigned int max_cpus)
drivers/irqchip/irq-armada-370-xp.c +5 -1
@@ -315,7 +315,8 @@ static int armada_370_xp_mpic_irq_map(struct irq_domain *h, }#ifdef CONFIG_SMP -void armada_mpic_send_doorbell (const struct cpumask *mask,unsigned int irq) +static void armada_mpic_send_doorbell (const struct cpumask *mask, +unsigned int irq) {int cpu;unsigned long map =0 ;
@@ -511,6 +512,9 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,if (parent_irq <=0 ) {irq_set_default_host (armada_370_xp_mpic_domain);set_handle_irq (armada_370_xp_handle_irq); +#ifdef CONFIG_SMP +set_smp_cross_call (armada_mpic_send_doorbell); +#endif }else {irq_set_chained_handler (parent_irq, armada_370_xp_mpic_handle_cascade_irq);
Signature · 1 line
1.8.3.2
PATCH v3 5/11 irqchip: irq-armada-370-xp: use cpu notifier to initialize secondary CPUs
In reply to Thomas PetazzoniSome irqchip initialization must be done on secondary CPUs. On mvebu platforms, this is currently achieved by having the arch/arm/mach-mvebu/platsmp.c code directly call into a function exported by the irqchip driver, which isn't really nice.
This commit changes this by using the same solution as the one used in the GIC driver: the irqchip driver registers a CPU notifier, which is used to do the secondary CPU IRQ initialization. This way, the irqchip driver is completely autonomous, and the function no longer needs to be exposed from the irqchip driver to the SoC code.
--- arch/arm/mach-mvebu/armada-370-xp.h | 1 - arch/arm/mach-mvebu/platsmp.c | 6 ------ drivers/irqchip/irq-armada-370-xp.c | 18 +++++++++++++++++- 3 files changed, 17 insertions(+), 8 deletions(-)
arch/arm/mach-mvebu/armada-370-xp.h +0 -1
@@ -20,7 +20,6 @@#define ARMADA_XP_MAX_CPUS 4 -void armada_xp_mpic_smp_cpu_init (void );void armada_xp_secondary_startup (void );extern struct smp_operations armada_xp_smp_ops;#endif
arch/arm/mach-mvebu/platsmp.c +0 -6
@@ -70,11 +70,6 @@ static void __init set_secondary_cpus_clock(void) } } -static void armada_xp_secondary_init (unsigned int cpu) -{ -armada_xp_mpic_smp_cpu_init (); -} -static int armada_xp_boot_secondary (unsigned int cpu,struct task_struct *idle) {int ret, hw_cpu;
@@ -130,7 +125,6 @@ static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)struct smp_operations armada_xp_smp_ops__initdata = { .smp_init_cpus = armada_xp_smp_init_cpus, .smp_prepare_cpus = armada_xp_smp_prepare_cpus, - .smp_secondary_init = armada_xp_secondary_init, .smp_boot_secondary = armada_xp_boot_secondary, #ifdef CONFIG_HOTPLUG_CPU .cpu_die = armada_xp_cpu_die,
drivers/irqchip/irq-armada-370-xp.c +17 -1
@@ -19,6 +19,7 @@#include <linux/irq.h> #include <linux/interrupt.h> #include <linux/irqchip/chained_irq.h> +#include <linux/cpu.h> #include <linux/io.h> #include <linux/of_address.h> #include <linux/of_irq.h>
@@ -336,7 +337,7 @@ static void armada_mpic_send_doorbell(const struct cpumask *mask, ARMADA_370_XP_SW_TRIG_INT_OFFS); } -void armada_xp_mpic_smp_cpu_init (void ) +static void armada_xp_mpic_smp_cpu_init (void ) {/* Clear pending IPIs */ writel (0 , per_cpu_int_base +ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS );
@@ -348,6 +349,20 @@ void armada_xp_mpic_smp_cpu_init(void)/* Unmask IPI interrupt */ writel (0 , per_cpu_int_base +ARMADA_370_XP_INT_CLEAR_MASK_OFFS ); } + +static int armada_xp_mpic_secondary_init (struct notifier_block *nfb, +unsigned long action,void *hcpu) +{ +if (action ==CPU_STARTING || action ==CPU_STARTING_FROZEN ) +armada_xp_mpic_smp_cpu_init (); +return NOTIFY_OK ; +} + +static struct notifier_block armada_370_xp_mpic_cpu_notifier = { + .notifier_call = armada_xp_mpic_secondary_init, + .priority =100 , +}; +#endif /* CONFIG_SMP */ static struct irq_domain_ops armada_370_xp_mpic_irq_ops = {
@@ -514,6 +529,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,set_handle_irq (armada_370_xp_handle_irq);#ifdef CONFIG_SMP set_smp_cross_call (armada_mpic_send_doorbell); +register_cpu_notifier (&armada_370_xp_mpic_cpu_notifier);#endif }else { irq_set_chained_handler(parent_irq,
Signature · 1 line
1.8.3.2
PATCH v3 6/11 ARM: mvebu: add function to set the resume boot address for Armada 375
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
In order to boot the secondary CPUs on Armada 375, we need to set the boot address of these CPUs, through a register part of the System Controller (this deviates from the Armada XP design, where the boot address was defined using a register part of the PMSU unit).
Therefore, this commit adds a new helper function in the System Controller driver to set the secondary CPU boot address.
Moreover, it moves the System Controller initialization as an early_initcall(), since arch_initcall() is too late for an SMP-related initialization.
--- arch/arm/mach-mvebu/common.h | 1 + arch/arm/mach-mvebu/system-controller.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/common.h +1 -0
@@ -20,6 +20,7 @@void mvebu_restart (enum reboot_mode mode,const char *cmd);int mvebu_cpu_reset_deassert (int cpu);void mvebu_pmsu_set_cpu_boot_addr (int hw_cpu,void *boot_addr); +void mvebu_system_controller_set_cpu_boot_addr (void *boot_addr);void armada_xp_cpu_die (unsigned int cpu);
arch/arm/mach-mvebu/system-controller.c +14 -1
@@ -37,6 +37,8 @@ struct mvebu_system_controller {u32 rstoutn_mask_reset_out_en;u32 system_soft_reset; + +u32 resume_boot_addr; };static struct mvebu_system_controller *mvebu_sc;
@@ -52,6 +54,7 @@ static const struct mvebu_system_controller armada_375_system_controller = { .system_soft_reset_offset = 0x58, .rstoutn_mask_reset_out_en = 0x1, .system_soft_reset = 0x1, + .resume_boot_addr = 0xd4, };static const struct mvebu_system_controller orion_system_controller = {
@@ -98,6 +101,16 @@ void mvebu_restart(enum reboot_mode mode, const char *cmd) ; } +#ifdef CONFIG_SMP +void mvebu_system_controller_set_cpu_boot_addr (void *boot_addr) +{ +BUG_ON (system_controller_base ==NULL ); +BUG_ON (mvebu_sc->resume_boot_addr ==0 ); +writel (virt_to_phys (boot_addr), system_controller_base + + mvebu_sc->resume_boot_addr); +} +#endif +static int __init mvebu_system_controller_init (void ) {const struct of_device_id *match;
@@ -114,4 +127,4 @@ static int __init mvebu_system_controller_init(void)return 0 ; } -arch_initcall (mvebu_system_controller_init); +early_initcall (mvebu_system_controller_init);
Signature · 1 line
1.8.3.2
PATCH v3 7/11 ARM: mvebu: add Armada 38x compatible string to pmsu
In reply to Thomas PetazzoniSince the Armada 38x PMSU registers are slightly different than the Armada 370/XP PMSU ones, we introduce a new compatible string "armada-380-pmsu" in the PMSU driver. These differences are not visible for the current usage of the PMSU, but they might become visible in the future.
--- Documentation/devicetree/bindings/arm/armada-370-xp-pmsu.txt | 9 ++++++--- arch/arm/mach-mvebu/pmsu.c | 1 + 2 files changed, 7 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/arm/armada-370-xp-pmsu.txt +6 -3
@@ -1,11 +1,14 @@ Power Management Service Unit(PMSU) ----------------------------------- -Available on Marvell SOCs: Armada 370 and Armada XP +Available on Marvell SOCs: Armada 370, Armada 38x and Armada XP Required properties: -- compatible: should be "marvell,armada-370-pmsu", whereas - "marvell,armada-370-xp-pmsu" is deprecated and will be removed +- compatible: should be one of: + - "marvell,armada-370-pmsu" for Armada 370 or Armada XP + - "marvell,armada-380-pmsu" for Armada 38x + - "marvell,armada-370-xp-pmsu" was used for Armada 370/XP but is now + deprecated and will be removed - reg: Should contain PMSU registers location and length.
arch/arm/mach-mvebu/pmsu.c +1 -0
@@ -38,6 +38,7 @@ static void __iomem *pmsu_mp_base;static struct of_device_id of_pmsu_table[] = { { .compatible ="marvell,armada-370-pmsu" , }, { .compatible ="marvell,armada-370-xp-pmsu" , }, + { .compatible ="marvell,armada-380-pmsu" , }, {/* end of list */ }, };
Signature · 1 line
1.8.3.2
PATCH v3 8/11 ARM: mvebu: add SMP support for Armada 375 and Armada 38x
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
This commit adds the SMP support for Armada 375 and Armada 38x. It turns out that the SMP logic for both of these SOCs are fairly similar, the only differences being:
* A different method to set the secondary CPU boot address
* An Armada 375 specific workaround needed for the early Z1 stepping, added by the following patch.
Other than that, the patch is fairly straightforward and adds the usual platsmp and headsmp code, defining the smp_operations structure that is referenced from the DT_MACHINE structures.
--- Documentation/devicetree/bindings/arm/cpus.txt | 2 + arch/arm/mach-mvebu/Kconfig | 4 ++ arch/arm/mach-mvebu/Makefile | 2 +- arch/arm/mach-mvebu/headsmp-a9.S | 22 +++++++++ arch/arm/mach-mvebu/platsmp-a9.c | 68 ++++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-mvebu/headsmp-a9.S create mode 100644 arch/arm/mach-mvebu/platsmp-a9.c
Documentation/devicetree/bindings/arm/cpus.txt +2 -0
@@ -185,6 +185,8 @@ nodes to be present and contain the properties described below. "qcom,gcc-msm8660" "qcom,kpss-acc-v1" "qcom,kpss-acc-v2" + "marvell,armada-375-smp" + "marvell,armada-380-smp" "marvell,armada-xp-smp" - cpu-release-addr
arch/arm/mach-mvebu/Kconfig +4 -0
@@ -40,6 +40,8 @@ config MACH_ARMADA_375 select ARMADA_375_CLK select CPU_V7 select HAVE_ARM_SCU + select HAVE_ARM_TWD + select HAVE_SMP select MACH_MVEBU_V7 select PINCTRL_ARMADA_375 help
@@ -54,6 +56,8 @@ config MACH_ARMADA_38X select ARMADA_38X_CLK select CPU_V7 select HAVE_ARM_SCU + select HAVE_ARM_TWD + select HAVE_SMP select MACH_MVEBU_V7 select PINCTRL_ARMADA_38X help
arch/arm/mach-mvebu/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-y += system-controller.o mvebu-soc-id.o cpu-reset.o obj-$(CONFIG_MACH_MVEBU_V7) += board-v7.o obj-$(CONFIG_MACH_DOVE) += dove.o obj-$(CONFIG_ARCH_MVEBU) += coherency.o coherency_ll.o pmsu.o -obj-$(CONFIG_SMP) += platsmp.o headsmp.o +obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_MACH_KIRKWOOD) += kirkwood.o kirkwood-pm.o obj-$(CONFIG_MACH_T5325) += board-t5325.o
arch/arm/mach-mvebu/headsmp-a9.S new file +22 -0
@@ -0,0 +1,22 @@ +/* + * SMP support: Entry point for secondary CPUs of Marvell EBU + * Cortex-A9 based SOCs (Armada 375 and Armada 38x). + * + * Copyright (C) 2014 Marvell + * + * Gregory CLEMENT <[email protected]> + * Thomas Petazzoni <[email protected]> + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include <linux/linkage.h> +#include <linux/init.h> + + __CPUINIT +ENTRY(mvebu_cortex_a9_secondary_startup) + bl v7_invalidate_l1 + b secondary_startup +ENDPROC(mvebu_cortex_a9_secondary_startup)
arch/arm/mach-mvebu/platsmp-a9.c new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH v3 9/11 ARM: mvebu: add workaround for SMP support for Armada 375 stepping Z1
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
Due to internal bootrom issue, CPU[1] initial jump code (four instructions) should be placed in SRAM memory of the SoC. In order to achieve this, we have to unmap the BootROM and at some specific location where the BootROM was place, create a specific MBus window for the SRAM. This SRAM is initialized with a few instructions of code that allows to jump into the real secondary CPU boot address.
This workaround will most likely be disabled when newer steppings of the Armada 375 will be made available, in which case a dynamic test based on mvebu-soc-id will be added.
--- arch/arm/mach-mvebu/headsmp-a9.S | 12 ++++++++++++ arch/arm/mach-mvebu/platsmp-a9.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
arch/arm/mach-mvebu/headsmp-a9.S +12 -0
@@ -16,6 +16,18 @@ #include <linux/init.h> __CPUINIT +#define CPU_RESUME_ADDR_REG 0xf10182d4 + +.global armada_375_smp_cpu1_enable_code_start +.global armada_375_smp_cpu1_enable_code_end + +armada_375_smp_cpu1_enable_code_start: + ldr r0, [pc, #4] + ldr r1, [r0] + mov pc, r1 + .word CPU_RESUME_ADDR_REG +armada_375_smp_cpu1_enable_code_end: + ENTRY(mvebu_cortex_a9_secondary_startup) bl v7_invalidate_l1 b secondary_startup
arch/arm/mach-mvebu/platsmp-a9.c +32 -0
@@ -16,11 +16,36 @@#include <linux/io.h> #include <linux/of.h> #include <linux/smp.h> +#include <linux/mbus.h> #include <asm/smp_scu.h> #include <asm/smp_plat.h> #include "common.h" #include "pmsu.h" +#define CRYPT0_ENG_ID 41 +#define CRYPT0_ENG_ATTR 0x1 +#define SRAM_PHYS_BASE 0xFFFF0000 + +#define BOOTROM_BASE 0xFFF00000 +#define BOOTROM_SIZE 0x100000 + +extern unsigned char armada_375_smp_cpu1_enable_code_end; +extern unsigned char armada_375_smp_cpu1_enable_code_start; + +void armada_375_smp_cpu1_enable_wa (void ) +{ +void __iomem *sram_virt_base; + +mvebu_mbus_del_window (BOOTROM_BASE ,BOOTROM_SIZE ); +mvebu_mbus_add_window_by_id (CRYPT0_ENG_ID ,CRYPT0_ENG_ATTR , +SRAM_PHYS_BASE ,SZ_64K ); + sram_virt_base =ioremap (SRAM_PHYS_BASE ,SZ_64K ); + +memcpy (sram_virt_base, &armada_375_smp_cpu1_enable_code_start, + &armada_375_smp_cpu1_enable_code_end + - &armada_375_smp_cpu1_enable_code_start); +} +extern void mvebu_cortex_a9_secondary_startup (void ); static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
@@ -55,7 +80,14 @@ static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,return 0 ; } +static void __init mvebu_cortex_a9_smp_prepare_cpus (unsigned int max_cpus) +{ +if (of_machine_is_compatible ("marvell,armada375" )) +armada_375_smp_cpu1_enable_wa (); +} +static struct smp_operations mvebu_cortex_a9_smp_ops__initdata = { + .smp_prepare_cpus = mvebu_cortex_a9_smp_prepare_cpus, .smp_boot_secondary = mvebu_cortex_a9_boot_secondary, #ifdef CONFIG_HOTPLUG_CPU .cpu_die = armada_xp_cpu_die,
Signature · 1 line
1.8.3.2
PATCH v3 10/11 ARM: mvebu: add SMP support in the Armada 375 device tree
In reply to Thomas PetazzoniFrom: Gregory CLEMENT <[email protected]>
Improve the Armada 375 Device Tree to add the CPU reset Device Tree node and declare the enabling method for CPUs, both of which are necessary to get SMP working.
--- arch/arm/boot/dts/armada-375.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/armada-375.dtsi +7 -0
@@ -39,6 +39,8 @@ cpus { #address-cells = <1>; #size-cells = <0>; + enable-method = "marvell,armada-375-smp"; + cpu at 0 { device_type = "cpu"; compatible = "arm,cortex-a9";
@@ -325,6 +327,11 @@ clocks = <&coreclk 0>; }; + cpurst at 20800 { + compatible = "marvell,armada-370-cpu-reset"; + reg = <0x20800 0x10>; + }; + coherency-fabric at 21010 { compatible = "marvell,armada-375-coherency-fabric"; reg = <0x21010 0x1c>;
Signature · 1 line
1.8.3.2
PATCH v3 11/11 ARM: mvebu: add SMP support in the Armada 38x device tree
In reply to Thomas PetazzoniThis commit improves the Armada 38x Device Tree to add the CPU reset and PMSU Device Tree nodes as well as the declaration of the enabling method for the CPUs. These are needed to get SMP working on Armada 38x platforms.
--- arch/arm/boot/dts/armada-380.dtsi | 2 ++ arch/arm/boot/dts/armada-385.dtsi | 2 ++ arch/arm/boot/dts/armada-38x.dtsi | 10 ++++++++++ 3 files changed, 14 insertions(+)
arch/arm/boot/dts/armada-380.dtsi +2 -0
@@ -21,6 +21,8 @@ cpus { #address-cells = <1>; #size-cells = <0>; + enable-method = "marvell,armada-380-smp"; + cpu at 0 { device_type = "cpu"; compatible = "arm,cortex-a9";
arch/arm/boot/dts/armada-385.dtsi +2 -0
@@ -21,6 +21,8 @@ cpus { #address-cells = <1>; #size-cells = <0>; + enable-method = "marvell,armada-380-smp"; + cpu at 0 { device_type = "cpu"; compatible = "arm,cortex-a9";
arch/arm/boot/dts/armada-38x.dtsi +10 -0
@@ -272,11 +272,21 @@ clock-names = "nbclk", "fixed"; }; + cpurst at 20800 { + compatible = "marvell,armada-370-cpu-reset"; + reg = <0x20800 0x10>; + }; + coherency-fabric at 21010 { compatible = "marvell,armada-380-coherency-fabric"; reg = <0x21010 0x1c>; }; + pmsu at 22000 { + compatible = "marvell,armada-380-pmsu"; + reg = <0x22000 0x1000>; + }; + eth1: ethernet at 30000 { compatible = "marvell,armada-370-neta"; reg = <0x30000 0x4000>;
Signature · 1 line
1.8.3.2
v3 cover SMP support for Armada 375 and 38x
In reply to Thomas PetazzoniQuoted 6 lines · Thomas Petazzoni
Jason, Andrew, Gregory, Sebastian,
This patch series adds SMP support for the Armada 375 and 38x. Read the bottom of the e-mail for details about the patches. Note that this patch series applies on *top* of the 375/38x coherency and PMSU rework series.
Patches 4 and 5 applied to mvebu/irqchip, while 3, 10, and 11 go to mvebu/dt. All others go to mvebu/soc. mvebu/irqchip is pulled in as a dep of mvebu/soc.
thx,
Jason.