Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Feb 2008 05:03:31 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135624 for review
Message-ID:  <200802180503.m1I53VOI048500@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135624

Change 135624 by kmacy@pandemonium:kmacy:xen31 on 2008/02/18 05:03:22

	add compatibility hypercall support

Affected files ...

.. //depot/projects/xen31/sys/i386/include/cpufunc.h#7 edit
.. //depot/projects/xen31/sys/i386/include/pmap.h#11 edit
.. //depot/projects/xen31/sys/i386/include/xen/hypercall.h#8 edit
.. //depot/projects/xen31/sys/i386/include/xen/hypervisor.h#6 edit
.. //depot/projects/xen31/sys/i386/include/xen/xen-os.h#6 edit
.. //depot/projects/xen31/sys/kern/subr_kdb.c#4 edit
.. //depot/projects/xen31/sys/xen/features.c#2 edit

Differences ...

==== //depot/projects/xen31/sys/i386/include/cpufunc.h#7 (text+ko) ====

@@ -45,7 +45,6 @@
 #ifdef XEN
 #include <machine/psl.h>
 #define NO_EXCHANGE
-#include <machine/xen/hypervisor.h>
 #include <machine/xen/xen-os.h>
 #include <vm/vm.h>
 #include <vm/vm_page.h>

==== //depot/projects/xen31/sys/i386/include/pmap.h#11 (text+ko) ====

@@ -194,7 +194,6 @@
 
 
 #ifdef XEN
-#include <machine/xen/hypervisor.h>
 #include <machine/xen/xen-os.h>
 #include <machine/xen/xenvar.h>
 #include <machine/xen/xenpmap.h>

==== //depot/projects/xen31/sys/i386/include/xen/hypercall.h#8 (text+ko) ====

@@ -30,11 +30,14 @@
 #ifndef __HYPERCALL_H__
 #define __HYPERCALL_H__
 
+#include <sys/systm.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/sched.h>
 
 #define __STR(x) #x
 #define STR(x) __STR(x)
+#define	ENOXENSYS	38
+
 
 #if defined(XEN)
 #define HYPERCALL_STR(name)                                     \
@@ -171,6 +174,13 @@
 	return _hypercall1(int, fpu_taskswitch, set);
 }
 
+static inline int 
+HYPERVISOR_sched_op_compat(
+	int cmd, unsigned long arg)
+{
+	return _hypercall2(int, sched_op_compat, cmd, arg);
+}
+
 static inline int
 HYPERVISOR_sched_op(
 	int cmd, void *arg)
@@ -245,9 +255,19 @@
 
 static inline int
 HYPERVISOR_event_channel_op(
-	int cmd, void *op)
+	int cmd, void *arg)
 {
-	return _hypercall2(int, event_channel_op, cmd, op);
+	int rc = _hypercall2(int, event_channel_op, cmd, arg);
+
+	if (__predict_false(rc == -ENOXENSYS)) {
+		struct evtchn_op op;
+		op.cmd = cmd;
+		memcpy(&op.u, arg, sizeof(op.u));
+		rc = _hypercall1(int, event_channel_op_compat, &op);
+		memcpy(arg, &op.u, sizeof(op.u));
+	}
+
+	return (rc);
 }
 
 static inline int
@@ -266,9 +286,19 @@
 
 static inline int
 HYPERVISOR_physdev_op(
-	int cmd, void *physdev_op)
+	int cmd, void *arg)
 {
-	return _hypercall2(int, physdev_op, cmd, physdev_op);
+	int rc = _hypercall2(int, physdev_op, cmd, arg);
+
+	if (__predict_false(rc == -ENOXENSYS)) {
+		struct physdev_op op;
+		op.cmd = cmd;
+		memcpy(&op.u, arg, sizeof(op.u));
+		rc = _hypercall1(int, physdev_op_compat, &op);
+		memcpy(arg, &op.u, sizeof(op.u));
+	}
+
+	return (rc);
 }
 
 static inline int
@@ -312,10 +342,13 @@
 	struct sched_shutdown sched_shutdown = {
 		.reason = SHUTDOWN_suspend
 	};
-	return _hypercall3(int, sched_op, SCHEDOP_shutdown,
+	int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
 			   &sched_shutdown, srec);
+	if (rc == -ENOXENSYS)
+		rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
+				 SHUTDOWN_suspend, srec);
+	return (rc);
 }
-#ifdef notyet
 static inline int
 HYPERVISOR_nmi_op(
         unsigned long op, void *arg)
@@ -323,6 +356,7 @@
         return _hypercall2(int, nmi_op, op, arg);
 }
 
+#ifdef notyet
 static inline unsigned long
 HYPERVISOR_hvm_op(
     int op, void *arg)

==== //depot/projects/xen31/sys/i386/include/xen/hypervisor.h#6 (text+ko) ====

@@ -16,6 +16,7 @@
 #endif
 
 #include <sys/cdefs.h>
+#include <sys/systm.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/platform.h>
 #include <xen/interface/event_channel.h>

==== //depot/projects/xen31/sys/i386/include/xen/xen-os.h#6 (text+ko) ====

@@ -4,10 +4,14 @@
  * random collection of macros and definition
  */
 
-#ifndef _OS_H_
-#define _OS_H_
+#ifndef _XEN_OS_H_
+#define _XEN_OS_H_
 #include <machine/param.h>
+#ifdef PAE
+#define CONFIG_X86_PAE
+#endif
 
+#include <xen/interface/xen.h>
 
 /* Force a proper event-channel callback from Xen. */
 void force_evtchn_callback(void);
@@ -70,7 +74,6 @@
 /* Everything below this point is not included by assembler (.S) files. */
 #ifndef __ASSEMBLY__
 #include <sys/types.h>
-#include <machine/xen/hypervisor.h>
 
 void printk(const char *fmt, ...);
 

==== //depot/projects/xen31/sys/kern/subr_kdb.c#4 (text+ko) ====

@@ -306,6 +306,7 @@
  */
 #ifdef XEN
 #include <machine/cpu.h> /* needed for btext/etext */
+#include <machine/xen/hypervisor.h>
 #endif
 void
 kdb_enter(const char *why, const char *msg)

==== //depot/projects/xen31/sys/xen/features.c#2 (text+ko) ====

@@ -1,3 +1,4 @@
+#include <sys/types.h>
 #include <machine/xen/hypervisor.h>
 #include <machine/xen/features.h>
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802180503.m1I53VOI048500>