# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 9316fe0c9c4f080cea8b2a5643ac421a571183db
# Parent 03d996c80eb3e19f053891691789c3d2137c8282
Remove __HYPERVISOR_sched_op_new in favour of a header file interface version
number system.
Define interface version in Kconfig and define it through CPPFLAGS for
C and assembly file compilation.
Add HYPERVISOR_{yield,block,shutdown} to remove direct use of sched_op
from guest code.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
diff -r 03d996c80eb3 -r 9316fe0c9c4f linux-2.6-xen-sparse/arch/i386/Makefile
--- a/linux-2.6-xen-sparse/arch/i386/Makefile Thu Mar 30 16:50:40 2006
+++ b/linux-2.6-xen-sparse/arch/i386/Makefile Thu Mar 30 16:50:44 2006
@@ -44,6 +44,11 @@
CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ;
then echo $(call cc-option,-fno-unit-at-a-time); fi ;)
CFLAGS += $(cflags-y)
+
+cppflags-$(CONFIG_XEN) += \
+ -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)
+
+CPPFLAGS += $(cppflags-y)
# Default subarch .c files
mcore-y := mach-default
diff -r 03d996c80eb3 -r 9316fe0c9c4f
linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c Thu Mar 30
16:50:40 2006
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c Thu Mar 30
16:50:44 2006
@@ -114,7 +114,7 @@
smp_mb__after_clear_bit();
stop_hz_timer();
/* Blocking includes an implicit local_irq_enable(). */
- HYPERVISOR_sched_op(SCHEDOP_block, 0);
+ HYPERVISOR_block();
start_hz_timer();
set_thread_flag(TIF_POLLING_NRFLAG);
}
diff -r 03d996c80eb3 -r 9316fe0c9c4f
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu Mar 30 16:50:40 2006
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu Mar 30 16:50:44 2006
@@ -1877,7 +1877,7 @@
static int
xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
{
- HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_crash);
+ HYPERVISOR_shutdown(SHUTDOWN_crash);
/* we're never actually going to get here... */
return NOTIFY_DONE;
}
diff -r 03d996c80eb3 -r 9316fe0c9c4f linux-2.6-xen-sparse/arch/ia64/Makefile
--- a/linux-2.6-xen-sparse/arch/ia64/Makefile Thu Mar 30 16:50:40 2006
+++ b/linux-2.6-xen-sparse/arch/ia64/Makefile Thu Mar 30 16:50:44 2006
@@ -42,6 +42,12 @@
endif
CFLAGS += $(cflags-y)
+
+cppflags-$(CONFIG_XEN) += \
+ -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)
+
+CPPFLAGS += $(cppflags-y)
+
head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o
libs-y += arch/ia64/lib/
diff -r 03d996c80eb3 -r 9316fe0c9c4f linux-2.6-xen-sparse/arch/x86_64/Makefile
--- a/linux-2.6-xen-sparse/arch/x86_64/Makefile Thu Mar 30 16:50:40 2006
+++ b/linux-2.6-xen-sparse/arch/x86_64/Makefile Thu Mar 30 16:50:44 2006
@@ -30,6 +30,10 @@
cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
CFLAGS += $(cflags-y)
+
+cppflags-$(CONFIG_XEN) += \
+ -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)
+CPPFLAGS += $(cppflags-y)
CFLAGS += -m64
CFLAGS += -mno-red-zone
diff -r 03d996c80eb3 -r 9316fe0c9c4f
linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c Thu Mar 30
16:50:40 2006
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c Thu Mar 30
16:50:44 2006
@@ -131,7 +131,7 @@
smp_mb__after_clear_bit();
stop_hz_timer();
/* Blocking includes an implicit local_irq_enable(). */
- HYPERVISOR_sched_op(SCHEDOP_block, 0);
+ HYPERVISOR_block();
start_hz_timer();
set_thread_flag(TIF_POLLING_NRFLAG);
}
diff -r 03d996c80eb3 -r 9316fe0c9c4f
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Thu Mar 30
16:50:40 2006
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Thu Mar 30
16:50:44 2006
@@ -999,7 +999,7 @@
static int
xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
{
- HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_crash);
+ HYPERVISOR_shutdown(SHUTDOWN_crash);
/* we're never actually going to get here... */
return NOTIFY_DONE;
}
diff -r 03d996c80eb3 -r 9316fe0c9c4f linux-2.6-xen-sparse/drivers/xen/Kconfig
--- a/linux-2.6-xen-sparse/drivers/xen/Kconfig Thu Mar 30 16:50:40 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig Thu Mar 30 16:50:44 2006
@@ -10,12 +10,11 @@
help
This is the Linux Xen port.
-config NO_IDLE_HZ
- bool
- depends on XEN
- default y
-
if XEN
+config XEN_INTERFACE_VERSION
+ hex
+ default 0x00030101
+
menu "XEN"
config XEN_PRIVILEGED_GUEST
@@ -191,7 +190,6 @@
config XEN_SYSFS
tristate "Export Xen attributes in sysfs"
- depends on XEN
depends on SYSFS
default y
help
@@ -207,4 +205,8 @@
bool
default y
+config NO_IDLE_HZ
+ bool
+ default y
+
endif
diff -r 03d996c80eb3 -r 9316fe0c9c4f
linux-2.6-xen-sparse/drivers/xen/core/reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Thu Mar 30 16:50:40 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Thu Mar 30 16:50:44 2006
@@ -42,7 +42,7 @@
{
/* We really want to get pending console data out before we die. */
xencons_force_flush();
- HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_reboot);
+ HYPERVISOR_shutdown(SHUTDOWN_reboot);
}
void machine_restart(char * __unused)
@@ -59,7 +59,7 @@
{
/* We really want to get pending console data out before we die. */
xencons_force_flush();
- HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_poweroff);
+ HYPERVISOR_shutdown(SHUTDOWN_poweroff);
}
int reboot_thru_bios = 0; /* for dmi_scan.c */
diff -r 03d996c80eb3 -r 9316fe0c9c4f
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h Thu Mar
30 16:50:40 2006
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h Thu Mar
30 16:50:44 2006
@@ -33,10 +33,9 @@
#ifndef __HYPERCALL_H__
#define __HYPERCALL_H__
-#include <xen/interface/xen.h>
-#include <xen/interface/sched.h>
-#include <xen/interface/nmi.h>
-#include <linux/errno.h>
+#ifndef __HYPERVISOR_H__
+# error "please don't include this file directly"
+#endif
#define __STR(x) #x
#define STR(x) __STR(x)
@@ -167,35 +166,17 @@
}
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, unsigned long arg)
+ int cmd, void *arg)
{
return _hypercall2(int, sched_op, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_sched_op_new(
- int cmd, void *arg)
-{
- return _hypercall2(int, sched_op_new, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_poll(
- evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
-{
- struct sched_poll sched_poll = {
- .ports = ports,
- .nr_ports = nr_ports,
- .timeout = jiffies_to_st(timeout)
- };
-
- int rc = HYPERVISOR_sched_op_new(SCHEDOP_poll, &sched_poll);
-
- if (rc == -ENOSYS)
- rc = HYPERVISOR_sched_op(SCHEDOP_yield, 0);
-
- return rc;
}
static inline long
@@ -327,8 +308,18 @@
HYPERVISOR_suspend(
unsigned long srec)
{
- return _hypercall3(int, sched_op, SCHEDOP_shutdown,
- SHUTDOWN_suspend, srec);
+ struct sched_shutdown sched_shutdown = {
+ .reason = SHUTDOWN_suspend
+ };
+
+ int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
+ &sched_shutdown, srec);
+
+ if (rc == -ENOSYS)
+ rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
+ SHUTDOWN_suspend, srec);
+
+ return rc;
}
static inline int
diff -r 03d996c80eb3 -r 9316fe0c9c4f
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Thu Mar
30 16:50:40 2006
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Thu Mar
30 16:50:44 2006
@@ -37,8 +37,11 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/version.h>
+#include <linux/errno.h>
#include <xen/interface/xen.h>
#include <xen/interface/dom0_ops.h>
+#include <xen/interface/sched.h>
+#include <xen/interface/nmi.h>
#include <asm/ptrace.h>
#include <asm/page.h>
#if defined(__i386__)
@@ -115,6 +118,64 @@
#define xen_init() (0)
+static inline int
+HYPERVISOR_yield(
+ void)
+{
+ int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_block(
+ void)
+{
+ int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_shutdown(
+ unsigned int reason)
+{
+ struct sched_shutdown sched_shutdown = {
+ .reason = reason
+ };
+
+ int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_poll(
+ evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
+{
+ struct sched_poll sched_poll = {
+ .ports = ports,
+ .nr_ports = nr_ports,
+ .timeout = jiffies_to_st(timeout)
+ };
+
+ int rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+ return rc;
+}
+
static inline void
MULTI_update_va_mapping(
multicall_entry_t *mcl, unsigned long va,
diff -r 03d996c80eb3 -r 9316fe0c9c4f
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Thu Mar 30 16:50:40 2006
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Thu Mar 30 16:50:44 2006
@@ -33,10 +33,9 @@
#ifndef __HYPERCALL_H__
#define __HYPERCALL_H__
-#include <xen/interface/xen.h>
-#include <xen/interface/sched.h>
-#include <xen/interface/dom0_ops.h>
-#include <linux/errno.h>
+#ifndef __HYPERVISOR_H__
+# error "please don't include this file directly"
+#endif
/* FIXME: temp place to hold these page related macros */
#include <asm/page.h>
@@ -164,35 +163,17 @@
})
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, unsigned long arg)
+ int cmd, void *arg)
{
return _hypercall2(int, sched_op, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_sched_op_new(
- int cmd, void *arg)
-{
- return _hypercall2(int, sched_op_new, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_poll(
- evtchn_port_t *ports, unsigned int nr_ports, unsigned long timeout)
-{
- struct sched_poll sched_poll = {
- .ports = ports,
- .nr_ports = nr_ports,
- .timeout = jiffies_to_st(timeout)
- };
-
- int rc = HYPERVISOR_sched_op_new(SCHEDOP_poll, &sched_poll);
-
- if (rc == -ENOSYS)
- rc = HYPERVISOR_sched_op(SCHEDOP_yield, 0);
-
- return rc;
}
static inline long
@@ -272,8 +253,18 @@
HYPERVISOR_suspend(
unsigned long srec)
{
- return _hypercall3(int, sched_op, SCHEDOP_shutdown,
- SHUTDOWN_suspend, srec);
+ struct sched_shutdown sched_shutdown = {
+ .reason = SHUTDOWN_suspend
+ };
+
+ int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
+ &sched_shutdown, srec);
+
+ if (rc == -ENOSYS)
+ rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
+ SHUTDOWN_suspend, srec);
+
+ return rc;
}
extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
diff -r 03d996c80eb3 -r 9316fe0c9c4f
linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h Thu Mar 30
16:50:40 2006
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h Thu Mar 30
16:50:44 2006
@@ -37,8 +37,10 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/version.h>
+#include <linux/errno.h>
#include <xen/interface/xen.h>
#include <xen/interface/dom0_ops.h>
+#include <xen/interface/sched.h>
#include <asm/ptrace.h>
#include <asm/page.h>
@@ -53,6 +55,64 @@
#define jiffies_to_st(j) 0
#include <asm/hypercall.h>
+
+static inline int
+HYPERVISOR_yield(
+ void)
+{
+ int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_block(
+ void)
+{
+ int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_shutdown(
+ unsigned int reason)
+{
+ struct sched_shutdown sched_shutdown = {
+ .reason = reason
+ };
+
+ int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_poll(
+ evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
+{
+ struct sched_poll sched_poll = {
+ .ports = ports,
+ .nr_ports = nr_ports,
+ .timeout = jiffies_to_st(timeout)
+ };
+
+ int rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+ return rc;
+}
// for drivers/xen/privcmd/privcmd.c
#define direct_remap_pfn_range(a,b,c,d,e,f) remap_pfn_range(a,b,c,d,e)
diff -r 03d996c80eb3 -r 9316fe0c9c4f
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h Thu Mar
30 16:50:40 2006
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h Thu Mar
30 16:50:44 2006
@@ -37,10 +37,9 @@
#ifndef __HYPERCALL_H__
#define __HYPERCALL_H__
-#include <xen/interface/xen.h>
-#include <xen/interface/sched.h>
-#include <xen/interface/nmi.h>
-#include <linux/errno.h>
+#ifndef __HYPERVISOR_H__
+# error "please don't include this file directly"
+#endif
#define __STR(x) #x
#define STR(x) __STR(x)
@@ -172,35 +171,17 @@
}
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, unsigned long arg)
+ int cmd, void *arg)
{
return _hypercall2(int, sched_op, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_sched_op_new(
- int cmd, void *arg)
-{
- return _hypercall2(int, sched_op_new, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_poll(
- evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
-{
- struct sched_poll sched_poll = {
- .ports = ports,
- .nr_ports = nr_ports,
- .timeout = jiffies_to_st(timeout)
- };
-
- int rc = HYPERVISOR_sched_op_new(SCHEDOP_poll, &sched_poll);
-
- if (rc == -ENOSYS)
- rc = HYPERVISOR_sched_op(SCHEDOP_yield, 0);
-
- return rc;
}
static inline long
@@ -328,8 +309,18 @@
HYPERVISOR_suspend(
unsigned long srec)
{
- return _hypercall3(int, sched_op, SCHEDOP_shutdown,
- SHUTDOWN_suspend, srec);
+ struct sched_shutdown sched_shutdown = {
+ .reason = SHUTDOWN_suspend
+ };
+
+ int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
+ &sched_shutdown, srec);
+
+ if (rc == -ENOSYS)
+ rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
+ SHUTDOWN_suspend, srec);
+
+ return rc;
}
static inline int
diff -r 03d996c80eb3 -r 9316fe0c9c4f xen/include/public/xen.h
--- a/xen/include/public/xen.h Thu Mar 30 16:50:40 2006
+++ b/xen/include/public/xen.h Thu Mar 30 16:50:44 2006
@@ -37,7 +37,7 @@
#define __HYPERVISOR_stack_switch 3
#define __HYPERVISOR_set_callbacks 4
#define __HYPERVISOR_fpu_taskswitch 5
-#define __HYPERVISOR_sched_op 6
+#define __HYPERVISOR_sched_op_compat 6 /* compat as of 0x00030101 */
#define __HYPERVISOR_dom0_op 7
#define __HYPERVISOR_set_debugreg 8
#define __HYPERVISOR_get_debugreg 9
@@ -59,7 +59,7 @@
#define __HYPERVISOR_mmuext_op 26
#define __HYPERVISOR_acm_op 27
#define __HYPERVISOR_nmi_op 28
-#define __HYPERVISOR_sched_op_new 29
+#define __HYPERVISOR_sched_op 29
/*
* VIRTUAL INTERRUPTS
@@ -436,6 +436,8 @@
#endif /* !__ASSEMBLY__ */
+#include "xen-compat.h"
+
#endif /* __XEN_PUBLIC_XEN_H__ */
/*
diff -r 03d996c80eb3 -r 9316fe0c9c4f xen/include/public/xen-compat.h
--- /dev/null Thu Mar 30 16:50:40 2006
+++ b/xen/include/public/xen-compat.h Thu Mar 30 16:50:44 2006
@@ -0,0 +1,21 @@
+/******************************************************************************
+ * xen-compat.h
+ *
+ * Guest OS interface to Xen. Compatibility layer.
+ *
+ * Copyright (c) 2006, Christian Limpach
+ */
+
+#ifndef __XEN_PUBLIC_XEN_COMPAT_H__
+#define __XEN_PUBLIC_XEN_COMPAT_H__
+
+#ifndef __XEN_INTERFACE_VERSION__
+#define __XEN_INTERFACE_VERSION__ 0x00000000
+#endif
+
+#if __XEN_INTERFACE_VERSION__ < 0x00030101
+#undef __HYPERVISOR_sched_op
+#define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
+#endif
+
+#endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|