Module Name: src
Committed By: riz
Date: Wed Feb 22 18:48:45 UTC 2012
Modified Files:
src/sys/arch/xen/include [netbsd-6]: hypervisor.h
src/sys/arch/xen/xen [netbsd-6]: clock.c hypervisor.c
Log Message:
Pull up following revision(s) (requested by bouyer in ticket #28):
sys/arch/xen/include/hypervisor.h: revision 1.38
sys/arch/xen/xen/hypervisor.c: revision 1.61
sys/arch/xen/xen/clock.c: revision 1.62
- make xen_version globally available, with macros to access major and
minor xen version.
- In xen_initclocks(), do a VCPUOP_stop_periodic_timer only for Xen 3.1
and later
Should fix PR port-xen/45961
- make xen_version globally available, with macros to access major and
minor xen version.
- In xen_initclocks(), do a VCPUOP_stop_periodic_timer only for Xen 3.1
and later
Should fix PR port-xen/45961
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.2.1 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.61 -r1.61.2.1 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.60 -r1.60.2.1 src/sys/arch/xen/xen/hypervisor.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/xen/include/hypervisor.h
diff -u src/sys/arch/xen/include/hypervisor.h:1.36 src/sys/arch/xen/include/hypervisor.h:1.36.2.1
--- src/sys/arch/xen/include/hypervisor.h:1.36 Wed Dec 7 15:47:42 2011
+++ src/sys/arch/xen/include/hypervisor.h Wed Feb 22 18:48:45 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.h,v 1.36 2011/12/07 15:47:42 cegger Exp $ */
+/* $NetBSD: hypervisor.h,v 1.36.2.1 2012/02/22 18:48:45 riz Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -133,6 +133,10 @@ struct cpu_info;
void do_hypervisor_callback(struct intrframe *regs);
void hypervisor_enable_event(unsigned int);
+extern int xen_version;
+#define XEN_MAJOR(x) (((x) & 0xffff0000) >> 16)
+#define XEN_MINOR(x) ((x) & 0x0000ffff)
+
/* hypervisor_machdep.c */
void hypervisor_send_event(struct cpu_info *, unsigned int);
void hypervisor_unmask_event(unsigned int);
Index: src/sys/arch/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.61 src/sys/arch/xen/xen/clock.c:1.61.2.1
--- src/sys/arch/xen/xen/clock.c:1.61 Sun Feb 12 14:38:18 2012
+++ src/sys/arch/xen/xen/clock.c Wed Feb 22 18:48:45 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.61 2012/02/12 14:38:18 jym Exp $ */
+/* $NetBSD: clock.c,v 1.61.2.1 2012/02/22 18:48:45 riz Exp $ */
/*
*
@@ -29,7 +29,7 @@
#include "opt_xen.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.61 2012/02/12 14:38:18 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.61.2.1 2012/02/22 18:48:45 riz Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -458,10 +458,13 @@ xen_initclocks(void)
* after a while. Use the one-shot timer every NS_PER_TICK
* and rearm it from the event handler.
*/
- err = HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
- ci->ci_cpuid,
+ if (XEN_MAJOR(xen_version) > 3 || XEN_MINOR(xen_version) > 0) {
+ /* exists only on Xen 3.1 and later */
+ err = HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
+ ci->ci_cpuid,
NULL);
- KASSERT(err == 0);
+ KASSERT(err == 0);
+ }
err = HYPERVISOR_set_timer_op(
vcpu_system_time[ci->ci_cpuid] + NS_PER_TICK);
Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.60 src/sys/arch/xen/xen/hypervisor.c:1.60.2.1
--- src/sys/arch/xen/xen/hypervisor.c:1.60 Fri Dec 9 11:47:49 2011
+++ src/sys/arch/xen/xen/hypervisor.c Wed Feb 22 18:48:45 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.60 2011/12/09 11:47:49 cherry Exp $ */
+/* $NetBSD: hypervisor.c,v 1.60.2.1 2012/02/22 18:48:45 riz Exp $ */
/*
* Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.60 2011/12/09 11:47:49 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.60.2.1 2012/02/22 18:48:45 riz Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -169,6 +169,8 @@ struct x86_isa_chipset x86_isa_chipset;
#endif
#endif
+int xen_version;
+
/* power management, for save/restore */
static bool hypervisor_suspend(device_t, const pmf_qual_t *);
static bool hypervisor_resume(device_t, const pmf_qual_t *);
@@ -201,7 +203,6 @@ hypervisor_vcpu_print(void *aux, const c
void
hypervisor_attach(device_t parent, device_t self, void *aux)
{
- int xen_version;
#if NPCI >0
#ifdef PCI_BUS_FIXUP
@@ -213,8 +214,8 @@ hypervisor_attach(device_t parent, devic
xenkernfs_init();
xen_version = HYPERVISOR_xen_version(XENVER_version, NULL);
- aprint_normal(": Xen version %d.%d\n", (xen_version & 0xffff0000) >> 16,
- xen_version & 0x0000ffff);
+ aprint_normal(": Xen version %d.%d\n", XEN_MAJOR(xen_version),
+ XEN_MINOR(xen_version));
xengnt_init();
events_init();