Add ELF_PADDR_OFFSET and VIRT_ENTRY strings to __xen_guest ELF section,

so that our kernels works with newer xen-3 hypervisors; and correct the value
of VIRT_BASE for dom0.
Now that we can embed the values of KERNBASE and KERNTEXTOFF in the binary
for Xen, make the domU memory layout the same as dom0 for Xen3 (making
it the other way round doens't work; probably because of alignement
constraints in the hypervisor). The old domU layout is used if options
XEN_COMPAT_030001 is present in the kernel config file. Enable this the
domU kernel config files for now, in case someone wants to run a NetBSD
domU on an older Xen3 installation.
This commit is contained in:
bouyer 2006-10-17 18:53:03 +00:00
parent 372e6ef309
commit 754514a443
5 changed files with 20 additions and 8 deletions

View File

@ -1,9 +1,11 @@
# $NetBSD: INSTALL_XEN3_DOMU,v 1.4 2006/10/02 03:28:30 chs Exp $
# $NetBSD: INSTALL_XEN3_DOMU,v 1.5 2006/10/17 18:53:03 bouyer Exp $
include "arch/xen/conf/std.xen"
options XEN
options XEN3
#options XEN_NO_HYPERCALLPAGE # use old hypercall method
options XEN_COMPAT_030001 #compatible with Xen3 before 3.0.2
options MAXPHYS=32768
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary

View File

@ -1,4 +1,4 @@
# $NetBSD: XEN3_DOMU,v 1.5 2006/09/28 18:53:15 bouyer Exp $
# $NetBSD: XEN3_DOMU,v 1.6 2006/10/17 18:53:03 bouyer Exp $
include "arch/xen/conf/std.xen"
@ -14,6 +14,7 @@ maxusers 32 # estimated number of users
options XEN
options XEN3
#options XEN_NO_HYPERCALLPAGE # use old hypercall method
options XEN_COMPAT_030001 #compatible with Xen3 before 3.0.2
options MAXPHYS=32768 #xbd doesn't handle 64k transfers
#options DOM0OPS

View File

@ -1,4 +1,4 @@
# $NetBSD: files.xen,v 1.50 2006/10/15 14:34:56 xtraeme Exp $
# $NetBSD: files.xen,v 1.51 2006/10/17 18:53:04 bouyer 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
@ -324,7 +324,7 @@ file arch/i386/i386/rbus_machdep.c cardbus
include "dev/pcmcia/files.pcmcia"
# Domain-0 operations
defflag opt_xen.h DOM0OPS XEN_NO_HYPERCALLPAGE
defflag opt_xen.h DOM0OPS XEN_NO_HYPERCALLPAGE XEN_COMPAT_030001
file arch/xen/xen/privcmd.c dom0ops
file arch/xen/i386/xen_shm_machdep.c dom0ops | xen3
file arch/xen/xen/xbdback.c dom0ops & !xen3

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.19 2006/10/01 21:36:11 bouyer Exp $ */
/* $NetBSD: locore.S,v 1.20 2006/10/17 18:53:04 bouyer Exp $ */
/* NetBSD: locore.S,v 1.31 2004/08/26 10:12:33 junyoung Exp */
/*
@ -190,9 +190,16 @@
.section __xen_guest
#ifdef XEN3
.ascii "GUEST_OS=netbsd,GUEST_VER=3.0,XEN_VER=xen-3.0"
#if defined(DOM0OPS) || !defined(XEN_COMPAT_030001)
.ascii ",VIRT_BASE=0xc0000000" /* KERNBASE */
.ascii ",ELF_PADDR_OFFSET=0xc0000000" /* KERNBASE */
#else
.ascii ",VIRT_BASE=0xc0100000" /* KERNTEXTOFF */
.ascii ",ELF_PADDR_OFFSET=0xc0100000" /* KERNTEXTOFF */
#endif
.ascii ",VIRT_ENTRY=0xc0100000" /* KERNTEXTOFF */
#ifndef XEN_NO_HYPERCALLPAGE
#ifdef DOM0OPS
#if defined(DOM0OPS) || !defined(XEN_COMPAT_030001)
.ascii ",HYPERCALL_PAGE=0x00000101"
#else
.ascii ",HYPERCALL_PAGE=0x00000001"

View File

@ -1,4 +1,4 @@
/* $NetBSD: xenpmap.h,v 1.14 2006/03/06 19:57:31 bouyer Exp $ */
/* $NetBSD: xenpmap.h,v 1.15 2006/10/17 18:53:04 bouyer Exp $ */
/*
*
@ -216,8 +216,10 @@ paddr_t *xpmap_phys_to_machine_mapping;
* (0xc0100000). On Xen-3 for domain0 it starts at KERNBASE (0xc0000000).
* So the offset between physical and virtual address is different on
* Xen-2 and Xen-3 for domain0.
* starting with xen-3.0.2, we can add notes so that virual memory starts
* at KERNBASE for domU as well.
*/
#if defined(XEN3) && defined(DOM0OPS)
#if defined(XEN3) && (defined(DOM0OPS) || !defined(XEN_COMPAT_030001))
#define XPMAP_OFFSET 0
#else
#define XPMAP_OFFSET (KERNTEXTOFF - KERNBASE)