Merge tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 16 Nov 2020 23:02:33 +0000 (15:02 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 16 Nov 2020 23:02:33 +0000 (15:02 -0800)
Pull Hyper-V fix from Wei Liu:
 "One patch from Chris to fix kexec on Hyper-V"

* tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
  Drivers: hv: vmbus: Allow cleanup of VMBUS_CONNECT_CPU if disconnected

1  2 
drivers/hv/hv.c

diff --combined drivers/hv/hv.c
@@@ -165,7 -165,7 +165,7 @@@ void hv_synic_enable_regs(unsigned int 
        hv_get_simp(simp.as_uint64);
        simp.simp_enabled = 1;
        simp.base_simp_gpa = virt_to_phys(hv_cpu->synic_message_page)
 -              >> PAGE_SHIFT;
 +              >> HV_HYP_PAGE_SHIFT;
  
        hv_set_simp(simp.as_uint64);
  
        hv_get_siefp(siefp.as_uint64);
        siefp.siefp_enabled = 1;
        siefp.base_siefp_gpa = virt_to_phys(hv_cpu->synic_event_page)
 -              >> PAGE_SHIFT;
 +              >> HV_HYP_PAGE_SHIFT;
  
        hv_set_siefp(siefp.as_uint64);
  
        /* Setup the shared SINT. */
        hv_get_synint_state(VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
  
 -      shared_sint.vector = HYPERVISOR_CALLBACK_VECTOR;
 +      shared_sint.vector = hv_get_vector();
        shared_sint.masked = false;
        shared_sint.auto_eoi = hv_recommend_using_aeoi();
        hv_set_synint_state(VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
@@@ -244,9 -244,13 +244,13 @@@ int hv_synic_cleanup(unsigned int cpu
  
        /*
         * Hyper-V does not provide a way to change the connect CPU once
-        * it is set; we must prevent the connect CPU from going offline.
+        * it is set; we must prevent the connect CPU from going offline
+        * while the VM is running normally. But in the panic or kexec()
+        * path where the vmbus is already disconnected, the CPU must be
+        * allowed to shut down.
         */
-       if (cpu == VMBUS_CONNECT_CPU)
+       if (cpu == VMBUS_CONNECT_CPU &&
+           vmbus_connection.conn_state == CONNECTED)
                return -EBUSY;
  
        /*