ia64/xen-unstable

changeset 12045:6f3865b4d3d3

[LINUX] Use CONFIG_XEN_COMPAT_030002 where possible.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Mon Oct 30 14:14:46 2006 +0000 (2006-10-30)
parents 44caba9460af
children d6802cfaf5f8
files 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
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c	Mon Oct 30 14:09:13 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c	Mon Oct 30 14:14:46 2006 +0000
     1.3 @@ -325,6 +325,7 @@ int xen_create_contiguous_region(
     1.4  	success = (exchange.nr_exchanged == (1UL << order));
     1.5  	BUG_ON(!success && ((exchange.nr_exchanged != 0) || (rc == 0)));
     1.6  	BUG_ON(success && (rc != 0));
     1.7 +#ifdef CONFIG_XEN_COMPAT_030002
     1.8  	if (unlikely(rc == -ENOSYS)) {
     1.9  		/* Compatibility when XENMEM_exchange is unsupported. */
    1.10  		if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
    1.11 @@ -341,6 +342,7 @@ int xen_create_contiguous_region(
    1.12  				BUG();
    1.13  		}
    1.14  	}
    1.15 +#endif
    1.16  
    1.17  	/* 3. Map the new extent in place of old pages. */
    1.18  	for (i = 0; i < (1UL<<order); i++) {
    1.19 @@ -419,6 +421,7 @@ void xen_destroy_contiguous_region(unsig
    1.20  	success = (exchange.nr_exchanged == 1);
    1.21  	BUG_ON(!success && ((exchange.nr_exchanged != 0) || (rc == 0)));
    1.22  	BUG_ON(success && (rc != 0));
    1.23 +#ifdef CONFIG_XEN_COMPAT_030002
    1.24  	if (unlikely(rc == -ENOSYS)) {
    1.25  		/* Compatibility when XENMEM_exchange is unsupported. */
    1.26  		if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
    1.27 @@ -429,6 +432,7 @@ void xen_destroy_contiguous_region(unsig
    1.28  			BUG();
    1.29  		success = 1;
    1.30  	}
    1.31 +#endif
    1.32  
    1.33  	/* 4. Map new pages in place of old pages. */
    1.34  	for (i = 0; i < (1UL<<order); i++) {
     2.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h	Mon Oct 30 14:09:13 2006 +0000
     2.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h	Mon Oct 30 14:14:46 2006 +0000
     2.3 @@ -260,6 +260,8 @@ HYPERVISOR_event_channel_op(
     2.4  	int cmd, void *arg)
     2.5  {
     2.6  	int rc = _hypercall2(int, event_channel_op, cmd, arg);
     2.7 +
     2.8 +#ifdef CONFIG_XEN_COMPAT_030002
     2.9  	if (unlikely(rc == -ENOSYS)) {
    2.10  		struct evtchn_op op;
    2.11  		op.cmd = cmd;
    2.12 @@ -267,6 +269,8 @@ HYPERVISOR_event_channel_op(
    2.13  		rc = _hypercall1(int, event_channel_op_compat, &op);
    2.14  		memcpy(arg, &op.u, sizeof(op.u));
    2.15  	}
    2.16 +#endif
    2.17 +
    2.18  	return rc;
    2.19  }
    2.20  
    2.21 @@ -296,6 +300,8 @@ HYPERVISOR_physdev_op(
    2.22  	int cmd, void *arg)
    2.23  {
    2.24  	int rc = _hypercall2(int, physdev_op, cmd, arg);
    2.25 +
    2.26 +#ifdef CONFIG_XEN_COMPAT_030002
    2.27  	if (unlikely(rc == -ENOSYS)) {
    2.28  		struct physdev_op op;
    2.29  		op.cmd = cmd;
    2.30 @@ -303,6 +309,8 @@ HYPERVISOR_physdev_op(
    2.31  		rc = _hypercall1(int, physdev_op_compat, &op);
    2.32  		memcpy(arg, &op.u, sizeof(op.u));
    2.33  	}
    2.34 +#endif
    2.35 +
    2.36  	return rc;
    2.37  }
    2.38  
    2.39 @@ -350,9 +358,11 @@ HYPERVISOR_suspend(
    2.40  	int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
    2.41  			     &sched_shutdown, srec);
    2.42  
    2.43 +#ifdef CONFIG_XEN_COMPAT_030002
    2.44  	if (rc == -ENOSYS)
    2.45  		rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
    2.46  				 SHUTDOWN_suspend, srec);
    2.47 +#endif
    2.48  
    2.49  	return rc;
    2.50  }
     3.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Mon Oct 30 14:09:13 2006 +0000
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Mon Oct 30 14:14:46 2006 +0000
     3.3 @@ -131,8 +131,10 @@ HYPERVISOR_yield(
     3.4  {
     3.5  	int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
     3.6  
     3.7 +#ifdef CONFIG_XEN_COMPAT_030002
     3.8  	if (rc == -ENOSYS)
     3.9  		rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
    3.10 +#endif
    3.11  
    3.12  	return rc;
    3.13  }
    3.14 @@ -143,8 +145,10 @@ HYPERVISOR_block(
    3.15  {
    3.16  	int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
    3.17  
    3.18 +#ifdef CONFIG_XEN_COMPAT_030002
    3.19  	if (rc == -ENOSYS)
    3.20  		rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
    3.21 +#endif
    3.22  
    3.23  	return rc;
    3.24  }
    3.25 @@ -159,8 +163,10 @@ HYPERVISOR_shutdown(
    3.26  
    3.27  	int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
    3.28  
    3.29 +#ifdef CONFIG_XEN_COMPAT_030002
    3.30  	if (rc == -ENOSYS)
    3.31  		rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
    3.32 +#endif
    3.33  
    3.34  	return rc;
    3.35  }
    3.36 @@ -177,8 +183,10 @@ HYPERVISOR_poll(
    3.37  	set_xen_guest_handle(sched_poll.ports, ports);
    3.38  
    3.39  	rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
    3.40 +#ifdef CONFIG_XEN_COMPAT_030002
    3.41  	if (rc == -ENOSYS)
    3.42  		rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
    3.43 +#endif
    3.44  
    3.45  	return rc;
    3.46  }
     4.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h	Mon Oct 30 14:09:13 2006 +0000
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h	Mon Oct 30 14:14:46 2006 +0000
     4.3 @@ -72,13 +72,16 @@ static void __init machine_specific_arch
     4.4  	ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event);
     4.5  	if (ret == 0)
     4.6  		ret = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe);
     4.7 +#ifdef CONFIG_XEN_COMPAT_030002
     4.8  	if (ret == -ENOSYS)
     4.9  		ret = HYPERVISOR_set_callbacks(
    4.10  			event.address.cs, event.address.eip,
    4.11  			failsafe.address.cs, failsafe.address.eip);
    4.12 +#endif
    4.13  	BUG_ON(ret);
    4.14  
    4.15  	ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
    4.16 +#ifdef CONFIG_XEN_COMPAT_030002
    4.17  	if (ret == -ENOSYS) {
    4.18  		static struct xennmi_callback __initdata cb = {
    4.19  			.handler_address = (unsigned long)nmi;
    4.20 @@ -86,6 +89,7 @@ static void __init machine_specific_arch
    4.21  
    4.22  		HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
    4.23  	}
    4.24 +#endif
    4.25  
    4.26  	if (HYPERVISOR_xen_version(XENVER_platform_parameters,
    4.27  				   &pp) == 0)
     5.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h	Mon Oct 30 14:09:13 2006 +0000
     5.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h	Mon Oct 30 14:14:46 2006 +0000
     5.3 @@ -258,6 +258,8 @@ HYPERVISOR_event_channel_op(
     5.4  	int cmd, void *arg)
     5.5  {
     5.6  	int rc = _hypercall2(int, event_channel_op, cmd, arg);
     5.7 +
     5.8 +#ifdef CONFIG_XEN_COMPAT_030002
     5.9  	if (unlikely(rc == -ENOSYS)) {
    5.10  		struct evtchn_op op;
    5.11  		op.cmd = cmd;
    5.12 @@ -265,6 +267,8 @@ HYPERVISOR_event_channel_op(
    5.13  		rc = _hypercall1(int, event_channel_op_compat, &op);
    5.14  		memcpy(arg, &op.u, sizeof(op.u));
    5.15  	}
    5.16 +#endif
    5.17 +
    5.18  	return rc;
    5.19  }
    5.20  
    5.21 @@ -294,6 +298,8 @@ HYPERVISOR_physdev_op(
    5.22  	int cmd, void *arg)
    5.23  {
    5.24  	int rc = _hypercall2(int, physdev_op, cmd, arg);
    5.25 +
    5.26 +#ifdef CONFIG_XEN_COMPAT_030002
    5.27  	if (unlikely(rc == -ENOSYS)) {
    5.28  		struct physdev_op op;
    5.29  		op.cmd = cmd;
    5.30 @@ -301,6 +307,8 @@ HYPERVISOR_physdev_op(
    5.31  		rc = _hypercall1(int, physdev_op_compat, &op);
    5.32  		memcpy(arg, &op.u, sizeof(op.u));
    5.33  	}
    5.34 +#endif
    5.35 +
    5.36  	return rc;
    5.37  }
    5.38  
    5.39 @@ -351,9 +359,11 @@ HYPERVISOR_suspend(
    5.40  	int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
    5.41  			     &sched_shutdown, srec);
    5.42  
    5.43 +#ifdef CONFIG_XEN_COMPAT_030002
    5.44  	if (rc == -ENOSYS)
    5.45  		rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
    5.46  				 SHUTDOWN_suspend, srec);
    5.47 +#endif
    5.48  
    5.49  	return rc;
    5.50  }
     6.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h	Mon Oct 30 14:09:13 2006 +0000
     6.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h	Mon Oct 30 14:14:46 2006 +0000
     6.3 @@ -39,15 +39,18 @@ static void __init machine_specific_arch
     6.4  		ret = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe);
     6.5  	if (ret == 0)
     6.6  		ret = HYPERVISOR_callback_op(CALLBACKOP_register, &syscall);
     6.7 +#ifdef CONFIG_XEN_COMPAT_030002
     6.8  	if (ret == -ENOSYS)
     6.9  		ret = HYPERVISOR_set_callbacks(
    6.10  			event.address,
    6.11  			failsafe.address,
    6.12  			syscall.address);
    6.13 +#endif
    6.14  	BUG_ON(ret);
    6.15  
    6.16  #ifdef CONFIG_X86_LOCAL_APIC
    6.17  	ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
    6.18 +#ifdef CONFIG_XEN_COMPAT_030002
    6.19  	if (ret == -ENOSYS) {
    6.20  		static struct xennmi_callback __initdata cb = {
    6.21  			.handler_address = (unsigned long)nmi;
    6.22 @@ -56,4 +59,5 @@ static void __init machine_specific_arch
    6.23  		HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
    6.24  	}
    6.25  #endif
    6.26 +#endif
    6.27  }