Commit 9e2fe2ce authored by Akinobu Mita's avatar Akinobu Mita Committed by Arnd Bergmann

[POWERPC] spufs: use memcpy_fromio() to copy from local store

GCC may generates inline copy loop to handle memcpy() function
instead of kernel defined memcpy(). But this inlined version of memcpy()
causes an alignment interrupt when copying from local store.

This patch uses memcpy_fromio() and memcpy_toio to copy local store
to prevent memcpy() being inlined.
Signed-off-by: default avatarAkinobu Mita <mita@fixstars.com>
Signed-off-by: default avatarArnd Bergmann <arnd.bergmann@de.ibm.com>
parent 8a7d86bd
...@@ -234,17 +234,17 @@ int spu_process_callback(struct spu_context *ctx) ...@@ -234,17 +234,17 @@ int spu_process_callback(struct spu_context *ctx)
{ {
struct spu_syscall_block s; struct spu_syscall_block s;
u32 ls_pointer, npc; u32 ls_pointer, npc;
char *ls; void __iomem *ls;
long spu_ret; long spu_ret;
int ret; int ret;
/* get syscall block from local store */ /* get syscall block from local store */
npc = ctx->ops->npc_read(ctx); npc = ctx->ops->npc_read(ctx) & ~3;
ls = ctx->ops->get_ls(ctx); ls = (void __iomem *)ctx->ops->get_ls(ctx);
ls_pointer = *(u32*)(ls + npc); ls_pointer = in_be32(ls + npc);
if (ls_pointer > (LS_SIZE - sizeof(s))) if (ls_pointer > (LS_SIZE - sizeof(s)))
return -EFAULT; return -EFAULT;
memcpy(&s, ls + ls_pointer, sizeof (s)); memcpy_fromio(&s, ls + ls_pointer, sizeof(s));
/* do actual syscall without pinning the spu */ /* do actual syscall without pinning the spu */
ret = 0; ret = 0;
...@@ -264,7 +264,7 @@ int spu_process_callback(struct spu_context *ctx) ...@@ -264,7 +264,7 @@ int spu_process_callback(struct spu_context *ctx)
} }
/* write result, jump over indirect pointer */ /* write result, jump over indirect pointer */
memcpy(ls + ls_pointer, &spu_ret, sizeof (spu_ret)); memcpy_toio(ls + ls_pointer, &spu_ret, sizeof(spu_ret));
ctx->ops->npc_write(ctx, npc); ctx->ops->npc_write(ctx, npc);
ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment