Skip to contentSkip to conversation

ARM: MCPM: ensure not to enter __hyp_soft_restart from loopback and cpu_power_down

PATCH New Sudeep Holla 3 participants 6 messages May 18, 2017 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: MCPM: ensure not to enter __hyp_soft_restart from loopback and cpu_power_down

Commit 9da5ac236de6 ("ARM: soft-reboot into same mode that we entered the kernel") added support to enter the new kernel in the same processor mode as the previous one when we soft-reboot from one kernel into another by pass a flag to cpu_reset() so it knows what to do exactly.

However it missed to make similar changes in MCPM code. Due to the missing flag, the CPUs enter HYP mode which is not supported with MCPM. MCPM works only in secure mode as it manages CCI.

This patch aligns the cpu_reset call in MCPM with other changes in the above mentioned commit.

Fixes 9da5ac236de6 ("ARM: soft-reboot into same mode that we entered the kernel")
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
---
 arch/arm/common/mcpm_entry.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Hi Nico, Russell,

I am seeing a boot failure without this patch on my TC2 where MCPM is enabled and active. The loopback test fails on primary, if skipped fails later on resume path.

Regards,
Sudeep

arch/arm/common/mcpm_entry.c +3 -3
index cf062472e07b..d2bd153484b6 100644
@@ -235,7 +235,7 @@ int mcpm_cpu_power_up(unsigned int cpu, unsigned int cluster)
 	return ret;
 }
 
-typedef void (*phys_reset_t)(unsigned long);
+typedef void (*phys_reset_t)(unsigned long, bool);
 
 void mcpm_cpu_power_down(void)
 {
@@ -300,7 +300,7 @@ void mcpm_cpu_power_down(void)
 	 * on the CPU.
 	 */
 	phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
-	phys_reset(__pa_symbol(mcpm_entry_point));
+	phys_reset(__pa_symbol(mcpm_entry_point), false);
 
 	/* should never get here */
 	BUG();
@@ -389,7 +389,7 @@ static int __init nocache_trampoline(unsigned long _arg)
 	__mcpm_cpu_down(cpu, cluster);
 
 	phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
-	phys_reset(__pa_symbol(mcpm_entry_point));
+	phys_reset(__pa_symbol(mcpm_entry_point), false);
 	BUG();
 }
 

--
2.7.4

#1 lore raw

PATCH 1/1 ARM: MCPM: ensure not to enter __hyp_soft_restart from loopback and cpu_power_down

Quoted 11 lines · Sudeep Holla

Commit 9da5ac236de6 ("ARM: soft-reboot into same mode that we entered the kernel") added support to enter the new kernel in the same processor mode as the previous one when we soft-reboot from one kernel into another by pass a flag to cpu_reset() so it knows what to do exactly.

However it missed to make similar changes in MCPM code. Due to the missing flag, the CPUs enter HYP mode which is not supported with MCPM. MCPM works only in secure mode as it manages CCI.

This patch aligns the cpu_reset call in MCPM with other changes in the above mentioned commit.

I could say... welcome to why casts are bad! The casts in this code have hidden the change of function prototype, which is why it's not been picked up by any of the build check systems.

Please change typedef to this:

typedef typeof(cpu_reset) *phys_reset_t;

so phys_reset_t at least follows the prototype of cpu_reset().

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#2 lore raw

PATCH 1/1 ARM: MCPM: ensure not to enter __hyp_soft_restart from loopback and cpu_power_down

Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Sudeep Holla

Commit 9da5ac236de6 ("ARM: soft-reboot into same mode that we entered the kernel") added support to enter the new kernel in the same processor mode as the previous one when we soft-reboot from one kernel into another by pass a flag to cpu_reset() so it knows what to do exactly.

However it missed to make similar changes in MCPM code. Due to the missing flag, the CPUs enter HYP mode which is not supported with MCPM. MCPM works only in secure mode as it manages CCI.

Quoted 7 lines
Quoted 2 lines

This patch aligns the cpu_reset call in MCPM with other changes in the above mentioned commit.

I could say... welcome to why casts are bad! The casts in this code have hidden the change of function prototype, which is why it's not been picked up by any of the build check systems.

True

Quoted 4 lines

Please change typedef to this:

typedef typeof(cpu_reset) *phys_reset_t;

IIUC, I need to drop * above. I will respin the patch with that change. Thanks for the suggestion.

Quoted 2 lines

so phys_reset_t at least follows the prototype of cpu_reset().

Signature · 2 lines
Regards,
Sudeep
#3 lore raw

PATCH v2 1/1 ARM: MCPM: ensure not to enter __hyp_soft_restart from loopback and cpu_power_down

In reply to Sudeep Holla

Commit 9da5ac236de6 ("ARM: soft-reboot into same mode that we entered the kernel") added support to enter the new kernel in the same processor mode as the previous one when we soft-reboot from one kernel into another by pass a flag to cpu_reset() so it knows what to do exactly.

However it missed to make similar changes in MCPM code. Due to the missing flag, the CPUs enter HYP mode which is not supported with MCPM. MCPM works only in secure mode as it manages CCI.

This patch aligns the cpu_reset call in MCPM with other changes in the above mentioned commit by making phys_reset_t to follow the prototype of cpu_reset().

Fixes 9da5ac236de6 ("ARM: soft-reboot into same mode that we entered the kernel")
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
---
 arch/arm/common/mcpm_entry.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Hi Nico, Russell,

I am seeing a boot failure without this patch on my TC2 where MCPM is enabled and active. The loopback test fails on primary, if skipped fails later on resume path.

Regards,
Sudeep

v1->v2:
- As suggested by Russell, changed phys_reset_t typedef to follow cpu_reset() prototype

arch/arm/common/mcpm_entry.c +3 -3
index cf062472e07b..2b913f17d50f 100644
@@ -235,7 +235,7 @@ int mcpm_cpu_power_up(unsigned int cpu, unsigned int cluster)
 	return ret;
 }
 
-typedef void (*phys_reset_t)(unsigned long);
+typedef typeof(cpu_reset) phys_reset_t;
 
 void mcpm_cpu_power_down(void)
 {
@@ -300,7 +300,7 @@ void mcpm_cpu_power_down(void)
 	 * on the CPU.
 	 */
 	phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
-	phys_reset(__pa_symbol(mcpm_entry_point));
+	phys_reset(__pa_symbol(mcpm_entry_point), false);
 
 	/* should never get here */
 	BUG();
@@ -389,7 +389,7 @@ static int __init nocache_trampoline(unsigned long _arg)
 	__mcpm_cpu_down(cpu, cluster);
 
 	phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
-	phys_reset(__pa_symbol(mcpm_entry_point));
+	phys_reset(__pa_symbol(mcpm_entry_point), false);
 	BUG();
 }
 

--
2.7.4

#4 lore raw

PATCH v2 1/1 ARM: MCPM: ensure not to enter __hyp_soft_restart from loopback and cpu_power_down

Quoted 9 lines · Sudeep Holla

Commit 9da5ac236de6 ("ARM: soft-reboot into same mode that we entered the kernel") added support to enter the new kernel in the same processor mode as the previous one when we soft-reboot from one kernel into another by pass a flag to cpu_reset() so it knows what to do exactly.

However it missed to make similar changes in MCPM code. Due to the missing flag, the CPUs enter HYP mode which is not supported with MCPM. MCPM works only in secure mode as it manages CCI.

Quoted 7 lines

This patch aligns the cpu_reset call in MCPM with other changes in the above mentioned commit by making phys_reset_t to follow the prototype of cpu_reset().

Fixes 9da5ac236de6 ("ARM: soft-reboot into same mode that we entered the kernel")
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>

Please send it to RMK's patch system.

Quoted 53 lines
---
 arch/arm/common/mcpm_entry.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Hi Nico, Russell,

I am seeing a boot failure without this patch on my TC2 where MCPM is enabled and active. The loopback test fails on primary, if skipped fails later on resume path.

Regards,
Sudeep

v1->v2:
- As suggested by Russell, changed phys_reset_t typedef to follow cpu_reset() prototype

arch/arm/common/mcpm_entry.c +3 -4
index cf062472e07b..2b913f17d50f 100644
@@ -235,7 +235,7 @@ int mcpm_cpu_power_up(unsigned int cpu, unsigned int cluster)
 	return ret;
 }
 
-typedef void (*phys_reset_t)(unsigned long);
+typedef typeof(cpu_reset) phys_reset_t;
 
 void mcpm_cpu_power_down(void)
 {
@@ -300,7 +300,7 @@ void mcpm_cpu_power_down(void)
 	 * on the CPU.
 	 */
 	phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
-	phys_reset(__pa_symbol(mcpm_entry_point));
+	phys_reset(__pa_symbol(mcpm_entry_point), false);
 
 	/* should never get here */
 	BUG();
@@ -389,7 +389,7 @@ static int __init nocache_trampoline(unsigned long _arg)
 	__mcpm_cpu_down(cpu, cluster);
 
 	phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
-	phys_reset(__pa_symbol(mcpm_entry_point));
+	phys_reset(__pa_symbol(mcpm_entry_point), false);
 	BUG();
 }
 
--

2.7.4

#5 lore raw

PATCH v2 1/1 ARM: MCPM: ensure not to enter __hyp_soft_restart from loopback and cpu_power_down

Quoted 15 lines · Nicolas Pitre
Quoted 13 lines · Sudeep Holla

Commit 9da5ac236de6 ("ARM: soft-reboot into same mode that we entered the kernel") added support to enter the new kernel in the same processor mode as the previous one when we soft-reboot from one kernel into another by pass a flag to cpu_reset() so it knows what to do exactly.

However it missed to make similar changes in MCPM code. Due to the missing flag, the CPUs enter HYP mode which is not supported with MCPM. MCPM works only in secure mode as it manages CCI.

This patch aligns the cpu_reset call in MCPM with other changes in the above mentioned commit by making phys_reset_t to follow the prototype of cpu_reset().

Quoted 8 lines
Quoted 3 lines
Fixes 9da5ac236de6 ("ARM: soft-reboot into same mode that we entered the kernel")
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>

Please send it to RMK's patch system.

Thanks, sent to patch system(8675/1)

Signature · 2 lines
Regards,
Sudeep