aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hv/hv.c25
-rw-r--r--drivers/hv/hyperv_vmbus.h2
-rw-r--r--drivers/hv/vmbus_drv.c1
3 files changed, 27 insertions, 1 deletions
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 39531dcf582f..d3943bceecc3 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -312,7 +312,11 @@ static void hv_init_clockevent_device(struct clock_event_device *dev, int cpu)
312 dev->features = CLOCK_EVT_FEAT_ONESHOT; 312 dev->features = CLOCK_EVT_FEAT_ONESHOT;
313 dev->cpumask = cpumask_of(cpu); 313 dev->cpumask = cpumask_of(cpu);
314 dev->rating = 1000; 314 dev->rating = 1000;
315 dev->owner = THIS_MODULE; 315 /*
316 * Avoid settint dev->owner = THIS_MODULE deliberately as doing so will
317 * result in clockevents_config_and_register() taking additional
318 * references to the hv_vmbus module making it impossible to unload.
319 */
316 320
317 dev->set_mode = hv_ce_setmode; 321 dev->set_mode = hv_ce_setmode;
318 dev->set_next_event = hv_ce_set_next_event; 322 dev->set_next_event = hv_ce_set_next_event;
@@ -470,6 +474,20 @@ void hv_synic_init(void *arg)
470} 474}
471 475
472/* 476/*
477 * hv_synic_clockevents_cleanup - Cleanup clockevent devices
478 */
479void hv_synic_clockevents_cleanup(void)
480{
481 int cpu;
482
483 if (!(ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE))
484 return;
485
486 for_each_online_cpu(cpu)
487 clockevents_unbind_device(hv_context.clk_evt[cpu], cpu);
488}
489
490/*
473 * hv_synic_cleanup - Cleanup routine for hv_synic_init(). 491 * hv_synic_cleanup - Cleanup routine for hv_synic_init().
474 */ 492 */
475void hv_synic_cleanup(void *arg) 493void hv_synic_cleanup(void *arg)
@@ -483,6 +501,11 @@ void hv_synic_cleanup(void *arg)
483 if (!hv_context.synic_initialized) 501 if (!hv_context.synic_initialized)
484 return; 502 return;
485 503
504 /* Turn off clockevent device */
505 if (ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE)
506 hv_ce_setmode(CLOCK_EVT_MODE_SHUTDOWN,
507 hv_context.clk_evt[cpu]);
508
486 rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64); 509 rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
487 510
488 shared_sint.masked = 1; 511 shared_sint.masked = 1;
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 6cf2de9f487a..b055e53bbc6e 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -572,6 +572,8 @@ extern void hv_synic_init(void *irqarg);
572 572
573extern void hv_synic_cleanup(void *arg); 573extern void hv_synic_cleanup(void *arg);
574 574
575extern void hv_synic_clockevents_cleanup(void);
576
575/* 577/*
576 * Host version information. 578 * Host version information.
577 */ 579 */
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index d8233d4513a5..6d99aa5c49d6 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1032,6 +1032,7 @@ static void __exit vmbus_exit(void)
1032 int cpu; 1032 int cpu;
1033 1033
1034 vmbus_connection.conn_state = DISCONNECTED; 1034 vmbus_connection.conn_state = DISCONNECTED;
1035 hv_synic_clockevents_cleanup();
1035 hv_remove_vmbus_irq(); 1036 hv_remove_vmbus_irq();
1036 vmbus_free_channels(); 1037 vmbus_free_channels();
1037 bus_unregister(&hv_bus); 1038 bus_unregister(&hv_bus);