diff options
author | Jack Steiner <steiner@sgi.com> | 2009-04-02 19:59:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-02 22:05:05 -0400 |
commit | fe5bb6b00c3a9374841d651e01694fe4190a677e (patch) | |
tree | 8580ba3dac70d236261557a458df535cdc0e2acd /drivers/misc/sgi-gru/grufile.c | |
parent | 66666e50fcd69d80117d7d243ce02e1f774cbaf5 (diff) |
sgi-gru: misc GRU cleanup
Misc trivial GRU drivers fixes:
- fix long lines
- eliminate extra whitespace
- eliminate compiler warning
- better validation of invalidate user parameters
- bug fix for GRU TLB flush (not the cpu TLB flush)
These changes are all internal to the SGI GRU driver and have no effect
on the base kernel.
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/grufile.c')
-rw-r--r-- | drivers/misc/sgi-gru/grufile.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index c67e4e8bd62c..15292e5f74a1 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
@@ -45,7 +45,8 @@ | |||
45 | #include <asm/uv/uv_mmrs.h> | 45 | #include <asm/uv/uv_mmrs.h> |
46 | 46 | ||
47 | struct gru_blade_state *gru_base[GRU_MAX_BLADES] __read_mostly; | 47 | struct gru_blade_state *gru_base[GRU_MAX_BLADES] __read_mostly; |
48 | unsigned long gru_start_paddr, gru_end_paddr __read_mostly; | 48 | unsigned long gru_start_paddr __read_mostly; |
49 | unsigned long gru_end_paddr __read_mostly; | ||
49 | struct gru_stats_s gru_stats; | 50 | struct gru_stats_s gru_stats; |
50 | 51 | ||
51 | /* Guaranteed user available resources on each node */ | 52 | /* Guaranteed user available resources on each node */ |
@@ -101,7 +102,7 @@ static int gru_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
101 | return -EPERM; | 102 | return -EPERM; |
102 | 103 | ||
103 | if (vma->vm_start & (GRU_GSEG_PAGESIZE - 1) || | 104 | if (vma->vm_start & (GRU_GSEG_PAGESIZE - 1) || |
104 | vma->vm_end & (GRU_GSEG_PAGESIZE - 1)) | 105 | vma->vm_end & (GRU_GSEG_PAGESIZE - 1)) |
105 | return -EINVAL; | 106 | return -EINVAL; |
106 | 107 | ||
107 | vma->vm_flags |= | 108 | vma->vm_flags |= |
@@ -295,7 +296,7 @@ static int gru_init_tables(unsigned long gru_base_paddr, void *gru_base_vaddr) | |||
295 | for_each_online_node(nid) { | 296 | for_each_online_node(nid) { |
296 | bid = uv_node_to_blade_id(nid); | 297 | bid = uv_node_to_blade_id(nid); |
297 | pnode = uv_node_to_pnode(nid); | 298 | pnode = uv_node_to_pnode(nid); |
298 | if (gru_base[bid]) | 299 | if (bid < 0 || gru_base[bid]) |
299 | continue; | 300 | continue; |
300 | page = alloc_pages_node(nid, GFP_KERNEL, order); | 301 | page = alloc_pages_node(nid, GFP_KERNEL, order); |
301 | if (!page) | 302 | if (!page) |
@@ -308,11 +309,11 @@ static int gru_init_tables(unsigned long gru_base_paddr, void *gru_base_vaddr) | |||
308 | dsrbytes = 0; | 309 | dsrbytes = 0; |
309 | cbrs = 0; | 310 | cbrs = 0; |
310 | for (gru = gru_base[bid]->bs_grus, chip = 0; | 311 | for (gru = gru_base[bid]->bs_grus, chip = 0; |
311 | chip < GRU_CHIPLETS_PER_BLADE; | 312 | chip < GRU_CHIPLETS_PER_BLADE; |
312 | chip++, gru++) { | 313 | chip++, gru++) { |
313 | paddr = gru_chiplet_paddr(gru_base_paddr, pnode, chip); | 314 | paddr = gru_chiplet_paddr(gru_base_paddr, pnode, chip); |
314 | vaddr = gru_chiplet_vaddr(gru_base_vaddr, pnode, chip); | 315 | vaddr = gru_chiplet_vaddr(gru_base_vaddr, pnode, chip); |
315 | gru_init_chiplet(gru, paddr, vaddr, bid, nid, chip); | 316 | gru_init_chiplet(gru, paddr, vaddr, nid, bid, chip); |
316 | n = hweight64(gru->gs_cbr_map) * GRU_CBR_AU_SIZE; | 317 | n = hweight64(gru->gs_cbr_map) * GRU_CBR_AU_SIZE; |
317 | cbrs = max(cbrs, n); | 318 | cbrs = max(cbrs, n); |
318 | n = hweight64(gru->gs_dsr_map) * GRU_DSR_AU_BYTES; | 319 | n = hweight64(gru->gs_dsr_map) * GRU_DSR_AU_BYTES; |
@@ -370,26 +371,26 @@ static int __init gru_init(void) | |||
370 | void *gru_start_vaddr; | 371 | void *gru_start_vaddr; |
371 | 372 | ||
372 | if (!is_uv_system()) | 373 | if (!is_uv_system()) |
373 | return 0; | 374 | return -ENODEV; |
374 | 375 | ||
375 | #if defined CONFIG_IA64 | 376 | #if defined CONFIG_IA64 |
376 | gru_start_paddr = 0xd000000000UL; /* ZZZZZZZZZZZZZZZZZZZ fixme */ | 377 | gru_start_paddr = 0xd000000000UL; /* ZZZZZZZZZZZZZZZZZZZ fixme */ |
377 | #else | 378 | #else |
378 | gru_start_paddr = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR) & | 379 | gru_start_paddr = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR) & |
379 | 0x7fffffffffffUL; | 380 | 0x7fffffffffffUL; |
380 | |||
381 | #endif | 381 | #endif |
382 | gru_start_vaddr = __va(gru_start_paddr); | 382 | gru_start_vaddr = __va(gru_start_paddr); |
383 | gru_end_paddr = gru_start_paddr + MAX_NUMNODES * GRU_SIZE; | 383 | gru_end_paddr = gru_start_paddr + GRU_MAX_BLADES * GRU_SIZE; |
384 | printk(KERN_INFO "GRU space: 0x%lx - 0x%lx\n", | 384 | printk(KERN_INFO "GRU space: 0x%lx - 0x%lx\n", |
385 | gru_start_paddr, gru_end_paddr); | 385 | gru_start_paddr, gru_end_paddr); |
386 | irq = get_base_irq(); | 386 | irq = get_base_irq(); |
387 | for (chip = 0; chip < GRU_CHIPLETS_PER_BLADE; chip++) { | 387 | for (chip = 0; chip < GRU_CHIPLETS_PER_BLADE; chip++) { |
388 | ret = request_irq(irq + chip, gru_intr, 0, id, NULL); | 388 | ret = request_irq(irq + chip, gru_intr, 0, id, NULL); |
389 | /* TODO: fix irq handling on x86. For now ignore failures because | 389 | /* TODO: fix irq handling on x86. For now ignore failure because |
390 | * interrupts are not required & not yet fully supported */ | 390 | * interrupts are not required & not yet fully supported */ |
391 | if (ret) { | 391 | if (ret) { |
392 | printk("!!!WARNING: GRU ignoring request failure!!!\n"); | 392 | printk(KERN_WARNING |
393 | "!!!WARNING: GRU ignoring request failure!!!\n"); | ||
393 | ret = 0; | 394 | ret = 0; |
394 | } | 395 | } |
395 | if (ret) { | 396 | if (ret) { |
@@ -469,7 +470,11 @@ struct vm_operations_struct gru_vm_ops = { | |||
469 | .fault = gru_fault, | 470 | .fault = gru_fault, |
470 | }; | 471 | }; |
471 | 472 | ||
473 | #ifndef MODULE | ||
472 | fs_initcall(gru_init); | 474 | fs_initcall(gru_init); |
475 | #else | ||
476 | module_init(gru_init); | ||
477 | #endif | ||
473 | module_exit(gru_exit); | 478 | module_exit(gru_exit); |
474 | 479 | ||
475 | module_param(gru_options, ulong, 0644); | 480 | module_param(gru_options, ulong, 0644); |