forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/arch/parisc/kernel/process.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * PARISC Architecture-dependent parts of process handling
34 * based on the work for i386
....@@ -15,21 +16,6 @@
1516 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org>
1617 * Copyright (C) 2001-2014 Helge Deller <deller@gmx.de>
1718 * 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
3319 */
3420
3521 #include <stdarg.h>
....@@ -61,7 +47,6 @@
6147 #include <asm/assembly.h>
6248 #include <asm/pdc.h>
6349 #include <asm/pdc_chassis.h>
64
-#include <asm/pgalloc.h>
6550 #include <asm/unwind.h>
6651 #include <asm/sections.h>
6752
....@@ -167,32 +152,13 @@
167152 }
168153
169154 /*
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
-/*
189155 * Idle thread support
190156 *
191157 * Detect when running on QEMU with SeaBIOS PDC Firmware and let
192158 * QEMU idle the host too.
193159 */
194160
195
-int running_on_qemu __read_mostly;
161
+int running_on_qemu __ro_after_init;
196162 EXPORT_SYMBOL(running_on_qemu);
197163
198164 void __cpuidle arch_cpu_idle_dead(void)
....@@ -203,7 +169,7 @@
203169
204170 void __cpuidle arch_cpu_idle(void)
205171 {
206
- local_irq_enable();
172
+ raw_local_irq_enable();
207173
208174 /* nop on real hardware, qemu will idle sleep. */
209175 asm volatile("or %%r10,%%r10,%%r10\n":::);
....@@ -223,7 +189,7 @@
223189 */
224190 int
225191 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)
227193 {
228194 struct pt_regs *cregs = &(p->thread.regs);
229195 void *stack = task_stack_page(p);
....@@ -234,7 +200,7 @@
234200 extern void * const ret_from_kernel_thread;
235201 extern void * const child_return;
236202
237
- if (unlikely(p->flags & PF_KTHREAD)) {
203
+ if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
238204 /* kernel thread */
239205 memset(cregs, 0, sizeof(struct pt_regs));
240206 if (!usp) /* idle thread */
....@@ -268,9 +234,9 @@
268234 cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE;
269235 cregs->kpc = (unsigned long) &child_return;
270236
271
- /* Setup thread TLS area from the 4th parameter in clone */
237
+ /* Setup thread TLS area */
272238 if (clone_flags & CLONE_SETTLS)
273
- cregs->cr27 = cregs->gr[23];
239
+ cregs->cr27 = tls;
274240 }
275241
276242 return 0;
....@@ -307,7 +273,7 @@
307273 Elf64_Fdesc *desc = ptr;
308274 void *p;
309275
310
- if (!probe_kernel_address(&desc->addr, p))
276
+ if (!get_kernel_nofault(p, (void *)&desc->addr))
311277 ptr = p;
312278 return ptr;
313279 }