forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
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
....@@ -138,13 +123,18 @@
138123 /* It seems we have no way to power the system off via
139124 * software. The user has to press the button himself. */
140125
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");
143127
144128 /* prevent soft lockup/stalled CPU messages for endless loop. */
145129 rcu_sysrq_start();
146130 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
+ }
148138 }
149139
150140 void (*pm_power_off)(void);
....@@ -167,32 +157,13 @@
167157 }
168158
169159 /*
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
-/*
189160 * Idle thread support
190161 *
191162 * Detect when running on QEMU with SeaBIOS PDC Firmware and let
192163 * QEMU idle the host too.
193164 */
194165
195
-int running_on_qemu __read_mostly;
166
+int running_on_qemu __ro_after_init;
196167 EXPORT_SYMBOL(running_on_qemu);
197168
198169 void __cpuidle arch_cpu_idle_dead(void)
....@@ -203,7 +174,7 @@
203174
204175 void __cpuidle arch_cpu_idle(void)
205176 {
206
- local_irq_enable();
177
+ raw_local_irq_enable();
207178
208179 /* nop on real hardware, qemu will idle sleep. */
209180 asm volatile("or %%r10,%%r10,%%r10\n":::);
....@@ -223,7 +194,7 @@
223194 */
224195 int
225196 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)
227198 {
228199 struct pt_regs *cregs = &(p->thread.regs);
229200 void *stack = task_stack_page(p);
....@@ -234,7 +205,7 @@
234205 extern void * const ret_from_kernel_thread;
235206 extern void * const child_return;
236207
237
- if (unlikely(p->flags & PF_KTHREAD)) {
208
+ if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
238209 /* kernel thread */
239210 memset(cregs, 0, sizeof(struct pt_regs));
240211 if (!usp) /* idle thread */
....@@ -268,9 +239,9 @@
268239 cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE;
269240 cregs->kpc = (unsigned long) &child_return;
270241
271
- /* Setup thread TLS area from the 4th parameter in clone */
242
+ /* Setup thread TLS area */
272243 if (clone_flags & CLONE_SETTLS)
273
- cregs->cr27 = cregs->gr[23];
244
+ cregs->cr27 = tls;
274245 }
275246
276247 return 0;
....@@ -307,7 +278,7 @@
307278 Elf64_Fdesc *desc = ptr;
308279 void *p;
309280
310
- if (!probe_kernel_address(&desc->addr, p))
281
+ if (!get_kernel_nofault(p, (void *)&desc->addr))
311282 ptr = p;
312283 return ptr;
313284 }