* [PATCH 0/2] ARM: Do not mess with CCI if booted from HYP
@ 2016-09-20 14:13 Marc Zyngier
2016-09-20 14:13 ` [PATCH 1/2] ARM: vexpress: Do not enable MCPM " Marc Zyngier
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Marc Zyngier @ 2016-09-20 14:13 UTC (permalink / raw)
To: linux-arm-kernel
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(-)
--
2.1.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] ARM: vexpress: Do not enable MCPM if booted from HYP
2016-09-20 14:13 [PATCH 0/2] ARM: Do not mess with CCI if booted from HYP Marc Zyngier
@ 2016-09-20 14:13 ` Marc Zyngier
2016-09-20 14:13 ` [PATCH 2/2] arm-cci: Do not probe the CCI ports " Marc Zyngier
2016-09-23 10:29 ` [PATCH 0/2] ARM: Do not mess with CCI " Lorenzo Pieralisi
2 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2016-09-20 14:13 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-vexpress/platsmp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 8b8d072..09819f1 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -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;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] arm-cci: Do not probe the CCI ports if booted from HYP
2016-09-20 14:13 [PATCH 0/2] ARM: Do not mess with CCI if booted from HYP Marc Zyngier
2016-09-20 14:13 ` [PATCH 1/2] ARM: vexpress: Do not enable MCPM " Marc Zyngier
@ 2016-09-20 14:13 ` Marc Zyngier
2016-09-23 10:29 ` [PATCH 0/2] ARM: Do not mess with CCI " Lorenzo Pieralisi
2 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2016-09-20 14:13 UTC (permalink / raw)
To: linux-arm-kernel
Poking 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).
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
drivers/bus/arm-cci.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index ffa7c9d..70f51a9 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -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)
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 0/2] ARM: Do not mess with CCI if booted from HYP
2016-09-20 14:13 [PATCH 0/2] ARM: Do not mess with CCI if booted from HYP Marc Zyngier
2016-09-20 14:13 ` [PATCH 1/2] ARM: vexpress: Do not enable MCPM " Marc Zyngier
2016-09-20 14:13 ` [PATCH 2/2] arm-cci: Do not probe the CCI ports " Marc Zyngier
@ 2016-09-23 10:29 ` Lorenzo Pieralisi
2 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Pieralisi @ 2016-09-23 10:29 UTC (permalink / raw)
To: linux-arm-kernel
Hi Marc,
On Tue, Sep 20, 2016 at 03:13:51PM +0100, Marc Zyngier wrote:
> 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.
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
>
> 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(-)
>
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-23 10:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-20 14:13 [PATCH 0/2] ARM: Do not mess with CCI if booted from HYP Marc Zyngier
2016-09-20 14:13 ` [PATCH 1/2] ARM: vexpress: Do not enable MCPM " Marc Zyngier
2016-09-20 14:13 ` [PATCH 2/2] arm-cci: Do not probe the CCI ports " Marc Zyngier
2016-09-23 10:29 ` [PATCH 0/2] ARM: Do not mess with CCI " Lorenzo Pieralisi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).