# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1175759912 -3600
# Node ID 2b24d842bbd31dfccaf4d73aa287c15e0f05181c
# Parent d9b670f76f51fe6e634734593eb27487c9e98dbb
linux: make compatibility config options more scalable
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S | 8
+++---
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c | 2 -
linux-2.6-xen-sparse/arch/i386/mach-xen/setup.c | 4 +--
linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c | 4 +--
linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S | 8
+++---
linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c | 4 +--
linux-2.6-xen-sparse/drivers/xen/Kconfig | 13
++++------
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h | 6 ++--
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h | 8
+++---
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h | 8
+++---
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h | 6 ++--
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h | 6 ++--
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h | 2 -
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h | 4 +--
14 files changed, 41 insertions(+), 42 deletions(-)
diff -r d9b670f76f51 -r 2b24d842bbd3
linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S
--- a/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S Thu Apr 05 08:46:54
2007 +0100
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/head-xen.S Thu Apr 05 08:58:32
2007 +0100
@@ -142,7 +142,7 @@ ENTRY(cpu_gdt_table)
.quad 0x0000000000000000 /* 0xf0 - unused */
.quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault
TSS */
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
/*
* __xen_guest information
*/
@@ -180,18 +180,18 @@ ENTRY(cpu_gdt_table)
#endif
.ascii ",LOADER=generic"
.byte 0
-#endif /* CONFIG_XEN_COMPAT_030002 */
+#endif /* CONFIG_XEN_COMPAT <= 0x030002 */
ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux")
ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6")
ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0")
ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long, __PAGE_OFFSET)
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, __PAGE_OFFSET)
#else
ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, 0)
-#endif /* !CONFIG_XEN_COMPAT_030002 */
+#endif
ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, startup_32)
ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypercall_page)
ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long, HYPERVISOR_VIRT_START)
diff -r d9b670f76f51 -r 2b24d842bbd3
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c Thu Apr 05 08:46:54
2007 +0100
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c Thu Apr 05 08:58:32
2007 +0100
@@ -1010,7 +1010,7 @@ static void stop_hz_timer(void)
singleshot.timeout_abs_ns = jiffies_to_st(j);
singleshot.flags = 0;
rc = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &singleshot);
-#ifdef CONFIG_XEN_COMPAT_030004
+#if CONFIG_XEN_COMPAT <= 0x030004
if (rc) {
BUG_ON(rc != -ENOSYS);
rc = HYPERVISOR_set_timer_op(singleshot.timeout_abs_ns);
diff -r d9b670f76f51 -r 2b24d842bbd3
linux-2.6-xen-sparse/arch/i386/mach-xen/setup.c
--- a/linux-2.6-xen-sparse/arch/i386/mach-xen/setup.c Thu Apr 05 08:46:54
2007 +0100
+++ b/linux-2.6-xen-sparse/arch/i386/mach-xen/setup.c Thu Apr 05 08:58:32
2007 +0100
@@ -114,7 +114,7 @@ void __init machine_specific_arch_setup(
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event);
if (ret == 0)
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (ret == -ENOSYS)
ret = HYPERVISOR_set_callbacks(
event.address.cs, event.address.eip,
@@ -123,7 +123,7 @@ void __init machine_specific_arch_setup(
BUG_ON(ret);
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (ret == -ENOSYS) {
static struct xennmi_callback __initdata cb = {
.handler_address = (unsigned long)nmi
diff -r d9b670f76f51 -r 2b24d842bbd3
linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Thu Apr 05 08:46:54
2007 +0100
+++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Thu Apr 05 08:58:32
2007 +0100
@@ -312,7 +312,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 CONFIG_XEN_COMPAT <= 0x030002
if (unlikely(rc == -ENOSYS)) {
/* Compatibility when XENMEM_exchange is unsupported. */
if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
@@ -408,7 +408,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 CONFIG_XEN_COMPAT <= 0x030002
if (unlikely(rc == -ENOSYS)) {
/* Compatibility when XENMEM_exchange is unsupported. */
if (HYPERVISOR_memory_op(XENMEM_decrease_reservation,
diff -r d9b670f76f51 -r 2b24d842bbd3
linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S Thu Apr 05
08:46:54 2007 +0100
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S Thu Apr 05
08:58:32 2007 +0100
@@ -152,7 +152,7 @@ ENTRY(empty_zero_page)
ENTRY(empty_zero_page)
.skip PAGE_SIZE
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
/*
* __xen_guest information
*/
@@ -184,17 +184,17 @@ ENTRY(empty_zero_page)
.ascii "|supervisor_mode_kernel"
.ascii ",LOADER=generic"
.byte 0
-#endif /* CONFIG_XEN_COMPAT_030002 */
+#endif /* CONFIG_XEN_COMPAT <= 0x030002 */
ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "linux")
ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "2.6")
ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0")
ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad, __START_KERNEL_map)
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, __START_KERNEL_map)
#else
ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, 0)
-#endif /* !CONFIG_XEN_COMPAT_030002 */
+#endif
ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad, startup_64)
ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad, hypercall_page)
ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, .quad,
_PAGE_PRESENT,_PAGE_PRESENT)
diff -r d9b670f76f51 -r 2b24d842bbd3
linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c Thu Apr 05 08:46:54
2007 +0100
+++ b/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c Thu Apr 05 08:58:32
2007 +0100
@@ -54,7 +54,7 @@ struct dma_mapping_ops* dma_ops;
struct dma_mapping_ops* dma_ops;
EXPORT_SYMBOL(dma_ops);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
unsigned int __kernel_page_user;
EXPORT_SYMBOL(__kernel_page_user);
#endif
@@ -551,7 +551,7 @@ void __init xen_init_pt(void)
addr = page[pud_index(__START_KERNEL_map)];
addr_to_page(addr, page);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
/* On Xen 3.0.2 and older we may need to explicitly specify _PAGE_USER
in kernel PTEs. We check that here. */
if (HYPERVISOR_xen_version(XENVER_version, NULL) <= 0x30000) {
diff -r d9b670f76f51 -r 2b24d842bbd3 linux-2.6-xen-sparse/drivers/xen/Kconfig
--- a/linux-2.6-xen-sparse/drivers/xen/Kconfig Thu Apr 05 08:46:54 2007 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig Thu Apr 05 08:58:32 2007 +0100
@@ -235,13 +235,12 @@ choice
endchoice
-config XEN_COMPAT_030002
- bool
- default XEN_COMPAT_030002_AND_LATER
-
-config XEN_COMPAT_030004
- bool
- default XEN_COMPAT_030002_AND_LATER || XEN_COMPAT_030004_AND_LATER
+config XEN_COMPAT
+ hex
+ default 0xffffff if XEN_COMPAT_LATEST_ONLY
+ default 0x030004 if XEN_COMPAT_030004_AND_LATER
+ default 0x030002 if XEN_COMPAT_030002_AND_LATER
+ default 0
endmenu
diff -r d9b670f76f51 -r 2b24d842bbd3
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 Apr
05 08:46:54 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h Thu Apr
05 08:58:32 2007 +0100
@@ -261,7 +261,7 @@ HYPERVISOR_event_channel_op(
{
int rc = _hypercall2(int, event_channel_op, cmd, arg);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (unlikely(rc == -ENOSYS)) {
struct evtchn_op op;
op.cmd = cmd;
@@ -301,7 +301,7 @@ HYPERVISOR_physdev_op(
{
int rc = _hypercall2(int, physdev_op, cmd, arg);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (unlikely(rc == -ENOSYS)) {
struct physdev_op op;
op.cmd = cmd;
@@ -358,7 +358,7 @@ HYPERVISOR_suspend(
int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
&sched_shutdown, srec);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (rc == -ENOSYS)
rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
SHUTDOWN_suspend, srec);
diff -r d9b670f76f51 -r 2b24d842bbd3
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 Apr
05 08:46:54 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Thu Apr
05 08:58:32 2007 +0100
@@ -146,7 +146,7 @@ HYPERVISOR_yield(
{
int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (rc == -ENOSYS)
rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
#endif
@@ -160,7 +160,7 @@ HYPERVISOR_block(
{
int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (rc == -ENOSYS)
rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
#endif
@@ -178,7 +178,7 @@ HYPERVISOR_shutdown(
int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (rc == -ENOSYS)
rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
#endif
@@ -198,7 +198,7 @@ HYPERVISOR_poll(
set_xen_guest_handle(sched_poll.ports, ports);
rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (rc == -ENOSYS)
rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
#endif
diff -r d9b670f76f51 -r 2b24d842bbd3
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h Thu Apr 05
08:46:54 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h Thu Apr 05
08:58:32 2007 +0100
@@ -102,7 +102,7 @@ static inline unsigned long long pmd_val
static inline unsigned long long pmd_val(pmd_t x)
{
unsigned long long ret = x.pmd;
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (ret) ret = pte_machine_to_phys(ret) | _PAGE_PRESENT;
#else
if (ret & _PAGE_PRESENT) ret = pte_machine_to_phys(ret);
@@ -134,7 +134,7 @@ static inline unsigned long pgd_val(pgd_
static inline unsigned long pgd_val(pgd_t x)
{
unsigned long ret = x.pgd;
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (ret) ret = machine_to_phys(ret) | _PAGE_PRESENT;
#else
if (ret & _PAGE_PRESENT) ret = machine_to_phys(ret);
@@ -197,10 +197,10 @@ extern int page_is_ram(unsigned long pag
#endif
#define __KERNEL_START (__PAGE_OFFSET + __PHYSICAL_START)
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
#undef LOAD_OFFSET
#define LOAD_OFFSET 0
-#endif /* CONFIG_XEN_COMPAT_030002 */
+#endif
#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
diff -r d9b670f76f51 -r 2b24d842bbd3
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 Apr
05 08:46:54 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h Thu Apr
05 08:58:32 2007 +0100
@@ -259,7 +259,7 @@ HYPERVISOR_event_channel_op(
{
int rc = _hypercall2(int, event_channel_op, cmd, arg);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (unlikely(rc == -ENOSYS)) {
struct evtchn_op op;
op.cmd = cmd;
@@ -299,7 +299,7 @@ HYPERVISOR_physdev_op(
{
int rc = _hypercall2(int, physdev_op, cmd, arg);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (unlikely(rc == -ENOSYS)) {
struct physdev_op op;
op.cmd = cmd;
@@ -359,7 +359,7 @@ HYPERVISOR_suspend(
int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
&sched_shutdown, srec);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (rc == -ENOSYS)
rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
SHUTDOWN_suspend, srec);
diff -r d9b670f76f51 -r 2b24d842bbd3
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h Thu Apr
05 08:46:54 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h Thu Apr
05 08:58:32 2007 +0100
@@ -104,7 +104,7 @@ static inline unsigned long pmd_val(pmd_
static inline unsigned long pmd_val(pmd_t x)
{
unsigned long ret = x.pmd;
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (ret) ret = pte_machine_to_phys(ret) | _PAGE_PRESENT;
#else
if (ret & _PAGE_PRESENT) ret = pte_machine_to_phys(ret);
@@ -166,10 +166,10 @@ static inline pgd_t __pgd(unsigned long
#define __PAGE_OFFSET 0xffff880000000000
#endif /* !__ASSEMBLY__ */
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
#undef LOAD_OFFSET
#define LOAD_OFFSET 0
-#endif /* CONFIG_XEN_COMPAT_030002 */
+#endif
/* to align the pointer to the (next) page boundary */
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
diff -r d9b670f76f51 -r 2b24d842bbd3
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h Thu Apr
05 08:46:54 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/pgtable.h Thu Apr
05 08:58:32 2007 +0100
@@ -205,7 +205,7 @@ static inline pte_t ptep_get_and_clear_f
#define _PAGE_PROTNONE 0x080 /* If not present */
#define _PAGE_NX (1UL<<_PAGE_BIT_NX)
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
extern unsigned int __kernel_page_user;
#else
#define __kernel_page_user 0
diff -r d9b670f76f51 -r 2b24d842bbd3
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h
Thu Apr 05 08:46:54 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/setup_arch_post.h
Thu Apr 05 08:58:32 2007 +0100
@@ -39,7 +39,7 @@ 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 CONFIG_XEN_COMPAT <= 0x030002
if (ret == -ENOSYS)
ret = HYPERVISOR_set_callbacks(
event.address,
@@ -50,7 +50,7 @@ static void __init machine_specific_arch
#ifdef CONFIG_X86_LOCAL_APIC
ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
-#ifdef CONFIG_XEN_COMPAT_030002
+#if CONFIG_XEN_COMPAT <= 0x030002
if (ret == -ENOSYS) {
static struct xennmi_callback __initdata cb = {
.handler_address = (unsigned long)nmi
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|