]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[POWERPC] spufs: DMA Restart after SIGSEGV
authorAndre Detsch <adetsch@br.ibm.com>
Thu, 20 Dec 2007 07:39:59 +0000 (16:39 +0900)
committerPaul Mackerras <paulus@samba.org>
Fri, 21 Dec 2007 08:46:21 +0000 (19:46 +1100)
This fixes the behavior of spufs when a spu tries a DMA operation
based on a wrong / unavailable address.

Instead of just generating a SIGBUS signal, spufs now
generates a SIGSEGV signal and restarts the problematic DMA operation
after the execution of the application's signal handler.  This allows
applications to employ user-level paging systems.

Although the restart_dma function is called before the application's
signal handler, the operation is not actually performed at this time,
since the spu context is already stopped.  The operation only takes
place when spu_run is restarted (which happens automatically).

Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/cell/spufs/backing_ops.c
arch/powerpc/platforms/cell/spufs/fault.c

index d4495531e5b257f1c61d26df4382805de087b727..50d98a154aaf257ae58a75373c13281874dc40a2 100644 (file)
@@ -373,7 +373,7 @@ static int spu_backing_send_mfc_command(struct spu_context *ctx,
 
 static void spu_backing_restart_dma(struct spu_context *ctx)
 {
-       /* nothing to do here */
+       ctx->csa.priv2.mfc_control_RW |= MFC_CNTL_RESTART_DMA_COMMAND;
 }
 
 struct spu_context_ops spu_backing_ops = {
index 825001c2b0952f208921bc91b3b12d66ab290f07..eff4d291ba855de23099b9ed36ee2183f892f7d6 100644 (file)
@@ -53,9 +53,10 @@ static void spufs_handle_event(struct spu_context *ctx,
                info.si_code = BUS_OBJERR;
                break;
        case SPE_EVENT_SPE_DATA_STORAGE:
-               info.si_signo = SIGBUS;
+               info.si_signo = SIGSEGV;
                info.si_addr = (void __user *)ea;
-               info.si_code = BUS_ADRERR;
+               info.si_code = SEGV_ACCERR;
+               ctx->ops->restart_dma(ctx);
                break;
        case SPE_EVENT_DMA_ALIGNMENT:
                info.si_signo = SIGBUS;