| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Low-level SPU handling |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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. |
|---|
| 21 | 8 | */ |
|---|
| 22 | 9 | #include <linux/sched/signal.h> |
|---|
| 23 | 10 | #include <linux/mm.h> |
|---|
| .. | .. |
|---|
| 36 | 23 | static void spufs_handle_event(struct spu_context *ctx, |
|---|
| 37 | 24 | unsigned long ea, int type) |
|---|
| 38 | 25 | { |
|---|
| 39 | | - siginfo_t info; |
|---|
| 40 | | - |
|---|
| 41 | 26 | if (ctx->flags & SPU_CREATE_EVENTS_ENABLED) { |
|---|
| 42 | 27 | ctx->event_return |= type; |
|---|
| 43 | 28 | wake_up_all(&ctx->stop_wq); |
|---|
| 44 | 29 | return; |
|---|
| 45 | 30 | } |
|---|
| 46 | 31 | |
|---|
| 47 | | - clear_siginfo(&info); |
|---|
| 48 | | - |
|---|
| 49 | 32 | switch (type) { |
|---|
| 50 | 33 | case SPE_EVENT_INVALID_DMA: |
|---|
| 51 | | - info.si_signo = SIGBUS; |
|---|
| 52 | | - info.si_code = BUS_OBJERR; |
|---|
| 34 | + force_sig_fault(SIGBUS, BUS_OBJERR, NULL); |
|---|
| 53 | 35 | break; |
|---|
| 54 | 36 | case SPE_EVENT_SPE_DATA_STORAGE: |
|---|
| 55 | | - info.si_signo = SIGSEGV; |
|---|
| 56 | | - info.si_addr = (void __user *)ea; |
|---|
| 57 | | - info.si_code = SEGV_ACCERR; |
|---|
| 58 | 37 | ctx->ops->restart_dma(ctx); |
|---|
| 38 | + force_sig_fault(SIGSEGV, SEGV_ACCERR, (void __user *)ea); |
|---|
| 59 | 39 | break; |
|---|
| 60 | 40 | case SPE_EVENT_DMA_ALIGNMENT: |
|---|
| 61 | | - info.si_signo = SIGBUS; |
|---|
| 62 | 41 | /* DAR isn't set for an alignment fault :( */ |
|---|
| 63 | | - info.si_code = BUS_ADRALN; |
|---|
| 42 | + force_sig_fault(SIGBUS, BUS_ADRALN, NULL); |
|---|
| 64 | 43 | break; |
|---|
| 65 | 44 | 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); |
|---|
| 70 | 49 | break; |
|---|
| 71 | 50 | } |
|---|
| 72 | | - |
|---|
| 73 | | - if (info.si_signo) |
|---|
| 74 | | - force_sig_info(info.si_signo, &info, current); |
|---|
| 75 | 51 | } |
|---|
| 76 | 52 | |
|---|
| 77 | 53 | int spufs_handle_class0(struct spu_context *ctx) |
|---|