.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * PARISC Architecture-dependent parts of process handling |
---|
3 | 4 | * based on the work for i386 |
---|
.. | .. |
---|
15 | 16 | * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org> |
---|
16 | 17 | * Copyright (C) 2001-2014 Helge Deller <deller@gmx.de> |
---|
17 | 18 | * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> |
---|
18 | | - * |
---|
19 | | - * |
---|
20 | | - * This program is free software; you can redistribute it and/or modify |
---|
21 | | - * it under the terms of the GNU General Public License as published by |
---|
22 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
23 | | - * (at your option) any later version. |
---|
24 | | - * |
---|
25 | | - * This program is distributed in the hope that it will be useful, |
---|
26 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
27 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
28 | | - * GNU General Public License for more details. |
---|
29 | | - * |
---|
30 | | - * You should have received a copy of the GNU General Public License |
---|
31 | | - * along with this program; if not, write to the Free Software |
---|
32 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
33 | 19 | */ |
---|
34 | 20 | |
---|
35 | 21 | #include <stdarg.h> |
---|
.. | .. |
---|
61 | 47 | #include <asm/assembly.h> |
---|
62 | 48 | #include <asm/pdc.h> |
---|
63 | 49 | #include <asm/pdc_chassis.h> |
---|
64 | | -#include <asm/pgalloc.h> |
---|
65 | 50 | #include <asm/unwind.h> |
---|
66 | 51 | #include <asm/sections.h> |
---|
67 | 52 | |
---|
.. | .. |
---|
138 | 123 | /* It seems we have no way to power the system off via |
---|
139 | 124 | * software. The user has to press the button himself. */ |
---|
140 | 125 | |
---|
141 | | - printk(KERN_EMERG "System shut down completed.\n" |
---|
142 | | - "Please power this system off now."); |
---|
| 126 | + printk("Power off or press RETURN to reboot.\n"); |
---|
143 | 127 | |
---|
144 | 128 | /* prevent soft lockup/stalled CPU messages for endless loop. */ |
---|
145 | 129 | rcu_sysrq_start(); |
---|
146 | 130 | lockup_detector_soft_poweroff(); |
---|
147 | | - for (;;); |
---|
| 131 | + while (1) { |
---|
| 132 | + /* reboot if user presses RETURN key */ |
---|
| 133 | + if (pdc_iodc_getc() == 13) { |
---|
| 134 | + printk("Rebooting...\n"); |
---|
| 135 | + machine_restart(NULL); |
---|
| 136 | + } |
---|
| 137 | + } |
---|
148 | 138 | } |
---|
149 | 139 | |
---|
150 | 140 | void (*pm_power_off)(void); |
---|
.. | .. |
---|
167 | 157 | } |
---|
168 | 158 | |
---|
169 | 159 | /* |
---|
170 | | - * Fill in the FPU structure for a core dump. |
---|
171 | | - */ |
---|
172 | | - |
---|
173 | | -int dump_fpu (struct pt_regs * regs, elf_fpregset_t *r) |
---|
174 | | -{ |
---|
175 | | - if (regs == NULL) |
---|
176 | | - return 0; |
---|
177 | | - |
---|
178 | | - memcpy(r, regs->fr, sizeof *r); |
---|
179 | | - return 1; |
---|
180 | | -} |
---|
181 | | - |
---|
182 | | -int dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *r) |
---|
183 | | -{ |
---|
184 | | - memcpy(r, tsk->thread.regs.fr, sizeof(*r)); |
---|
185 | | - return 1; |
---|
186 | | -} |
---|
187 | | - |
---|
188 | | -/* |
---|
189 | 160 | * Idle thread support |
---|
190 | 161 | * |
---|
191 | 162 | * Detect when running on QEMU with SeaBIOS PDC Firmware and let |
---|
192 | 163 | * QEMU idle the host too. |
---|
193 | 164 | */ |
---|
194 | 165 | |
---|
195 | | -int running_on_qemu __read_mostly; |
---|
| 166 | +int running_on_qemu __ro_after_init; |
---|
196 | 167 | EXPORT_SYMBOL(running_on_qemu); |
---|
197 | 168 | |
---|
198 | 169 | void __cpuidle arch_cpu_idle_dead(void) |
---|
.. | .. |
---|
203 | 174 | |
---|
204 | 175 | void __cpuidle arch_cpu_idle(void) |
---|
205 | 176 | { |
---|
206 | | - local_irq_enable(); |
---|
| 177 | + raw_local_irq_enable(); |
---|
207 | 178 | |
---|
208 | 179 | /* nop on real hardware, qemu will idle sleep. */ |
---|
209 | 180 | asm volatile("or %%r10,%%r10,%%r10\n":::); |
---|
.. | .. |
---|
223 | 194 | */ |
---|
224 | 195 | int |
---|
225 | 196 | copy_thread(unsigned long clone_flags, unsigned long usp, |
---|
226 | | - unsigned long kthread_arg, struct task_struct *p) |
---|
| 197 | + unsigned long kthread_arg, struct task_struct *p, unsigned long tls) |
---|
227 | 198 | { |
---|
228 | 199 | struct pt_regs *cregs = &(p->thread.regs); |
---|
229 | 200 | void *stack = task_stack_page(p); |
---|
.. | .. |
---|
234 | 205 | extern void * const ret_from_kernel_thread; |
---|
235 | 206 | extern void * const child_return; |
---|
236 | 207 | |
---|
237 | | - if (unlikely(p->flags & PF_KTHREAD)) { |
---|
| 208 | + if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) { |
---|
238 | 209 | /* kernel thread */ |
---|
239 | 210 | memset(cregs, 0, sizeof(struct pt_regs)); |
---|
240 | 211 | if (!usp) /* idle thread */ |
---|
.. | .. |
---|
268 | 239 | cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE; |
---|
269 | 240 | cregs->kpc = (unsigned long) &child_return; |
---|
270 | 241 | |
---|
271 | | - /* Setup thread TLS area from the 4th parameter in clone */ |
---|
| 242 | + /* Setup thread TLS area */ |
---|
272 | 243 | if (clone_flags & CLONE_SETTLS) |
---|
273 | | - cregs->cr27 = cregs->gr[23]; |
---|
| 244 | + cregs->cr27 = tls; |
---|
274 | 245 | } |
---|
275 | 246 | |
---|
276 | 247 | return 0; |
---|
.. | .. |
---|
307 | 278 | Elf64_Fdesc *desc = ptr; |
---|
308 | 279 | void *p; |
---|
309 | 280 | |
---|
310 | | - if (!probe_kernel_address(&desc->addr, p)) |
---|
| 281 | + if (!get_kernel_nofault(p, (void *)&desc->addr)) |
---|
311 | 282 | ptr = p; |
---|
312 | 283 | return ptr; |
---|
313 | 284 | } |
---|