Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP

Instead of having an early init function check the machine compatible
and installing multi-cluster SMP support for the A80 if it matches,
use a new cpu enable-method string. This makes the platform support
future proof in case anyone manages to add PSCI support.

The original init code for the SMP support is changed into the
.prepare_cpus callback in the smp_operations structure. Instead of
panicing when resources are missing like on some platforms, our code
merely guards against engaging SMP or CPU hotplug and returns an error.

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>

+21 -1
+1
Documentation/devicetree/bindings/arm/cpus.txt
··· 198 198 "actions,s500-smp" 199 199 "allwinner,sun6i-a31" 200 200 "allwinner,sun8i-a23" 201 + "allwinner,sun9i-a80-smp" 201 202 "amlogic,meson8-smp" 202 203 "amlogic,meson8b-smp" 203 204 "arm,realview-smp"
+20 -1
arch/arm/mach-sunxi/mc_smp.c
··· 690 690 struct resource res; 691 691 int ret; 692 692 693 - if (!of_machine_is_compatible("allwinner,sun9i-a80")) 693 + /* 694 + * Don't bother checking the "cpus" node, as an enable-method 695 + * property in that node is undocumented. 696 + */ 697 + node = of_cpu_device_node_get(0); 698 + if (!node) 699 + return -ENODEV; 700 + 701 + /* 702 + * We can't actually use the enable-method magic in the kernel. 703 + * Our loopback / trampoline code uses the CPU suspend framework, 704 + * which requires the identity mapping be available. It would not 705 + * yet be available if we used the .init_cpus or .prepare_cpus 706 + * callbacks in smp_operations, which we would use if we were to 707 + * use CPU_METHOD_OF_DECLARE 708 + */ 709 + ret = of_property_match_string(node, "enable-method", 710 + "allwinner,sun9i-a80-smp"); 711 + of_node_put(node); 712 + if (ret) 694 713 return -ENODEV; 695 714 696 715 if (!sunxi_mc_smp_cpu_table_init())