Skip to content

RFC ARM: Unify const-swabbing and conditional asm

Dave Martin linux-arm-kernel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4ARM: Allow assembler.h to be used with inline asmarch/arm/include/asm/assembler.h+8 -41 reply
1/4ARM: Allow assembler.h to be used with inline asm+0 -01 reply
2/4ARM: Add common compile-time swab32 for asm codearch/arm/include/asm/assembler.h arch/arm/include/asm/opcodes.h+26 -60 replies
3/4ARM: Add const cpu_to_le32 for asmarch/arm/include/asm/assembler.h+6 -00 replies
4/4drivers/bus: arm-cci: Fix CCI enable code for BE32drivers/bus/arm-cci.c+4 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/4] ARM: Unify const-swabbing and conditional asm

There are a few things in assembler.h that would be useful with inline asm, but currently assembler.h refuses to be included into C files.

This refactoring provides a place to put const swabbing helpers, which can then be used in inline asm and other places (I recycle and share the code from <asm/opcodes.h>).

The final patch modifies the CCI driver to use the new __asm_cpu_to_le32() helper, based closely on Victor Kamensky's recent fix for BE8. This allows us to avoid some unneeded ifdeffery.

Comments?

These patches are untested, but I have build-tested the CCI driver in LE and BE32 configurations, which produces the following change in the generated code:

e0400001 sub r0, r0, r1
e5900004 ldr r0, [r0, #4]
-e3a03003 mov r3, #3
+e3a03403 mov r3, #50331648 ; 0x3000000
e5803000 str r3, [r0]
e28f1024 add r1, pc, #36 ; 0x24
e5910000 ldr r0, [r1]
e7900001 ldr r0, [r0, r1]
e590100c ldr r1, [r0, #12]
-e3110001 tst r1, #1
+e3110401 tst r1, #16777216 ; 0x1000000
1afffffc bne 288 <cci_port_not_found+0x44>
e3a00000 mov r0, #0
e12fff1e bx lr

Dave Martin (4):
ARM: Allow assembler.h to be used with inline asm
ARM: Add common compile-time swab32 for asm code
ARM: Add const cpu_to_le32 for asm drivers/bus: arm-cci: Fix CCI enable code for BE32

 arch/arm/include/asm/assembler.h |   41 ++++++++++++++++++++++++++++++++++----
 arch/arm/include/asm/opcodes.h   |    9 +++------
 drivers/bus/arm-cci.c            |    6 ++++--
 3 files changed, 44 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.9.5