aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-gru/grumain.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sgi-gru/grumain.c')
-rw-r--r--drivers/misc/sgi-gru/grumain.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c
index aef6822cb80e..0eeb8dddd2f5 100644
--- a/drivers/misc/sgi-gru/grumain.c
+++ b/drivers/misc/sgi-gru/grumain.c
@@ -22,7 +22,7 @@
22#include "grutables.h" 22#include "grutables.h"
23#include "gruhandles.h" 23#include "gruhandles.h"
24 24
25unsigned long options __read_mostly; 25unsigned long gru_options __read_mostly;
26 26
27static struct device_driver gru_driver = { 27static struct device_driver gru_driver = {
28 .name = "gru" 28 .name = "gru"
@@ -163,14 +163,14 @@ static unsigned long reserve_resources(unsigned long *p, int n, int mmax,
163 return bits; 163 return bits;
164} 164}
165 165
166unsigned long reserve_gru_cb_resources(struct gru_state *gru, int cbr_au_count, 166unsigned long gru_reserve_cb_resources(struct gru_state *gru, int cbr_au_count,
167 char *cbmap) 167 char *cbmap)
168{ 168{
169 return reserve_resources(&gru->gs_cbr_map, cbr_au_count, GRU_CBR_AU, 169 return reserve_resources(&gru->gs_cbr_map, cbr_au_count, GRU_CBR_AU,
170 cbmap); 170 cbmap);
171} 171}
172 172
173unsigned long reserve_gru_ds_resources(struct gru_state *gru, int dsr_au_count, 173unsigned long gru_reserve_ds_resources(struct gru_state *gru, int dsr_au_count,
174 char *dsmap) 174 char *dsmap)
175{ 175{
176 return reserve_resources(&gru->gs_dsr_map, dsr_au_count, GRU_DSR_AU, 176 return reserve_resources(&gru->gs_dsr_map, dsr_au_count, GRU_DSR_AU,
@@ -182,10 +182,10 @@ static void reserve_gru_resources(struct gru_state *gru,
182{ 182{
183 gru->gs_active_contexts++; 183 gru->gs_active_contexts++;
184 gts->ts_cbr_map = 184 gts->ts_cbr_map =
185 reserve_gru_cb_resources(gru, gts->ts_cbr_au_count, 185 gru_reserve_cb_resources(gru, gts->ts_cbr_au_count,
186 gts->ts_cbr_idx); 186 gts->ts_cbr_idx);
187 gts->ts_dsr_map = 187 gts->ts_dsr_map =
188 reserve_gru_ds_resources(gru, gts->ts_dsr_au_count, NULL); 188 gru_reserve_ds_resources(gru, gts->ts_dsr_au_count, NULL);
189} 189}
190 190
191static void free_gru_resources(struct gru_state *gru, 191static void free_gru_resources(struct gru_state *gru,
@@ -416,6 +416,7 @@ static void gru_free_gru_context(struct gru_thread_state *gts)
416 416
417/* 417/*
418 * Prefetching cachelines help hardware performance. 418 * Prefetching cachelines help hardware performance.
419 * (Strictly a performance enhancement. Not functionally required).
419 */ 420 */
420static void prefetch_data(void *p, int num, int stride) 421static void prefetch_data(void *p, int num, int stride)
421{ 422{
@@ -746,6 +747,8 @@ again:
746 * gru_nopage 747 * gru_nopage
747 * 748 *
748 * Map the user's GRU segment 749 * Map the user's GRU segment
750 *
751 * Note: gru segments alway mmaped on GRU_GSEG_PAGESIZE boundaries.
749 */ 752 */
750int gru_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 753int gru_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
751{ 754{
@@ -757,6 +760,7 @@ int gru_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
757 vma, vaddr, GSEG_BASE(vaddr)); 760 vma, vaddr, GSEG_BASE(vaddr));
758 STAT(nopfn); 761 STAT(nopfn);
759 762
763 /* The following check ensures vaddr is a valid address in the VMA */
760 gts = gru_find_thread_state(vma, TSID(vaddr, vma)); 764 gts = gru_find_thread_state(vma, TSID(vaddr, vma));
761 if (!gts) 765 if (!gts)
762 return VM_FAULT_SIGBUS; 766 return VM_FAULT_SIGBUS;
@@ -775,7 +779,7 @@ again:
775 } 779 }
776 780
777 if (!gts->ts_gru) { 781 if (!gts->ts_gru) {
778 while (!gru_assign_gru_context(gts)) { 782 if (!gru_assign_gru_context(gts)) {
779 mutex_unlock(&gts->ts_ctxlock); 783 mutex_unlock(&gts->ts_ctxlock);
780 preempt_enable(); 784 preempt_enable();
781 schedule_timeout(GRU_ASSIGN_DELAY); /* true hack ZZZ */ 785 schedule_timeout(GRU_ASSIGN_DELAY); /* true hack ZZZ */