Re: arch/arm/include/asm/xor.h:60:3: error: write to reserved register 'R7'

From: Nick Desaulniers
Date: Mon Oct 10 2022 - 13:03:58 EST


On Fri, Oct 7, 2022 at 6:16 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> Hi Ard,
>
> FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

Thanks for the report. Filed
https://github.com/ClangBuiltLinux/linux/issues/1732
to follow up on this.

>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 4c86114194e644b6da9107d75910635c9e87179e
> commit: d6800ca73a7d325627c045c16d7cfdc7465f4333 Revert "ARM: 9144/1: forbid ftrace with clang and thumb2_kernel"
> date: 8 months ago
> config: arm-randconfig-r013-20221007
> compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install arm cross compiling tool for clang build
> # apt-get install binutils-arm-linux-gnueabi
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d6800ca73a7d325627c045c16d7cfdc7465f4333
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout d6800ca73a7d325627c045c16d7cfdc7465f4333
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> In file included from crypto/xor.c:17:
> >> arch/arm/include/asm/xor.h:60:3: error: write to reserved register 'R7'
> GET_BLOCK_4(p1);
> ^
> arch/arm/include/asm/xor.h:20:10: note: expanded from macro 'GET_BLOCK_4'
> __asm__("ldmia %0, {%1, %2, %3, %4}" \
> ^
> arch/arm/include/asm/xor.h:62:3: error: write to reserved register 'R7'
> PUT_BLOCK_4(p1);
> ^
> arch/arm/include/asm/xor.h:42:23: note: expanded from macro 'PUT_BLOCK_4'
> __asm__ __volatile__("stmia %0!, {%2, %3, %4, %5}" \
> ^
> arch/arm/include/asm/xor.h:81:3: error: write to reserved register 'R7'
> GET_BLOCK_4(p1);
> ^
> arch/arm/include/asm/xor.h:20:10: note: expanded from macro 'GET_BLOCK_4'
> __asm__("ldmia %0, {%1, %2, %3, %4}" \
> ^
> arch/arm/include/asm/xor.h:84:3: error: write to reserved register 'R7'
> PUT_BLOCK_4(p1);
> ^
> arch/arm/include/asm/xor.h:42:23: note: expanded from macro 'PUT_BLOCK_4'
> __asm__ __volatile__("stmia %0!, {%2, %3, %4, %5}" \
> ^
> 4 errors generated.
>
>
> vim +/R7 +60 arch/arm/include/asm/xor.h
>
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 13
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 14 #define GET_BLOCK_2(dst) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 15 __asm__("ldmia %0, {%1, %2}" \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 16 : "=r" (dst), "=r" (a1), "=r" (a2) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 17 : "0" (dst))
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 18
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 19 #define GET_BLOCK_4(dst) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 20 __asm__("ldmia %0, {%1, %2, %3, %4}" \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 21 : "=r" (dst), "=r" (a1), "=r" (a2), "=r" (a3), "=r" (a4) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 22 : "0" (dst))
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 23
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 24 #define XOR_BLOCK_2(src) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 25 __asm__("ldmia %0!, {%1, %2}" \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 26 : "=r" (src), "=r" (b1), "=r" (b2) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 27 : "0" (src)); \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 28 __XOR(a1, b1); __XOR(a2, b2);
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 29
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 30 #define XOR_BLOCK_4(src) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 31 __asm__("ldmia %0!, {%1, %2, %3, %4}" \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 32 : "=r" (src), "=r" (b1), "=r" (b2), "=r" (b3), "=r" (b4) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 33 : "0" (src)); \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 34 __XOR(a1, b1); __XOR(a2, b2); __XOR(a3, b3); __XOR(a4, b4)
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 35
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 36 #define PUT_BLOCK_2(dst) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 37 __asm__ __volatile__("stmia %0!, {%2, %3}" \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 38 : "=r" (dst) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 39 : "0" (dst), "r" (a1), "r" (a2))
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 40
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 41 #define PUT_BLOCK_4(dst) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 42 __asm__ __volatile__("stmia %0!, {%2, %3, %4, %5}" \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 43 : "=r" (dst) \
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 44 : "0" (dst), "r" (a1), "r" (a2), "r" (a3), "r" (a4))
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 45
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 46 static void
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 47 xor_arm4regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 48 {
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 49 unsigned int lines = bytes / sizeof(unsigned long) / 4;
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 50 register unsigned int a1 __asm__("r4");
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 51 register unsigned int a2 __asm__("r5");
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 52 register unsigned int a3 __asm__("r6");
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 53 register unsigned int a4 __asm__("r7");
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 54 register unsigned int b1 __asm__("r8");
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 55 register unsigned int b2 __asm__("r9");
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 56 register unsigned int b3 __asm__("ip");
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 57 register unsigned int b4 __asm__("lr");
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 58
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 59 do {
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 @60 GET_BLOCK_4(p1);
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 61 XOR_BLOCK_4(p2);
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 62 PUT_BLOCK_4(p1);
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 63 } while (--lines);
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 64 }
> ^1da177e4c3f41 include/asm-arm/xor.h Linus Torvalds 2005-04-16 65
>
> :::::: The code at line 60 was first introduced by commit
> :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
>
> :::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
> :::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp



--
Thanks,
~Nick Desaulniers