X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=drivers%2Fhv%2Fvmbus_drv.c;h=cf19dfa5ead187bf6c2eb535e31986ca5e671981;hb=fffddfd6c8e0c10c42c6e2cc54ba880fcc36ebbb;hp=8e1a9ec5300328eee7bb22a71c47c42f31ad5aa9;hpb=df9b42963f2d010ae3163a894ce22cf6b27cd344;p=~andy%2Flinux diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 8e1a9ec5300..cf19dfa5ead 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include "hyperv_vmbus.h" @@ -41,7 +42,6 @@ static struct acpi_device *hv_acpi_dev; static struct tasklet_struct msg_dpc; -static struct tasklet_struct event_dpc; static struct completion probe_event; static int irq; @@ -454,21 +454,40 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id) union hv_synic_event_flags *event; bool handled = false; + page_addr = hv_context.synic_event_page[cpu]; + if (page_addr == NULL) + return IRQ_NONE; + + event = (union hv_synic_event_flags *)page_addr + + VMBUS_MESSAGE_SINT; /* * Check for events before checking for messages. This is the order * in which events and messages are checked in Windows guests on * Hyper-V, and the Windows team suggested we do the same. */ - page_addr = hv_context.synic_event_page[cpu]; - event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; + if ((vmbus_proto_version == VERSION_WS2008) || + (vmbus_proto_version == VERSION_WIN7)) { - /* Since we are a child, we only need to check bit 0 */ - if (sync_test_and_clear_bit(0, (unsigned long *) &event->flags32[0])) { + /* Since we are a child, we only need to check bit 0 */ + if (sync_test_and_clear_bit(0, + (unsigned long *) &event->flags32[0])) { + handled = true; + } + } else { + /* + * Our host is win8 or above. The signaling mechanism + * has changed and we can directly look at the event page. + * If bit n is set then we have an interrup on the channel + * whose id is n. + */ handled = true; - tasklet_schedule(&event_dpc); } + if (handled) + tasklet_schedule(hv_context.event_dpc[cpu]); + + page_addr = hv_context.synic_message_page[cpu]; msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; @@ -484,6 +503,19 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id) return IRQ_NONE; } +/* + * vmbus interrupt flow handler: + * vmbus interrupts can concurrently occur on multiple CPUs and + * can be handled concurrently. + */ + +static void vmbus_flow_handler(unsigned int irq, struct irq_desc *desc) +{ + kstat_incr_irqs_this_cpu(irq, desc); + + desc->action->handler(irq, desc->action->dev_id); +} + /* * vmbus_bus_init -Main vmbus driver initialization routine. * @@ -506,7 +538,6 @@ static int vmbus_bus_init(int irq) } tasklet_init(&msg_dpc, vmbus_on_msg_dpc, 0); - tasklet_init(&event_dpc, vmbus_on_event, 0); ret = bus_register(&hv_bus); if (ret) @@ -520,6 +551,13 @@ static int vmbus_bus_init(int irq) goto err_unregister; } + /* + * Vmbus interrupts can be handled concurrently on + * different CPUs. Establish an appropriate interrupt flow + * handler that can support this model. + */ + irq_set_handler(irq, vmbus_flow_handler); + vector = IRQ0_VECTOR + irq; /* @@ -575,8 +613,6 @@ int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, c ret = driver_register(&hv_driver->driver); - vmbus_request_offers(); - return ret; } EXPORT_SYMBOL_GPL(__vmbus_driver_register);