Author: sephe
Date: Wed Apr 13 03:45:39 2016
New Revision: 297908
URL: https://svnweb.freebsd.org/changeset/base/297908

Log:
  hyperv/vmbus: Merge duplicated version check for events
  
  Submitted by: Jun Su <junsu microsoft com>
  Reviewed by:  sephe
  MFC after:    1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:        https://reviews.freebsd.org/D5911

Modified:
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Wed Apr 13 03:36:34 2016        
(r297907)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Wed Apr 13 03:45:39 2016        
(r297908)
@@ -305,14 +305,18 @@ hv_vmbus_on_events(int cpu)
        KASSERT(cpu <= mp_maxid, ("VMBUS: hv_vmbus_on_events: "
            "cpu out of range!"));
 
+       page_addr = hv_vmbus_g_context.syn_ic_event_page[cpu];
+       event = (hv_vmbus_synic_event_flags *)
+           page_addr + HV_VMBUS_MESSAGE_SINT;
        if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) ||
            (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7)) {
                maxdword = HV_MAX_NUM_CHANNELS_SUPPORTED >> 5;
                /*
                 * receive size is 1/2 page and divide that by 4 bytes
                 */
-               recv_interrupt_page =
-                   hv_vmbus_g_connection.recv_interrupt_page;
+               if (synch_test_and_clear_bit(0, &event->flags32[0]))
+                       recv_interrupt_page =
+                           hv_vmbus_g_connection.recv_interrupt_page;
        } else {
                /*
                 * On Host with Win8 or above, the event page can be
@@ -320,9 +324,6 @@ hv_vmbus_on_events(int cpu)
                 * that has the pending interrupt.
                 */
                maxdword = HV_EVENT_FLAGS_DWORD_COUNT;
-               page_addr = hv_vmbus_g_context.syn_ic_event_page[cpu];
-               event = (hv_vmbus_synic_event_flags *)
-                   page_addr + HV_VMBUS_MESSAGE_SINT;
                recv_interrupt_page = event->flags32;
        }
 

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c    Wed Apr 13 03:36:34 
2016        (r297907)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c    Wed Apr 13 03:45:39 
2016        (r297908)
@@ -145,7 +145,6 @@ hv_vmbus_isr(struct trapframe *frame)
 {
        int                             cpu;
        hv_vmbus_message*               msg;
-       hv_vmbus_synic_event_flags*     event;
        void*                           page_addr;
 
        cpu = PCPU_GET(cpuid);
@@ -156,26 +155,7 @@ hv_vmbus_isr(struct trapframe *frame)
         * in Windows when running as a guest in Hyper-V
         */
 
-       page_addr = hv_vmbus_g_context.syn_ic_event_page[cpu];
-       event = (hv_vmbus_synic_event_flags*)
-                   page_addr + HV_VMBUS_MESSAGE_SINT;
-
-       if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) ||
-           (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7)) {
-               /* Since we are a child, we only need to check bit 0 */
-               if (synch_test_and_clear_bit(0, &event->flags32[0])) {
-                       hv_vmbus_on_events(cpu);
-               }
-       } else {
-               /*
-                * On host with Win8 or above, we can directly look at
-                * the event page. If bit n is set, we have an interrupt 
-                * on the channel with id n.
-                * Directly schedule the event software interrupt on
-                * current cpu.
-                */
-               hv_vmbus_on_events(cpu);
-       }
+       hv_vmbus_on_events(cpu);
 
        /* Check if there are actual msgs to be process */
        page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu];
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to