--- old/usr/src/uts/common/os/ddi_intr.c	Sat Mar 10 03:57:34 2018
+++ new/usr/src/uts/common/os/ddi_intr.c	Sat Mar 10 03:57:34 2018
@@ -278,6 +278,7 @@
 	tmp_hdl.ih_scratch1 = count;
 	tmp_hdl.ih_scratch2 = (void *)(uintptr_t)behavior;
 	tmp_hdl.ih_dip = dip;
+	tmp_hdl.ih_irq = -1;
 
 	if (i_ddi_intr_ops(dip, dip, DDI_INTROP_ALLOC,
 	    &tmp_hdl, (void *)actualp) != DDI_SUCCESS) {
@@ -324,10 +325,14 @@
 		hdlp->ih_state = DDI_IHDL_STATE_ALLOC;
 		hdlp->ih_dip = dip;
 		hdlp->ih_inum = i;
+		hdlp->ih_irq = -1;
 		i_ddi_alloc_intr_phdl(hdlp);
-		if (type & DDI_INTR_TYPE_FIXED)
+		if (type & DDI_INTR_TYPE_FIXED) {
+			if (tmp_hdl.ih_irq != -1)
+				hdlp->ih_irq = tmp_hdl.ih_irq;
 			i_ddi_set_intr_handle(dip, hdlp->ih_inum,
 			    (ddi_intr_handle_t)hdlp);
+		}
 
 		DDI_INTR_APIDBG((CE_CONT, "ddi_intr_alloc: hdlp = 0x%p\n",
 		    (void *)h_array[i]));
--- old/usr/src/uts/common/sys/ddi_intr_impl.h	Sat Mar 10 03:57:35 2018
+++ new/usr/src/uts/common/sys/ddi_intr_impl.h	Sat Mar 10 03:57:35 2018
@@ -79,6 +79,7 @@
 	uint16_t		ih_type;	/* interrupt type being used */
 	ushort_t		ih_inum;	/* interrupt number */
 	uint32_t		ih_vector;	/* vector number */
+	int			ih_irq;		/* irq number */
 	uint16_t		ih_ver;		/* Version */
 	uint_t			ih_state;	/* interrupt handle state */
 	uint_t			ih_cap;		/* interrupt capabilities */
--- old/usr/src/uts/i86pc/i86hvm/io/xpv/evtchn.c	Sat Mar 10 03:57:35 2018
+++ new/usr/src/uts/i86pc/i86hvm/io/xpv/evtchn.c	Sat Mar 10 03:57:35 2018
@@ -375,7 +375,7 @@
 	}
 
 	/* Tell the hypervisor which interrupt we're waiting on. */
-	evtchn_callback_irq = ((ddi_intr_handle_impl_t *)*ihp)->ih_vector;
+	evtchn_callback_irq = ((ddi_intr_handle_impl_t *)*ihp)->ih_irq;
 
 	if (set_hvm_callback(evtchn_callback_irq) != 0) {
 		cmn_err(CE_WARN, "Couldn't register evtchn callback");
--- old/usr/src/uts/i86pc/io/apix/apix.c	Sat Mar 10 03:57:36 2018
+++ new/usr/src/uts/i86pc/io/apix/apix.c	Sat Mar 10 03:57:36 2018
@@ -114,7 +114,8 @@
 static void apix_intx_set_shared(int irqno, int delta);
 static apix_vector_t *apix_intx_xlate_vector(dev_info_t *, int,
     struct intrspec *);
-static int apix_intx_alloc_vector(dev_info_t *, int, struct intrspec *);
+static int apix_intx_alloc_vector(dev_info_t *, ddi_intr_handle_impl_t *,
+    struct intrspec *);
 
 extern int apic_clkinit(int);
 
@@ -261,15 +262,6 @@
 	if (apix_enable == 0)
 		return (PSM_FAILURE);
 
-	/*
-	 * FIXME Temporarily disable apix module on Xen HVM platform due to
-	 * known hang during boot (see #3605).
-	 *
-	 * Please remove when/if the issue is resolved.
-	 */
-	if (get_hwenv() == HW_XEN_HVM)
-		return (PSM_FAILURE);
-
 	/* check for hw features if specified  */
 	if (apix_hw_chk_enable) {
 		/* check if x2APIC mode is supported */
@@ -1184,8 +1176,7 @@
 				return (PSM_FAILURE);
 			}
 			ispec = ((ihdl_plat_t *)hdlp->ih_private)->ip_ispecp;
-			*result = apix_intx_alloc_vector(dip, hdlp->ih_inum,
-			    ispec);
+			*result = apix_intx_alloc_vector(dip, hdlp, ispec);
 			break;
 		default:
 			return (PSM_FAILURE);
@@ -2523,17 +2514,20 @@
 }
 
 static int
-apix_intx_alloc_vector(dev_info_t *dip, int inum, struct intrspec *ispec)
+apix_intx_alloc_vector(dev_info_t *dip, ddi_intr_handle_impl_t *hdlp,
+    struct intrspec *ispec)
 {
 	int irqno;
 	apix_vector_t *vecp;
 
-	if ((irqno = apix_intx_xlate_irq(dip, inum, ispec)) == -1)
+	if ((irqno = apix_intx_xlate_irq(dip, hdlp->ih_inum, ispec)) == -1)
 		return (0);
 
-	if ((vecp = apix_alloc_intx(dip, inum, irqno)) == NULL)
+	if ((vecp = apix_alloc_intx(dip, hdlp->ih_inum, irqno)) == NULL)
 		return (0);
 
+	hdlp->ih_irq = irqno;
+
 	DDI_INTR_IMPLDBG((CE_CONT, "apix_intx_alloc_vector: dip=0x%p name=%s "
 	    "irqno=0x%x cpuid=%d vector=0x%x\n",
 	    (void *)dip, ddi_driver_name(dip), irqno,
--- old/usr/src/uts/i86pc/io/pci/pci_common.c	Sat Mar 10 03:57:36 2018
+++ new/usr/src/uts/i86pc/io/pci/pci_common.c	Sat Mar 10 03:57:36 2018
@@ -950,6 +950,8 @@
 	    hdlp->ih_cb_arg2, &ihdl_plat_datap->ip_ticks, rdip))
 		return (DDI_FAILURE);
 
+	if (hdlp->ih_irq == -1)
+		hdlp->ih_irq = irq;
 	hdlp->ih_vector = irq;
 
 	return (DDI_SUCCESS);
