aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-gru/grufault.c
diff options
context:
space:
mode:
authorJack Steiner <steiner@sgi.com>2009-06-17 19:28:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 16:04:03 -0400
commit92b39388eeb45326feb0fa8bd69dbbce66c9efbf (patch)
treef39193cc5341dfd4ed3b807f9f802c4575822a29 /drivers/misc/sgi-gru/grufault.c
parent9f2501142bd3c496afa7efdf18583aab56fe3134 (diff)
gru: generic infrastructure for context options
Change the user GRU request for specifying the "task_slice" option to use a generic infrastructure that can be expanded in the future to include additional context options. No new capabilities are added with this patch. 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/sgi-gru/grufault.c')
-rw-r--r--drivers/misc/sgi-gru/grufault.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c
index cdd151b30dc7..b894b7ed9c35 100644
--- a/drivers/misc/sgi-gru/grufault.c
+++ b/drivers/misc/sgi-gru/grufault.c
@@ -749,18 +749,30 @@ long gru_get_gseg_statistics(unsigned long arg)
749 * Register the current task as the user of the GSEG slice. 749 * Register the current task as the user of the GSEG slice.
750 * Needed for TLB fault interrupt targeting. 750 * Needed for TLB fault interrupt targeting.
751 */ 751 */
752int gru_set_task_slice(long address) 752int gru_set_context_option(unsigned long arg)
753{ 753{
754 struct gru_thread_state *gts; 754 struct gru_thread_state *gts;
755 struct gru_set_context_option_req req;
756 int ret = 0;
755 757
756 STAT(set_task_slice); 758 STAT(set_context_option);
757 gru_dbg(grudev, "address 0x%lx\n", address); 759 if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
758 gts = gru_alloc_locked_gts(address); 760 return -EFAULT;
761 gru_dbg(grudev, "op %d, gseg 0x%lx, value1 0x%lx\n", req.op, req.gseg, req.val1);
762
763 gts = gru_alloc_locked_gts(req.gseg);
759 if (!gts) 764 if (!gts)
760 return -EINVAL; 765 return -EINVAL;
761 766
762 gts->ts_tgid_owner = current->tgid; 767 switch (req.op) {
768 case sco_gseg_owner:
769 /* Register the current task as the GSEG owner */
770 gts->ts_tgid_owner = current->tgid;
771 break;
772 default:
773 ret = -EINVAL;
774 }
763 gru_unlock_gts(gts); 775 gru_unlock_gts(gts);
764 776
765 return 0; 777 return ret;
766} 778}