aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/sgi-gru/grufault.c11
-rw-r--r--drivers/misc/sgi-gru/grufile.c3
-rw-r--r--drivers/misc/sgi-gru/gruprocfs.c4
-rw-r--r--drivers/misc/sgi-gru/grutables.h9
4 files changed, 14 insertions, 13 deletions
diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c
index bf6e9f7bed54..15507d31e62b 100644
--- a/drivers/misc/sgi-gru/grufault.c
+++ b/drivers/misc/sgi-gru/grufault.c
@@ -600,18 +600,11 @@ static int gru_unload_all_contexts(void)
600{ 600{
601 struct gru_thread_state *gts; 601 struct gru_thread_state *gts;
602 struct gru_state *gru; 602 struct gru_state *gru;
603 int maxgid, gid, ctxnum; 603 int gid, ctxnum;
604 int nodesperblade;
605 604
606 if (!capable(CAP_SYS_ADMIN)) 605 if (!capable(CAP_SYS_ADMIN))
607 return -EPERM; 606 return -EPERM;
608 if (num_online_nodes() > 1 && 607 foreach_gid(gid) {
609 (uv_node_to_blade_id(1) == uv_node_to_blade_id(0)))
610 nodesperblade = 2;
611 else
612 nodesperblade = 1;
613 maxgid = GRU_CHIPLETS_PER_BLADE * num_online_nodes() / nodesperblade;
614 for (gid = 0; gid < maxgid; gid++) {
615 gru = GID_TO_GRU(gid); 608 gru = GID_TO_GRU(gid);
616 spin_lock(&gru->gs_lock); 609 spin_lock(&gru->gs_lock);
617 for (ctxnum = 0; ctxnum < GRU_NUM_CCH; ctxnum++) { 610 for (ctxnum = 0; ctxnum < GRU_NUM_CCH; ctxnum++) {
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c
index f8dcdb1a0ec4..b7a21ce91496 100644
--- a/drivers/misc/sgi-gru/grufile.c
+++ b/drivers/misc/sgi-gru/grufile.c
@@ -47,6 +47,7 @@
47struct gru_blade_state *gru_base[GRU_MAX_BLADES] __read_mostly; 47struct gru_blade_state *gru_base[GRU_MAX_BLADES] __read_mostly;
48unsigned long gru_start_paddr __read_mostly; 48unsigned long gru_start_paddr __read_mostly;
49unsigned long gru_end_paddr __read_mostly; 49unsigned long gru_end_paddr __read_mostly;
50unsigned int gru_max_gids __read_mostly;
50struct gru_stats_s gru_stats; 51struct gru_stats_s gru_stats;
51 52
52/* Guaranteed user available resources on each node */ 53/* Guaranteed user available resources on each node */
@@ -276,6 +277,8 @@ static void gru_init_chiplet(struct gru_state *gru, unsigned long paddr,
276 gru->gs_dsr_map = (1UL << GRU_DSR_AU) - 1; 277 gru->gs_dsr_map = (1UL << GRU_DSR_AU) - 1;
277 gru->gs_asid_limit = MAX_ASID; 278 gru->gs_asid_limit = MAX_ASID;
278 gru_tgh_flush_init(gru); 279 gru_tgh_flush_init(gru);
280 if (gru->gs_gid >= gru_max_gids)
281 gru_max_gids = gru->gs_gid + 1;
279 gru_dbg(grudev, "bid %d, nid %d, gid %d, vaddr %p (0x%lx)\n", 282 gru_dbg(grudev, "bid %d, nid %d, gid %d, vaddr %p (0x%lx)\n",
280 bid, nid, gru->gs_gid, gru->gs_gru_base_vaddr, 283 bid, nid, gru->gs_gid, gru->gs_gru_base_vaddr,
281 gru->gs_gru_base_paddr); 284 gru->gs_gru_base_paddr);
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
index 8724551aa55e..ee74821b171c 100644
--- a/drivers/misc/sgi-gru/gruprocfs.c
+++ b/drivers/misc/sgi-gru/gruprocfs.c
@@ -226,7 +226,7 @@ static void seq_stop(struct seq_file *file, void *data)
226 226
227static void *seq_start(struct seq_file *file, loff_t *gid) 227static void *seq_start(struct seq_file *file, loff_t *gid)
228{ 228{
229 if (*gid < GRU_MAX_GRUS) 229 if (*gid < gru_max_gids)
230 return gid; 230 return gid;
231 return NULL; 231 return NULL;
232} 232}
@@ -234,7 +234,7 @@ static void *seq_start(struct seq_file *file, loff_t *gid)
234static void *seq_next(struct seq_file *file, void *data, loff_t *gid) 234static void *seq_next(struct seq_file *file, void *data, loff_t *gid)
235{ 235{
236 (*gid)++; 236 (*gid)++;
237 if (*gid < GRU_MAX_GRUS) 237 if (*gid < gru_max_gids)
238 return gid; 238 return gid;
239 return NULL; 239 return NULL;
240} 240}
diff --git a/drivers/misc/sgi-gru/grutables.h b/drivers/misc/sgi-gru/grutables.h
index 685db88cc475..c6e0e3de07f3 100644
--- a/drivers/misc/sgi-gru/grutables.h
+++ b/drivers/misc/sgi-gru/grutables.h
@@ -153,6 +153,7 @@
153extern struct gru_stats_s gru_stats; 153extern struct gru_stats_s gru_stats;
154extern struct gru_blade_state *gru_base[]; 154extern struct gru_blade_state *gru_base[];
155extern unsigned long gru_start_paddr, gru_end_paddr; 155extern unsigned long gru_start_paddr, gru_end_paddr;
156extern unsigned int gru_max_gids;
156 157
157#define GRU_MAX_BLADES MAX_NUMNODES 158#define GRU_MAX_BLADES MAX_NUMNODES
158#define GRU_MAX_GRUS (GRU_MAX_BLADES * GRU_CHIPLETS_PER_BLADE) 159#define GRU_MAX_GRUS (GRU_MAX_BLADES * GRU_CHIPLETS_PER_BLADE)
@@ -406,12 +407,12 @@ struct gru_state {
406 gru segments (64) */ 407 gru segments (64) */
407 void *gs_gru_base_vaddr; /* Virtual address of 408 void *gs_gru_base_vaddr; /* Virtual address of
408 gru segments (64) */ 409 gru segments (64) */
409 unsigned char gs_gid; /* unique GRU number */ 410 unsigned short gs_gid; /* unique GRU number */
411 unsigned short gs_blade_id; /* blade of GRU */
410 unsigned char gs_tgh_local_shift; /* used to pick TGH for 412 unsigned char gs_tgh_local_shift; /* used to pick TGH for
411 local flush */ 413 local flush */
412 unsigned char gs_tgh_first_remote; /* starting TGH# for 414 unsigned char gs_tgh_first_remote; /* starting TGH# for
413 remote flush */ 415 remote flush */
414 unsigned short gs_blade_id; /* blade of GRU */
415 spinlock_t gs_asid_lock; /* lock used for 416 spinlock_t gs_asid_lock; /* lock used for
416 assigning asids */ 417 assigning asids */
417 spinlock_t gs_lock; /* lock used for 418 spinlock_t gs_lock; /* lock used for
@@ -506,6 +507,10 @@ struct gru_blade_state {
506 (i) < GRU_CHIPLETS_PER_BLADE; \ 507 (i) < GRU_CHIPLETS_PER_BLADE; \
507 (i)++, (gru)++) 508 (i)++, (gru)++)
508 509
510/* Scan all GRUs */
511#define foreach_gid(gid) \
512 for ((gid) = 0; (gid) < gru_max_gids; (gid)++)
513
509/* Scan all active GTSs on a gru. Note: must hold ss_lock to use this macro. */ 514/* Scan all active GTSs on a gru. Note: must hold ss_lock to use this macro. */
510#define for_each_gts_on_gru(gts, gru, ctxnum) \ 515#define for_each_gts_on_gru(gts, gru, ctxnum) \
511 for ((ctxnum) = 0; (ctxnum) < GRU_NUM_CCH; (ctxnum)++) \ 516 for ((ctxnum) = 0; (ctxnum) < GRU_NUM_CCH; (ctxnum)++) \