Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen Add ``hypervisor at mainbus'' and attach all de...
details: https://anonhg.NetBSD.org/src/rev/b612b5ed99d1
branches: trunk
changeset: 565964:b612b5ed99d1
user: cl <cl%NetBSD.org@localhost>
date: Sat Apr 24 17:35:27 2004 +0000
description:
Add ``hypervisor at mainbus'' and attach all devices provided by the
hypervisor to it instead of mainbus.
rename arch/xen/i386/hypervisor.c -> arch/xen/i386/hypervisor_machdep.c
diffstat:
sys/arch/xen/conf/GENERIC | 15 +-
sys/arch/xen/conf/XEN | 13 +-
sys/arch/xen/conf/files.xen | 19 +-
sys/arch/xen/i386/hypervisor.c | 199 ---------------------------------
sys/arch/xen/i386/hypervisor_machdep.c | 199 +++++++++++++++++++++++++++++++++
sys/arch/xen/i386/mainbus.c | 54 +-------
sys/arch/xen/i386/npx_hv.c | 6 +-
sys/arch/xen/include/hypervisor.h | 10 +-
sys/arch/xen/include/if_xennetvar.h | 4 +-
sys/arch/xen/include/xbdvar.h | 4 +-
sys/arch/xen/xen/console.c | 6 +-
sys/arch/xen/xen/if_xennet.c | 6 +-
sys/arch/xen/xen/xbd.c | 6 +-
13 files changed, 259 insertions(+), 282 deletions(-)
diffs (truncated from 798 to 300 lines):
diff -r 3f3b2e6e822b -r b612b5ed99d1 sys/arch/xen/conf/GENERIC
--- a/sys/arch/xen/conf/GENERIC Sat Apr 24 16:47:29 2004 +0000
+++ b/sys/arch/xen/conf/GENERIC Sat Apr 24 17:35:27 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.2 2004/04/17 12:56:27 cl Exp $
+# $NetBSD: GENERIC,v 1.3 2004/04/24 17:35:27 cl Exp $
# NetBSD: GENERIC,v 1.596 2004/04/07 13:13:59 augustss Exp
#
# GENERIC machine description file
@@ -23,7 +23,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.2 $"
+#ident "GENERIC-$Revision: 1.3 $"
maxusers 32 # estimated number of users
@@ -198,11 +198,14 @@
cpu* at mainbus?
-npx0 at mainbus? # x86 math coprocessor
+hypervisor* at mainbus? # Xen hypervisor
+
+npx0 at hypervisor? # x86 math coprocessor
-xenc* at mainbus? # Xen virtual console
-xennet* at mainbus? # Xen virtual network interface
-xbd* at mainbus? # Xen virtual block device
+xenc* at hypervisor? # Xen virtual console
+xennet* at hypervisor? # Xen virtual network interface
+
+xbd* at hypervisor? # Xen virtual block device
# Pull in optional local configuration
diff -r 3f3b2e6e822b -r b612b5ed99d1 sys/arch/xen/conf/XEN
--- a/sys/arch/xen/conf/XEN Sat Apr 24 16:47:29 2004 +0000
+++ b/sys/arch/xen/conf/XEN Sat Apr 24 17:35:27 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: XEN,v 1.2 2004/04/17 12:56:27 cl Exp $
+# $NetBSD: XEN,v 1.3 2004/04/24 17:35:27 cl Exp $
include "arch/xen/conf/std.xen"
@@ -116,11 +116,14 @@
cpu* at mainbus?
-npx0 at mainbus? # x86 math coprocessor
+hypervisor* at mainbus? # Xen hypervisor
+
+npx0 at hypervisor? # x86 math coprocessor
-xenc* at mainbus? # Xen virtual console
-xennet* at mainbus? # Xen virtual network interface
-xbd* at mainbus? # Xen virtual block device
+xenc* at hypervisor? # Xen virtual console
+xennet* at hypervisor? # Xen virtual network interface
+
+xbd* at hypervisor? # Xen virtual block device
include "arch/xen/conf/GENERIC.local"
diff -r 3f3b2e6e822b -r b612b5ed99d1 sys/arch/xen/conf/files.xen
--- a/sys/arch/xen/conf/files.xen Sat Apr 24 16:47:29 2004 +0000
+++ b/sys/arch/xen/conf/files.xen Sat Apr 24 17:35:27 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.xen,v 1.4 2004/04/17 12:56:27 cl Exp $
+# $NetBSD: files.xen,v 1.5 2004/04/24 17:35:27 cl 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
@@ -28,7 +28,7 @@
file arch/i386/i386/db_trace.c ddb
file kern/subr_disk_mbr.c disk
file arch/xen/i386/gdt.c
-file arch/xen/i386/hypervisor.c
+file arch/xen/i386/hypervisor_machdep.c
file arch/i386/i386/in_cksum.S inet | inet6
file arch/i386/i386/ipkdb_glue.c ipkdb
file arch/i386/i386/kgdb_machdep.c kgdb
@@ -101,18 +101,23 @@
device mainbus: mainbus
attach mainbus at root
-file arch/xen/i386/mainbus.c mainbus
+file arch/xen/i386/mainbus.c mainbus
+
+# Xen hypervisor
+device hypervisor { }
+attach hypervisor at mainbus
+file arch/xen/xen/hypervisor.c hypervisor needs-flag
# Numeric Processing Extension; Math Co-processor
device npx
file arch/xen/i386/npx.c npx needs-flag
-attach npx at mainbus with npx_hv
+attach npx at hypervisor with npx_hv
file arch/xen/i386/npx_hv.c npx_hv
# Xen console support
device xenc: tty
-attach xenc at mainbus
+attach xenc at hypervisor
file arch/xen/xen/console.c xenc needs-flag
#include "dev/wscons/files.wscons"
@@ -188,11 +193,11 @@
# Xen devices
device xennet: arp, ether, ifnet
-attach xennet at mainbus
+attach xennet at hypervisor
file arch/xen/xen/if_xennet.c xennet needs-flag
device xbd: disk
-attach xbd at mainbus
+attach xbd at hypervisor
file arch/xen/xen/xbd.c xbd needs-flag
include "arch/xen/conf/majors.i386"
diff -r 3f3b2e6e822b -r b612b5ed99d1 sys/arch/xen/i386/hypervisor.c
--- a/sys/arch/xen/i386/hypervisor.c Sat Apr 24 16:47:29 2004 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/* $NetBSD: hypervisor.c,v 1.2 2004/04/17 12:46:42 cl Exp $ */
-
-/*
- *
- * Copyright (c) 2004 Christian Limpach.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian Limpach.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/******************************************************************************
- * hypervisor.c
- *
- * Communication to/from hypervisor.
- *
- * Copyright (c) 2002-2003, K A Fraser
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <sys/cdefs.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <machine/xen.h>
-#include <machine/hypervisor.h>
-
-/* static */ unsigned long event_mask = 0;
-static unsigned long ev_err_count;
-
-int stipending(void);
-int
-stipending()
-{
- unsigned long events;
- struct cpu_info *ci;
- int num, ret;
-
- ret = 0;
- ci = curcpu();
-
-#if 0
- if (HYPERVISOR_shared_info->events)
- printf("stipending events %08lx mask %08lx ilevel %d\n",
- HYPERVISOR_shared_info->events,
- HYPERVISOR_shared_info->events_mask, ci->ci_ilevel);
-#endif
-
- do {
- /*
- * we're only called after STIC, so we know that we'll
- * have to STI at the end
- */
- __cli();
-
- events = xchg(&HYPERVISOR_shared_info->events, 0);
- events &= event_mask;
-
- while (events) {
- __asm__ __volatile__ (
- " bsfl %1,%0 ;"
- " btrl %0,%1 ;"
- : "=r" (num) : "r" (events));
- ci->ci_ipending |= (1 << num);
- if (ret == 0 &&
- ci->ci_ilevel <
- ci->ci_isources[num]->is_handlers->ih_level)
- ret = 1;
- }
-
- __sti();
- } while (HYPERVISOR_shared_info->events);
-
-#if 0
- if (ci->ci_ipending & 0x1)
- printf("stipending events %08lx mask %08lx ilevel %d ipending %08x\n",
- HYPERVISOR_shared_info->events,
- HYPERVISOR_shared_info->events_mask, ci->ci_ilevel,
- ci->ci_ipending);
-#endif
-
- return (ret);
-}
-
-void do_hypervisor_callback(struct trapframe *regs)
-{
- unsigned long events, flags;
- shared_info_t *shared = HYPERVISOR_shared_info;
- struct cpu_info *ci;
- int level;
- extern int once;
-
- ci = curcpu();
- level = ci->ci_ilevel;
- if (0 && once == 2)
- printf("hypervisor\n");
-
- do {
- /* Specialised local_irq_save(). */
- flags = test_and_clear_bit(EVENTS_MASTER_ENABLE_BIT,
- &shared->events_mask);
- barrier();
-
- events = xchg(&shared->events, 0);
- events &= event_mask;
-
- /* 'events' now contains some pending events to handle. */
- __asm__ __volatile__ (
- " push %1 ;"
- " sub $4,%%esp ;"
- " jmp 2f ;"
- "1: btrl %%eax,%0 ;" /* clear bit */
- " mov %%eax,(%%esp) ;"
- " call do_event ;" /* do_event(event) */
- "2: bsfl %0,%%eax ;" /* %eax == bit # */
- " jnz 1b ;"
- " add $8,%%esp ;"
- /* we use %ebx because it is callee-saved */
- : : "b" (events), "r" (regs)
- /* clobbered by callback function calls */
- : "eax", "ecx", "edx", "memory" );
-
- /* Specialised local_irq_restore(). */
- if (flags)
- set_bit(EVENTS_MASTER_ENABLE_BIT, &shared->events_mask);
- barrier();
- }
- while ( shared->events );
-
- if (level != ci->ci_ilevel)
- printf("hypervisor done %08lx level %d/%d ipending %08x\n",
- HYPERVISOR_shared_info->events_mask, level, ci->ci_ilevel,
- ci->ci_ipending);
Home |
Main Index |
Thread Index |
Old Index