aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv/vmbus_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hv/vmbus_drv.c')
-rw-r--r--drivers/hv/vmbus_drv.c57
1 files changed, 6 insertions, 51 deletions
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 077bb1bdac34..3f0a95290e14 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -25,7 +25,6 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/device.h> 27#include <linux/device.h>
28#include <linux/irq.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
30#include <linux/sysctl.h> 29#include <linux/sysctl.h>
31#include <linux/slab.h> 30#include <linux/slab.h>
@@ -558,9 +557,6 @@ static struct bus_type hv_bus = {
558 .dev_groups = vmbus_groups, 557 .dev_groups = vmbus_groups,
559}; 558};
560 559
561static const char *driver_name = "hyperv";
562
563
564struct onmessage_work_context { 560struct onmessage_work_context {
565 struct work_struct work; 561 struct work_struct work;
566 struct hv_message msg; 562 struct hv_message msg;
@@ -619,7 +615,7 @@ static void vmbus_on_msg_dpc(unsigned long data)
619 } 615 }
620} 616}
621 617
622static irqreturn_t vmbus_isr(int irq, void *dev_id) 618static void vmbus_isr(void)
623{ 619{
624 int cpu = smp_processor_id(); 620 int cpu = smp_processor_id();
625 void *page_addr; 621 void *page_addr;
@@ -629,7 +625,7 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
629 625
630 page_addr = hv_context.synic_event_page[cpu]; 626 page_addr = hv_context.synic_event_page[cpu];
631 if (page_addr == NULL) 627 if (page_addr == NULL)
632 return IRQ_NONE; 628 return;
633 629
634 event = (union hv_synic_event_flags *)page_addr + 630 event = (union hv_synic_event_flags *)page_addr +
635 VMBUS_MESSAGE_SINT; 631 VMBUS_MESSAGE_SINT;
@@ -665,28 +661,8 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
665 msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; 661 msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT;
666 662
667 /* Check if there are actual msgs to be processed */ 663 /* Check if there are actual msgs to be processed */
668 if (msg->header.message_type != HVMSG_NONE) { 664 if (msg->header.message_type != HVMSG_NONE)
669 handled = true;
670 tasklet_schedule(&msg_dpc); 665 tasklet_schedule(&msg_dpc);
671 }
672
673 if (handled)
674 return IRQ_HANDLED;
675 else
676 return IRQ_NONE;
677}
678
679/*
680 * vmbus interrupt flow handler:
681 * vmbus interrupts can concurrently occur on multiple CPUs and
682 * can be handled concurrently.
683 */
684
685static void vmbus_flow_handler(unsigned int irq, struct irq_desc *desc)
686{
687 kstat_incr_irqs_this_cpu(irq, desc);
688
689 desc->action->handler(irq, desc->action->dev_id);
690} 666}
691 667
692/* 668/*
@@ -715,25 +691,7 @@ static int vmbus_bus_init(int irq)
715 if (ret) 691 if (ret)
716 goto err_cleanup; 692 goto err_cleanup;
717 693
718 ret = request_irq(irq, vmbus_isr, 0, driver_name, hv_acpi_dev); 694 hv_setup_vmbus_irq(vmbus_isr);
719
720 if (ret != 0) {
721 pr_err("Unable to request IRQ %d\n",
722 irq);
723 goto err_unregister;
724 }
725
726 /*
727 * Vmbus interrupts can be handled concurrently on
728 * different CPUs. Establish an appropriate interrupt flow
729 * handler that can support this model.
730 */
731 irq_set_handler(irq, vmbus_flow_handler);
732
733 /*
734 * Register our interrupt handler.
735 */
736 hv_register_vmbus_handler(irq, vmbus_isr);
737 695
738 ret = hv_synic_alloc(); 696 ret = hv_synic_alloc();
739 if (ret) 697 if (ret)
@@ -753,9 +711,8 @@ static int vmbus_bus_init(int irq)
753 711
754err_alloc: 712err_alloc:
755 hv_synic_free(); 713 hv_synic_free();
756 free_irq(irq, hv_acpi_dev); 714 hv_remove_vmbus_irq();
757 715
758err_unregister:
759 bus_unregister(&hv_bus); 716 bus_unregister(&hv_bus);
760 717
761err_cleanup: 718err_cleanup:
@@ -947,7 +904,6 @@ static int __init hv_acpi_init(void)
947 /* 904 /*
948 * Get irq resources first. 905 * Get irq resources first.
949 */ 906 */
950
951 ret = acpi_bus_register_driver(&vmbus_acpi_driver); 907 ret = acpi_bus_register_driver(&vmbus_acpi_driver);
952 908
953 if (ret) 909 if (ret)
@@ -978,8 +934,7 @@ cleanup:
978 934
979static void __exit vmbus_exit(void) 935static void __exit vmbus_exit(void)
980{ 936{
981 937 hv_remove_vmbus_irq();
982 free_irq(irq, hv_acpi_dev);
983 vmbus_free_channels(); 938 vmbus_free_channels();
984 bus_unregister(&hv_bus); 939 bus_unregister(&hv_bus);
985 hv_cleanup(); 940 hv_cleanup();