2023-12-18 14:55:41

by kernel test robot

[permalink] [raw]
Subject: arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode

Hi Baoquan,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ceb6a6f023fd3e8b07761ed900352ef574010bcb
commit: d70c27b728b8da1ab9c3b7ca117ee1c99dc86d29 sh, kexec: fix the incorrect ifdeffery and dependency of CONFIG_KEXEC
date: 6 days ago
config: sh-randconfig-r002-20220124 (https://download.01.org/0day-ci/archive/20231218/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231218/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

arch/sh/kernel/relocate_kernel.S: Assembler messages:
>> arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode
arch/sh/kernel/relocate_kernel.S:41: Error: invalid operands for opcode
arch/sh/kernel/relocate_kernel.S:126: Error: invalid operands for opcode
arch/sh/kernel/relocate_kernel.S:129: Error: invalid operands for opcode


vim +38 arch/sh/kernel/relocate_kernel.S

9d44190eae97ad4 kogiidena 2006-01-16 13
9d44190eae97ad4 kogiidena 2006-01-16 14 .globl relocate_new_kernel
9d44190eae97ad4 kogiidena 2006-01-16 15 relocate_new_kernel:
9d44190eae97ad4 kogiidena 2006-01-16 16 /* r4 = indirection_page */
9d44190eae97ad4 kogiidena 2006-01-16 17 /* r5 = reboot_code_buffer */
9d44190eae97ad4 kogiidena 2006-01-16 18 /* r6 = start_address */
9d44190eae97ad4 kogiidena 2006-01-16 19
b7cf6ddc13186f9 Magnus Damm 2009-03-18 20 mov.l 10f, r0 /* PAGE_SIZE */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 21 add r5, r0 /* setup new stack at end of control page */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 22
b7cf6ddc13186f9 Magnus Damm 2009-03-18 23 /* save r15->r8 to new stack */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 24 mov.l r15, @-r0
b7cf6ddc13186f9 Magnus Damm 2009-03-18 25 mov r0, r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 26 mov.l r14, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 27 mov.l r13, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 28 mov.l r12, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 29 mov.l r11, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 30 mov.l r10, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 31 mov.l r9, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 32 mov.l r8, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 33
b7cf6ddc13186f9 Magnus Damm 2009-03-18 34 /* save other random registers */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 35 sts.l macl, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 36 sts.l mach, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 37 stc.l gbr, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 @38 stc.l ssr, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 39 stc.l sr, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 40 sts.l pr, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 41 stc.l spc, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 42
b7cf6ddc13186f9 Magnus Damm 2009-03-18 43 /* switch to bank1 and save r7->r0 */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 44 mov.l 12f, r9
b7cf6ddc13186f9 Magnus Damm 2009-03-18 45 stc sr, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 46 or r9, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 47 ldc r8, sr
b7cf6ddc13186f9 Magnus Damm 2009-03-18 48 mov.l r7, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 49 mov.l r6, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 50 mov.l r5, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 51 mov.l r4, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 52 mov.l r3, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 53 mov.l r2, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 54 mov.l r1, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 55 mov.l r0, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 56
b7cf6ddc13186f9 Magnus Damm 2009-03-18 57 /* switch to bank0 and save r7->r0 */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 58 mov.l 12f, r9
b7cf6ddc13186f9 Magnus Damm 2009-03-18 59 not r9, r9
b7cf6ddc13186f9 Magnus Damm 2009-03-18 60 stc sr, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 61 and r9, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 62 ldc r8, sr
b7cf6ddc13186f9 Magnus Damm 2009-03-18 63 mov.l r7, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 64 mov.l r6, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 65 mov.l r5, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 66 mov.l r4, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 67 mov.l r3, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 68 mov.l r2, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 69 mov.l r1, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 70 mov.l r0, @-r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 71
b7cf6ddc13186f9 Magnus Damm 2009-03-18 72 mov.l r4, @-r15 /* save indirection page again */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 73
b7cf6ddc13186f9 Magnus Damm 2009-03-18 74 bsr swap_pages /* swap pages before jumping to new kernel */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 75 nop
b7cf6ddc13186f9 Magnus Damm 2009-03-18 76
b7cf6ddc13186f9 Magnus Damm 2009-03-18 77 mova 11f, r0
b7cf6ddc13186f9 Magnus Damm 2009-03-18 78 mov.l r15, @r0 /* save pointer to stack */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 79
b7cf6ddc13186f9 Magnus Damm 2009-03-18 80 jsr @r6 /* hand over control to new kernel */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 81 nop
b7cf6ddc13186f9 Magnus Damm 2009-03-18 82
b7cf6ddc13186f9 Magnus Damm 2009-03-18 83 mov.l 11f, r15 /* get pointer to stack */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 84 mov.l @r15+, r4 /* restore r4 to get indirection page */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 85
b7cf6ddc13186f9 Magnus Damm 2009-03-18 86 bsr swap_pages /* swap pages back to previous state */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 87 nop
b7cf6ddc13186f9 Magnus Damm 2009-03-18 88
b7cf6ddc13186f9 Magnus Damm 2009-03-18 89 /* make sure bank0 is active and restore r0->r7 */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 90 mov.l 12f, r9
b7cf6ddc13186f9 Magnus Damm 2009-03-18 91 not r9, r9
b7cf6ddc13186f9 Magnus Damm 2009-03-18 92 stc sr, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 93 and r9, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 94 ldc r8, sr
b7cf6ddc13186f9 Magnus Damm 2009-03-18 95 mov.l @r15+, r0
b7cf6ddc13186f9 Magnus Damm 2009-03-18 96 mov.l @r15+, r1
b7cf6ddc13186f9 Magnus Damm 2009-03-18 97 mov.l @r15+, r2
b7cf6ddc13186f9 Magnus Damm 2009-03-18 98 mov.l @r15+, r3
b7cf6ddc13186f9 Magnus Damm 2009-03-18 99 mov.l @r15+, r4
b7cf6ddc13186f9 Magnus Damm 2009-03-18 100 mov.l @r15+, r5
b7cf6ddc13186f9 Magnus Damm 2009-03-18 101 mov.l @r15+, r6
b7cf6ddc13186f9 Magnus Damm 2009-03-18 102 mov.l @r15+, r7
b7cf6ddc13186f9 Magnus Damm 2009-03-18 103
b7cf6ddc13186f9 Magnus Damm 2009-03-18 104 /* switch to bank1 and restore r0->r7 */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 105 mov.l 12f, r9
b7cf6ddc13186f9 Magnus Damm 2009-03-18 106 stc sr, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 107 or r9, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 108 ldc r8, sr
b7cf6ddc13186f9 Magnus Damm 2009-03-18 109 mov.l @r15+, r0
b7cf6ddc13186f9 Magnus Damm 2009-03-18 110 mov.l @r15+, r1
b7cf6ddc13186f9 Magnus Damm 2009-03-18 111 mov.l @r15+, r2
b7cf6ddc13186f9 Magnus Damm 2009-03-18 112 mov.l @r15+, r3
b7cf6ddc13186f9 Magnus Damm 2009-03-18 113 mov.l @r15+, r4
b7cf6ddc13186f9 Magnus Damm 2009-03-18 114 mov.l @r15+, r5
b7cf6ddc13186f9 Magnus Damm 2009-03-18 115 mov.l @r15+, r6
b7cf6ddc13186f9 Magnus Damm 2009-03-18 116 mov.l @r15+, r7
b7cf6ddc13186f9 Magnus Damm 2009-03-18 117
b7cf6ddc13186f9 Magnus Damm 2009-03-18 118 /* switch back to bank0 */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 119 mov.l 12f, r9
b7cf6ddc13186f9 Magnus Damm 2009-03-18 120 not r9, r9
b7cf6ddc13186f9 Magnus Damm 2009-03-18 121 stc sr, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 122 and r9, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 123 ldc r8, sr
9d44190eae97ad4 kogiidena 2006-01-16 124
b7cf6ddc13186f9 Magnus Damm 2009-03-18 125 /* restore other random registers */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 126 ldc.l @r15+, spc
b7cf6ddc13186f9 Magnus Damm 2009-03-18 127 lds.l @r15+, pr
b7cf6ddc13186f9 Magnus Damm 2009-03-18 128 ldc.l @r15+, sr
b7cf6ddc13186f9 Magnus Damm 2009-03-18 129 ldc.l @r15+, ssr
b7cf6ddc13186f9 Magnus Damm 2009-03-18 130 ldc.l @r15+, gbr
b7cf6ddc13186f9 Magnus Damm 2009-03-18 131 lds.l @r15+, mach
b7cf6ddc13186f9 Magnus Damm 2009-03-18 132 lds.l @r15+, macl
9d44190eae97ad4 kogiidena 2006-01-16 133
b7cf6ddc13186f9 Magnus Damm 2009-03-18 134 /* restore r8->r15 */
b7cf6ddc13186f9 Magnus Damm 2009-03-18 135 mov.l @r15+, r8
b7cf6ddc13186f9 Magnus Damm 2009-03-18 136 mov.l @r15+, r9
b7cf6ddc13186f9 Magnus Damm 2009-03-18 137 mov.l @r15+, r10
b7cf6ddc13186f9 Magnus Damm 2009-03-18 138 mov.l @r15+, r11
b7cf6ddc13186f9 Magnus Damm 2009-03-18 139 mov.l @r15+, r12
b7cf6ddc13186f9 Magnus Damm 2009-03-18 140 mov.l @r15+, r13
b7cf6ddc13186f9 Magnus Damm 2009-03-18 141 mov.l @r15+, r14
b7cf6ddc13186f9 Magnus Damm 2009-03-18 142 mov.l @r15+, r15
b7cf6ddc13186f9 Magnus Damm 2009-03-18 143 rts
b7cf6ddc13186f9 Magnus Damm 2009-03-18 144 nop
b7cf6ddc13186f9 Magnus Damm 2009-03-18 145
b7cf6ddc13186f9 Magnus Damm 2009-03-18 146 swap_pages:
9d44190eae97ad4 kogiidena 2006-01-16 147 bra 1f
9d44190eae97ad4 kogiidena 2006-01-16 148 mov r4,r0 /* cmd = indirection_page */
9d44190eae97ad4 kogiidena 2006-01-16 149 0:
9d44190eae97ad4 kogiidena 2006-01-16 150 mov.l @r4+,r0 /* cmd = *ind++ */
9d44190eae97ad4 kogiidena 2006-01-16 151

:::::: The code at line 38 was first introduced by commit
:::::: b7cf6ddc13186f9272438a97aa75972d496d0b0a sh: add kexec jump support

:::::: TO: Magnus Damm <[email protected]>
:::::: CC: Paul Mundt <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


2023-12-20 05:44:38

by Baoquan He

[permalink] [raw]
Subject: Re: arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode

On 12/18/23 at 10:55pm, kernel test robot wrote:
> Hi Baoquan,
>
> FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: ceb6a6f023fd3e8b07761ed900352ef574010bcb
> commit: d70c27b728b8da1ab9c3b7ca117ee1c99dc86d29 sh, kexec: fix the incorrect ifdeffery and dependency of CONFIG_KEXEC
> date: 6 days ago
> config: sh-randconfig-r002-20220124 (https://download.01.org/0day-ci/archive/20231218/[email protected]/config)
> compiler: sh4-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231218/[email protected]/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <[email protected]>
> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> All errors (new ones prefixed by >>):
>
> arch/sh/kernel/relocate_kernel.S: Assembler messages:
> >> arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode
> arch/sh/kernel/relocate_kernel.S:41: Error: invalid operands for opcode
> arch/sh/kernel/relocate_kernel.S:126: Error: invalid operands for opcode
> arch/sh/kernel/relocate_kernel.S:129: Error: invalid operands for opcode

I reproduced this error, haven't got why and a way to fix it, will come
back later if I have fix.

>
> vim +38 arch/sh/kernel/relocate_kernel.S
>
> 9d44190eae97ad4 kogiidena 2006-01-16 13
> 9d44190eae97ad4 kogiidena 2006-01-16 14 .globl relocate_new_kernel
> 9d44190eae97ad4 kogiidena 2006-01-16 15 relocate_new_kernel:
> 9d44190eae97ad4 kogiidena 2006-01-16 16 /* r4 = indirection_page */
> 9d44190eae97ad4 kogiidena 2006-01-16 17 /* r5 = reboot_code_buffer */
> 9d44190eae97ad4 kogiidena 2006-01-16 18 /* r6 = start_address */
> 9d44190eae97ad4 kogiidena 2006-01-16 19
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 20 mov.l 10f, r0 /* PAGE_SIZE */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 21 add r5, r0 /* setup new stack at end of control page */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 22
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 23 /* save r15->r8 to new stack */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 24 mov.l r15, @-r0
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 25 mov r0, r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 26 mov.l r14, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 27 mov.l r13, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 28 mov.l r12, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 29 mov.l r11, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 30 mov.l r10, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 31 mov.l r9, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 32 mov.l r8, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 33
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 34 /* save other random registers */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 35 sts.l macl, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 36 sts.l mach, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 37 stc.l gbr, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 @38 stc.l ssr, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 39 stc.l sr, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 40 sts.l pr, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 41 stc.l spc, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 42
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 43 /* switch to bank1 and save r7->r0 */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 44 mov.l 12f, r9
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 45 stc sr, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 46 or r9, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 47 ldc r8, sr
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 48 mov.l r7, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 49 mov.l r6, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 50 mov.l r5, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 51 mov.l r4, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 52 mov.l r3, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 53 mov.l r2, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 54 mov.l r1, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 55 mov.l r0, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 56
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 57 /* switch to bank0 and save r7->r0 */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 58 mov.l 12f, r9
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 59 not r9, r9
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 60 stc sr, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 61 and r9, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 62 ldc r8, sr
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 63 mov.l r7, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 64 mov.l r6, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 65 mov.l r5, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 66 mov.l r4, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 67 mov.l r3, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 68 mov.l r2, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 69 mov.l r1, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 70 mov.l r0, @-r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 71
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 72 mov.l r4, @-r15 /* save indirection page again */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 73
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 74 bsr swap_pages /* swap pages before jumping to new kernel */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 75 nop
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 76
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 77 mova 11f, r0
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 78 mov.l r15, @r0 /* save pointer to stack */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 79
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 80 jsr @r6 /* hand over control to new kernel */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 81 nop
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 82
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 83 mov.l 11f, r15 /* get pointer to stack */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 84 mov.l @r15+, r4 /* restore r4 to get indirection page */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 85
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 86 bsr swap_pages /* swap pages back to previous state */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 87 nop
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 88
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 89 /* make sure bank0 is active and restore r0->r7 */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 90 mov.l 12f, r9
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 91 not r9, r9
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 92 stc sr, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 93 and r9, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 94 ldc r8, sr
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 95 mov.l @r15+, r0
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 96 mov.l @r15+, r1
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 97 mov.l @r15+, r2
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 98 mov.l @r15+, r3
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 99 mov.l @r15+, r4
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 100 mov.l @r15+, r5
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 101 mov.l @r15+, r6
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 102 mov.l @r15+, r7
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 103
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 104 /* switch to bank1 and restore r0->r7 */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 105 mov.l 12f, r9
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 106 stc sr, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 107 or r9, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 108 ldc r8, sr
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 109 mov.l @r15+, r0
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 110 mov.l @r15+, r1
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 111 mov.l @r15+, r2
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 112 mov.l @r15+, r3
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 113 mov.l @r15+, r4
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 114 mov.l @r15+, r5
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 115 mov.l @r15+, r6
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 116 mov.l @r15+, r7
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 117
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 118 /* switch back to bank0 */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 119 mov.l 12f, r9
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 120 not r9, r9
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 121 stc sr, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 122 and r9, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 123 ldc r8, sr
> 9d44190eae97ad4 kogiidena 2006-01-16 124
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 125 /* restore other random registers */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 126 ldc.l @r15+, spc
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 127 lds.l @r15+, pr
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 128 ldc.l @r15+, sr
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 129 ldc.l @r15+, ssr
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 130 ldc.l @r15+, gbr
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 131 lds.l @r15+, mach
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 132 lds.l @r15+, macl
> 9d44190eae97ad4 kogiidena 2006-01-16 133
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 134 /* restore r8->r15 */
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 135 mov.l @r15+, r8
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 136 mov.l @r15+, r9
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 137 mov.l @r15+, r10
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 138 mov.l @r15+, r11
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 139 mov.l @r15+, r12
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 140 mov.l @r15+, r13
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 141 mov.l @r15+, r14
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 142 mov.l @r15+, r15
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 143 rts
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 144 nop
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 145
> b7cf6ddc13186f9 Magnus Damm 2009-03-18 146 swap_pages:
> 9d44190eae97ad4 kogiidena 2006-01-16 147 bra 1f
> 9d44190eae97ad4 kogiidena 2006-01-16 148 mov r4,r0 /* cmd = indirection_page */
> 9d44190eae97ad4 kogiidena 2006-01-16 149 0:
> 9d44190eae97ad4 kogiidena 2006-01-16 150 mov.l @r4+,r0 /* cmd = *ind++ */
> 9d44190eae97ad4 kogiidena 2006-01-16 151
>
> :::::: The code at line 38 was first introduced by commit
> :::::: b7cf6ddc13186f9272438a97aa75972d496d0b0a sh: add kexec jump support
>
> :::::: TO: Magnus Damm <[email protected]>
> :::::: CC: Paul Mundt <[email protected]>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>


2023-12-20 06:00:50

by Al Viro

[permalink] [raw]
Subject: Re: arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode

On Wed, Dec 20, 2023 at 01:44:19PM +0800, Baoquan He wrote:

> > arch/sh/kernel/relocate_kernel.S: Assembler messages:
> > >> arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode
> > arch/sh/kernel/relocate_kernel.S:41: Error: invalid operands for opcode
> > arch/sh/kernel/relocate_kernel.S:126: Error: invalid operands for opcode
> > arch/sh/kernel/relocate_kernel.S:129: Error: invalid operands for opcode
>
> I reproduced this error, haven't got why and a way to fix it, will come
> back later if I have fix.

At a guess - after that commit ARCH_SUPPORTS_CRASH_DUMP is enough to enable CRASH_DUMP,
which selects KEXEC_CORE regardless of ARCH_SUPPORTS_KEXEC. And on sh you have
the former selected on any UP build, while the latter - only on MMU ones (i.e.
not SH2).

2023-12-20 13:27:52

by Baoquan He

[permalink] [raw]
Subject: Re: arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode

On 12/20/23 at 06:00am, Al Viro wrote:
> On Wed, Dec 20, 2023 at 01:44:19PM +0800, Baoquan He wrote:
>
> > > arch/sh/kernel/relocate_kernel.S: Assembler messages:
> > > >> arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode
> > > arch/sh/kernel/relocate_kernel.S:41: Error: invalid operands for opcode
> > > arch/sh/kernel/relocate_kernel.S:126: Error: invalid operands for opcode
> > > arch/sh/kernel/relocate_kernel.S:129: Error: invalid operands for opcode
> >
> > I reproduced this error, haven't got why and a way to fix it, will come
> > back later if I have fix.
>
> At a guess - after that commit ARCH_SUPPORTS_CRASH_DUMP is enough to enable CRASH_DUMP,
> which selects KEXEC_CORE regardless of ARCH_SUPPORTS_KEXEC. And on sh you have
> the former selected on any UP build, while the latter - only on MMU ones (i.e.
> not SH2).

Yeah, you are right. I managed to set CONFIG_CPU_SH4=y and CONFIG_MMU=y,
the building passed.
---------------------
CONFIG_CPU_SH4=y
CONFIG_CPU_SH4A=y
CONFIG_CPU_SHX2=y
...
CONFIG_MMU=y
...
CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
CONFIG_CRASH_DUMP=y
-----------------------------

Since the kexec_core code building depends on CONFIG_MMU=y, we may
need to add dependency on MMU for ARCH_SUPPORTS_CRASH_DUMP. I made below
change, do you think it's OK?

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 7500521b2b98..fe1500871648 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -548,6 +548,7 @@ config ARCH_SUPPORTS_KEXEC

config ARCH_SUPPORTS_CRASH_DUMP
def_bool BROKEN_ON_SMP
+ depends on MMU

config ARCH_SUPPORTS_KEXEC_JUMP
def_bool y


2023-12-20 17:37:33

by Al Viro

[permalink] [raw]
Subject: Re: arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode

On Wed, Dec 20, 2023 at 09:27:32PM +0800, Baoquan He wrote:
> Since the kexec_core code building depends on CONFIG_MMU=y, we may
> need to add dependency on MMU for ARCH_SUPPORTS_CRASH_DUMP. I made below
> change, do you think it's OK?
>
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 7500521b2b98..fe1500871648 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -548,6 +548,7 @@ config ARCH_SUPPORTS_KEXEC
>
> config ARCH_SUPPORTS_CRASH_DUMP
> def_bool BROKEN_ON_SMP
> + depends on MMU
>
> config ARCH_SUPPORTS_KEXEC_JUMP
> def_bool y
>

I'm *not* familiar with crashdump or kexec machinery, let alone the
current changes in there, so take the following with a cartload of
salt, but... does sh crash dump support depend upon the code in
question? From quick grep it looks like we only want it in machine_kexec(),
so the conditionals used in the commit in question might be wrong...

2023-12-21 04:24:52

by Baoquan He

[permalink] [raw]
Subject: Re: arch/sh/kernel/relocate_kernel.S:38: Error: invalid operands for opcode

On 12/20/23 at 05:37pm, Al Viro wrote:
> On Wed, Dec 20, 2023 at 09:27:32PM +0800, Baoquan He wrote:
> > Since the kexec_core code building depends on CONFIG_MMU=y, we may
> > need to add dependency on MMU for ARCH_SUPPORTS_CRASH_DUMP. I made below
> > change, do you think it's OK?
> >
> > diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> > index 7500521b2b98..fe1500871648 100644 > > --- a/arch/sh/Kconfig > > +++ b/arch/sh/Kconfig
> > @@ -548,6 +548,7 @@ config ARCH_SUPPORTS_KEXEC
> >
> > config ARCH_SUPPORTS_CRASH_DUMP
> > def_bool BROKEN_ON_SMP
> > + depends on MMU
> >
> > config ARCH_SUPPORTS_KEXEC_JUMP
> > def_bool y
> >
>
> I'm *not* familiar with crashdump or kexec machinery, let alone the
> current changes in there, so take the following with a cartload of
> salt, but... does sh crash dump support depend upon the code in
> question? From quick grep it looks like we only want it in machine_kexec(),
> so the conditionals used in the commit in question might be wrong...

Hmm, I checked commit d70c27b728b8da1 ("sh, kexec: fix the incorrect
ifdeffery and dependency of CONFIG_KEXEC") again, those ifdeffery of
CONFIG_KEXEC_CORE should be changed to CONFIG_CRASH_CORE because those
embraced codes are crash_core related codes.

machine_kexec() is needed by kexec reboot and crash dumping. We either
enable CONFIG_KEXEC_CORE, CONFIG_KEXEC or CONFIG_KEXEC_FILE only for
kexec reboot, or enable CONFIG_KEXEC_CORE, CONFIG_KEXEC or CONFIG_KEXEC_FILE
and CONFIG_CRASH_CORE, CONFIG_CRASH_DUMP to support kexec reboot and
crash dumping. Seems KEXEC_CORE codes can be built not relying on
CRASH_CORE, while CRASH_CORE need be built relying on KEXEC_CORE,
otherwise it doesn't make sense.

Anyway, I will try to clean up the ifdeffery so that they looks clearer.