forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/powerpc/platforms/cell/spufs/fault.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Low-level SPU handling
34 *
45 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
56 *
67 * Author: Arnd Bergmann <arndb@de.ibm.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2, or (at your option)
11
- * any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
218 */
229 #include <linux/sched/signal.h>
2310 #include <linux/mm.h>
....@@ -36,42 +23,31 @@
3623 static void spufs_handle_event(struct spu_context *ctx,
3724 unsigned long ea, int type)
3825 {
39
- siginfo_t info;
40
-
4126 if (ctx->flags & SPU_CREATE_EVENTS_ENABLED) {
4227 ctx->event_return |= type;
4328 wake_up_all(&ctx->stop_wq);
4429 return;
4530 }
4631
47
- clear_siginfo(&info);
48
-
4932 switch (type) {
5033 case SPE_EVENT_INVALID_DMA:
51
- info.si_signo = SIGBUS;
52
- info.si_code = BUS_OBJERR;
34
+ force_sig_fault(SIGBUS, BUS_OBJERR, NULL);
5335 break;
5436 case SPE_EVENT_SPE_DATA_STORAGE:
55
- info.si_signo = SIGSEGV;
56
- info.si_addr = (void __user *)ea;
57
- info.si_code = SEGV_ACCERR;
5837 ctx->ops->restart_dma(ctx);
38
+ force_sig_fault(SIGSEGV, SEGV_ACCERR, (void __user *)ea);
5939 break;
6040 case SPE_EVENT_DMA_ALIGNMENT:
61
- info.si_signo = SIGBUS;
6241 /* DAR isn't set for an alignment fault :( */
63
- info.si_code = BUS_ADRALN;
42
+ force_sig_fault(SIGBUS, BUS_ADRALN, NULL);
6443 break;
6544 case SPE_EVENT_SPE_ERROR:
66
- info.si_signo = SIGILL;
67
- info.si_addr = (void __user *)(unsigned long)
68
- ctx->ops->npc_read(ctx) - 4;
69
- info.si_code = ILL_ILLOPC;
45
+ force_sig_fault(
46
+ SIGILL, ILL_ILLOPC,
47
+ (void __user *)(unsigned long)
48
+ ctx->ops->npc_read(ctx) - 4);
7049 break;
7150 }
72
-
73
- if (info.si_signo)
74
- force_sig_info(info.si_signo, &info, current);
7551 }
7652
7753 int spufs_handle_class0(struct spu_context *ctx)