From dedaf26748c2876f98a4253f0951ed84e5c8f496 Mon Sep 17 00:00:00 2001 From: yamt Date: Tue, 6 Mar 2007 12:35:39 +0000 Subject: [PATCH] fix vcpu after recent cpubus changes. --- sys/arch/xen/i386/cpu.c | 18 ++++++++++++---- sys/arch/xen/include/vcpuvar.h | 39 ++++++++++++++++++++++++++++++++++ sys/arch/xen/xen/hypervisor.c | 19 +++++++++-------- 3 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 sys/arch/xen/include/vcpuvar.h diff --git a/sys/arch/xen/i386/cpu.c b/sys/arch/xen/i386/cpu.c index b3e410d810c2..56ee7564dc21 100644 --- a/sys/arch/xen/i386/cpu.c +++ b/sys/arch/xen/i386/cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.9 2007/03/05 23:26:40 dogcow Exp $ */ +/* $NetBSD: cpu.c,v 1.10 2007/03/06 12:35:39 yamt Exp $ */ /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp */ /*- @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.9 2007/03/05 23:26:40 dogcow Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10 2007/03/06 12:35:39 yamt Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -106,6 +106,10 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.9 2007/03/05 23:26:40 dogcow Exp $"); #include #include +#ifdef XEN3 +#include +#endif + #if NLAPIC > 0 #include #include @@ -300,7 +304,11 @@ vcpu_match(parent, match, aux) struct cfdata *match; void *aux; { - return 1; + struct vcpu_attach_args *vcaa = aux; + + if (strcmp(vcaa->vcaa_name, match->cf_name) == 0) + return 1; + return 0; } void @@ -308,7 +316,9 @@ vcpu_attach(parent, self, aux) struct device *parent, *self; void *aux; { - cpu_attach_common(parent, self, aux); + struct vcpu_attach_args *vcaa = aux; + + cpu_attach_common(parent, self, &vcaa->vcaa_caa); } #endif diff --git a/sys/arch/xen/include/vcpuvar.h b/sys/arch/xen/include/vcpuvar.h new file mode 100644 index 000000000000..36ac1ce92dc9 --- /dev/null +++ b/sys/arch/xen/include/vcpuvar.h @@ -0,0 +1,39 @@ +/* $NetBSD: vcpuvar.h,v 1.1 2007/03/06 12:35:39 yamt Exp $ */ + +/*- + * Copyright (c)2007 YAMAMOTO Takashi, + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + */ + +#ifndef _XEN_VCPUVAR_H_ +#define _XEN_VCPUVAR_H_ + +#include + +struct vcpu_attach_args { + const char *vcaa_name; + struct cpu_attach_args vcaa_caa; +}; + +#endif /* _XEN_VCPUVAR_H_ */ diff --git a/sys/arch/xen/xen/hypervisor.c b/sys/arch/xen/xen/hypervisor.c index 08a28ab84649..019c830b15c4 100644 --- a/sys/arch/xen/xen/hypervisor.c +++ b/sys/arch/xen/xen/hypervisor.c @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor.c,v 1.30 2007/03/05 23:26:40 dogcow Exp $ */ +/* $NetBSD: hypervisor.c,v 1.31 2007/03/06 12:35:39 yamt Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -63,7 +63,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.30 2007/03/05 23:26:40 dogcow Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.31 2007/03/06 12:35:39 yamt Exp $"); #include #include @@ -105,7 +105,7 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.30 2007/03/05 23:26:40 dogcow Exp $ #endif /* DOM0OPS || XEN3 */ #ifdef XEN3 #include -#include +#include #endif #if NPCI > 0 #include @@ -180,7 +180,7 @@ union hypervisor_attach_cookie { #endif #endif /* NPCI */ #ifdef XEN3 - struct cpu_attach_args hac_caa; + struct vcpu_attach_args hac_vcaa; #endif }; @@ -249,11 +249,12 @@ hypervisor_attach(parent, self, aux) #ifdef XEN3 xengnt_init(); - memset(&hac.hac_caa, 0, sizeof(hac.hac_caa)); - hac.hac_caa.cpu_number = 0; - hac.hac_caa.cpu_role = CPU_ROLE_SP; - hac.hac_caa.cpu_func = 0; - config_found_ia(self, "xendevbus", &hac.hac_caa, hypervisor_print); + memset(&hac.hac_vcaa, 0, sizeof(hac.hac_vcaa)); + hac.hac_vcaa.vcaa_name = "vcpu"; + hac.hac_vcaa.vcaa_caa.cpu_number = 0; + hac.hac_vcaa.vcaa_caa.cpu_role = CPU_ROLE_SP; + hac.hac_vcaa.vcaa_caa.cpu_func = 0; + config_found_ia(self, "xendevbus", &hac.hac_vcaa, hypervisor_print); #endif init_events();