Module Name:    src
Committed By:   cherry
Date:           Mon Dec 24 14:55:42 UTC 2018

Modified Files:
        src/sys/arch/x86/x86: intr.c
        src/sys/arch/xen/include: intr.h
        src/sys/arch/xen/x86: xen_intr.c xen_ipi.c
        src/sys/arch/xen/xen: clock.c if_xennet_xenbus.c pciback.c xbd_xenbus.c
            xbdback_xenbus.c xencons.c xenevt.c xennetback_xenbus.c
            xpci_xenbus.c
        src/sys/arch/xen/xenbus: xenbus_comms.c

Log Message:
Bifurcate the interrupt establish functions between XEN and non-XEN

Thus intr_establish_xname() becomes xen_intr_establish_xname() etc.

One consequence of this is that dom0 devices expect the native
function calls to be available and we thus provide weak aliasing for
dom0 builds to succeed. XEN and non-XEN devices are distinguished by
the PIC they are established on. XEN interrupts are exclusively
established on xen_pic, while dom0 interrupts are established on
natively available PICs.

This allows us an orthogonal path to xen device management (eg:
xenstore events) in XENPVHVM, without having to worry about unifying
the vector entry paths, etc., which is quite challenging.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/xen/x86/xen_ipi.c
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/xen/xen/xbd_xenbus.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/xen/xen/xencons.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/xen/xen/xenevt.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/xen/xen/xennetback_xenbus.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xen/xpci_xenbus.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xenbus/xenbus_comms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.138 src/sys/arch/x86/x86/intr.c:1.139
--- src/sys/arch/x86/x86/intr.c:1.138	Sun Dec 23 12:11:40 2018
+++ src/sys/arch/x86/x86/intr.c	Mon Dec 24 14:55:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.138 2018/12/23 12:11:40 jdolecek Exp $	*/
+/*	$NetBSD: intr.c,v 1.139 2018/12/24 14:55:41 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.138 2018/12/23 12:11:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.139 2018/12/24 14:55:41 cherry Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1207,117 +1207,12 @@ intr_num_handlers(struct intrsource *isp
 	return num;
 }
 
-#else /* XEN */
-void *
-intr_establish(int legacy_irq, struct pic *pic, int pin,
-    int type, int level, int (*handler)(void *), void *arg,
-    bool known_mpsafe)
-{
-
-	return intr_establish_xname(legacy_irq, pic, pin, type, level,
-	    handler, arg, known_mpsafe, "XEN");
-}
-
-void *
-intr_establish_xname(int legacy_irq, struct pic *pic, int pin,
-    int type, int level, int (*handler)(void *), void *arg,
-    bool known_mpsafe, const char *xname)
-{
-	const char *intrstr;
-	char intrstr_buf[INTRIDBUF];
-
-	if (pic->pic_type == PIC_XEN) {
-		struct intrhand *rih;
-
-		/*
-		 * event_set_handler interprets `level != IPL_VM' to
-		 * mean MP-safe, so we require the caller to match that
-		 * for the moment.
-		 */
-		KASSERT(known_mpsafe == (level != IPL_VM));
-
-		intrstr = intr_create_intrid(legacy_irq, pic, pin, intrstr_buf,
-		    sizeof(intrstr_buf));
-
-		event_set_handler(pin, handler, arg, level, intrstr, xname);
-
-		rih = kmem_zalloc(sizeof(*rih), cold ? KM_NOSLEEP : KM_SLEEP);
-		if (rih == NULL) {
-			printf("%s: can't allocate handler info\n", __func__);
-			return NULL;
-		}
-
-		/*
-		 * XXX:
-		 * This is just a copy for API conformance.
-		 * The real ih is lost in the innards of
-		 * event_set_handler(); where the details of
-		 * biglock_wrapper etc are taken care of.
-		 * All that goes away when we nuke event_set_handler()
-		 * et. al. and unify with x86/intr.c
-		 */
-		rih->ih_pin = pin; /* port */
-		rih->ih_fun = rih->ih_realfun = handler;
-		rih->ih_arg = rih->ih_realarg = arg;
-		rih->pic_type = pic->pic_type;
-		return rih;
-	} 	/* Else we assume pintr */
-
-#if NPCI > 0 || NISA > 0
-	struct pintrhand *pih;
-	int gsi;
-	int vector, evtchn;
-
-	KASSERTMSG(legacy_irq == -1 || (0 <= legacy_irq && legacy_irq < NUM_XEN_IRQS),
-	    "bad legacy IRQ value: %d", legacy_irq);
-	KASSERTMSG(!(legacy_irq == -1 && pic == &i8259_pic),
-	    "non-legacy IRQon i8259 ");
-
-	gsi = xen_pic_to_gsi(pic, pin);
-
-	intrstr = intr_create_intrid(gsi, pic, pin, intrstr_buf,
-	    sizeof(intrstr_buf));
-
-	vector = xen_vec_alloc(gsi);
-
-	if (irq2port[gsi] == 0) {
-		extern struct cpu_info phycpu_info_primary; /* XXX */
-		struct cpu_info *ci = &phycpu_info_primary;
-
-		pic->pic_addroute(pic, ci, pin, vector, type);
-
-		evtchn = bind_pirq_to_evtch(gsi);
-		KASSERT(evtchn > 0);
-		KASSERT(evtchn < NR_EVENT_CHANNELS);
-		irq2port[gsi] = evtchn + 1;
-		xen_atomic_set_bit(&ci->ci_evtmask[0], evtchn);
-	} else {
-		/*
-		 * Shared interrupt - we can't rebind.
-		 * The port is shared instead.
-		 */
-		evtchn = irq2port[gsi] - 1;
-	}
-
-	pih = pirq_establish(gsi, evtchn, handler, arg, level,
-			     intrstr, xname);
-	pih->pic_type = pic->pic_type;
-	return pih;
-#endif /* NPCI > 0 || NISA > 0 */
-
-	/* FALLTHROUGH */
-	return NULL;
-}
-
-#endif /* XEN */
-
 /*
  * Deregister an interrupt handler.
  */
 void
 intr_disestablish(struct intrhand *ih)
 {
-#if !defined(XEN)
 	struct cpu_info *ci;
 	struct intrsource *isp;
 	uint64_t where;
@@ -1343,44 +1238,10 @@ intr_disestablish(struct intrhand *ih)
 	}
 	mutex_exit(&cpu_lock);
 	kmem_free(ih, sizeof(*ih));
-#else /* XEN */
-	if (ih->pic_type == PIC_XEN) {
-		event_remove_handler(ih->ih_pin, ih->ih_realfun,
-		    ih->ih_realarg);
-		kmem_free(ih, sizeof(*ih));
-		return;
-	}
-#if defined(DOM0OPS)
-	/* 
-	 * Cache state, to prevent a use after free situation with
-	 * ih.
-	 */
-
-	struct pintrhand *pih = (struct pintrhand *)ih;
-
-	int pirq = pih->pirq;
-	int port = pih->evtch;
-	KASSERT(irq2port[pirq] != 0);
-
-	pirq_disestablish(pih);
-
-	if (evtsource[port] == NULL) {
-			/*
-			 * Last handler was removed by
-			 * event_remove_handler().
-			 *
-			 * We can safely unbind the pirq now.
-			 */
-
-			port = unbind_pirq_from_evtch(pirq);
-			KASSERT(port == pih->evtch);
-			irq2port[pirq] = 0;
-	}
-#endif
-	return;
-#endif /* XEN */
 }
 
+#endif /* !XEN */
+
 #if defined(XEN) /* nuke conditional post integration */
 static const char *
 xen_intr_string(int port, char *buf, size_t len, struct pic *pic)

Index: src/sys/arch/xen/include/intr.h
diff -u src/sys/arch/xen/include/intr.h:1.49 src/sys/arch/xen/include/intr.h:1.50
--- src/sys/arch/xen/include/intr.h:1.49	Wed Oct 10 02:34:08 2018
+++ src/sys/arch/xen/include/intr.h	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.49 2018/10/10 02:34:08 cherry Exp $	*/
+/*	$NetBSD: intr.h,v 1.50 2018/12/24 14:55:42 cherry Exp $	*/
 /*	NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp	*/
 
 /*-
@@ -82,6 +82,13 @@ void xen_broadcast_ipi(uint32_t);
 #define xen_send_ipi(_i1, _i2) (0) /* nothing */
 #define xen_broadcast_ipi(_i1) ((void) 0) /* nothing */
 #endif /* MULTIPROCESSOR */
+
+void *xen_intr_establish_xname(int, struct pic *, int, int, int, int (*)(void *),
+    void *, bool, const char *);
+void *xen_intr_establish(int, struct pic *, int, int, int, int (*)(void *),
+    void *, bool);
+void xen_intr_disestablish(struct intrhand *);
+
 #endif /* !_LOCORE */
 
 #endif /* _XEN_INTR_H_ */

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.9 src/sys/arch/xen/x86/xen_intr.c:1.10
--- src/sys/arch/xen/x86/xen_intr.c:1.9	Fri Jan 16 20:16:47 2009
+++ src/sys/arch/xen/x86/xen_intr.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.9 2009/01/16 20:16:47 jym Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.10 2018/12/24 14:55:42 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,9 +30,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.9 2009/01/16 20:16:47 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.10 2018/12/24 14:55:42 cherry Exp $");
 
 #include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/kmem.h>
+
+#include <xen/evtchn.h>
 
 #include <machine/cpu.h>
 #include <machine/intr.h>
@@ -112,3 +116,151 @@ x86_write_psl(u_long psl)
 	    	hypervisor_force_callback();
 	}
 }
+
+void *
+xen_intr_establish(int legacy_irq, struct pic *pic, int pin,
+    int type, int level, int (*handler)(void *), void *arg,
+    bool known_mpsafe)
+{
+
+	return xen_intr_establish_xname(legacy_irq, pic, pin, type, level,
+	    handler, arg, known_mpsafe, "XEN");
+}
+
+void *
+xen_intr_establish_xname(int legacy_irq, struct pic *pic, int pin,
+    int type, int level, int (*handler)(void *), void *arg,
+    bool known_mpsafe, const char *xname)
+{
+	const char *intrstr;
+	char intrstr_buf[INTRIDBUF];
+
+	if (pic->pic_type == PIC_XEN) {
+		struct intrhand *rih;
+
+		/*
+		 * event_set_handler interprets `level != IPL_VM' to
+		 * mean MP-safe, so we require the caller to match that
+		 * for the moment.
+		 */
+		KASSERT(known_mpsafe == (level != IPL_VM));
+
+		intrstr = intr_create_intrid(legacy_irq, pic, pin, intrstr_buf,
+		    sizeof(intrstr_buf));
+
+		event_set_handler(pin, handler, arg, level, intrstr, xname);
+
+		rih = kmem_zalloc(sizeof(*rih), cold ? KM_NOSLEEP : KM_SLEEP);
+		if (rih == NULL) {
+			printf("%s: can't allocate handler info\n", __func__);
+			return NULL;
+		}
+
+		/*
+		 * XXX:
+		 * This is just a copy for API conformance.
+		 * The real ih is lost in the innards of
+		 * event_set_handler(); where the details of
+		 * biglock_wrapper etc are taken care of.
+		 * All that goes away when we nuke event_set_handler()
+		 * et. al. and unify with x86/intr.c
+		 */
+		rih->ih_pin = pin; /* port */
+		rih->ih_fun = rih->ih_realfun = handler;
+		rih->ih_arg = rih->ih_realarg = arg;
+		rih->pic_type = pic->pic_type;
+		return rih;
+	} 	/* Else we assume pintr */
+
+#if NPCI > 0 || NISA > 0
+	struct pintrhand *pih;
+	int gsi;
+	int vector, evtchn;
+
+	KASSERTMSG(legacy_irq == -1 || (0 <= legacy_irq && legacy_irq < NUM_XEN_IRQS),
+	    "bad legacy IRQ value: %d", legacy_irq);
+	KASSERTMSG(!(legacy_irq == -1 && pic == &i8259_pic),
+	    "non-legacy IRQon i8259 ");
+
+	gsi = xen_pic_to_gsi(pic, pin);
+
+	intrstr = intr_create_intrid(gsi, pic, pin, intrstr_buf,
+	    sizeof(intrstr_buf));
+
+	vector = xen_vec_alloc(gsi);
+
+	if (irq2port[gsi] == 0) {
+		extern struct cpu_info phycpu_info_primary; /* XXX */
+		struct cpu_info *ci = &phycpu_info_primary;
+
+		pic->pic_addroute(pic, ci, pin, vector, type);
+
+		evtchn = bind_pirq_to_evtch(gsi);
+		KASSERT(evtchn > 0);
+		KASSERT(evtchn < NR_EVENT_CHANNELS);
+		irq2port[gsi] = evtchn + 1;
+		xen_atomic_set_bit(&ci->ci_evtmask[0], evtchn);
+	} else {
+		/*
+		 * Shared interrupt - we can't rebind.
+		 * The port is shared instead.
+		 */
+		evtchn = irq2port[gsi] - 1;
+	}
+
+	pih = pirq_establish(gsi, evtchn, handler, arg, level,
+			     intrstr, xname);
+	pih->pic_type = pic->pic_type;
+	return pih;
+#endif /* NPCI > 0 || NISA > 0 */
+
+	/* FALLTHROUGH */
+	return NULL;
+}
+
+/*
+ * Deregister an interrupt handler.
+ */
+void
+xen_intr_disestablish(struct intrhand *ih)
+{
+
+	if (ih->pic_type == PIC_XEN) {
+		event_remove_handler(ih->ih_pin, ih->ih_realfun,
+		    ih->ih_realarg);
+		kmem_free(ih, sizeof(*ih));
+		return;
+	}
+#if defined(DOM0OPS)
+	/* 
+	 * Cache state, to prevent a use after free situation with
+	 * ih.
+	 */
+
+	struct pintrhand *pih = (struct pintrhand *)ih;
+
+	int pirq = pih->pirq;
+	int port = pih->evtch;
+	KASSERT(irq2port[pirq] != 0);
+
+	pirq_disestablish(pih);
+
+	if (evtsource[port] == NULL) {
+			/*
+			 * Last handler was removed by
+			 * event_remove_handler().
+			 *
+			 * We can safely unbind the pirq now.
+			 */
+
+			port = unbind_pirq_from_evtch(pirq);
+			KASSERT(port == pih->evtch);
+			irq2port[pirq] = 0;
+	}
+#endif
+	return;
+}
+
+__weak_alias(intr_establish, xen_intr_establish);
+__weak_alias(intr_establish_xname, xen_intr_establish_xname);
+__weak_alias(intr_disestablish, xen_intr_disestablish);

Index: src/sys/arch/xen/x86/xen_ipi.c
diff -u src/sys/arch/xen/x86/xen_ipi.c:1.28 src/sys/arch/xen/x86/xen_ipi.c:1.29
--- src/sys/arch/xen/x86/xen_ipi.c:1.28	Fri Oct 26 05:33:21 2018
+++ src/sys/arch/xen/x86/xen_ipi.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ipi.c,v 1.28 2018/10/26 05:33:21 cherry Exp $ */
+/* $NetBSD: xen_ipi.c,v 1.29 2018/12/24 14:55:42 cherry Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,10 +33,10 @@
 
 /* 
  * Based on: x86/ipi.c
- * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.28 2018/10/26 05:33:21 cherry Exp $");
+ * __KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.29 2018/12/24 14:55:42 cherry Exp $");
  */
 
-__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.28 2018/10/26 05:33:21 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.29 2018/12/24 14:55:42 cherry Exp $");
 
 #include "opt_ddb.h"
 
@@ -137,7 +137,7 @@ xen_ipi_init(void)
 	snprintf(intr_xname, sizeof(intr_xname), "%s ipi",
 	    device_xname(ci->ci_dev));
 
-	if (intr_establish_xname(-1, &xen_pic, evtchn, IST_LEVEL, IPL_HIGH,
+	if (xen_intr_establish_xname(-1, &xen_pic, evtchn, IST_LEVEL, IPL_HIGH,
 		xen_ipi_handler, ci, true, intr_xname) == NULL) {
 		panic("%s: unable to register ipi handler\n", __func__);
 		/* NOTREACHED */

Index: src/sys/arch/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.74 src/sys/arch/xen/xen/clock.c:1.75
--- src/sys/arch/xen/xen/clock.c:1.74	Sun Nov 18 23:50:48 2018
+++ src/sys/arch/xen/xen/clock.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.74 2018/11/18 23:50:48 cherry Exp $	*/
+/*	$NetBSD: clock.c,v 1.75 2018/12/24 14:55:42 cherry Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.74 2018/11/18 23:50:48 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.75 2018/12/24 14:55:42 cherry Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -728,7 +728,7 @@ xen_suspendclocks(struct cpu_info *ci)
 	KASSERT(evtch != -1);
 
 	hypervisor_mask_event(evtch);
-	intr_disestablish(ci->ci_xen_timer_intrhand);
+	xen_intr_disestablish(ci->ci_xen_timer_intrhand);
 	ci->ci_xen_timer_intrhand = NULL;
 
 	aprint_verbose("Xen clock: removed event channel %d\n", evtch);
@@ -763,7 +763,7 @@ xen_resumeclocks(struct cpu_info *ci)
 	snprintf(intr_xname, sizeof(intr_xname), "%s clock",
 	    device_xname(ci->ci_dev));
 	/* XXX sketchy function pointer cast -- fix the API, please */
-	ci->ci_xen_timer_intrhand = intr_establish_xname(-1, &xen_pic, evtch,
+	ci->ci_xen_timer_intrhand = xen_intr_establish_xname(-1, &xen_pic, evtch,
 	    IST_LEVEL, IPL_CLOCK, (int (*)(void *))xen_timer_handler, ci, true,
 	    intr_xname);
 	if (ci->ci_xen_timer_intrhand == NULL)

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.81 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.82
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.81	Fri Oct 26 05:33:21 2018
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_xennet_xenbus.c,v 1.81 2018/10/26 05:33:21 cherry Exp $      */
+/*      $NetBSD: if_xennet_xenbus.c,v 1.82 2018/12/24 14:55:42 cherry Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.81 2018/10/26 05:33:21 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.82 2018/12/24 14:55:42 cherry Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -423,7 +423,7 @@ xennet_xenbus_detach(device_t self, int 
 	DPRINTF(("%s: xennet_xenbus_detach\n", device_xname(self)));
 	s0 = splnet();
 	xennet_stop(ifp, 1);
-	intr_disestablish(sc->sc_ih);
+	xen_intr_disestablish(sc->sc_ih);
 	/* wait for pending TX to complete, and collect pending RX packets */
 	xennet_handler(sc);
 	while (sc->sc_tx_ring.sring->rsp_prod != sc->sc_tx_ring.rsp_cons) {
@@ -517,7 +517,7 @@ xennet_xenbus_resume(device_t dev, const
 		goto abort_resume;
 	aprint_verbose_dev(dev, "using event channel %d\n",
 	    sc->sc_evtchn);
-	sc->sc_ih = intr_establish_xname(-1, &xen_pic, sc->sc_evtchn, IST_LEVEL,
+	sc->sc_ih = xen_intr_establish_xname(-1, &xen_pic, sc->sc_evtchn, IST_LEVEL,
 	    IPL_NET, &xennet_handler, sc, false, device_xname(dev));
 	KASSERT(sc->sc_ih != NULL);
 	return true;
@@ -641,7 +641,7 @@ xennet_xenbus_suspend(device_t dev, cons
 	 */
 
 	sc->sc_backend_status = BEST_SUSPENDED;
-	intr_disestablish(sc->sc_ih);
+	xen_intr_disestablish(sc->sc_ih);
 
 	splx(s);
 

Index: src/sys/arch/xen/xen/pciback.c
diff -u src/sys/arch/xen/xen/pciback.c:1.17 src/sys/arch/xen/xen/pciback.c:1.18
--- src/sys/arch/xen/xen/pciback.c:1.17	Fri Oct 26 05:33:21 2018
+++ src/sys/arch/xen/xen/pciback.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*      $NetBSD: pciback.c,v 1.17 2018/10/26 05:33:21 cherry Exp $      */
+/*      $NetBSD: pciback.c,v 1.18 2018/12/24 14:55:42 cherry Exp $      */
 
 /*
  * Copyright (c) 2009 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.17 2018/10/26 05:33:21 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.18 2018/12/24 14:55:42 cherry Exp $");
 
 #include "opt_xen.h"
 
@@ -525,7 +525,7 @@ pciback_xenbus_destroy(void *arg)
 	int err;
 
 	hypervisor_mask_event(pbxi->pbx_evtchn);
-	intr_disestablish(pbxi->pbx_ih);
+	xen_intr_disestablish(pbxi->pbx_ih);
 	mutex_enter(&pb_xenbus_lock);
 	SLIST_REMOVE(&pb_xenbus_instances,
 	    pbxi, pb_xenbus_instance, pbx_next);
@@ -619,8 +619,8 @@ pciback_xenbus_frontend_changed(void *ar
 		x86_sfence();
 		xenbus_switch_state(xbusd, NULL, XenbusStateConnected);
 		x86_sfence();
-		pbxi->pbx_ih = intr_establish_xname(-1, &xen_pic, pbxi->pbx_evtchn, IST_LEVEL, IPL_BIO,
-		    pciback_xenbus_evthandler, pbxi, true, "pciback");
+		pbxi->pbx_ih = xen_intr_establish_xname(-1, &xen_pic, pbxi->pbx_evtchn,
+		    IST_LEVEL, IPL_BIO, pciback_xenbus_evthandler, pbxi, true, "pciback");
 		KASSERT(pbxi->pbx_ih != NULL);
 		hypervisor_unmask_event(pbxi->pbx_evtchn);
 		hypervisor_notify_via_evtchn(pbxi->pbx_evtchn);

Index: src/sys/arch/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.90 src/sys/arch/xen/xen/xbd_xenbus.c:1.91
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.90	Fri Oct 26 05:33:21 2018
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbd_xenbus.c,v 1.90 2018/10/26 05:33:21 cherry Exp $      */
+/*      $NetBSD: xbd_xenbus.c,v 1.91 2018/12/24 14:55:42 cherry Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.90 2018/10/26 05:33:21 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.91 2018/12/24 14:55:42 cherry Exp $");
 
 #include "opt_xen.h"
 
@@ -378,7 +378,7 @@ xbd_xenbus_detach(device_t dev, int flag
 	}
 
 	hypervisor_mask_event(sc->sc_evtchn);
-	intr_disestablish(sc->sc_ih);
+	xen_intr_disestablish(sc->sc_ih);
 
 	while (xengnt_status(sc->sc_ring_gntref)) {
 		/* XXXSMP */
@@ -413,7 +413,7 @@ xbd_xenbus_suspend(device_t dev, const p
 
 	hypervisor_mask_event(sc->sc_evtchn);
 	sc->sc_backend_status = BLKIF_STATE_SUSPENDED;
-	intr_disestablish(sc->sc_ih);
+	xen_intr_disestablish(sc->sc_ih);
 
 	splx(s);
 
@@ -465,7 +465,7 @@ xbd_xenbus_resume(device_t dev, const pm
 
 	aprint_verbose_dev(dev, "using event channel %d\n",
 	    sc->sc_evtchn);
-	sc->sc_ih = intr_establish_xname(-1, &xen_pic, sc->sc_evtchn, IST_LEVEL,
+	sc->sc_ih = xen_intr_establish_xname(-1, &xen_pic, sc->sc_evtchn, IST_LEVEL,
 	    IPL_BIO, &xbd_handler, sc, false, device_xname(dev));
 	KASSERT(sc->sc_ih != NULL);
 

Index: src/sys/arch/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.69 src/sys/arch/xen/xen/xbdback_xenbus.c:1.70
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.69	Fri Oct 26 05:33:21 2018
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbdback_xenbus.c,v 1.69 2018/10/26 05:33:21 cherry Exp $      */
+/*      $NetBSD: xbdback_xenbus.c,v 1.70 2018/12/24 14:55:42 cherry Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.69 2018/10/26 05:33:21 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.70 2018/12/24 14:55:42 cherry Exp $");
 
 #include <sys/atomic.h>
 #include <sys/buf.h>
@@ -644,7 +644,7 @@ xbdback_connect(struct xbdback_instance 
 	XENPRINTF(("xbdback %s: connect evchannel %d\n", xbusd->xbusd_path, xbdi->xbdi_evtchn));
 	xbdi->xbdi_evtchn = evop.u.bind_interdomain.local_port;
 
-	xbdi->xbdi_ih = intr_establish_xname(-1, &xen_pic, xbdi->xbdi_evtchn,
+	xbdi->xbdi_ih = xen_intr_establish_xname(-1, &xen_pic, xbdi->xbdi_evtchn,
 	    IST_LEVEL, IPL_BIO, xbdback_evthandler, xbdi, false,
 	    xbdi->xbdi_name);
 	KASSERT(xbdi->xbdi_ih != NULL);
@@ -691,7 +691,7 @@ xbdback_disconnect(struct xbdback_instan
 		return;
 	}
 	hypervisor_mask_event(xbdi->xbdi_evtchn);
-	intr_disestablish(xbdi->xbdi_ih);
+	xen_intr_disestablish(xbdi->xbdi_ih);
 
 	/* signal thread that we want to disconnect, then wait for it */
 	xbdi->xbdi_status = DISCONNECTING;

Index: src/sys/arch/xen/xen/xencons.c
diff -u src/sys/arch/xen/xen/xencons.c:1.46 src/sys/arch/xen/xen/xencons.c:1.47
--- src/sys/arch/xen/xen/xencons.c:1.46	Fri Oct 26 05:33:21 2018
+++ src/sys/arch/xen/xen/xencons.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xencons.c,v 1.46 2018/10/26 05:33:21 cherry Exp $	*/
+/*	$NetBSD: xencons.c,v 1.47 2018/12/24 14:55:42 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.46 2018/10/26 05:33:21 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.47 2018/12/24 14:55:42 cherry Exp $");
 
 #include "opt_xen.h"
 
@@ -217,7 +217,7 @@ xencons_suspend(device_t dev, const pmf_
 	if (!xendomain_is_dom0()) {
 		evtch = xen_start_info.console_evtchn;
 		hypervisor_mask_event(evtch);
-		intr_disestablish(ih);
+		xen_intr_disestablish(ih);
 		aprint_verbose_dev(dev, "removed event channel %d\n", ih->ih_pin);
 	}
 
@@ -233,7 +233,7 @@ xencons_resume(device_t dev, const pmf_q
 		/* dom0 console resume is required only during first start-up */
 		if (cold) {
 			evtch = bind_virq_to_evtch(VIRQ_CONSOLE);
-			ih = intr_establish_xname(-1, &xen_pic, evtch,
+			ih = xen_intr_establish_xname(-1, &xen_pic, evtch,
 			    IST_LEVEL, IPL_TTY, xencons_intr,
 			    xencons_console_device, false,
 			    device_xname(dev));
@@ -241,7 +241,7 @@ xencons_resume(device_t dev, const pmf_q
 		}
 	} else {
 		evtch = xen_start_info.console_evtchn;
-		ih = intr_establish_xname(-1, &xen_pic, evtch,
+		ih = xen_intr_establish_xname(-1, &xen_pic, evtch,
 		    IST_LEVEL, IPL_TTY, xencons_handler,
 		    xencons_console_device, false, device_xname(dev));
 		KASSERT(ih != NULL);

Index: src/sys/arch/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.51 src/sys/arch/xen/xen/xenevt.c:1.52
--- src/sys/arch/xen/xen/xenevt.c:1.51	Wed Oct 24 03:59:33 2018
+++ src/sys/arch/xen/xen/xenevt.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*      $NetBSD: xenevt.c,v 1.51 2018/10/24 03:59:33 cherry Exp $      */
+/*      $NetBSD: xenevt.c,v 1.52 2018/12/24 14:55:42 cherry Exp $      */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.51 2018/10/24 03:59:33 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.52 2018/12/24 14:55:42 cherry Exp $");
 
 #include "opt_xen.h"
 #include <sys/param.h>
@@ -178,12 +178,12 @@ xenevtattach(int n)
 	 * Allocate a loopback event port.
 	 * This helps us massage xenevt_processevt() into the
 	 * callchain at the appropriate level using only
-	 * intr_establish_xname().
+	 * xen_intr_establish_xname().
 	 */
 	evtchn_port_t evtchn = xenevt_alloc_event();
 
 	/* The real objective here is to wiggle into the ih callchain for IPL level */
-	ih = intr_establish_xname(-1, &xen_pic, evtchn,  IST_LEVEL, level,
+	ih = xen_intr_establish_xname(-1, &xen_pic, evtchn,  IST_LEVEL, level,
 	    xenevt_processevt, NULL, mpsafe, "xenevt");
 
 	KASSERT(ih != NULL);

Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.72 src/sys/arch/xen/xen/xennetback_xenbus.c:1.73
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.72	Sun Dec 23 12:09:45 2018
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*      $NetBSD: xennetback_xenbus.c,v 1.72 2018/12/23 12:09:45 bouyer Exp $      */
+/*      $NetBSD: xennetback_xenbus.c,v 1.73 2018/12/24 14:55:42 cherry Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.72 2018/12/23 12:09:45 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.73 2018/12/24 14:55:42 cherry Exp $");
 
 #include "opt_xen.h"
 
@@ -385,7 +385,7 @@ xennetback_xenbus_destroy(void *arg)
 
 	if (xneti->xni_ih != NULL) {
 		hypervisor_mask_event(xneti->xni_evtchn);
-		intr_disestablish(xneti->xni_ih);
+		xen_intr_disestablish(xneti->xni_ih);
 		xneti->xni_ih = NULL;
 
 		if (xneti->xni_softintr) {
@@ -556,7 +556,7 @@ xennetback_connect(struct xnetback_insta
 	xneti->xni_status = CONNECTED;
 	xen_wmb();
 
-	xneti->xni_ih = intr_establish_xname(-1, &xen_pic, xneti->xni_evtchn,
+	xneti->xni_ih = xen_intr_establish_xname(-1, &xen_pic, xneti->xni_evtchn,
 	    IST_LEVEL, IPL_NET, xennetback_evthandler, xneti, false,
 	    xneti->xni_if.if_xname);
 	KASSERT(xneti->xni_ih != NULL);

Index: src/sys/arch/xen/xen/xpci_xenbus.c
diff -u src/sys/arch/xen/xen/xpci_xenbus.c:1.20 src/sys/arch/xen/xen/xpci_xenbus.c:1.21
--- src/sys/arch/xen/xen/xpci_xenbus.c:1.20	Wed Oct 24 03:59:33 2018
+++ src/sys/arch/xen/xen/xpci_xenbus.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/*      $NetBSD: xpci_xenbus.c,v 1.20 2018/10/24 03:59:33 cherry Exp $      */
+/*      $NetBSD: xpci_xenbus.c,v 1.21 2018/12/24 14:55:42 cherry Exp $      */
 
 /*
  * Copyright (c) 2009 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xpci_xenbus.c,v 1.20 2018/10/24 03:59:33 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xpci_xenbus.c,v 1.21 2018/12/24 14:55:42 cherry Exp $");
 
 #include "opt_xen.h"
 
@@ -188,7 +188,7 @@ xpci_xenbus_resume(void *p)
 	aprint_verbose_dev(sc->sc_dev, "using event channel %d\n",
 	    sc->sc_evtchn);
 #if 0
-	intr_establish_xname(-1, &xen_pic, pbxi->pbx_evtchn, IST_LEVEL,
+	xen_intr_establish_xname(-1, &xen_pic, pbxi->pbx_evtchn, IST_LEVEL,
 	    IPL_BIO, &xpci_handler, sc, true,
 	    device_xname(sc->sc_dev));
 #endif

Index: src/sys/arch/xen/xenbus/xenbus_comms.c
diff -u src/sys/arch/xen/xenbus/xenbus_comms.c:1.20 src/sys/arch/xen/xenbus/xenbus_comms.c:1.21
--- src/sys/arch/xen/xenbus/xenbus_comms.c:1.20	Fri Oct 26 05:33:21 2018
+++ src/sys/arch/xen/xenbus/xenbus_comms.c	Mon Dec 24 14:55:42 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_comms.c,v 1.20 2018/10/26 05:33:21 cherry Exp $ */
+/* $NetBSD: xenbus_comms.c,v 1.21 2018/12/24 14:55:42 cherry Exp $ */
 /******************************************************************************
  * xenbus_comms.c
  *
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenbus_comms.c,v 1.20 2018/10/26 05:33:21 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_comms.c,v 1.21 2018/12/24 14:55:42 cherry Exp $");
 
 #include <sys/types.h>
 #include <sys/null.h> 
@@ -221,7 +221,7 @@ xb_init_comms(device_t dev)
 
 	evtchn = xen_start_info.store_evtchn;
 
-	ih = intr_establish_xname(-1, &xen_pic, evtchn, IST_LEVEL, IPL_TTY,
+	ih = xen_intr_establish_xname(-1, &xen_pic, evtchn, IST_LEVEL, IPL_TTY,
 	    wake_waiting, NULL, false, device_xname(dev));
 
 	hypervisor_unmask_event(evtchn);
@@ -238,7 +238,7 @@ xb_suspend_comms(device_t dev)
 	evtchn = xen_start_info.store_evtchn;
 
 	hypervisor_mask_event(evtchn);
-	intr_disestablish(ih);
+	xen_intr_disestablish(ih);
 	aprint_verbose_dev(dev, "removed event channel %d\n", evtchn);
 }
 

Reply via email to