aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorJack Steiner <steiner@sgi.com>2009-06-17 19:28:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 16:03:59 -0400
commit6e9100741ca430eeef8022794f8b62a23a5916af (patch)
tree4c19d2cbbd2d3f1cd429946120c078b653ae67b3 /drivers/misc
parentd57c82b10709bbb1deb7eb26cf42abcde8851e4d (diff)
gru: support cch_allocate for kernel threads
Change the interface to cch_allocate so that it can be used to allocate GRU contexts for kernel threads. Kernel threads use the GRU in unmapped mode and do not require ASIDs for the GRU TLB. 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/misc')
-rw-r--r--drivers/misc/sgi-gru/gruhandles.c12
-rw-r--r--drivers/misc/sgi-gru/gruhandles.h4
-rw-r--r--drivers/misc/sgi-gru/grukservices.c5
-rw-r--r--drivers/misc/sgi-gru/grumain.c15
4 files changed, 17 insertions, 19 deletions
diff --git a/drivers/misc/sgi-gru/gruhandles.c b/drivers/misc/sgi-gru/gruhandles.c
index 9b7ccb328697..a3a870ad9153 100644
--- a/drivers/misc/sgi-gru/gruhandles.c
+++ b/drivers/misc/sgi-gru/gruhandles.c
@@ -72,18 +72,8 @@ static int wait_instruction_complete(void *h, enum mcs_op opc)
72 return status; 72 return status;
73} 73}
74 74
75int cch_allocate(struct gru_context_configuration_handle *cch, 75int cch_allocate(struct gru_context_configuration_handle *cch)
76 int asidval, int sizeavail, unsigned long cbrmap,
77 unsigned long dsrmap)
78{ 76{
79 int i;
80
81 for (i = 0; i < 8; i++) {
82 cch->asid[i] = (asidval++);
83 cch->sizeavail[i] = sizeavail;
84 }
85 cch->dsr_allocation_map = dsrmap;
86 cch->cbr_allocation_map = cbrmap;
87 cch->opc = CCHOP_ALLOCATE; 77 cch->opc = CCHOP_ALLOCATE;
88 start_instruction(cch); 78 start_instruction(cch);
89 return wait_instruction_complete(cch, cchop_allocate); 79 return wait_instruction_complete(cch, cchop_allocate);
diff --git a/drivers/misc/sgi-gru/gruhandles.h b/drivers/misc/sgi-gru/gruhandles.h
index 03b76a1993c3..9f41e2cc09d5 100644
--- a/drivers/misc/sgi-gru/gruhandles.h
+++ b/drivers/misc/sgi-gru/gruhandles.h
@@ -480,9 +480,7 @@ enum gru_cbr_state {
480/* minimum TLB purge count to ensure a full purge */ 480/* minimum TLB purge count to ensure a full purge */
481#define GRUMAXINVAL 1024UL 481#define GRUMAXINVAL 1024UL
482 482
483int cch_allocate(struct gru_context_configuration_handle *cch, 483int cch_allocate(struct gru_context_configuration_handle *cch);
484 int asidval, int sizeavail, unsigned long cbrmap, unsigned long dsrmap);
485
486int cch_start(struct gru_context_configuration_handle *cch); 484int cch_start(struct gru_context_configuration_handle *cch);
487int cch_interrupt(struct gru_context_configuration_handle *cch); 485int cch_interrupt(struct gru_context_configuration_handle *cch);
488int cch_deallocate(struct gru_context_configuration_handle *cch); 486int cch_deallocate(struct gru_context_configuration_handle *cch);
diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c
index d8bd7d84a7cf..900f7aad2286 100644
--- a/drivers/misc/sgi-gru/grukservices.c
+++ b/drivers/misc/sgi-gru/grukservices.c
@@ -672,7 +672,10 @@ int gru_kservices_init(struct gru_state *gru)
672 cch->tlb_int_enable = 0; 672 cch->tlb_int_enable = 0;
673 cch->tfm_done_bit_enable = 0; 673 cch->tfm_done_bit_enable = 0;
674 cch->unmap_enable = 1; 674 cch->unmap_enable = 1;
675 err = cch_allocate(cch, 0, 0, cbr_map, dsr_map); 675 cch->dsr_allocation_map = dsr_map;
676 cch->cbr_allocation_map = cbr_map;
677
678 err = cch_allocate(cch);
676 if (err) { 679 if (err) {
677 gru_dbg(grudev, 680 gru_dbg(grudev,
678 "Unable to allocate kernel CCH: gid %d, err %d\n", 681 "Unable to allocate kernel CCH: gid %d, err %d\n",
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c
index 6358244f392d..0c7bd384f0cf 100644
--- a/drivers/misc/sgi-gru/grumain.c
+++ b/drivers/misc/sgi-gru/grumain.c
@@ -537,13 +537,12 @@ void gru_load_context(struct gru_thread_state *gts)
537{ 537{
538 struct gru_state *gru = gts->ts_gru; 538 struct gru_state *gru = gts->ts_gru;
539 struct gru_context_configuration_handle *cch; 539 struct gru_context_configuration_handle *cch;
540 int err, asid, ctxnum = gts->ts_ctxnum; 540 int i, err, asid, ctxnum = gts->ts_ctxnum;
541 541
542 gru_dbg(grudev, "gts %p\n", gts); 542 gru_dbg(grudev, "gts %p\n", gts);
543 cch = get_cch(gru->gs_gru_base_vaddr, ctxnum); 543 cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
544 544
545 lock_cch_handle(cch); 545 lock_cch_handle(cch);
546 asid = gru_load_mm_tracker(gru, gts);
547 cch->tfm_fault_bit_enable = 546 cch->tfm_fault_bit_enable =
548 (gts->ts_user_options == GRU_OPT_MISS_FMM_POLL 547 (gts->ts_user_options == GRU_OPT_MISS_FMM_POLL
549 || gts->ts_user_options == GRU_OPT_MISS_FMM_INTR); 548 || gts->ts_user_options == GRU_OPT_MISS_FMM_INTR);
@@ -553,8 +552,16 @@ void gru_load_context(struct gru_thread_state *gts)
553 cch->tlb_int_select = gts->ts_tlb_int_select; 552 cch->tlb_int_select = gts->ts_tlb_int_select;
554 } 553 }
555 cch->tfm_done_bit_enable = 0; 554 cch->tfm_done_bit_enable = 0;
556 err = cch_allocate(cch, asid, gts->ts_sizeavail, gts->ts_cbr_map, 555 cch->dsr_allocation_map = gts->ts_dsr_map;
557 gts->ts_dsr_map); 556 cch->cbr_allocation_map = gts->ts_cbr_map;
557 asid = gru_load_mm_tracker(gru, gts);
558 cch->unmap_enable = 0;
559 for (i = 0; i < 8; i++) {
560 cch->asid[i] = asid + i;
561 cch->sizeavail[i] = gts->ts_sizeavail;
562 }
563
564 err = cch_allocate(cch);
558 if (err) { 565 if (err) {
559 gru_dbg(grudev, 566 gru_dbg(grudev,
560 "err %d: cch %p, gts %p, cbr 0x%lx, dsr 0x%lx\n", 567 "err %d: cch %p, gts %p, cbr 0x%lx, dsr 0x%lx\n",