[LINUX] Use CONFIG_XEN_COMPAT_030002 where possible.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 30 Oct 2006 14:14:46 +0000 (14:14 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 30 Oct 2006 14:14:46 +0000 (14:14 +0000)
Signed-off-by: Jan Beulich <jbeulich@novell.com>
linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h

index 5dc6646cf583d1192c2948462c24c4329f81e8e8..7263ef4dea3a00b1846088d51fe08b51ae2811f2 100644 (file)
@@ -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(unsigned long vstart, unsigned int order)
        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(unsigned long vstart, unsigned int order)
                        BUG();
                success = 1;
        }
+#endif
 
        /* 4. Map new pages in place of old pages. */
        for (i = 0; i < (1UL<<order); i++) {
index 2e6d1fa59693039abbd58e2cbb68344752fa0b47..a12e34901677100718333aa10ecedd0d4027784d 100644 (file)
@@ -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;
 }
index 47586d22f9dc15915291dfca4c111764b4bf011e..a037eb24e461299bccb12e7495482f801a71b095 100644 (file)
@@ -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;
 }
index b4507b120e9984e68df0f8a02830f88bfc05f4f8..b0b554d97a3675433fdb924a02098e913030a033 100644 (file)
@@ -72,13 +72,16 @@ static void __init machine_specific_arch_setup(void)
        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_setup(void)
 
                HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
        }
+#endif
 
        if (HYPERVISOR_xen_version(XENVER_platform_parameters,
                                   &pp) == 0)
index 14fb01d3d27e02b5bf35d90374094257bf2e46fd..956a4c4b0d6bf140c4fe71e4be1fdcb844a1b26e 100644 (file)
@@ -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;
 }
index 0a70d239c212c9e51bee27944340f59025b4c8f7..b866c305e58d0b5357e1271cf9b9a7030a5541b3 100644 (file)
@@ -39,15 +39,18 @@ static void __init machine_specific_arch_setup(void)
                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_setup(void)
                HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
        }
 #endif
+#endif
 }