xen: arm32: resync bitops with Linux v3.14-rc7
authorIan Campbell <ian.campbell@citrix.com>
Wed, 26 Mar 2014 13:38:37 +0000 (13:38 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 3 Apr 2014 16:15:41 +0000 (17:15 +0100)
This pulls in the following Linux commits:

commit c36ef4b1762302a493c6cb754073bded084700e2
Author: Will Deacon <will.deacon@arm.com>
Date:   Wed Nov 23 11:28:25 2011 +0100

    ARM: 7171/1: unwind: add unwind directives to bitops assembly macros

    The bitops functions (e.g. _test_and_set_bit) on ARM do not have unwind
    annotations and therefore the kernel cannot backtrace out of them on a
    fatal error (for example, NULL pointer dereference).

    This patch annotates the bitops assembly macros with UNWIND annotations
    so that we can produce a meaningful backtrace on error. Callers of the
    macros are modified to pass their function name as a macro parameter,
    enforcing that the macros are used as standalone function implementations.

Acked-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
commit d779c07dd72098a7416d907494f958213b7726f3
Author: Will Deacon <will.deacon@arm.com>
Date:   Thu Jun 27 12:01:51 2013 +0100

    ARM: bitops: prefetch the destination word for write prior to strex

    The cost of changing a cacheline from shared to exclusive state can be
    significant, especially when this is triggered by an exclusive store,
    since it may result in having to retry the transaction.

    This patch prefixes our atomic bitops implementation with prefetchw,
    to try and grab the line in exclusive state from the start. The testop
    macro is left alone, since the barrier semantics limit the usefulness
    of prefetching data.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
commit b7ec699405f55667caeb46d96229d75bf33a83ad
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Nov 19 15:46:11 2013 +0100

    ARM: 7893/1: bitops: only emit .arch_extension mp if CONFIG_SMP

    Uwe reported a build failure when targetting a NOMMU platform with my
    recent prefetch changes:

      arch/arm/lib/changebit.S: Assembler messages:
      arch/arm/lib/changebit.S:15: Error: architectural extension `mp' is
                        not allowed for the current base architecture

    This is due to use of the .arch_extension mp directive immediately prior
    to an ALT_SMP(...) instruction. Whilst the ALT_SMP macro will expand to
    nothing if !CONFIG_SMP, gas will still choke on the directive.

    This patch fixes the issue by only emitting the sequence (including the
    directive) if CONFIG_SMP=y.

Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Tim Deegan <tim@xen.org>
xen/arch/arm/arm32/lib/bitops.h
xen/arch/arm/arm32/lib/changebit.S
xen/arch/arm/arm32/lib/clearbit.S
xen/arch/arm/arm32/lib/setbit.S
xen/arch/arm/arm32/lib/testchangebit.S
xen/arch/arm/arm32/lib/testclearbit.S
xen/arch/arm/arm32/lib/testsetbit.S

index 689f2e866544ad8abbe7421d5e0991e63b55c949..25784c3354275914c250128306251bd3b30406cb 100644 (file)
@@ -1,13 +1,20 @@
 #include <xen/config.h>
 
 #if __LINUX_ARM_ARCH__ >= 6
-       .macro  bitop, instr
+       .macro  bitop, name, instr
+ENTRY( \name           )
+UNWIND(        .fnstart        )
        ands    ip, r1, #3
        strneb  r1, [ip]                @ assert word-aligned
        mov     r2, #1
        and     r3, r0, #31             @ Get bit offset
        mov     r0, r0, lsr #5
        add     r1, r1, r0, lsl #2      @ Get word offset
+#if __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP)
+       .arch_extension mp
+       ALT_SMP(W(pldw) [r1])
+       ALT_UP(W(nop))
+#endif
        mov     r3, r2, lsl r3
 1:     ldrex   r2, [r1]
        \instr  r2, r2, r3
        cmp     r0, #0
        bne     1b
        bx      lr
+UNWIND(        .fnend          )
+ENDPROC(\name          )
        .endm
 
-       .macro  testop, instr, store
+       .macro  testop, name, instr, store
+ENTRY( \name           )
+UNWIND(        .fnstart        )
        ands    ip, r1, #3
        strneb  r1, [ip]                @ assert word-aligned
        mov     r2, #1
@@ -36,6 +47,8 @@
        cmp     r0, #0
        movne   r0, #1
 2:     bx      lr
+UNWIND(        .fnend          )
+ENDPROC(\name          )
        .endm
 #else
        .macro  bitop, name, instr
index 62954bcd0742e8b15c02e5f562ecfdb32ccb7f88..11f41d2bd679cd96eb573b7c7accea6514533926 100644 (file)
@@ -13,6 +13,4 @@
 #include "bitops.h"
                 .text
 
-ENTRY(_change_bit)
-       bitop   eor
-ENDPROC(_change_bit)
+bitop  _change_bit, eor
index 42ce41656d61d722bc452f55306b905e573cab5b..1b6a5691f86d00a08c63fc277bd4c7b7751b9658 100644 (file)
@@ -14,6 +14,4 @@
 #include "bitops.h"
                 .text
 
-ENTRY(_clear_bit)
-       bitop   bic
-ENDPROC(_clear_bit)
+bitop  _clear_bit, bic
index c82885155370cf7662c753eb6138e2cb4b654d7c..1f4ef5659bdde74a0a5b3cf023a83342727e8a85 100644 (file)
@@ -13,6 +13,4 @@
 #include "bitops.h"
        .text
 
-ENTRY(_set_bit)
-       bitop   orr
-ENDPROC(_set_bit)
+bitop  _set_bit, orr
index a7f527cd98078410a7e753d3b0f5c6a10bced857..7f4635caa2a497dbc496634231a7d69cd85eb080 100644 (file)
@@ -13,6 +13,4 @@
 #include "bitops.h"
                 .text
 
-ENTRY(_test_and_change_bit)
-       testop  eor, str
-ENDPROC(_test_and_change_bit)
+testop _test_and_change_bit, eor, str
index 8f39c72936d6a976414083df177d1f4f9706ea92..4d4152fda819f59a9cee8e8b0bed6397c191de2d 100644 (file)
@@ -13,6 +13,4 @@
 #include "bitops.h"
                 .text
 
-ENTRY(_test_and_clear_bit)
-       testop  bicne, strne
-ENDPROC(_test_and_clear_bit)
+testop _test_and_clear_bit, bicne, strne
index 1b8d2731006ab33adeaaddcacbb687e53100a2af..54f48f9afa67f7189604d0ebbaaeb5ca489f74d5 100644 (file)
@@ -13,6 +13,4 @@
 #include "bitops.h"
                 .text
 
-ENTRY(_test_and_set_bit)
-       testop  orreq, streq
-ENDPROC(_test_and_set_bit)
+testop _test_and_set_bit, orreq, streq