| .. | .. |
|---|
| 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 | |
|---|
| .. | .. |
|---|
| 167 | 152 | } |
|---|
| 168 | 153 | |
|---|
| 169 | 154 | /* |
|---|
| 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 | 155 | * Idle thread support |
|---|
| 190 | 156 | * |
|---|
| 191 | 157 | * Detect when running on QEMU with SeaBIOS PDC Firmware and let |
|---|
| 192 | 158 | * QEMU idle the host too. |
|---|
| 193 | 159 | */ |
|---|
| 194 | 160 | |
|---|
| 195 | | -int running_on_qemu __read_mostly; |
|---|
| 161 | +int running_on_qemu __ro_after_init; |
|---|
| 196 | 162 | EXPORT_SYMBOL(running_on_qemu); |
|---|
| 197 | 163 | |
|---|
| 198 | 164 | void __cpuidle arch_cpu_idle_dead(void) |
|---|
| .. | .. |
|---|
| 203 | 169 | |
|---|
| 204 | 170 | void __cpuidle arch_cpu_idle(void) |
|---|
| 205 | 171 | { |
|---|
| 206 | | - local_irq_enable(); |
|---|
| 172 | + raw_local_irq_enable(); |
|---|
| 207 | 173 | |
|---|
| 208 | 174 | /* nop on real hardware, qemu will idle sleep. */ |
|---|
| 209 | 175 | asm volatile("or %%r10,%%r10,%%r10\n":::); |
|---|
| .. | .. |
|---|
| 223 | 189 | */ |
|---|
| 224 | 190 | int |
|---|
| 225 | 191 | copy_thread(unsigned long clone_flags, unsigned long usp, |
|---|
| 226 | | - unsigned long kthread_arg, struct task_struct *p) |
|---|
| 192 | + unsigned long kthread_arg, struct task_struct *p, unsigned long tls) |
|---|
| 227 | 193 | { |
|---|
| 228 | 194 | struct pt_regs *cregs = &(p->thread.regs); |
|---|
| 229 | 195 | void *stack = task_stack_page(p); |
|---|
| .. | .. |
|---|
| 234 | 200 | extern void * const ret_from_kernel_thread; |
|---|
| 235 | 201 | extern void * const child_return; |
|---|
| 236 | 202 | |
|---|
| 237 | | - if (unlikely(p->flags & PF_KTHREAD)) { |
|---|
| 203 | + if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) { |
|---|
| 238 | 204 | /* kernel thread */ |
|---|
| 239 | 205 | memset(cregs, 0, sizeof(struct pt_regs)); |
|---|
| 240 | 206 | if (!usp) /* idle thread */ |
|---|
| .. | .. |
|---|
| 268 | 234 | cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE; |
|---|
| 269 | 235 | cregs->kpc = (unsigned long) &child_return; |
|---|
| 270 | 236 | |
|---|
| 271 | | - /* Setup thread TLS area from the 4th parameter in clone */ |
|---|
| 237 | + /* Setup thread TLS area */ |
|---|
| 272 | 238 | if (clone_flags & CLONE_SETTLS) |
|---|
| 273 | | - cregs->cr27 = cregs->gr[23]; |
|---|
| 239 | + cregs->cr27 = tls; |
|---|
| 274 | 240 | } |
|---|
| 275 | 241 | |
|---|
| 276 | 242 | return 0; |
|---|
| .. | .. |
|---|
| 307 | 273 | Elf64_Fdesc *desc = ptr; |
|---|
| 308 | 274 | void *p; |
|---|
| 309 | 275 | |
|---|
| 310 | | - if (!probe_kernel_address(&desc->addr, p)) |
|---|
| 276 | + if (!get_kernel_nofault(p, (void *)&desc->addr)) |
|---|
| 311 | 277 | ptr = p; |
|---|
| 312 | 278 | return ptr; |
|---|
| 313 | 279 | } |
|---|