changeset 21478:c8eb45f6d679

Merge pull request #483 from gwr/omnios-482 Provide psm_get_ipivect even on single CPU systems
author Andy Fiddaman <andy@omniosce.org>
date Wed, 05 Jun 2019 09:17:02 +0000
parents 846f8dd0563e (current diff) 52d7090cfa1e (diff)
children 20cc80a39985 b5df7c709c23 f707a5313c37
files
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/i86pc/os/mp_machdep.c	Wed Jun 05 09:46:37 2019 +0200
+++ b/usr/src/uts/i86pc/os/mp_machdep.c	Wed Jun 05 09:17:02 2019 +0000
@@ -1134,6 +1134,14 @@
 	if (pops->psm_enable_intr)
 		psm_enable_intr  = pops->psm_enable_intr;
 
+	/*
+	 * Set this vector so it can be used by vmbus (for Hyper-V)
+	 * Need this even for single-CPU systems.  This works for
+	 * "pcplusmp" and "apix" platforms, but not "uppc" (because
+	 * "Uni-processor PC" does not provide a _get_ipivect).
+	 */
+	psm_get_ipivect = pops->psm_get_ipivect;
+
 	/* check for multiple CPUs */
 	if (cnt < 2 && plat_dr_support_cpu() == B_FALSE)
 		return;
@@ -1156,7 +1164,6 @@
 #endif
 	}
 
-	psm_get_ipivect = pops->psm_get_ipivect;
 	psm_get_pir_ipivect = pops->psm_get_pir_ipivect;
 	psm_send_pir_ipi = pops->psm_send_pir_ipi;
 	psm_cmci_setup = pops->psm_cmci_setup;
--- a/usr/src/uts/intel/io/hyperv/vmbus/vmbus.c	Wed Jun 05 09:46:37 2019 +0200
+++ b/usr/src/uts/intel/io/hyperv/vmbus/vmbus.c	Wed Jun 05 09:17:02 2019 +0000
@@ -840,8 +840,9 @@
 		    tq_name, 1, maxclsyspri, 0);
 	}
 
+	/* Checked in attach, but let's be careful. */
 	if (psm_get_ipivect == NULL)
-		return (0);
+		panic("psm_get_ipivect == NULL");
 
 	sc->vmbus_idtvec = psm_get_ipivect(IPL_VMBUS, -1);
 	if (add_avintr(NULL, IPL_VMBUS, (avfunc)vmbus_handle_intr,
@@ -1142,6 +1143,15 @@
 		return (DDI_FAILURE);
 	}
 
+	/*
+	 * Make sure the platform module provides psm_get_ipivect
+	 * or we'll fail in vmbus_intr_setup
+	 */
+	if (psm_get_ipivect == NULL) {
+		dev_err(dip, CE_WARN, "psm_get_ipivect == NULL");
+		return (DDI_FAILURE);
+	}
+
 	mutex_enter(&vmbus_lock);
 	int instance = ddi_get_instance(dip);
 	if (ddi_soft_state_zalloc(vmbus_state, instance) != DDI_SUCCESS) {