aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/misc/sgi-gru/grufault.c24
-rw-r--r--drivers/misc/sgi-gru/grufile.c4
-rw-r--r--drivers/misc/sgi-gru/grulib.h14
-rw-r--r--drivers/misc/sgi-gru/gruprocfs.c2
-rw-r--r--drivers/misc/sgi-gru/grutables.h4
5 files changed, 35 insertions, 13 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}
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c
index 2b72629db91a..fa2d93a9fb8d 100644
--- a/drivers/misc/sgi-gru/grufile.c
+++ b/drivers/misc/sgi-gru/grufile.c
@@ -198,8 +198,8 @@ static long gru_file_unlocked_ioctl(struct file *file, unsigned int req,
198 case GRU_CREATE_CONTEXT: 198 case GRU_CREATE_CONTEXT:
199 err = gru_create_new_context(arg); 199 err = gru_create_new_context(arg);
200 break; 200 break;
201 case GRU_SET_TASK_SLICE: 201 case GRU_SET_CONTEXT_OPTION:
202 err = gru_set_task_slice(arg); 202 err = gru_set_context_option(arg);
203 break; 203 break;
204 case GRU_USER_GET_EXCEPTION_DETAIL: 204 case GRU_USER_GET_EXCEPTION_DETAIL:
205 err = gru_get_exception_detail(arg); 205 err = gru_get_exception_detail(arg);
diff --git a/drivers/misc/sgi-gru/grulib.h b/drivers/misc/sgi-gru/grulib.h
index 8ed6acbc47c7..8615b904a7c7 100644
--- a/drivers/misc/sgi-gru/grulib.h
+++ b/drivers/misc/sgi-gru/grulib.h
@@ -32,8 +32,8 @@
32/* Set Number of Request Blocks */ 32/* Set Number of Request Blocks */
33#define GRU_CREATE_CONTEXT _IOWR(GRU_IOCTL_NUM, 1, void *) 33#define GRU_CREATE_CONTEXT _IOWR(GRU_IOCTL_NUM, 1, void *)
34 34
35/* Register task as using the slice */ 35/* Set Context Options */
36#define GRU_SET_TASK_SLICE _IOWR(GRU_IOCTL_NUM, 5, void *) 36#define GRU_SET_CONTEXT_OPTION _IOWR(GRU_IOCTL_NUM, 4, void *)
37 37
38/* Fetch exception detail */ 38/* Fetch exception detail */
39#define GRU_USER_GET_EXCEPTION_DETAIL _IOWR(GRU_IOCTL_NUM, 6, void *) 39#define GRU_USER_GET_EXCEPTION_DETAIL _IOWR(GRU_IOCTL_NUM, 6, void *)
@@ -96,6 +96,16 @@ struct gru_unload_context_req {
96}; 96};
97 97
98/* 98/*
99 * Structure used to set context options
100 */
101enum {sco_gseg_owner};
102struct gru_set_context_option_req {
103 unsigned long gseg;
104 int op;
105 unsigned long val1;
106};
107
108/*
99 * Structure used to pass TLB flush parameters to the driver 109 * Structure used to pass TLB flush parameters to the driver
100 */ 110 */
101struct gru_flush_tlb_req { 111struct gru_flush_tlb_req {
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
index b5b9cf5c182e..9cbf95bedce6 100644
--- a/drivers/misc/sgi-gru/gruprocfs.c
+++ b/drivers/misc/sgi-gru/gruprocfs.c
@@ -73,7 +73,7 @@ static int statistics_show(struct seq_file *s, void *p)
73 printstat(s, user_flush_tlb); 73 printstat(s, user_flush_tlb);
74 printstat(s, user_unload_context); 74 printstat(s, user_unload_context);
75 printstat(s, user_exception); 75 printstat(s, user_exception);
76 printstat(s, set_task_slice); 76 printstat(s, set_context_option);
77 printstat(s, migrate_check); 77 printstat(s, migrate_check);
78 printstat(s, migrated_retarget); 78 printstat(s, migrated_retarget);
79 printstat(s, migrated_unload); 79 printstat(s, migrated_unload);
diff --git a/drivers/misc/sgi-gru/grutables.h b/drivers/misc/sgi-gru/grutables.h
index 63b76e2732ff..ee2f4121db21 100644
--- a/drivers/misc/sgi-gru/grutables.h
+++ b/drivers/misc/sgi-gru/grutables.h
@@ -198,7 +198,7 @@ struct gru_stats_s {
198 atomic_long_t user_flush_tlb; 198 atomic_long_t user_flush_tlb;
199 atomic_long_t user_unload_context; 199 atomic_long_t user_unload_context;
200 atomic_long_t user_exception; 200 atomic_long_t user_exception;
201 atomic_long_t set_task_slice; 201 atomic_long_t set_context_option;
202 atomic_long_t migrate_check; 202 atomic_long_t migrate_check;
203 atomic_long_t migrated_retarget; 203 atomic_long_t migrated_retarget;
204 atomic_long_t migrated_unload; 204 atomic_long_t migrated_unload;
@@ -649,7 +649,7 @@ extern int gru_handle_user_call_os(unsigned long address);
649extern int gru_user_flush_tlb(unsigned long arg); 649extern int gru_user_flush_tlb(unsigned long arg);
650extern int gru_user_unload_context(unsigned long arg); 650extern int gru_user_unload_context(unsigned long arg);
651extern int gru_get_exception_detail(unsigned long arg); 651extern int gru_get_exception_detail(unsigned long arg);
652extern int gru_set_task_slice(long address); 652extern int gru_set_context_option(unsigned long address);
653extern int gru_cpu_fault_map_id(void); 653extern int gru_cpu_fault_map_id(void);
654extern struct vm_area_struct *gru_find_vma(unsigned long vaddr); 654extern struct vm_area_struct *gru_find_vma(unsigned long vaddr);
655extern void gru_flush_all_tlb(struct gru_state *gru); 655extern void gru_flush_all_tlb(struct gru_state *gru);