Commit 27ca8a7b authored by Jack Steiner's avatar Jack Steiner Committed by Linus Torvalds

sgi-gru: fix bugs related to module unload of the GRU driver

Fix bugs related to module unload of the GRU driver.
Signed-off-by: default avatarJack Steiner <steiner@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e1c3219d
...@@ -440,7 +440,7 @@ static int __init gru_init(void) ...@@ -440,7 +440,7 @@ static int __init gru_init(void)
static void __exit gru_exit(void) static void __exit gru_exit(void)
{ {
int i, bid; int i, bid, gid;
int order = get_order(sizeof(struct gru_state) * int order = get_order(sizeof(struct gru_state) *
GRU_CHIPLETS_PER_BLADE); GRU_CHIPLETS_PER_BLADE);
...@@ -450,6 +450,9 @@ static void __exit gru_exit(void) ...@@ -450,6 +450,9 @@ static void __exit gru_exit(void)
for (i = 0; i < GRU_CHIPLETS_PER_BLADE; i++) for (i = 0; i < GRU_CHIPLETS_PER_BLADE; i++)
free_irq(IRQ_GRU + i, NULL); free_irq(IRQ_GRU + i, NULL);
foreach_gid(gid)
gru_kservices_exit(GID_TO_GRU(gid));
for (bid = 0; bid < GRU_MAX_BLADES; bid++) for (bid = 0; bid < GRU_MAX_BLADES; bid++)
free_pages((unsigned long)gru_base[bid], order); free_pages((unsigned long)gru_base[bid], order);
......
...@@ -690,3 +690,22 @@ int gru_kservices_init(struct gru_state *gru) ...@@ -690,3 +690,22 @@ int gru_kservices_init(struct gru_state *gru)
quicktest(gru); quicktest(gru);
return 0; return 0;
} }
void gru_kservices_exit(struct gru_state *gru)
{
struct gru_context_configuration_handle *cch;
struct gru_blade_state *bs;
bs = gru->gs_blade;
if (gru != &bs->bs_grus[1])
return;
cch = get_cch(gru->gs_gru_base_vaddr, KERNEL_CTXNUM);
lock_cch_handle(cch);
if (cch_interrupt_sync(cch))
BUG();
if (cch_deallocate(cch))
BUG();
unlock_cch_handle(cch);
}
...@@ -600,6 +600,7 @@ extern void gru_unload_context(struct gru_thread_state *gts, int savestate); ...@@ -600,6 +600,7 @@ extern void gru_unload_context(struct gru_thread_state *gts, int savestate);
extern void gts_drop(struct gru_thread_state *gts); extern void gts_drop(struct gru_thread_state *gts);
extern void gru_tgh_flush_init(struct gru_state *gru); extern void gru_tgh_flush_init(struct gru_state *gru);
extern int gru_kservices_init(struct gru_state *gru); extern int gru_kservices_init(struct gru_state *gru);
extern void gru_kservices_exit(struct gru_state *gru);
extern irqreturn_t gru_intr(int irq, void *dev_id); extern irqreturn_t gru_intr(int irq, void *dev_id);
extern int gru_handle_user_call_os(unsigned long address); extern int gru_handle_user_call_os(unsigned long address);
extern int gru_user_flush_tlb(unsigned long arg); extern int gru_user_flush_tlb(unsigned long arg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment