Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/cherry-xenmp]: src/sys/arch Pullup relevant changes from -current



details:   https://anonhg.NetBSD.org/src/rev/a07ba7c15858
branches:  cherry-xenmp
changeset: 765628:a07ba7c15858
user:      cherry <cherry%NetBSD.org@localhost>
date:      Wed Aug 17 09:40:39 2011 +0000

description:
Pullup relevant changes from -current

diffstat:

 sys/arch/i386/include/cpu.h           |   3 +-
 sys/arch/x86/include/cpu.h            |   6 +-
 sys/arch/x86/x86/pmap.c               |   8 +--
 sys/arch/xen/include/evtchn.h         |   7 +-
 sys/arch/xen/include/intr.h           |  23 +++-----
 sys/arch/xen/include/xenpmap.h        |  10 +++-
 sys/arch/xen/x86/cpu.c                |  24 ++++++++-
 sys/arch/xen/x86/hypervisor_machdep.c |  91 +++++++++-----------------------
 sys/arch/xen/x86/intr.c               |  25 +--------
 sys/arch/xen/x86/x86_xpmap.c          |  50 +++++++++++-------
 sys/arch/xen/x86/xen_ipi.c            |  41 +++++---------
 sys/arch/xen/xen/evtchn.c             |  95 ++++++++++++++++++++--------------
 sys/arch/xen/xen/xentests.c           |   5 +-
 13 files changed, 179 insertions(+), 209 deletions(-)

diffs (truncated from 1123 to 300 lines):

diff -r 2d532019e663 -r a07ba7c15858 sys/arch/i386/include/cpu.h
--- a/sys/arch/i386/include/cpu.h       Sun Aug 07 19:48:07 2011 +0000
+++ b/sys/arch/i386/include/cpu.h       Wed Aug 17 09:40:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.176 2008/12/29 19:59:09 pooka Exp $  */
+/*     $NetBSD: cpu.h,v 1.176.12.1 2011/08/17 09:40:39 cherry Exp $    */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -68,6 +68,7 @@
            (*(struct cpu_info * const *)offsetof(struct cpu_info, ci_curlwp)));
        return l;
 }
+
 __inline static void __unused
 cpu_set_curpri(int pri)
 {
diff -r 2d532019e663 -r a07ba7c15858 sys/arch/x86/include/cpu.h
--- a/sys/arch/x86/include/cpu.h        Sun Aug 07 19:48:07 2011 +0000
+++ b/sys/arch/x86/include/cpu.h        Wed Aug 17 09:40:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.34.2.3 2011/07/16 10:59:45 cherry Exp $      */
+/*     $NetBSD: cpu.h,v 1.34.2.4 2011/08/17 09:40:39 cherry Exp $      */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -67,8 +67,6 @@
 #include <sys/evcnt.h>
 #include <sys/device_if.h> /* for device_t */
 
-#include <sys/device_if.h> /* for device_t */
-
 #ifdef XEN
 #include <xen/xen3-public/xen.h>
 #include <xen/xen3-public/event_channel.h>
@@ -316,6 +314,8 @@
 void cpu_init_idle_lwps(void);
 void cpu_init_msrs(struct cpu_info *, bool);
 void cpu_load_pmap(struct pmap *);
+void cpu_broadcast_halt(void);
+void cpu_kick(struct cpu_info *);
 
 extern uint32_t cpus_attached;
 
diff -r 2d532019e663 -r a07ba7c15858 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Sun Aug 07 19:48:07 2011 +0000
+++ b/sys/arch/x86/x86/pmap.c   Wed Aug 17 09:40:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.121.2.4 2011/07/31 20:49:11 cherry Exp $    */
+/*     $NetBSD: pmap.c,v 1.121.2.5 2011/08/17 09:40:39 cherry Exp $    */
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.121.2.4 2011/07/31 20:49:11 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.121.2.5 2011/08/17 09:40:39 cherry Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1619,10 +1619,6 @@
                VM_PROT_READ | VM_PROT_WRITE, 0);
 
        pmap_update(pmap_kernel());
-
-       xpq_queue_lock();
-       xpq_queue_pin_l3_table(xpmap_ptom_masked(ci->ci_pae_l3_pdirpa));
-       xpq_queue_unlock();
 #endif
 #if defined(XEN) && defined (__x86_64)
        KASSERT(ci != NULL);
diff -r 2d532019e663 -r a07ba7c15858 sys/arch/xen/include/evtchn.h
--- a/sys/arch/xen/include/evtchn.h     Sun Aug 07 19:48:07 2011 +0000
+++ b/sys/arch/xen/include/evtchn.h     Wed Aug 17 09:40:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: evtchn.h,v 1.18.10.2 2011/08/04 09:07:46 cherry Exp $  */
+/*     $NetBSD: evtchn.h,v 1.18.10.3 2011/08/17 09:40:39 cherry Exp $  */
 
 /*
  *
@@ -41,10 +41,9 @@
 int event_set_handler(int, int (*func)(void *), void *, int, const char *);
 int event_remove_handler(int, int (*func)(void *), void *);
 
+struct cpu_info;
 struct intrhand;
-void event_set_iplhandler(struct cpu_info *ci,
-                         struct intrhand *, 
-                         int);
+void event_set_iplhandler(struct cpu_info *, struct intrhand *, int);
 
 extern int debug_port;
 extern int xen_debug_handler(void *);
diff -r 2d532019e663 -r a07ba7c15858 sys/arch/xen/include/intr.h
--- a/sys/arch/xen/include/intr.h       Sun Aug 07 19:48:07 2011 +0000
+++ b/sys/arch/xen/include/intr.h       Wed Aug 17 09:40:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.h,v 1.31.10.3 2011/08/04 09:07:46 cherry Exp $    */
+/*     $NetBSD: intr.h,v 1.31.10.4 2011/08/17 09:40:39 cherry Exp $    */
 /*     NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp       */
 
 /*-
@@ -33,18 +33,15 @@
 #ifndef _XEN_INTR_H_
 #define        _XEN_INTR_H_
 
-#ifndef _LOCORE
-#include <machine/cpu.h>
-#include <machine/pic.h>
 #include <machine/intrdefs.h>
 
-#include <sys/evcnt.h>
-#include <sys/types.h>
-#include <sys/simplelock.h>
-
+#ifndef _LOCORE
 #include <xen/xen.h>
 #include <xen/hypervisor.h>
 #include <xen/evtchn.h>
+#include <machine/cpu.h>
+#include <machine/pic.h>
+#include <sys/evcnt.h>
 
 #include "opt_xen.h"
 
@@ -57,9 +54,8 @@
        uint32_t ev_imask;              /* interrupt mask */
        struct intrhand *ev_handlers;   /* handler chain */
        struct evcnt ev_evcnt;          /* interrupt counter */
+       struct cpu_info *ev_cpu;        /* cpu on which this event is bound */
        char ev_evname[32];             /* event counter name */
-       struct cpu_info *ev_cpu;        /* cpu on which this event is bound */
-       struct simplelock ev_lock;      /* protects this structure */
 };
 
 /*
@@ -166,7 +162,6 @@
 
 void intr_default_setup(void);
 int x86_nmi(void);
-void intr_calculatemasks(struct evtsource *);
 
 void *intr_establish(int, struct pic *, int, int, int, int (*)(void *), void *, bool);
 void intr_disestablish(struct intrhand *);
@@ -185,9 +180,9 @@
 int xen_send_ipi(struct cpu_info *, uint32_t);
 void xen_broadcast_ipi(uint32_t);
 #else
-#define xen_ipi_init(_1) do {} while(0) /* nothing */
-#define xen_send_ipi(_i1, _i2) do {} while(0) /* nothing */
-#define xen_broadcast_ipi(_i1) do {} while(0) /* nothing */
+#define xen_ipi_init(_1) ((void) 0) /* nothing */
+#define xen_send_ipi(_i1, _i2) (0) /* nothing */
+#define xen_broadcast_ipi(_i1) ((void) 0) /* nothing */
 #endif /* MULTIPROCESSOR */
 
 #endif /* !_LOCORE */
diff -r 2d532019e663 -r a07ba7c15858 sys/arch/xen/include/xenpmap.h
--- a/sys/arch/xen/include/xenpmap.h    Sun Aug 07 19:48:07 2011 +0000
+++ b/sys/arch/xen/include/xenpmap.h    Wed Aug 17 09:40:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xenpmap.h,v 1.27.2.2 2011/06/23 14:19:49 cherry Exp $  */
+/*     $NetBSD: xenpmap.h,v 1.27.2.3 2011/08/17 09:40:39 cherry Exp $  */
 
 /*
  *
@@ -36,8 +36,16 @@
 
 #define        INVALID_P2M_ENTRY       (~0UL)
 
+#ifdef MULTIPROCESSOR
 void xpq_queue_lock(void);
 void xpq_queue_unlock(void);
+bool xpq_queue_locked(void);
+#else /* MULTIPROCESSOR */
+#define xpq_queue_lock() do {} while(0) /* nothing */
+#define xpq_queue_unlock() do {} while(0) /* nothing */
+#define xpq_queue_locked() (true) /* Always true for UP */
+#endif /* MULTIPROCESSOR */
+
 void xpq_queue_machphys_update(paddr_t, paddr_t);
 void xpq_queue_invlpg(vaddr_t);
 void xpq_queue_pte_update(paddr_t, pt_entry_t);
diff -r 2d532019e663 -r a07ba7c15858 sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Sun Aug 07 19:48:07 2011 +0000
+++ b/sys/arch/xen/x86/cpu.c    Wed Aug 17 09:40:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.56.2.5 2011/08/07 19:48:08 cherry Exp $      */
+/*     $NetBSD: cpu.c,v 1.56.2.6 2011/08/17 09:40:39 cherry Exp $      */
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.56.2.5 2011/08/07 19:48:08 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.56.2.6 2011/08/17 09:40:39 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1289,3 +1289,23 @@
 
 #endif /* __x86_64__ */
 }
+
+/*
+ * Notify all other cpus to halt.
+ */
+
+void
+cpu_broadcast_halt(void)
+{
+       xen_broadcast_ipi(XEN_IPI_HALT);
+}
+
+/*
+ * Send a dummy ipi to a cpu.
+ */
+
+void
+cpu_kick(struct cpu_info *ci)
+{
+       xen_send_ipi(ci, XEN_IPI_KICK);
+}
diff -r 2d532019e663 -r a07ba7c15858 sys/arch/xen/x86/hypervisor_machdep.c
--- a/sys/arch/xen/x86/hypervisor_machdep.c     Sun Aug 07 19:48:07 2011 +0000
+++ b/sys/arch/xen/x86/hypervisor_machdep.c     Wed Aug 17 09:40:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hypervisor_machdep.c,v 1.14.2.2 2011/08/04 09:07:47 cherry Exp $       */
+/*     $NetBSD: hypervisor_machdep.c,v 1.14.2.3 2011/08/17 09:40:39 cherry Exp $       */
 
 /*
  *
@@ -54,7 +54,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.14.2.2 2011/08/04 09:07:47 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.14.2.3 2011/08/17 09:40:39 cherry Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -86,33 +86,15 @@
 // #define PORT_DEBUG 4
 // #define EARLY_DEBUG_EVENT
 
-static inline unsigned int
-evt_bitstr_to_port(unsigned long l1, unsigned long l2)
-{
-       unsigned int l1i, l2i, port;
-
-       l1i = xen_ffs(l1) - 1;
-       l2i = xen_ffs(l2) - 1;
-
-       port = (l1i << LONG_SHIFT) + l2i;
-       return port;
-}
-
 /* callback function type */
-typedef void (*iterate_func_t)(struct cpu_info *,
-                              unsigned int,
-                              unsigned int,
-                              unsigned int,
-                              void *);
-
+typedef void (*iterate_func_t)(struct cpu_info *, unsigned int,
+                              unsigned int, unsigned int, void *);
 
 static inline void
-evt_iterate_pending(struct cpu_info *ci,
-                   volatile unsigned long *pendingl1,
-                   volatile unsigned long *pendingl2,
-                   volatile unsigned long *mask,
-                   iterate_func_t iterate_pending,
-                   void *iterate_args)
+evt_iterate_bits(struct cpu_info *ci, volatile unsigned long *pendingl1,
+                volatile unsigned long *pendingl2, 
+                volatile unsigned long *mask,
+                iterate_func_t iterate_pending, void *iterate_args)
 {
 
        KASSERT(pendingl1 != NULL);
@@ -148,11 +130,8 @@
  */
    
 static inline void
-evt_set_pending(struct cpu_info *ci,
-               unsigned int port,
-               unsigned int l1i,
-               unsigned int l2i,
-               void *args)
+evt_set_pending(struct cpu_info *ci, unsigned int port, unsigned int l1i,
+               unsigned int l2i, void *args)
 {
 
        KASSERT(args != NULL);
@@ -161,9 +140,8 @@



Home | Main Index | Thread Index | Old Index