15 #include <linux/sched.h>
17 #include <linux/module.h>
20 #include <linux/elfcore.h>
27 #include <linux/kernel.h>
29 #include <linux/signal.h>
31 #include <asm/switch_to.h>
33 #include <asm/syscalls.h>
34 #include <asm/traps.h>
35 #include <asm/setup.h>
36 #ifdef CONFIG_HARDWALL
37 #include <asm/hardwall.h>
49 static int no_idle_nap;
55 if (!
strcmp(str,
"poll")) {
56 pr_info(
"using polling idle threads.\n");
58 }
else if (!
strcmp(str,
"halt"))
82 while (!need_resched())
90 tick_nohz_idle_enter();
92 while (!need_resched()) {
112 tick_nohz_idle_exit();
124 #ifdef CONFIG_HARDWALL
160 unsigned long stack_size,
197 childregs->
regs[0] = 0;
205 childregs->
tp = regs->
regs[4];
216 ksp = (
unsigned long) childregs;
218 ((
long *)ksp)[0] = ((
long *)ksp)[1] = 0;
223 ((
long *)ksp)[0] = ((
long *)ksp)[1] = 0;
226 #if CHIP_HAS_TILE_DMA()
231 memset(&p->
thread.tile_dma_state, 0,
sizeof(
struct tile_dma_state));
235 #if CHIP_HAS_SN_PROC()
237 p->
thread.sn_proc_running = 0;
241 #if CHIP_HAS_PROC_STATUS_SPR()
243 p->
thread.proc_status = 0;
246 #ifdef CONFIG_HARDWALL
249 sizeof(
struct hardwall_task) * HARDWALL_TYPES);
257 save_arch_state(&p->
thread);
272 ((
unsigned long)tsk & (__alignof__(*tsk) - 1)) != 0)) {
293 elf_core_copy_regs(regs, ptregs);
297 #if CHIP_HAS_TILE_DMA()
302 #if CONFIG_KERNEL_PL == 2
314 #if CONFIG_KERNEL_PL == 2
324 static void save_tile_dma_state(
struct tile_dma_state *
dma)
327 unsigned long post_suspend_state;
359 const struct tile_dma_state *dma = &t->tile_dma_state;
370 SPR_DMA_STATUS__BUSY_MASK)
391 t->dma_async_tlb.fault_num = 0;
400 #if CHIP_HAS_SPLIT_INTR_MASK()
413 #if CHIP_HAS_PROC_STATUS_SPR()
416 #if !CHIP_HAS_FIXED_INTVEC_BASE()
419 #if CHIP_HAS_TILE_RTF_HWM()
422 #if CHIP_HAS_DSTREAM_PF()
427 static void restore_arch_state(
const struct thread_struct *t)
429 #if CHIP_HAS_SPLIT_INTR_MASK()
442 #if CHIP_HAS_PROC_STATUS_SPR()
445 #if !CHIP_HAS_FIXED_INTVEC_BASE()
448 #if CHIP_HAS_TILE_RTF_HWM()
451 #if CHIP_HAS_DSTREAM_PF()
459 #if CHIP_HAS_SN_PROC()
462 #if CHIP_HAS_TILE_DMA()
463 struct tile_dma_state *dma = &
current->thread.tile_dma_state;
465 save_tile_dma_state(dma);
467 #if CHIP_HAS_SN_PROC()
474 current->thread.sn_proc_running =
476 if (
current->thread.sn_proc_running)
486 save_arch_state(&prev->
thread);
488 #if CHIP_HAS_TILE_DMA()
495 if (next->
thread.tile_dma_state.enabled) {
496 restore_tile_dma_state(&next->
thread);
504 restore_arch_state(&next->
thread);
506 #if CHIP_HAS_SN_PROC()
511 if (next->
thread.sn_proc_running) {
517 #ifdef CONFIG_HARDWALL
558 #if CHIP_HAS_TILE_DMA() || CHIP_HAS_SN_PROC()
570 tracehook_notify_resume(regs);
577 panic(
"work_pending: bad flags %#x\n", thread_info_flags);
582 void __user *, parent_tidptr,
void __user *, child_tidptr,
588 parent_tidptr, child_tidptr);
595 const char __user *
const __user *, argv,
596 const char __user *
const __user *, envp,
603 error = PTR_ERR(filename);
604 if (IS_ERR(filename))
624 error = PTR_ERR(filename);
625 if (IS_ERR(filename))
627 error = compat_do_execve(filename->
name, argv, envp, regs);
659 static void start_kernel_thread(
int dummy,
int (*
fn)(
int),
int arg)
671 memset(®s, 0,
sizeof(regs));
673 regs.
pc = (
long) start_kernel_thread;
704 pr_err(
" Pid: %d, comm: %20s, CPU: %d\n",
707 for (i = 0; i < 51; i += 3)
709 i, regs->
regs[i], i+1, regs->
regs[i+1],
710 i+2, regs->
regs[i+2]);
711 pr_err(
" r51: "REGFMT
" r52: "REGFMT
" tp : "REGFMT
"\n",
713 pr_err(
" sp : "REGFMT
" lr : "REGFMT
"\n", regs->
sp, regs->
lr);
715 for (i = 0; i < 52; i += 4)
716 pr_err(
" r%-2d: "REGFMT
" r%-2d: "REGFMT
717 " r%-2d: "REGFMT
" r%-2d: "REGFMT
"\n",
718 i, regs->
regs[i], i+1, regs->
regs[i+1],
719 i+2, regs->
regs[i+2], i+3, regs->
regs[i+3]);
720 pr_err(
" r52: "REGFMT
" tp : "REGFMT
" sp : "REGFMT
" lr : "REGFMT
"\n",
721 regs->
regs[52], regs->
tp, regs->
sp, regs->
lr);
723 pr_err(
" pc : "REGFMT
" ex1: %ld faultnum: %ld\n",