* [PATCH 0/2] ARM: zynq: smp improvements
@ 2019-08-06 3:07 Luis Araneda
2019-08-06 3:07 ` [PATCH 1/2] ARM: zynq: support smp in thumb mode Luis Araneda
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Luis Araneda @ 2019-08-06 3:07 UTC (permalink / raw)
To: linux, michal.simek; +Cc: stable, linux-arm-kernel, linux-kernel, Luis Araneda
This series adds support for kernel compiled in Thumb mode
and fixes a kernel panic on smp bring-up when FORTIFY_SOURCE
is enabled.
The series started with the second patch as an RFC, and
the first patch were suggested on the review to complement
the fix.
The changes were run-tested on a Digilent Zybo Z7 board
Luis Araneda (2):
ARM: zynq: support smp in thumb mode
ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up
arch/arm/mach-zynq/headsmp.S | 2 ++
arch/arm/mach-zynq/platsmp.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
--
2.22.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] ARM: zynq: support smp in thumb mode
2019-08-06 3:07 [PATCH 0/2] ARM: zynq: smp improvements Luis Araneda
@ 2019-08-06 3:07 ` Luis Araneda
2019-08-06 5:17 ` Greg KH
2019-08-06 6:39 ` Michal Simek
2019-08-06 3:07 ` [PATCH 2/2] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up Luis Araneda
2019-08-06 5:17 ` [PATCH 0/2] ARM: zynq: smp improvements Greg KH
2 siblings, 2 replies; 8+ messages in thread
From: Luis Araneda @ 2019-08-06 3:07 UTC (permalink / raw)
To: linux, michal.simek; +Cc: stable, linux-arm-kernel, linux-kernel, Luis Araneda
Add .arm directive to headsmp.S to ensure that the
CPU starts in 32-bit ARM mode and the correct code
size is copied on smp bring-up
Additionally, start secondary CPUs on secondary_startup_arm
to automatically switch from ARM to thumb on a thumb kernel
Suggested-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Luis Araneda <luaraneda@gmail.com>
---
arch/arm/mach-zynq/headsmp.S | 2 ++
arch/arm/mach-zynq/platsmp.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-zynq/headsmp.S b/arch/arm/mach-zynq/headsmp.S
index ab85003cf9ad..3449e0d1f990 100644
--- a/arch/arm/mach-zynq/headsmp.S
+++ b/arch/arm/mach-zynq/headsmp.S
@@ -7,6 +7,8 @@
#include <linux/init.h>
#include <asm/assembler.h>
+ .arm
+
ENTRY(zynq_secondary_trampoline)
ARM_BE8(setend be) @ ensure we are in BE8 mode
ldr r0, zynq_secondary_trampoline_jump
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index a7cfe07156f4..38728badabd4 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -81,7 +81,7 @@ EXPORT_SYMBOL(zynq_cpun_start);
static int zynq_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
- return zynq_cpun_start(__pa_symbol(secondary_startup), cpu);
+ return zynq_cpun_start(__pa_symbol(secondary_startup_arm), cpu);
}
/*
--
2.22.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up
2019-08-06 3:07 [PATCH 0/2] ARM: zynq: smp improvements Luis Araneda
2019-08-06 3:07 ` [PATCH 1/2] ARM: zynq: support smp in thumb mode Luis Araneda
@ 2019-08-06 3:07 ` Luis Araneda
2019-08-06 5:17 ` Greg KH
2019-08-06 6:41 ` Michal Simek
2019-08-06 5:17 ` [PATCH 0/2] ARM: zynq: smp improvements Greg KH
2 siblings, 2 replies; 8+ messages in thread
From: Luis Araneda @ 2019-08-06 3:07 UTC (permalink / raw)
To: linux, michal.simek; +Cc: stable, linux-arm-kernel, linux-kernel, Luis Araneda
This fixes a kernel panic (read overflow) on memcpy when
FORTIFY_SOURCE is enabled.
The computed size of memcpy args are:
- p_size (dst): 4294967295 = (size_t) -1
- q_size (src): 1
- size (len): 8
Additionally, the memory is marked as __iomem, so one of
the memcpy_* functions should be used for read/write
Signed-off-by: Luis Araneda <luaraneda@gmail.com>
---
arch/arm/mach-zynq/platsmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 38728badabd4..a10085be9073 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -57,7 +57,7 @@ int zynq_cpun_start(u32 address, int cpu)
* 0x4: Jump by mov instruction
* 0x8: Jumping address
*/
- memcpy((__force void *)zero, &zynq_secondary_trampoline,
+ memcpy_toio(zero, &zynq_secondary_trampoline,
trampoline_size);
writel(address, zero + trampoline_size);
--
2.22.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] ARM: zynq: smp improvements
2019-08-06 3:07 [PATCH 0/2] ARM: zynq: smp improvements Luis Araneda
2019-08-06 3:07 ` [PATCH 1/2] ARM: zynq: support smp in thumb mode Luis Araneda
2019-08-06 3:07 ` [PATCH 2/2] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up Luis Araneda
@ 2019-08-06 5:17 ` Greg KH
2 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2019-08-06 5:17 UTC (permalink / raw)
To: Luis Araneda; +Cc: linux, michal.simek, stable, linux-arm-kernel, linux-kernel
On Mon, Aug 05, 2019 at 11:07:16PM -0400, Luis Araneda wrote:
> This series adds support for kernel compiled in Thumb mode
> and fixes a kernel panic on smp bring-up when FORTIFY_SOURCE
> is enabled.
>
> The series started with the second patch as an RFC, and
> the first patch were suggested on the review to complement
> the fix.
>
> The changes were run-tested on a Digilent Zybo Z7 board
>
> Luis Araneda (2):
> ARM: zynq: support smp in thumb mode
> ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up
>
> arch/arm/mach-zynq/headsmp.S | 2 ++
> arch/arm/mach-zynq/platsmp.c | 4 ++--
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> --
> 2.22.0
>
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up
2019-08-06 3:07 ` [PATCH 2/2] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up Luis Araneda
@ 2019-08-06 5:17 ` Greg KH
2019-08-06 6:41 ` Michal Simek
1 sibling, 0 replies; 8+ messages in thread
From: Greg KH @ 2019-08-06 5:17 UTC (permalink / raw)
To: Luis Araneda; +Cc: linux, michal.simek, stable, linux-arm-kernel, linux-kernel
On Mon, Aug 05, 2019 at 11:07:18PM -0400, Luis Araneda wrote:
> This fixes a kernel panic (read overflow) on memcpy when
> FORTIFY_SOURCE is enabled.
>
> The computed size of memcpy args are:
> - p_size (dst): 4294967295 = (size_t) -1
> - q_size (src): 1
> - size (len): 8
>
> Additionally, the memory is marked as __iomem, so one of
> the memcpy_* functions should be used for read/write
>
> Signed-off-by: Luis Araneda <luaraneda@gmail.com>
> ---
> arch/arm/mach-zynq/platsmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] ARM: zynq: support smp in thumb mode
2019-08-06 3:07 ` [PATCH 1/2] ARM: zynq: support smp in thumb mode Luis Araneda
@ 2019-08-06 5:17 ` Greg KH
2019-08-06 6:39 ` Michal Simek
1 sibling, 0 replies; 8+ messages in thread
From: Greg KH @ 2019-08-06 5:17 UTC (permalink / raw)
To: Luis Araneda; +Cc: linux, michal.simek, stable, linux-arm-kernel, linux-kernel
On Mon, Aug 05, 2019 at 11:07:17PM -0400, Luis Araneda wrote:
> Add .arm directive to headsmp.S to ensure that the
> CPU starts in 32-bit ARM mode and the correct code
> size is copied on smp bring-up
>
> Additionally, start secondary CPUs on secondary_startup_arm
> to automatically switch from ARM to thumb on a thumb kernel
>
> Suggested-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Luis Araneda <luaraneda@gmail.com>
> ---
> arch/arm/mach-zynq/headsmp.S | 2 ++
> arch/arm/mach-zynq/platsmp.c | 2 +-
> 2 files changed, 3 insertions(+), 1 deletion(-)
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] ARM: zynq: support smp in thumb mode
2019-08-06 3:07 ` [PATCH 1/2] ARM: zynq: support smp in thumb mode Luis Araneda
2019-08-06 5:17 ` Greg KH
@ 2019-08-06 6:39 ` Michal Simek
1 sibling, 0 replies; 8+ messages in thread
From: Michal Simek @ 2019-08-06 6:39 UTC (permalink / raw)
To: Luis Araneda, linux, michal.simek; +Cc: stable, linux-arm-kernel, linux-kernel
On 06. 08. 19 5:07, Luis Araneda wrote:
> Add .arm directive to headsmp.S to ensure that the
> CPU starts in 32-bit ARM mode and the correct code
> size is copied on smp bring-up
>
> Additionally, start secondary CPUs on secondary_startup_arm
> to automatically switch from ARM to thumb on a thumb kernel
>
> Suggested-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Luis Araneda <luaraneda@gmail.com>
> ---
> arch/arm/mach-zynq/headsmp.S | 2 ++
> arch/arm/mach-zynq/platsmp.c | 2 +-
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-zynq/headsmp.S b/arch/arm/mach-zynq/headsmp.S
> index ab85003cf9ad..3449e0d1f990 100644
> --- a/arch/arm/mach-zynq/headsmp.S
> +++ b/arch/arm/mach-zynq/headsmp.S
> @@ -7,6 +7,8 @@
> #include <linux/init.h>
> #include <asm/assembler.h>
>
> + .arm
> +
> ENTRY(zynq_secondary_trampoline)
> ARM_BE8(setend be) @ ensure we are in BE8 mode
> ldr r0, zynq_secondary_trampoline_jump
> diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
> index a7cfe07156f4..38728badabd4 100644
> --- a/arch/arm/mach-zynq/platsmp.c
> +++ b/arch/arm/mach-zynq/platsmp.c
> @@ -81,7 +81,7 @@ EXPORT_SYMBOL(zynq_cpun_start);
>
> static int zynq_boot_secondary(unsigned int cpu, struct task_struct *idle)
> {
> - return zynq_cpun_start(__pa_symbol(secondary_startup), cpu);
> + return zynq_cpun_start(__pa_symbol(secondary_startup_arm), cpu);
> }
>
> /*
>
It is really a question if this should go to stable tree. It is pretty
much new feature.
Will be good to also add link to similar patch for example this one
5616f36713ea77f57ae908bf2fef641364403c9f.
M
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up
2019-08-06 3:07 ` [PATCH 2/2] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up Luis Araneda
2019-08-06 5:17 ` Greg KH
@ 2019-08-06 6:41 ` Michal Simek
1 sibling, 0 replies; 8+ messages in thread
From: Michal Simek @ 2019-08-06 6:41 UTC (permalink / raw)
To: Luis Araneda, linux, michal.simek; +Cc: stable, linux-arm-kernel, linux-kernel
On 06. 08. 19 5:07, Luis Araneda wrote:
> This fixes a kernel panic (read overflow) on memcpy when
> FORTIFY_SOURCE is enabled.
>
> The computed size of memcpy args are:
> - p_size (dst): 4294967295 = (size_t) -1
> - q_size (src): 1
> - size (len): 8
>
> Additionally, the memory is marked as __iomem, so one of
> the memcpy_* functions should be used for read/write
>
> Signed-off-by: Luis Araneda <luaraneda@gmail.com>
> ---
> arch/arm/mach-zynq/platsmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
> index 38728badabd4..a10085be9073 100644
> --- a/arch/arm/mach-zynq/platsmp.c
> +++ b/arch/arm/mach-zynq/platsmp.c
> @@ -57,7 +57,7 @@ int zynq_cpun_start(u32 address, int cpu)
> * 0x4: Jump by mov instruction
> * 0x8: Jumping address
> */
> - memcpy((__force void *)zero, &zynq_secondary_trampoline,
> + memcpy_toio(zero, &zynq_secondary_trampoline,
> trampoline_size);
> writel(address, zero + trampoline_size);
>
I would consider this one as stable material. Please also add there link
to the patch which this patch fixes.
M
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-08-06 6:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-06 3:07 [PATCH 0/2] ARM: zynq: smp improvements Luis Araneda
2019-08-06 3:07 ` [PATCH 1/2] ARM: zynq: support smp in thumb mode Luis Araneda
2019-08-06 5:17 ` Greg KH
2019-08-06 6:39 ` Michal Simek
2019-08-06 3:07 ` [PATCH 2/2] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up Luis Araneda
2019-08-06 5:17 ` Greg KH
2019-08-06 6:41 ` Michal Simek
2019-08-06 5:17 ` [PATCH 0/2] ARM: zynq: smp improvements Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox