diff options
-rw-r--r-- | arch/powerpc/platforms/cell/spu_base.c | 19 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/sched.c | 4 |
2 files changed, 23 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index 75b5af0a7e21..5f399313b472 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
@@ -425,6 +425,25 @@ static void spu_init_channels(struct spu *spu) | |||
425 | } | 425 | } |
426 | } | 426 | } |
427 | 427 | ||
428 | struct spu *spu_alloc_spu(struct spu *req_spu) | ||
429 | { | ||
430 | struct spu *spu, *ret = NULL; | ||
431 | |||
432 | mutex_lock(&spu_mutex); | ||
433 | list_for_each_entry(spu, &cbe_spu_info[req_spu->node].free_spus, list) { | ||
434 | if (spu == req_spu) { | ||
435 | list_del_init(&spu->list); | ||
436 | pr_debug("Got SPU %d %d\n", spu->number, spu->node); | ||
437 | spu_init_channels(spu); | ||
438 | ret = spu; | ||
439 | break; | ||
440 | } | ||
441 | } | ||
442 | mutex_unlock(&spu_mutex); | ||
443 | return ret; | ||
444 | } | ||
445 | EXPORT_SYMBOL_GPL(spu_alloc_spu); | ||
446 | |||
428 | struct spu *spu_alloc_node(int node) | 447 | struct spu *spu_alloc_node(int node) |
429 | { | 448 | { |
430 | struct spu *spu = NULL; | 449 | struct spu *spu = NULL; |
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index a9569de4c141..49b8f6867a96 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
@@ -507,6 +507,10 @@ static struct spu *spu_get_idle(struct spu_context *ctx) | |||
507 | int node = cpu_to_node(raw_smp_processor_id()); | 507 | int node = cpu_to_node(raw_smp_processor_id()); |
508 | int n; | 508 | int n; |
509 | 509 | ||
510 | spu = affinity_check(ctx); | ||
511 | if (spu) | ||
512 | return spu_alloc_spu(spu); | ||
513 | |||
510 | for (n = 0; n < MAX_NUMNODES; n++, node++) { | 514 | for (n = 0; n < MAX_NUMNODES; n++, node++) { |
511 | node = (node < MAX_NUMNODES) ? node : 0; | 515 | node = (node < MAX_NUMNODES) ? node : 0; |
512 | if (!node_allowed(ctx, node)) | 516 | if (!node_allowed(ctx, node)) |