tree:
https://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git for-next
head: 929f6a183839a4c4aabb38a61e02fe32239e6b59
commit: 95ce6c73da3b909d27181df5ab47bb0d901e5698 [10/13] riscv: Enable context tracking
config: riscv-randconfig-r015-20200712 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
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
git checkout 95ce6c73da3b909d27181df5ab47bb0d901e5698
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
arch/riscv/kernel/entry.S: Assembler messages:
> arch/riscv/kernel/entry.S:106: Error: illegal operands `andi
a0,s1,0x00001800'
vim +106 arch/riscv/kernel/entry.S
103
104 #ifdef CONFIG_CONTEXT_TRACKING
105 /* If previous state is in user mode, call context_tracking_user_exit. */
106 andi a0, s1, SR_PP
107 bnez a0, skip_context_tracking
108 call context_tracking_user_exit
109 skip_context_tracking:
110 #endif
111
112 /*
113 * MSB of cause differentiates between
114 * interrupts and exceptions
115 */
116 bge s4, zero, 1f
117
118 la ra, ret_from_exception
119
120 /* Handle interrupts */
121 move a0, sp /* pt_regs */
122 la a1, handle_arch_irq
123 REG_L a1, (a1)
124 jr a1
125 1:
126 #ifdef CONFIG_TRACE_IRQFLAGS
127 call trace_hardirqs_on
128 #endif
129 /*
130 * Exceptions run with interrupts enabled or disabled depending on the
131 * state of SR_PIE in m/sstatus.
132 */
133 andi t0, s1, SR_PIE
134 beqz t0, 1f
135 csrs CSR_STATUS, SR_IE
136
137 1:
138 la ra, ret_from_exception
139 /* Handle syscalls */
140 li t0, EXC_SYSCALL
141 beq s4, t0, handle_syscall
142
143 /* Handle other exceptions */
144 slli t0, s4, RISCV_LGPTR
145 la t1, excp_vect_table
146 la t2, excp_vect_table_end
147 move a0, sp /* pt_regs */
148 add t0, t1, t0
149 /* Check if exception code lies within bounds */
150 bgeu t0, t2, 1f
151 REG_L t0, 0(t0)
152 jr t0
153 1:
154 tail do_trap_unknown
155
156 handle_syscall:
157 #if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING)
158 /* Recover a0 - a7 for system calls */
159 REG_L a0, PT_A0(sp)
160 REG_L a1, PT_A1(sp)
161 REG_L a2, PT_A2(sp)
162 REG_L a3, PT_A3(sp)
163 REG_L a4, PT_A4(sp)
164 REG_L a5, PT_A5(sp)
165 REG_L a6, PT_A6(sp)
166 REG_L a7, PT_A7(sp)
167 #endif
168 /* save the initial A0 value (needed in signal handlers) */
169 REG_S a0, PT_ORIG_A0(sp)
170 /*
171 * Advance SEPC to avoid executing the original
172 * scall instruction on sret
173 */
174 addi s2, s2, 0x4
175 REG_S s2, PT_EPC(sp)
176 /* Trace syscalls, but only if requested by the user. */
177 REG_L t0, TASK_TI_FLAGS(tp)
178 andi t0, t0, _TIF_SYSCALL_WORK
179 bnez t0, handle_syscall_trace_enter
180 check_syscall_nr:
181 /* Check to make sure we don't jump to a bogus syscall number. */
182 li t0, __NR_syscalls
183 la s0, sys_ni_syscall
184 /*
185 * Syscall number held in a7.
186 * If syscall number is above allowed value, redirect to ni_syscall.
187 */
188 bge a7, t0, 1f
189 /*
190 * Check if syscall is rejected by tracer, i.e., a7 == -1.
191 * If yes, we pretend it was executed.
192 */
193 li t1, -1
194 beq a7, t1, ret_from_syscall_rejected
195 blt a7, t1, 1f
196 /* Call syscall */
197 la s0, sys_call_table
198 slli t0, a7, RISCV_LGPTR
199 add s0, s0, t0
200 REG_L s0, 0(s0)
201 1:
202 jalr s0
203
204 ret_from_syscall:
205 /* Set user a0 to kernel a0 */
206 REG_S a0, PT_A0(sp)
207 /*
208 * We didn't execute the actual syscall.
209 * Seccomp already set return value for the current task pt_regs.
210 * (If it was configured with SECCOMP_RET_ERRNO/TRACE)
211 */
212 ret_from_syscall_rejected:
213 /* Trace syscalls, but only if requested by the user. */
214 REG_L t0, TASK_TI_FLAGS(tp)
215 andi t0, t0, _TIF_SYSCALL_WORK
216 bnez t0, handle_syscall_trace_exit
217
218 ret_from_exception:
219 REG_L s0, PT_STATUS(sp)
220 csrc CSR_STATUS, SR_IE
221 #ifdef CONFIG_TRACE_IRQFLAGS
222 call trace_hardirqs_off
223 #endif
224 #ifdef CONFIG_RISCV_M_MODE
225 /* the MPP value is too large to be used as an immediate arg for addi */
226 li t0, SR_MPP
227 and s0, s0, t0
228 #else
229 andi s0, s0, SR_SPP
230 #endif
231 bnez s0, resume_kernel
232
233 resume_userspace:
234 /* Interrupts must be disabled here so flags are checked atomically */
235 REG_L s0, TASK_TI_FLAGS(tp) /* current_thread_info->flags */
236 andi s1, s0, _TIF_WORK_MASK
237 bnez s1, work_pending
238
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org