244 lines
7.3 KiB
Diff
244 lines
7.3 KiB
Diff
# HG changeset patch
|
|
# User kfraser@localhost.localdomain
|
|
# Date Mon Oct 30 14:14:46 2006 +0000
|
|
# Node ID 6f3865b4d3d3bddbd64c0ed7c21b03bd98e78a0a
|
|
# parent: 44caba9460afd444a6a56c5d4517f938ca99130c
|
|
[LINUX] Use CONFIG_XEN_COMPAT_030002 where possible.
|
|
Signed-off-by: Jan Beulich <jbeulich@novell.com>
|
|
|
|
--- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Mon Oct 30 14:09:13 2006 +0000
|
|
+++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Mon Oct 30 14:14:46 2006 +0000
|
|
@@ -325,6 +325,7 @@ int xen_create_contiguous_region(
|
|
success = (exchange.nr_exchanged == (1UL << order));
|
|
BUG_ON(!success && ((exchange.nr_exchanged != 0) || (rc == 0)));
|
|
BUG_ON(success && (rc != 0));
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (unlikely(rc == -ENOSYS)) {
|
|
/* Compatibility when XENMEM_exchange is unsupported. */
|
|
if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
|
|
@@ -341,6 +342,7 @@ int xen_create_contiguous_region(
|
|
BUG();
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
/* 3. Map the new extent in place of old pages. */
|
|
for (i = 0; i < (1UL<<order); i++) {
|
|
@@ -419,6 +421,7 @@ void xen_destroy_contiguous_region(unsig
|
|
success = (exchange.nr_exchanged == 1);
|
|
BUG_ON(!success && ((exchange.nr_exchanged != 0) || (rc == 0)));
|
|
BUG_ON(success && (rc != 0));
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (unlikely(rc == -ENOSYS)) {
|
|
/* Compatibility when XENMEM_exchange is unsupported. */
|
|
if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
|
|
@@ -429,6 +432,7 @@ void xen_destroy_contiguous_region(unsig
|
|
BUG();
|
|
success = 1;
|
|
}
|
|
+#endif
|
|
|
|
/* 4. Map new pages in place of old pages. */
|
|
for (i = 0; i < (1UL<<order); i++) {
|
|
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h Mon Oct 30 14:09:13 2006 +0000
|
|
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h Mon Oct 30 14:14:46 2006 +0000
|
|
@@ -260,6 +260,8 @@ HYPERVISOR_event_channel_op(
|
|
int cmd, void *arg)
|
|
{
|
|
int rc = _hypercall2(int, event_channel_op, cmd, arg);
|
|
+
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (unlikely(rc == -ENOSYS)) {
|
|
struct evtchn_op op;
|
|
op.cmd = cmd;
|
|
@@ -267,6 +269,8 @@ HYPERVISOR_event_channel_op(
|
|
rc = _hypercall1(int, event_channel_op_compat, &op);
|
|
memcpy(arg, &op.u, sizeof(op.u));
|
|
}
|
|
+#endif
|
|
+
|
|
return rc;
|
|
}
|
|
|
|
@@ -296,6 +300,8 @@ HYPERVISOR_physdev_op(
|
|
int cmd, void *arg)
|
|
{
|
|
int rc = _hypercall2(int, physdev_op, cmd, arg);
|
|
+
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (unlikely(rc == -ENOSYS)) {
|
|
struct physdev_op op;
|
|
op.cmd = cmd;
|
|
@@ -303,6 +309,8 @@ HYPERVISOR_physdev_op(
|
|
rc = _hypercall1(int, physdev_op_compat, &op);
|
|
memcpy(arg, &op.u, sizeof(op.u));
|
|
}
|
|
+#endif
|
|
+
|
|
return rc;
|
|
}
|
|
|
|
@@ -350,9 +358,11 @@ HYPERVISOR_suspend(
|
|
int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
|
|
&sched_shutdown, srec);
|
|
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (rc == -ENOSYS)
|
|
rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
|
|
SHUTDOWN_suspend, srec);
|
|
+#endif
|
|
|
|
return rc;
|
|
}
|
|
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Mon Oct 30 14:09:13 2006 +0000
|
|
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Mon Oct 30 14:14:46 2006 +0000
|
|
@@ -131,8 +131,10 @@ HYPERVISOR_yield(
|
|
{
|
|
int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
|
|
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (rc == -ENOSYS)
|
|
rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
|
|
+#endif
|
|
|
|
return rc;
|
|
}
|
|
@@ -143,8 +145,10 @@ HYPERVISOR_block(
|
|
{
|
|
int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
|
|
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (rc == -ENOSYS)
|
|
rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
|
|
+#endif
|
|
|
|
return rc;
|
|
}
|
|
@@ -159,8 +163,10 @@ HYPERVISOR_shutdown(
|
|
|
|
int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
|
|
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (rc == -ENOSYS)
|
|
rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
|
|
+#endif
|
|
|
|
return rc;
|
|
}
|
|
@@ -177,8 +183,10 @@ HYPERVISOR_poll(
|
|
set_xen_guest_handle(sched_poll.ports, ports);
|
|
|
|
rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (rc == -ENOSYS)
|
|
rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
|
|
+#endif
|
|
|
|
return rc;
|
|
}
|
|
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h Mon Oct 30 14:09:13 2006 +0000
|
|
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h Mon Oct 30 14:14:46 2006 +0000
|
|
@@ -72,13 +72,16 @@ static void __init machine_specific_arch
|
|
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event);
|
|
if (ret == 0)
|
|
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe);
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (ret == -ENOSYS)
|
|
ret = HYPERVISOR_set_callbacks(
|
|
event.address.cs, event.address.eip,
|
|
failsafe.address.cs, failsafe.address.eip);
|
|
+#endif
|
|
BUG_ON(ret);
|
|
|
|
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (ret == -ENOSYS) {
|
|
static struct xennmi_callback __initdata cb = {
|
|
.handler_address = (unsigned long)nmi;
|
|
@@ -86,6 +89,7 @@ static void __init machine_specific_arch
|
|
|
|
HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
|
|
}
|
|
+#endif
|
|
|
|
if (HYPERVISOR_xen_version(XENVER_platform_parameters,
|
|
&pp) == 0)
|
|
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h Mon Oct 30 14:09:13 2006 +0000
|
|
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h Mon Oct 30 14:14:46 2006 +0000
|
|
@@ -258,6 +258,8 @@ HYPERVISOR_event_channel_op(
|
|
int cmd, void *arg)
|
|
{
|
|
int rc = _hypercall2(int, event_channel_op, cmd, arg);
|
|
+
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (unlikely(rc == -ENOSYS)) {
|
|
struct evtchn_op op;
|
|
op.cmd = cmd;
|
|
@@ -265,6 +267,8 @@ HYPERVISOR_event_channel_op(
|
|
rc = _hypercall1(int, event_channel_op_compat, &op);
|
|
memcpy(arg, &op.u, sizeof(op.u));
|
|
}
|
|
+#endif
|
|
+
|
|
return rc;
|
|
}
|
|
|
|
@@ -294,6 +298,8 @@ HYPERVISOR_physdev_op(
|
|
int cmd, void *arg)
|
|
{
|
|
int rc = _hypercall2(int, physdev_op, cmd, arg);
|
|
+
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (unlikely(rc == -ENOSYS)) {
|
|
struct physdev_op op;
|
|
op.cmd = cmd;
|
|
@@ -301,6 +307,8 @@ HYPERVISOR_physdev_op(
|
|
rc = _hypercall1(int, physdev_op_compat, &op);
|
|
memcpy(arg, &op.u, sizeof(op.u));
|
|
}
|
|
+#endif
|
|
+
|
|
return rc;
|
|
}
|
|
|
|
@@ -351,9 +359,11 @@ HYPERVISOR_suspend(
|
|
int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
|
|
&sched_shutdown, srec);
|
|
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (rc == -ENOSYS)
|
|
rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
|
|
SHUTDOWN_suspend, srec);
|
|
+#endif
|
|
|
|
return rc;
|
|
}
|
|
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h Mon Oct 30 14:09:13 2006 +0000
|
|
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h Mon Oct 30 14:14:46 2006 +0000
|
|
@@ -39,15 +39,18 @@ static void __init machine_specific_arch
|
|
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe);
|
|
if (ret == 0)
|
|
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &syscall);
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (ret == -ENOSYS)
|
|
ret = HYPERVISOR_set_callbacks(
|
|
event.address,
|
|
failsafe.address,
|
|
syscall.address);
|
|
+#endif
|
|
BUG_ON(ret);
|
|
|
|
#ifdef CONFIG_X86_LOCAL_APIC
|
|
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
|
|
+#ifdef CONFIG_XEN_COMPAT_030002
|
|
if (ret == -ENOSYS) {
|
|
static struct xennmi_callback __initdata cb = {
|
|
.handler_address = (unsigned long)nmi;
|
|
@@ -56,4 +59,5 @@ static void __init machine_specific_arch
|
|
HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
|
|
}
|
|
#endif
|
|
+#endif
|
|
}
|
|
|