ARM: Do not mess with CCI if booted from HYP
Subsystems (3)
cover ARM: Do not mess with CCI if booted from HYP
Some systems (such as the VExpress TC2) are built around a CCI-400, which is only accessible from secure mode. This obviously breaks if the system is booted in non-secure mode. Detecting non-secure is pretty hard to do, unless the system is booted from HYP.
This small patch series makes sure that:
- The CCI ports are not accessed when the kernel is booted from HYP
- MCPM (which depends on CCI) is not enabled on VExpress if booted from HYP.
This allows a multi_v7_defconfig kernel to be booted on a TC2 booting from HYP, instead of miserably dying very early on.
Marc Zyngier (2):
ARM: vexpress: Do not enable MCPM if booted from HYP
arm-cci: Do not probe the CCI ports if booted from HYP
arch/arm/mach-vexpress/platsmp.c | 8 ++++++-- drivers/bus/arm-cci.c | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/2 ARM: vexpress: Do not enable MCPM if booted from HYP
Using MCPM implies being able to tweak the CCI at runtime, which is impossible to do when running non-secure. Since HYP implies running non-secure, let's not enable MCPM in that case.
--- arch/arm/mach-vexpress/platsmp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/arm/mach-vexpress/platsmp.c +6 -2
@@ -17,6 +17,7 @@#include <asm/mcpm.h> #include <asm/smp_scu.h> +#include <asm/virt.h> #include <asm/mach/map.h> #include <plat/platsmp.h>
@@ -29,11 +30,14 @@ bool __init vexpress_smp_init_ops(void)/* * The best way to detect a multi-cluster configuration at the moment * is to look for the presence of a CCI in the system. -* Override the default vexpress_smp_ops if so. +* Override the default vexpress_smp_ops if so, but only if +* the kernel is not booted from HYP mode (which indicates +* that we're running in non-secure mode, where the CCI is not +* accessible). */ struct device_node *node; node =of_find_compatible_node (NULL ,NULL ,"arm,cci-400" ); -if (node &&of_device_is_available (node)) { +if (node &&of_device_is_available (node) && !is_hyp_mode_available ()) {mcpm_smp_set_ops ();return true; }
Signature · 1 line
2.1.4
PATCH 2/2 arm-cci: Do not probe the CCI ports if booted from HYP
In reply to Marc ZyngierPoking the CCI ports from non-secure is likely to end up in fireworks, so let's not try our luck here, and skip the driver initialization if booted from HYP (which is always non-secure).
--- drivers/bus/arm-cci.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/bus/arm-cci.c +11 -0
@@ -28,6 +28,7 @@#include <asm/cacheflush.h> #include <asm/smp_plat.h> +#include <asm/virt.h> static void __iomem *cci_ctrl_base;static unsigned long cci_ctrl_phys;
@@ -2184,6 +2185,16 @@ static int cci_probe_ports(struct device_node *np)const char *match_str;bool is_ace; +/* +* If we booted in HYP mode, then we're running non-secure, +* and there is zero chance that we'll be able to configure +* anything on the CCI. Gracefully leave the room... +*/ +if (is_hyp_mode_available ()) { +pr_info ("%s: skipping probe (running non-secure)\n" , + np->full_name); +return -ENODEV ; + } cci_config =of_match_node (arm_cci_matches, np)->data;if (!cci_config)
Signature · 1 line
2.1.4
cover ARM: Do not mess with CCI if booted from HYP
In reply to Marc ZyngierHi Marc,
Quoted 5 lines · Marc Zyngier
Some systems (such as the VExpress TC2) are built around a CCI-400, which is only accessible from secure mode. This obviously breaks if the system is booted in non-secure mode. Detecting non-secure is pretty hard to do, unless the system is booted from HYP.
Quoted 7 lines
This small patch series makes sure that:
- The CCI ports are not accessed when the kernel is booted from HYP
- MCPM (which depends on CCI) is not enabled on VExpress if booted from HYP.This allows a
multi_v7_defconfigkernel to be booted on a TC2 booting from HYP, instead of miserably dying very early on.
As discussed I came up with a different set of patches that detect CCI ports status as reported by DT and prevent enabling MCPM if the CCI ports are not under kernel control (eg they are reported as "disabled" by DT since we booted in HYP).
I will post patches for review and test shortly.
Thanks for fixing it anyway,
Lorenzo
Quoted 12 lines
Marc Zyngier (2):
ARM: vexpress: Do not enable MCPM if booted from HYP
arm-cci: Do not probe the CCI ports if booted from HYParch/arm/mach-vexpress/platsmp.c | 8 ++++++-- drivers/bus/arm-cci.c | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-)Signature · 1 line
2.1.4