Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Unify the xen and native x86/ interrupt setup funct...
details: https://anonhg.NetBSD.org/src/rev/1ffaa38c1959
branches: trunk
changeset: 355172:1ffaa38c1959
user: cherry <cherry%NetBSD.org@localhost>
date: Sun Jul 16 14:02:48 2017 +0000
description:
Unify the xen and native x86/ interrupt setup functions and
spl traversal data structures.
This is towards PVHVM.
diffstat:
sys/arch/amd64/amd64/genassym.cf | 14 +-
sys/arch/amd64/amd64/vector.S | 8 +-
sys/arch/i386/i386/genassym.cf | 14 +-
sys/arch/i386/i386/vector.S | 10 +-
sys/arch/x86/include/cpu.h | 7 +-
sys/arch/x86/include/intr.h | 16 ++-
sys/arch/xen/conf/files.xen | 4 +-
sys/arch/xen/include/intr.h | 116 +---------------
sys/arch/xen/xen/evtchn.c | 36 ++--
sys/arch/xen/xen/isa_machdep.c | 266 ------------------------------------
sys/arch/xen/xen/pci_intr_machdep.c | 8 +-
sys/arch/xen/xen/xenevt.c | 8 +-
12 files changed, 63 insertions(+), 444 deletions(-)
diffs (truncated from 849 to 300 lines):
diff -r 183927a9d315 -r 1ffaa38c1959 sys/arch/amd64/amd64/genassym.cf
--- a/sys/arch/amd64/amd64/genassym.cf Sun Jul 16 10:46:45 2017 +0000
+++ b/sys/arch/amd64/amd64/genassym.cf Sun Jul 16 14:02:48 2017 +0000
@@ -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 @@
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_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_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
diff -r 183927a9d315 -r 1ffaa38c1959 sys/arch/amd64/amd64/vector.S
--- a/sys/arch/amd64/amd64/vector.S Sun Jul 16 10:46:45 2017 +0000
+++ b/sys/arch/amd64/amd64/vector.S Sun Jul 16 14:02:48 2017 +0000
@@ -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 @@
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 @@
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: \
diff -r 183927a9d315 -r 1ffaa38c1959 sys/arch/i386/i386/genassym.cf
--- a/sys/arch/i386/i386/genassym.cf Sun Jul 16 10:46:45 2017 +0000
+++ b/sys/arch/i386/i386/genassym.cf Sun Jul 16 14:02:48 2017 +0000
@@ -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 @@
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 @@
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_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)
diff -r 183927a9d315 -r 1ffaa38c1959 sys/arch/i386/i386/vector.S
--- a/sys/arch/i386/i386/vector.S Sun Jul 16 10:46:45 2017 +0000
+++ b/sys/arch/i386/i386/vector.S Sun Jul 16 14:02:48 2017 +0000
@@ -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 @@
.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 @@
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 ;\
\
diff -r 183927a9d315 -r 1ffaa38c1959 sys/arch/x86/include/cpu.h
--- a/sys/arch/x86/include/cpu.h Sun Jul 16 10:46:45 2017 +0000
+++ b/sys/arch/x86/include/cpu.h Sun Jul 16 14:02:48 2017 +0000
@@ -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 @@
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
+#endif
struct intrsource *ci_isources[MAX_INTR_SOURCES];
-#endif
+
volatile int ci_mtx_count; /* Negative count of spin mutexes */
volatile int ci_mtx_oldspl; /* Old SPL at this ci_idepth */
diff -r 183927a9d315 -r 1ffaa38c1959 sys/arch/x86/include/intr.h
--- a/sys/arch/x86/include/intr.h Sun Jul 16 10:46:45 2017 +0000
+++ b/sys/arch/x86/include/intr.h Sun Jul 16 14:02:48 2017 +0000
@@ -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 @@
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 @@
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 @@
void x86_broadcast_ipi(int);
void x86_ipi_handler(void);
+#ifndef XEN
extern void (* const ipifunc[X86_NIPI])(struct cpu_info *);
+#endif
#endif /* _KERNEL */
diff -r 183927a9d315 -r 1ffaa38c1959 sys/arch/xen/conf/files.xen
--- a/sys/arch/xen/conf/files.xen Sun Jul 16 10:46:45 2017 +0000
+++ b/sys/arch/xen/conf/files.xen Sun Jul 16 14:02:48 2017 +0000
@@ -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/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
diff -r 183927a9d315 -r 1ffaa38c1959 sys/arch/xen/include/intr.h
--- a/sys/arch/xen/include/intr.h Sun Jul 16 10:46:45 2017 +0000
+++ b/sys/arch/xen/include/intr.h Sun Jul 16 14:02:48 2017 +0000
@@ -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 @@
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[];
Home |
Main Index |
Thread Index |
Old Index