Module Name:    src
Committed By:   cherry
Date:           Sun Jul 16 14:02:48 UTC 2017

Modified Files:
        src/sys/arch/amd64/amd64: genassym.cf vector.S
        src/sys/arch/i386/i386: genassym.cf vector.S
        src/sys/arch/x86/include: cpu.h intr.h
        src/sys/arch/xen/conf: files.xen
        src/sys/arch/xen/include: intr.h
        src/sys/arch/xen/xen: evtchn.c pci_intr_machdep.c xenevt.c
Removed Files:
        src/sys/arch/xen/xen: isa_machdep.c

Log Message:
Unify the xen and native x86/ interrupt setup functions and
spl traversal data structures.

This is towards PVHVM.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.27 -r0 src/sys/arch/xen/xen/isa_machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/xen/pci_intr_machdep.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/xen/xen/xenevt.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/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.60 src/sys/arch/amd64/amd64/genassym.cf:1.61
--- src/sys/arch/amd64/amd64/genassym.cf:1.60	Fri Nov 20 11:58:00 2015
+++ src/sys/arch/amd64/amd64/genassym.cf	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.60 2015/11/20 11:58:00 maxv Exp $
+#	$NetBSD: genassym.cf,v 1.61 2017/07/16 14:02:48 cherry Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -278,11 +278,7 @@ endif
 define	IH_FUN			offsetof(struct intrhand, ih_fun)
 define	IH_ARG			offsetof(struct intrhand, ih_arg)
 define  IH_LEVEL		offsetof(struct intrhand, ih_level)
-ifdef XEN
-define IH_IPL_NEXT		offsetof(struct intrhand, ih_ipl_next)
-else
 define	IH_NEXT			offsetof(struct intrhand, ih_next)
-endif
 
 ifdef COMPAT_NETBSD32
 define	SC_FS32			offsetof(struct netbsd32_sigcontext, sc_fs)
@@ -299,13 +295,6 @@ define  LINUX32_SYS_sigreturn		LINUX32_S
 define  LINUX32_SYS_exit		LINUX32_SYS_exit
 endif
 
-ifdef XEN
-define	SIZEOF_IPLSOURCE	sizeof(struct iplsource)
-define	IS_RECURSE      offsetof(struct iplsource, ipl_recurse)
-define	IS_RESUME       offsetof(struct iplsource, ipl_resume)
-define	IS_HANDLERS     offsetof(struct iplsource, ipl_handlers)
-define	EV_EVCNTL	offsetof(struct evcnt, ev_count)
-else
 define	IS_RECURSE	offsetof(struct intrsource, is_recurse)
 define	IS_RESUME	offsetof(struct intrsource, is_resume)
 define	IS_EVCNT	offsetof(struct intrsource, is_evcnt.ev_count)
@@ -316,7 +305,6 @@ define	IS_PIN		offsetof(struct intrsourc
 define	IS_TYPE		offsetof(struct intrsource, is_type)
 define	IS_MAXLEVEL	offsetof(struct intrsource, is_maxlevel)
 define	IS_LWP			offsetof(struct intrsource, is_lwp)
-endif
 
 define	IPL_NONE		IPL_NONE
 define	IPL_PREEMPT		IPL_PREEMPT

Index: src/sys/arch/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.49 src/sys/arch/amd64/amd64/vector.S:1.50
--- src/sys/arch/amd64/amd64/vector.S:1.49	Tue May 23 08:54:38 2017
+++ src/sys/arch/amd64/amd64/vector.S	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.49 2017/05/23 08:54:38 nonaka Exp $	*/
+/*	$NetBSD: vector.S,v 1.50 2017/07/16 14:02:48 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -829,7 +829,9 @@ LABEL(x2apic_level_stubs)
 END(x2apic_level_stubs)
 #endif
 
-#else	/* !XEN */
+#endif /* !defined(XEN) */
+
+#if defined(XEN)
 /* Resume/recurse procedures for spl() */
 #define	XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
 IDTVEC(recurse_ ## name ## num)						;\
@@ -851,7 +853,7 @@ IDTVEC(resume_ ## name ## num)						\
 	movq	IH_ARG(%rbx),%rdi					;\
 	movq	%rsp,%rsi						;\
 	call	*IH_FUN(%rbx)		/* call it */			;\
-	movq	IH_IPL_NEXT(%rbx),%rbx	/* next handler in chain */	;\
+	movq	IH_NEXT(%rbx),%rbx	/* next handler in chain */	;\
 	testq	%rbx,%rbx						;\
 	jnz	6b							;\
 5:									\

Index: src/sys/arch/i386/i386/genassym.cf
diff -u src/sys/arch/i386/i386/genassym.cf:1.99 src/sys/arch/i386/i386/genassym.cf:1.100
--- src/sys/arch/i386/i386/genassym.cf:1.99	Wed Aug 26 03:00:53 2015
+++ src/sys/arch/i386/i386/genassym.cf	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.99 2015/08/26 03:00:53 uebayasi Exp $
+#	$NetBSD: genassym.cf,v 1.100 2017/07/16 14:02:48 cherry Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -250,11 +250,7 @@ endif
 define	IH_FUN			offsetof(struct intrhand, ih_fun)
 define	IH_ARG			offsetof(struct intrhand, ih_arg)
 define	IH_LEVEL		offsetof(struct intrhand, ih_level)
-ifdef XEN
-define	IH_IPL_NEXT		offsetof(struct intrhand, ih_ipl_next)
-else
 define	IH_NEXT			offsetof(struct intrhand, ih_next)
-endif
 
 define	CPU_INFO_SELF		offsetof(struct cpu_info, ci_self)
 define	CPU_INFO_RESCHED	offsetof(struct cpu_info, ci_want_resched)
@@ -322,13 +318,6 @@ endif
 define	SIZEOF_CPU_INFO		sizeof(struct cpu_info)
 define	SIZEOF_ISTUB		sizeof(struct intrstub)
 
-ifdef XEN
-define	SIZEOF_IPLSOURCE	sizeof(struct iplsource)
-define	IS_RECURSE		offsetof(struct iplsource, ipl_recurse)
-define	IS_RESUME		offsetof(struct iplsource, ipl_resume)
-define	IS_HANDLERS		offsetof(struct iplsource, ipl_handlers)
-define	EV_EVCNTL		offsetof(struct evcnt, ev_count)
-else
 define	SIZEOF_ISOURCE		sizeof(struct intrsource)
 define	IS_RECURSE		offsetof(struct intrsource, is_recurse)
 define	IS_RESUME		offsetof(struct intrsource, is_resume)
@@ -341,7 +330,6 @@ define	IS_PIN			offsetof(struct intrsour
 define	IS_TYPE			offsetof(struct intrsource, is_type)
 define	IS_MAXLEVEL		offsetof(struct intrsource, is_maxlevel)
 define	IS_LWP			offsetof(struct intrsource, is_lwp)
-endif
 
 define	TREC_SP			offsetof(struct trec, tr_sp)
 define	TREC_HPC		offsetof(struct trec, tr_hpc)

Index: src/sys/arch/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.69 src/sys/arch/i386/i386/vector.S:1.70
--- src/sys/arch/i386/i386/vector.S:1.69	Tue May 23 08:54:38 2017
+++ src/sys/arch/i386/i386/vector.S	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.69 2017/05/23 08:54:38 nonaka Exp $	*/
+/*	$NetBSD: vector.S,v 1.70 2017/07/16 14:02:48 cherry Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.69 2017/05/23 08:54:38 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.70 2017/07/16 14:02:48 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -892,7 +892,9 @@ LABEL(x2apic_level_stubs)
 	.long _C_LABEL(Xresume_x2apic_level31)
 END(x2apic_level_stubs)
 #endif
-#else /* XEN */
+#endif /* XEN */
+
+#if defined(XEN)
 #define voidop(num)
 
 #define	XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
@@ -916,7 +918,7 @@ IDTVEC(resume_ ## name ## num)						\
 	pushl	IH_ARG(%ebx)						;\
 	call	*IH_FUN(%ebx)		/* call it */			;\
 	addl	$4,%esp			/* toss the arg */		;\
-	movl	IH_IPL_NEXT(%ebx),%ebx	/* next handler in chain */	;\
+	movl	IH_NEXT(%ebx),%ebx	/* next handler in chain */	;\
 	testl	%ebx,%ebx						;\
 	jnz	6b							;\
 									\

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.73 src/sys/arch/x86/include/cpu.h:1.74
--- src/sys/arch/x86/include/cpu.h:1.73	Fri Jun 16 18:17:42 2017
+++ src/sys/arch/x86/include/cpu.h	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.73 2017/06/16 18:17:42 jdolecek Exp $	*/
+/*	$NetBSD: cpu.h,v 1.74 2017/07/16 14:02:48 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -125,11 +125,10 @@ struct cpu_info {
 	uintptr_t ci_pmap_data[128 / sizeof(uintptr_t)];
 
 #ifdef XEN
-	struct iplsource  *ci_isources[NIPL];
 	u_long ci_evtmask[NR_EVENT_CHANNELS]; /* events allowed on this CPU */
-#else
-	struct intrsource *ci_isources[MAX_INTR_SOURCES];
 #endif
+	struct intrsource *ci_isources[MAX_INTR_SOURCES];
+
 	volatile int	ci_mtx_count;	/* Negative count of spin mutexes */
 	volatile int	ci_mtx_oldspl;	/* Old SPL at this ci_idepth */
 

Index: src/sys/arch/x86/include/intr.h
diff -u src/sys/arch/x86/include/intr.h:1.50 src/sys/arch/x86/include/intr.h:1.51
--- src/sys/arch/x86/include/intr.h:1.50	Tue May 23 08:54:39 2017
+++ src/sys/arch/x86/include/intr.h	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.50 2017/05/23 08:54:39 nonaka Exp $	*/
+/*	$NetBSD: intr.h,v 1.51 2017/07/16 14:02:48 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -32,8 +32,10 @@
 #ifndef _X86_INTR_H_
 #define _X86_INTR_H_
 
+#if !defined(XEN)
 #define	__HAVE_FAST_SOFTINTS
 #define	__HAVE_PREEMPTION
+#endif /*  !defined(XEN) */
 
 #ifdef _KERNEL
 #include <sys/types.h>
@@ -67,7 +69,9 @@
  */
 
 struct intrstub {
+#if !defined(XEN)
 	void *ist_entry;
+#endif
 	void *ist_recurse;
 	void *ist_resume;
 };
@@ -86,6 +90,10 @@ struct intrsource {
 	void *is_recurse;		/* entry for spllower */
 	void *is_resume;		/* entry for doreti */
 	lwp_t *is_lwp;			/* for soft interrupts */
+#if defined(XEN)
+	u_long ipl_evt_mask1;	/* pending events for this IPL */
+	u_long ipl_evt_mask2[NR_EVENT_CHANNELS];
+#endif
 	struct evcnt is_evcnt;		/* interrupt counter per cpu */
 	int is_flags;			/* see below */
 	int is_type;			/* level, edge */
@@ -116,8 +124,12 @@ struct intrhand {
 	void	*ih_realarg;
 	struct	intrhand *ih_next;
 	struct	intrhand **ih_prevp;
+#if !defined(XEN)
 	int	ih_pin;
 	int	ih_slot;
+#else
+	struct	intrhand *ih_evt_next;
+#endif
 	struct cpu_info *ih_cpu;
 };
 
@@ -206,7 +218,9 @@ int x86_send_ipi(struct cpu_info *, int)
 void x86_broadcast_ipi(int);
 void x86_ipi_handler(void);
 
+#ifndef XEN
 extern void (* const ipifunc[X86_NIPI])(struct cpu_info *);
+#endif
 
 #endif /* _KERNEL */
 

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.148 src/sys/arch/xen/conf/files.xen:1.149
--- src/sys/arch/xen/conf/files.xen:1.148	Thu Jun 22 18:14:32 2017
+++ src/sys/arch/xen/conf/files.xen	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.148 2017/06/22 18:14:32 khorben Exp $
+#	$NetBSD: files.xen,v 1.149 2017/07/16 14:02:48 cherry Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -399,7 +399,7 @@ file	arch/xen/xen/privcmd.c		dom0ops
 file 	arch/xen/x86/xen_shm_machdep.c	dom0ops
 file	arch/x86/pci/pci_machdep.c	hypervisor & pci & dom0ops
 file	arch/xen/xen/pci_intr_machdep.c	hypervisor & pci
-file	arch/xen/xen/isa_machdep.c	hypervisor & dom0ops
+file	arch/x86/isa/isa_machdep.c	hypervisor & dom0ops
 file	arch/xen/xen/xenevt.c		xenevt & dom0ops
 file	arch/xen/xen/xennetback_xenbus.c xvif
 file	arch/xen/xen/xennet_checksum.c	xvif | xennet

Index: src/sys/arch/xen/include/intr.h
diff -u src/sys/arch/xen/include/intr.h:1.41 src/sys/arch/xen/include/intr.h:1.42
--- src/sys/arch/xen/include/intr.h:1.41	Sun Jul 16 06:14:24 2017
+++ src/sys/arch/xen/include/intr.h	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.41 2017/07/16 06:14:24 cherry Exp $	*/
+/*	$NetBSD: intr.h,v 1.42 2017/07/16 14:02:48 cherry Exp $	*/
 /*	NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp	*/
 
 /*-
@@ -36,6 +36,8 @@
 #include <machine/intrdefs.h>
 
 #ifndef _LOCORE
+#include <xen/xen-public/xen.h>
+#include <x86/intr.h>
 #include <xen/xen.h>
 #include <xen/hypervisor.h>
 #include <machine/pic.h>
@@ -58,124 +60,14 @@ struct evtsource {
 	char ev_evname[32];		/* event counter name */
 };
 
-/*
- * Structure describing an interrupt level. struct cpu_info has an array of
- * IPL_MAX of theses. The index in the array is equal to the stub number of
- * the stubcode as present in vector.s
- */
-
-struct intrstub {
-#if 0
-	void *ist_entry;
-#endif
-	void *ist_recurse;
-	void *ist_resume;
-};
-
-/* for x86 compatibility */
-extern struct intrstub i8259_stubs[];
-extern struct intrstub ioapic_edge_stubs[];
-extern struct intrstub ioapic_level_stubs[];
-extern struct intrstub x2apic_edge_stubs[];
-extern struct intrstub x2apic_level_stubs[];
-
-struct iplsource {
-	struct intrhand *ipl_handlers;   /* handler chain */
-	void *ipl_recurse;               /* entry for spllower */
-	void *ipl_resume;                /* entry for doreti */
-	struct lwp *ipl_lwp;
-	u_long ipl_evt_mask1;	/* pending events for this IPL */
-	u_long ipl_evt_mask2[NR_EVENT_CHANNELS];
-};
-
-
-
-/*
- * Interrupt handler chains. These are linked in both the evtsource and
- * the iplsource.
- * The handler is called with its (single) argument.
- */
-
-struct intrhand {
-	int	(*ih_fun)(void *);
-	void	*ih_arg;
-	int	ih_level;
-	int	(*ih_realfun)(void *);
-	void	*ih_realarg;
-	struct	intrhand *ih_ipl_next;
-	struct	intrhand *ih_evt_next;
-	struct cpu_info *ih_cpu;
-};
-
-struct xen_intr_handle {
-	int pirq; /* also contains the  APIC_INT_* flags if NIOAPIC > 0 */
-	int evtch;
-};
-
 extern struct intrstub xenev_stubs[];
 
-#define IUNMASK(ci,level) (ci)->ci_iunmask[(level)]
-
-extern void Xspllower(int);
-
-int splraise(int);
-void spllower(int);
-
-#define SPL_ASSERT_BELOW(x) KDASSERT(curcpu()->ci_ilevel < (x))
-
-/*
- * Miscellaneous
- */
-#define	spl0()		spllower(IPL_NONE)
-#define	splx(x)		spllower(x)
-
-typedef uint8_t ipl_t;
-typedef struct {
-	ipl_t _ipl;
-} ipl_cookie_t;
-
-static inline ipl_cookie_t
-makeiplcookie(ipl_t ipl)
-{
-
-	return (ipl_cookie_t){._ipl = ipl};
-}
-
-static inline int
-splraiseipl(ipl_cookie_t icookie)
-{
-
-	return splraise(icookie._ipl);
-}
-
-#include <sys/spl.h>
-
-/*
- * Stub declarations.
- */
-
-struct pcibus_attach_args;
-
-typedef int intr_handle_t;
 
 #ifdef MULTIPROCESSOR
-int intr_biglock_wrapper(void *);
+int xen_intr_biglock_wrapper(void *);
 #endif
 
-void intr_default_setup(void);
-int x86_nmi(void);
-
-void *intr_establish(int, struct pic *, int, int, int, int (*)(void *), void *, bool);
-void *intr_establish_xname(int, struct pic *, int, int, int, int (*)(void *), void *,
-    bool, const char *);
-void intr_disestablish(struct intrhand *);
-const char *intr_string(intr_handle_t);
-void cpu_intr_init(struct cpu_info *);
 int xen_intr_map(int *, int);
-#ifdef INTRDEBUG
-void intr_printconfig(void);
-#endif
-int intr_find_mpmapping(int, int, intr_handle_t *);
 struct pic *intr_findpic(int);
 void intr_add_pcibus(struct pcibus_attach_args *);
 

Index: src/sys/arch/xen/xen/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.72 src/sys/arch/xen/xen/evtchn.c:1.73
--- src/sys/arch/xen/xen/evtchn.c:1.72	Sun Jul 16 05:03:36 2017
+++ src/sys/arch/xen/xen/evtchn.c	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.72 2017/07/16 05:03:36 cherry Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.73 2017/07/16 14:02:48 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.72 2017/07/16 05:03:36 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.73 2017/07/16 14:02:48 cherry Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -127,7 +127,7 @@ int debug_port = -1;
  */
 
 int
-intr_biglock_wrapper(void *vp)
+xen_intr_biglock_wrapper(void *vp)
 {
 	struct intrhand *ih = vp;
 	int ret;
@@ -336,8 +336,8 @@ splx:
 			while (iplmask & iplbit) {
 				ci->ci_ipending &= ~iplbit;
 				ci->ci_ilevel = i;
-				for (ih = ci->ci_isources[i]->ipl_handlers;
-				    ih != NULL; ih = ih->ih_ipl_next) {
+				for (ih = ci->ci_isources[i]->is_handlers;
+				    ih != NULL; ih = ih->ih_next) {
 					KASSERT(ih->ih_cpu == ci);
 					sti();
 					ih_fun = (void *)ih->ih_fun;
@@ -689,11 +689,11 @@ event_set_handler(int evtch, int (*func)
 	ih->ih_fun = ih->ih_realfun = func;
 	ih->ih_arg = ih->ih_realarg = arg;
 	ih->ih_evt_next = NULL;
-	ih->ih_ipl_next = NULL;
+	ih->ih_next = NULL;
 	ih->ih_cpu = ci;
 #ifdef MULTIPROCESSOR
 	if (!mpsafe) {
-		ih->ih_fun = intr_biglock_wrapper;
+		ih->ih_fun = xen_intr_biglock_wrapper;
 		ih->ih_arg = ih;
 	}
 #endif /* MULTIPROCESSOR */
@@ -758,29 +758,29 @@ event_set_iplhandler(struct cpu_info *ci
 		     struct intrhand *ih,
 		     int level)
 {
-	struct iplsource *ipls;
+	struct intrsource *ipls;
 
 	KASSERT(ci == ih->ih_cpu);
 	if (ci->ci_isources[level] == NULL) {
-		ipls = kmem_zalloc(sizeof (struct iplsource),
+		ipls = kmem_zalloc(sizeof (struct intrsource),
 		    KM_NOSLEEP);
 		if (ipls == NULL)
 			panic("can't allocate fixed interrupt source");
-		ipls->ipl_recurse = xenev_stubs[level].ist_recurse;
-		ipls->ipl_resume = xenev_stubs[level].ist_resume;
-		ipls->ipl_handlers = ih;
+		ipls->is_recurse = xenev_stubs[level].ist_recurse;
+		ipls->is_resume = xenev_stubs[level].ist_resume;
+		ipls->is_handlers = ih;
 		ci->ci_isources[level] = ipls;
 	} else {
 		ipls = ci->ci_isources[level];
-		ih->ih_ipl_next = ipls->ipl_handlers;
-		ipls->ipl_handlers = ih;
+		ih->ih_next = ipls->is_handlers;
+		ipls->is_handlers = ih;
 	}
 }
 
 int
 event_remove_handler(int evtch, int (*func)(void *), void *arg)
 {
-	struct iplsource *ipls;
+	struct intrsource *ipls;
 	struct evtsource *evts;
 	struct intrhand *ih;
 	struct intrhand **ihp;
@@ -805,15 +805,15 @@ event_remove_handler(int evtch, int (*fu
 	*ihp = ih->ih_evt_next;
 
 	ipls = ci->ci_isources[ih->ih_level];
-	for (ihp = &ipls->ipl_handlers, ih = ipls->ipl_handlers;
+	for (ihp = &ipls->is_handlers, ih = ipls->is_handlers;
 	    ih != NULL;
-	    ihp = &ih->ih_ipl_next, ih = ih->ih_ipl_next) {
+	    ihp = &ih->ih_next, ih = ih->ih_next) {
 		if (ih->ih_realfun == func && ih->ih_realarg == arg)
 			break;
 	}
 	if (ih == NULL)
 		panic("event_remove_handler");
-	*ihp = ih->ih_ipl_next;
+	*ihp = ih->ih_next;
 	mutex_spin_exit(&evtlock[evtch]);
 	kmem_free(ih, sizeof (struct intrhand));
 	if (evts->ev_handlers == NULL) {

Index: src/sys/arch/xen/xen/pci_intr_machdep.c
diff -u src/sys/arch/xen/xen/pci_intr_machdep.c:1.18 src/sys/arch/xen/xen/pci_intr_machdep.c:1.19
--- src/sys/arch/xen/xen/pci_intr_machdep.c:1.18	Sun Jul 16 06:14:24 2017
+++ src/sys/arch/xen/xen/pci_intr_machdep.c	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-/*      $NetBSD: pci_intr_machdep.c,v 1.18 2017/07/16 06:14:24 cherry Exp $      */
+/*      $NetBSD: pci_intr_machdep.c,v 1.19 2017/07/16 14:02:48 cherry Exp $      */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.18 2017/07/16 06:14:24 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.19 2017/07/16 14:02:48 cherry Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -173,7 +173,7 @@ pci_intr_string(pci_chipset_tag_t pc, pc
 		return buf;
 	}
 #endif
-	snprintf(buf, len, "irq %d, event channel %d",
+	snprintf(buf, len, "irq %"PRIu64", event channel %d",
 	    ih, evtch);
 	return buf;
 }
@@ -215,7 +215,7 @@ pci_intr_establish(pci_chipset_tag_t pci
 		    device_xname(pic->sc_dev), APIC_IRQ_PIN(intrh));
 	} else
 #endif
-		snprintf(evname, sizeof(evname), "irq%d", intrh);
+		snprintf(evname, sizeof(evname), "irq%"PRIu64, intrh);
 
 	return (void *)pirq_establish(APIC_IRQ_LEGACY_IRQ(intrh),
 	    get_pirq_to_evtch(APIC_IRQ_LEGACY_IRQ(intrh)), func, arg, level, evname);

Index: src/sys/arch/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.46 src/sys/arch/xen/xen/xenevt.c:1.47
--- src/sys/arch/xen/xen/xenevt.c:1.46	Thu Jun  1 02:45:08 2017
+++ src/sys/arch/xen/xen/xenevt.c	Sun Jul 16 14:02:48 2017
@@ -1,4 +1,4 @@
-/*      $NetBSD: xenevt.c,v 1.46 2017/06/01 02:45:08 chs Exp $      */
+/*      $NetBSD: xenevt.c,v 1.47 2017/07/16 14:02:48 cherry Exp $      */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.46 2017/06/01 02:45:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.47 2017/07/16 14:02:48 cherry Exp $");
 
 #include "opt_xen.h"
 #include <sys/param.h>
@@ -172,11 +172,11 @@ xenevtattach(int n)
 	ih->ih_level = level;
 	ih->ih_fun = ih->ih_realfun = xenevt_processevt;
 	ih->ih_arg = ih->ih_realarg = NULL;
-	ih->ih_ipl_next = NULL;
+	ih->ih_next = NULL;
 	ih->ih_cpu = &cpu_info_primary;
 #ifdef MULTIPROCESSOR
 	if (!mpsafe) {
-		ih->ih_fun = intr_biglock_wrapper;
+		ih->ih_fun = xen_intr_biglock_wrapper;
 		ih->ih_arg = ih;
 	}
 #endif /* MULTIPROCESSOR */

Reply via email to