diff options
author | Jack Steiner <steiner@sgi.com> | 2009-12-15 19:48:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:20:15 -0500 |
commit | 99f7c229b32bdf7424fbeb1d0d1b3883e14e97d0 (patch) | |
tree | bc5cbd2cd6c8452faacfb2e27dc1fe9dc3e1000a /drivers | |
parent | 55484c45dbeca2eec7642932ec3f60f8a2d4bdbf (diff) |
gru: allow users to specify gru chiplet 3
This patch builds on the infrastructure introduced in the patches that
allow user specification of GRU blades & chiplets for context allocation.
This patch simplifies the algorithms for migrating GRU contexts between
blades.
No new functionality is introduced.
Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/sgi-gru/grufault.c | 8 | ||||
-rw-r--r-- | drivers/misc/sgi-gru/grumain.c | 30 | ||||
-rw-r--r-- | drivers/misc/sgi-gru/grutables.h | 4 |
3 files changed, 13 insertions, 29 deletions
diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c index 321ad809f345..9470303a9cb9 100644 --- a/drivers/misc/sgi-gru/grufault.c +++ b/drivers/misc/sgi-gru/grufault.c | |||
@@ -362,7 +362,7 @@ static int gru_try_dropin(struct gru_thread_state *gts, | |||
362 | 362 | ||
363 | if (!(gts->ts_sizeavail & GRU_SIZEAVAIL(pageshift))) { | 363 | if (!(gts->ts_sizeavail & GRU_SIZEAVAIL(pageshift))) { |
364 | gts->ts_sizeavail |= GRU_SIZEAVAIL(pageshift); | 364 | gts->ts_sizeavail |= GRU_SIZEAVAIL(pageshift); |
365 | if (atomic || !gru_update_cch(gts, 0)) { | 365 | if (atomic || !gru_update_cch(gts)) { |
366 | gts->ts_force_cch_reload = 1; | 366 | gts->ts_force_cch_reload = 1; |
367 | goto failupm; | 367 | goto failupm; |
368 | } | 368 | } |
@@ -553,14 +553,12 @@ int gru_handle_user_call_os(unsigned long cb) | |||
553 | */ | 553 | */ |
554 | if (gts->ts_gru && gts->ts_force_cch_reload) { | 554 | if (gts->ts_gru && gts->ts_force_cch_reload) { |
555 | gts->ts_force_cch_reload = 0; | 555 | gts->ts_force_cch_reload = 0; |
556 | gru_update_cch(gts, 0); | 556 | gru_update_cch(gts); |
557 | } | 557 | } |
558 | 558 | ||
559 | ret = -EAGAIN; | 559 | ret = -EAGAIN; |
560 | cbrnum = thread_cbr_number(gts, ucbnum); | 560 | cbrnum = thread_cbr_number(gts, ucbnum); |
561 | if (gts->ts_force_unload) { | 561 | if (gts->ts_gru) { |
562 | gru_unload_context(gts, 1); | ||
563 | } else if (gts->ts_gru) { | ||
564 | tfh = get_tfh_by_index(gts->ts_gru, cbrnum); | 562 | tfh = get_tfh_by_index(gts->ts_gru, cbrnum); |
565 | cbk = get_gseg_base_address_cb(gts->ts_gru->gs_gru_base_vaddr, | 563 | cbk = get_gseg_base_address_cb(gts->ts_gru->gs_gru_base_vaddr, |
566 | gts->ts_ctxnum, ucbnum); | 564 | gts->ts_ctxnum, ucbnum); |
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c index 54ad7544a9a0..9ec54bde4472 100644 --- a/drivers/misc/sgi-gru/grumain.c +++ b/drivers/misc/sgi-gru/grumain.c | |||
@@ -551,7 +551,6 @@ void gru_unload_context(struct gru_thread_state *gts, int savestate) | |||
551 | 551 | ||
552 | if (cch_deallocate(cch)) | 552 | if (cch_deallocate(cch)) |
553 | BUG(); | 553 | BUG(); |
554 | gts->ts_force_unload = 0; /* ts_force_unload locked by CCH lock */ | ||
555 | unlock_cch_handle(cch); | 554 | unlock_cch_handle(cch); |
556 | 555 | ||
557 | gru_free_gru_context(gts); | 556 | gru_free_gru_context(gts); |
@@ -624,11 +623,8 @@ void gru_load_context(struct gru_thread_state *gts) | |||
624 | * Update fields in an active CCH: | 623 | * Update fields in an active CCH: |
625 | * - retarget interrupts on local blade | 624 | * - retarget interrupts on local blade |
626 | * - update sizeavail mask | 625 | * - update sizeavail mask |
627 | * - force a delayed context unload by clearing the CCH asids. This | ||
628 | * forces TLB misses for new GRU instructions. The context is unloaded | ||
629 | * when the next TLB miss occurs. | ||
630 | */ | 626 | */ |
631 | int gru_update_cch(struct gru_thread_state *gts, int force_unload) | 627 | int gru_update_cch(struct gru_thread_state *gts) |
632 | { | 628 | { |
633 | struct gru_context_configuration_handle *cch; | 629 | struct gru_context_configuration_handle *cch; |
634 | struct gru_state *gru = gts->ts_gru; | 630 | struct gru_state *gru = gts->ts_gru; |
@@ -642,21 +638,13 @@ int gru_update_cch(struct gru_thread_state *gts, int force_unload) | |||
642 | goto exit; | 638 | goto exit; |
643 | if (cch_interrupt(cch)) | 639 | if (cch_interrupt(cch)) |
644 | BUG(); | 640 | BUG(); |
645 | if (!force_unload) { | 641 | for (i = 0; i < 8; i++) |
646 | for (i = 0; i < 8; i++) | 642 | cch->sizeavail[i] = gts->ts_sizeavail; |
647 | cch->sizeavail[i] = gts->ts_sizeavail; | 643 | gts->ts_tlb_int_select = gru_cpu_fault_map_id(); |
648 | gts->ts_tlb_int_select = gru_cpu_fault_map_id(); | 644 | cch->tlb_int_select = gru_cpu_fault_map_id(); |
649 | cch->tlb_int_select = gru_cpu_fault_map_id(); | 645 | cch->tfm_fault_bit_enable = |
650 | cch->tfm_fault_bit_enable = | 646 | (gts->ts_user_options == GRU_OPT_MISS_FMM_POLL |
651 | (gts->ts_user_options == GRU_OPT_MISS_FMM_POLL | 647 | || gts->ts_user_options == GRU_OPT_MISS_FMM_INTR); |
652 | || gts->ts_user_options == GRU_OPT_MISS_FMM_INTR); | ||
653 | } else { | ||
654 | for (i = 0; i < 8; i++) | ||
655 | cch->asid[i] = 0; | ||
656 | cch->tfm_fault_bit_enable = 0; | ||
657 | cch->tlb_int_enable = 0; | ||
658 | gts->ts_force_unload = 1; | ||
659 | } | ||
660 | if (cch_start(cch)) | 648 | if (cch_start(cch)) |
661 | BUG(); | 649 | BUG(); |
662 | ret = 1; | 650 | ret = 1; |
@@ -681,7 +669,7 @@ static int gru_retarget_intr(struct gru_thread_state *gts) | |||
681 | 669 | ||
682 | gru_dbg(grudev, "retarget from %d to %d\n", gts->ts_tlb_int_select, | 670 | gru_dbg(grudev, "retarget from %d to %d\n", gts->ts_tlb_int_select, |
683 | gru_cpu_fault_map_id()); | 671 | gru_cpu_fault_map_id()); |
684 | return gru_update_cch(gts, 0); | 672 | return gru_update_cch(gts); |
685 | } | 673 | } |
686 | 674 | ||
687 | /* | 675 | /* |
diff --git a/drivers/misc/sgi-gru/grutables.h b/drivers/misc/sgi-gru/grutables.h index 8a61a8599bac..676da7821992 100644 --- a/drivers/misc/sgi-gru/grutables.h +++ b/drivers/misc/sgi-gru/grutables.h | |||
@@ -382,8 +382,6 @@ struct gru_thread_state { | |||
382 | char ts_blade; /* If >= 0, migrate context if | 382 | char ts_blade; /* If >= 0, migrate context if |
383 | ref from diferent blade */ | 383 | ref from diferent blade */ |
384 | char ts_force_cch_reload; | 384 | char ts_force_cch_reload; |
385 | char ts_force_unload;/* force context to be unloaded | ||
386 | after migration */ | ||
387 | char ts_cbr_idx[GRU_CBR_AU];/* CBR numbers of each | 385 | char ts_cbr_idx[GRU_CBR_AU];/* CBR numbers of each |
388 | allocated CB */ | 386 | allocated CB */ |
389 | int ts_data_valid; /* Indicates if ts_gdata has | 387 | int ts_data_valid; /* Indicates if ts_gdata has |
@@ -636,7 +634,7 @@ extern struct gru_state *gru_assign_gru_context(struct gru_thread_state *gts); | |||
636 | extern void gru_load_context(struct gru_thread_state *gts); | 634 | extern void gru_load_context(struct gru_thread_state *gts); |
637 | extern void gru_steal_context(struct gru_thread_state *gts); | 635 | extern void gru_steal_context(struct gru_thread_state *gts); |
638 | extern void gru_unload_context(struct gru_thread_state *gts, int savestate); | 636 | extern void gru_unload_context(struct gru_thread_state *gts, int savestate); |
639 | extern int gru_update_cch(struct gru_thread_state *gts, int force_unload); | 637 | extern int gru_update_cch(struct gru_thread_state *gts); |
640 | extern void gts_drop(struct gru_thread_state *gts); | 638 | extern void gts_drop(struct gru_thread_state *gts); |
641 | extern void gru_tgh_flush_init(struct gru_state *gru); | 639 | extern void gru_tgh_flush_init(struct gru_state *gru); |
642 | extern int gru_kservices_init(void); | 640 | extern int gru_kservices_init(void); |