diff mbox

[3.16.y-ckt,stable] Patch "ARM: mvebu: make the coherency_ll.S functions work with no coherency fabric" has been added to staging queue

Message ID 1420626542-24316-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques Jan. 7, 2015, 10:29 a.m. UTC
This is a note to let you know that I have just added a patch titled

    ARM: mvebu: make the coherency_ll.S functions work with no coherency fabric

to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue

This patch is scheduled to be released in version 3.16.7-ckt4.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

From 61536b3b3703c070a753fde94c3c41b1239b2388 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Thu, 13 Nov 2014 10:38:56 +0100
Subject: ARM: mvebu: make the coherency_ll.S functions work with no coherency
 fabric

commit 30cdef97107370a7f63ab5d80fd2de30540750c8 upstream.

The ll_add_cpu_to_smp_group(), ll_enable_coherency() and
ll_disable_coherency() are used on Armada XP to control the coherency
fabric. However, they make the assumption that the coherency fabric is
always available, which is currently a correct assumption but will no
longer be true with a followup commit that disables the usage of the
coherency fabric when the conditions are not met to use it.

Therefore, this commit modifies those functions so that they check the
return value of ll_get_coherency_base(), and if the return value is 0,
they simply return without configuring anything in the coherency
fabric.

The ll_get_coherency_base() function is also modified to properly
return 0 when the function is called with the MMU disabled. In this
case, it normally returns the physical address of the coherency
fabric, but we now check if the virtual address is 0, and if that's
case, return a physical address of 0 to indicate that the coherency
fabric is not enabled.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1415871540-20302-2-git-send-email-thomas.petazzoni@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/mach-mvebu/coherency_ll.S | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

--
2.1.4

Comments

Luis Henriques Jan. 12, 2015, 3:25 p.m. UTC | #1
On Wed, Jan 07, 2015 at 10:29:02AM +0000, Luis Henriques wrote:
> This is a note to let you know that I have just added a patch titled
> 
>     ARM: mvebu: make the coherency_ll.S functions work with no coherency fabric
> 
> to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
> which can be found at:
> 
>  http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue
> 
> This patch is scheduled to be released in version 3.16.7-ckt4.
> 
> If you, or anyone else, feels it should not be added to this tree, please 
> reply to this email.
>

Actually, this patch is breaking the builds of 3.16 kernel using
configs mvebu_v7_defconfig and multi_v7_defconfig:

arch/arm/mach-mvebu/coherency_ll.S: Assembler messages:
arch/arm/mach-mvebu/coherency_ll.S:98: Error: bad instruction `reteq r0'
arch/arm/mach-mvebu/coherency_ll.S:123: Error: bad instruction `reteq r0'
arch/arm/mach-mvebu/coherency_ll.S:150: Error: bad instruction `reteq r0'

Mainline builds fine, so I assume I'm missing some other patch, but I
couldn't find out which one.  Any ideas, or shall I just drop this
from the queue?

Cheers,
--
Luís


> For more information about the 3.16.y-ckt tree, see
> https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
> 
> Thanks.
> -Luis
> 
> ------
> 
> From 61536b3b3703c070a753fde94c3c41b1239b2388 Mon Sep 17 00:00:00 2001
> From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Date: Thu, 13 Nov 2014 10:38:56 +0100
> Subject: ARM: mvebu: make the coherency_ll.S functions work with no coherency
>  fabric
> 
> commit 30cdef97107370a7f63ab5d80fd2de30540750c8 upstream.
> 
> The ll_add_cpu_to_smp_group(), ll_enable_coherency() and
> ll_disable_coherency() are used on Armada XP to control the coherency
> fabric. However, they make the assumption that the coherency fabric is
> always available, which is currently a correct assumption but will no
> longer be true with a followup commit that disables the usage of the
> coherency fabric when the conditions are not met to use it.
> 
> Therefore, this commit modifies those functions so that they check the
> return value of ll_get_coherency_base(), and if the return value is 0,
> they simply return without configuring anything in the coherency
> fabric.
> 
> The ll_get_coherency_base() function is also modified to properly
> return 0 when the function is called with the MMU disabled. In this
> case, it normally returns the physical address of the coherency
> fabric, but we now check if the virtual address is 0, and if that's
> case, return a physical address of 0 to indicate that the coherency
> fabric is not enabled.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> Link: https://lkml.kernel.org/r/1415871540-20302-2-git-send-email-thomas.petazzoni@free-electrons.com
> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> ---
>  arch/arm/mach-mvebu/coherency_ll.S | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S
> index 510c29e079ca..13dfa92c84b6 100644
> --- a/arch/arm/mach-mvebu/coherency_ll.S
> +++ b/arch/arm/mach-mvebu/coherency_ll.S
> @@ -24,7 +24,10 @@
>  #include <asm/cp15.h>
> 
>  	.text
> -/* Returns the coherency base address in r1 (r0 is untouched) */
> +/*
> + * Returns the coherency base address in r1 (r0 is untouched), or 0 if
> + * the coherency fabric is not enabled.
> + */
>  ENTRY(ll_get_coherency_base)
>  	mrc	p15, 0, r1, c1, c0, 0
>  	tst	r1, #CR_M @ Check MMU bit enabled
> @@ -32,8 +35,13 @@ ENTRY(ll_get_coherency_base)
> 
>  	/*
>  	 * MMU is disabled, use the physical address of the coherency
> -	 * base address.
> +	 * base address. However, if the coherency fabric isn't mapped
> +	 * (i.e its virtual address is zero), it means coherency is
> +	 * not enabled, so we return 0.
>  	 */
> +	ldr	r1, =coherency_base
> +	cmp	r1, #0
> +	beq	2f
>  	adr	r1, 3f
>  	ldr	r3, [r1]
>  	ldr	r1, [r1, r3]
> @@ -85,6 +93,9 @@ ENTRY(ll_add_cpu_to_smp_group)
>  	 */
>  	mov 	r0, lr
>  	bl	ll_get_coherency_base
> +	/* Bail out if the coherency is not enabled */
> +	cmp	r1, #0
> +	reteq	r0
>  	bl	ll_get_coherency_cpumask
>  	mov 	lr, r0
>  	add	r0, r1, #ARMADA_XP_CFB_CFG_REG_OFFSET
> @@ -107,6 +118,9 @@ ENTRY(ll_enable_coherency)
>  	 */
>  	mov r0, lr
>  	bl	ll_get_coherency_base
> +	/* Bail out if the coherency is not enabled */
> +	cmp	r1, #0
> +	reteq	r0
>  	bl	ll_get_coherency_cpumask
>  	mov lr, r0
>  	add	r0, r1, #ARMADA_XP_CFB_CTL_REG_OFFSET
> @@ -131,6 +145,9 @@ ENTRY(ll_disable_coherency)
>  	 */
>  	mov 	r0, lr
>  	bl	ll_get_coherency_base
> +	/* Bail out if the coherency is not enabled */
> +	cmp	r1, #0
> +	reteq	r0
>  	bl	ll_get_coherency_cpumask
>  	mov 	lr, r0
>  	add	r0, r1, #ARMADA_XP_CFB_CTL_REG_OFFSET
> --
> 2.1.4
>
Thomas Petazzoni Jan. 12, 2015, 3:27 p.m. UTC | #2
Dear Luis Henriques,

On Mon, 12 Jan 2015 15:25:37 +0000, Luis Henriques wrote:
> On Wed, Jan 07, 2015 at 10:29:02AM +0000, Luis Henriques wrote:
> > This is a note to let you know that I have just added a patch titled
> > 
> >     ARM: mvebu: make the coherency_ll.S functions work with no coherency fabric
> > 
> > to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
> > which can be found at:
> > 
> >  http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue
> > 
> > This patch is scheduled to be released in version 3.16.7-ckt4.
> > 
> > If you, or anyone else, feels it should not be added to this tree, please 
> > reply to this email.
> >
> 
> Actually, this patch is breaking the builds of 3.16 kernel using
> configs mvebu_v7_defconfig and multi_v7_defconfig:
> 
> arch/arm/mach-mvebu/coherency_ll.S: Assembler messages:
> arch/arm/mach-mvebu/coherency_ll.S:98: Error: bad instruction `reteq r0'
> arch/arm/mach-mvebu/coherency_ll.S:123: Error: bad instruction `reteq r0'
> arch/arm/mach-mvebu/coherency_ll.S:150: Error: bad instruction `reteq r0'
> 
> Mainline builds fine, so I assume I'm missing some other patch, but I
> couldn't find out which one.  Any ideas, or shall I just drop this
> from the queue?

I guess:

commit 6ebbf2ce437b33022d30badd49dc94d33ecfa498
Author: Russell King <rmk+kernel@arm.linux.org.uk>
Date:   Mon Jun 30 16:29:12 2014 +0100

    ARM: convert all "mov.* pc, reg" to "bx reg" for ARMv6+

is the commit that introduced reteq. But instead of adding this one to
stable, maybe I should provide a different patch for stable that
doesn't use reteq.

Thomas
Luis Henriques Jan. 12, 2015, 3:40 p.m. UTC | #3
On Mon, Jan 12, 2015 at 04:27:59PM +0100, Thomas Petazzoni wrote:
> Dear Luis Henriques,
> 
> On Mon, 12 Jan 2015 15:25:37 +0000, Luis Henriques wrote:
> > On Wed, Jan 07, 2015 at 10:29:02AM +0000, Luis Henriques wrote:
> > > This is a note to let you know that I have just added a patch titled
> > > 
> > >     ARM: mvebu: make the coherency_ll.S functions work with no coherency fabric
> > > 
> > > to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
> > > which can be found at:
> > > 
> > >  http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue
> > > 
> > > This patch is scheduled to be released in version 3.16.7-ckt4.
> > > 
> > > If you, or anyone else, feels it should not be added to this tree, please 
> > > reply to this email.
> > >
> > 
> > Actually, this patch is breaking the builds of 3.16 kernel using
> > configs mvebu_v7_defconfig and multi_v7_defconfig:
> > 
> > arch/arm/mach-mvebu/coherency_ll.S: Assembler messages:
> > arch/arm/mach-mvebu/coherency_ll.S:98: Error: bad instruction `reteq r0'
> > arch/arm/mach-mvebu/coherency_ll.S:123: Error: bad instruction `reteq r0'
> > arch/arm/mach-mvebu/coherency_ll.S:150: Error: bad instruction `reteq r0'
> > 
> > Mainline builds fine, so I assume I'm missing some other patch, but I
> > couldn't find out which one.  Any ideas, or shall I just drop this
> > from the queue?
> 
> I guess:
> 
> commit 6ebbf2ce437b33022d30badd49dc94d33ecfa498
> Author: Russell King <rmk+kernel@arm.linux.org.uk>
> Date:   Mon Jun 30 16:29:12 2014 +0100
> 
>     ARM: convert all "mov.* pc, reg" to "bx reg" for ARMv6+
> 
> is the commit that introduced reteq. But instead of adding this one to
> stable, maybe I should provide a different patch for stable that
> doesn't use reteq.
>

Hmm... yeah, this commit doesn't seem to qualify for stable kernels.
I believe Greg applied 30cdef971073 ("ARM: mvebu: make the
coherency_ll.S functions work with no coherency fabric") to stable
kernels 3.17 and 3.18, which already include this commit you're
suggesting.

For now I'll drop this patch from the 3.16 queue; if you believe it is
important to have this fix in kernels < 3.17, please send the backport
without the reteq to the stable mailing-list.

And thanks for your quick reply!

Cheers,
--
Luís

> Thomas
> -- 
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
diff mbox

Patch

diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S
index 510c29e079ca..13dfa92c84b6 100644
--- a/arch/arm/mach-mvebu/coherency_ll.S
+++ b/arch/arm/mach-mvebu/coherency_ll.S
@@ -24,7 +24,10 @@ 
 #include <asm/cp15.h>

 	.text
-/* Returns the coherency base address in r1 (r0 is untouched) */
+/*
+ * Returns the coherency base address in r1 (r0 is untouched), or 0 if
+ * the coherency fabric is not enabled.
+ */
 ENTRY(ll_get_coherency_base)
 	mrc	p15, 0, r1, c1, c0, 0
 	tst	r1, #CR_M @ Check MMU bit enabled
@@ -32,8 +35,13 @@  ENTRY(ll_get_coherency_base)

 	/*
 	 * MMU is disabled, use the physical address of the coherency
-	 * base address.
+	 * base address. However, if the coherency fabric isn't mapped
+	 * (i.e its virtual address is zero), it means coherency is
+	 * not enabled, so we return 0.
 	 */
+	ldr	r1, =coherency_base
+	cmp	r1, #0
+	beq	2f
 	adr	r1, 3f
 	ldr	r3, [r1]
 	ldr	r1, [r1, r3]
@@ -85,6 +93,9 @@  ENTRY(ll_add_cpu_to_smp_group)
 	 */
 	mov 	r0, lr
 	bl	ll_get_coherency_base
+	/* Bail out if the coherency is not enabled */
+	cmp	r1, #0
+	reteq	r0
 	bl	ll_get_coherency_cpumask
 	mov 	lr, r0
 	add	r0, r1, #ARMADA_XP_CFB_CFG_REG_OFFSET
@@ -107,6 +118,9 @@  ENTRY(ll_enable_coherency)
 	 */
 	mov r0, lr
 	bl	ll_get_coherency_base
+	/* Bail out if the coherency is not enabled */
+	cmp	r1, #0
+	reteq	r0
 	bl	ll_get_coherency_cpumask
 	mov lr, r0
 	add	r0, r1, #ARMADA_XP_CFB_CTL_REG_OFFSET
@@ -131,6 +145,9 @@  ENTRY(ll_disable_coherency)
 	 */
 	mov 	r0, lr
 	bl	ll_get_coherency_base
+	/* Bail out if the coherency is not enabled */
+	cmp	r1, #0
+	reteq	r0
 	bl	ll_get_coherency_cpumask
 	mov 	lr, r0
 	add	r0, r1, #ARMADA_XP_CFB_CTL_REG_OFFSET