From 4f3230eb632ab458cf561c35bc7b3920c2027dcb Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: [LINUX] PV-on-HVM: Directly include headers which are used in various files rather than relying on them being included indirectly. This is required because these headers are not pulled in indirectly on older kernels. Signed-off-by: Ian Campbell --- unmodified_drivers/linux-2.6/platform-pci/platform-pci.c | 1 + 1 file changed, 1 insertion(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c index 36ad585fbf..75f20dc1d7 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3 From 16d6a52754732197f475c6a70ff9ec171f154972 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Include a Makefile in each subdirectory to maintain compatability with kernels from before Kbuild files were introduced. This follows best practice as described in Documentation/kbuild/modules.txt Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- unmodified_drivers/linux-2.6/blkfront/Makefile | 3 +++ unmodified_drivers/linux-2.6/netfront/Makefile | 3 +++ unmodified_drivers/linux-2.6/platform-pci/Makefile | 3 +++ unmodified_drivers/linux-2.6/xenbus/Makefile | 3 +++ 4 files changed, 12 insertions(+) create mode 100644 unmodified_drivers/linux-2.6/blkfront/Makefile create mode 100644 unmodified_drivers/linux-2.6/netfront/Makefile create mode 100644 unmodified_drivers/linux-2.6/platform-pci/Makefile create mode 100644 unmodified_drivers/linux-2.6/xenbus/Makefile (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/blkfront/Makefile b/unmodified_drivers/linux-2.6/blkfront/Makefile new file mode 100644 index 0000000000..64e7acd194 --- /dev/null +++ b/unmodified_drivers/linux-2.6/blkfront/Makefile @@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif diff --git a/unmodified_drivers/linux-2.6/netfront/Makefile b/unmodified_drivers/linux-2.6/netfront/Makefile new file mode 100644 index 0000000000..64e7acd194 --- /dev/null +++ b/unmodified_drivers/linux-2.6/netfront/Makefile @@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif diff --git a/unmodified_drivers/linux-2.6/platform-pci/Makefile b/unmodified_drivers/linux-2.6/platform-pci/Makefile new file mode 100644 index 0000000000..64e7acd194 --- /dev/null +++ b/unmodified_drivers/linux-2.6/platform-pci/Makefile @@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif diff --git a/unmodified_drivers/linux-2.6/xenbus/Makefile b/unmodified_drivers/linux-2.6/xenbus/Makefile new file mode 100644 index 0000000000..64e7acd194 --- /dev/null +++ b/unmodified_drivers/linux-2.6/xenbus/Makefile @@ -0,0 +1,3 @@ +ifneq ($(KERNELRELEASE),) +include $(src)/Kbuild +endif -- cgit v1.2.3 From 06b12ba822be1347e4eba853fc5cd3b1f23e4595 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Add infrastructure for a compatibility shim in order to support PV-on-HVM drivers for older kernel releases. The compatability code is included in the xen-platform-pci module since this module underpins all the others. Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h | 6 ++++++ unmodified_drivers/linux-2.6/overrides.mk | 2 +- unmodified_drivers/linux-2.6/platform-pci/Kbuild | 2 +- unmodified_drivers/linux-2.6/platform-pci/evtchn.c | 4 ++++ unmodified_drivers/linux-2.6/platform-pci/platform-compat.c | 4 ++++ unmodified_drivers/linux-2.6/platform-pci/platform-pci.c | 4 ++++ unmodified_drivers/linux-2.6/platform-pci/xen_support.c | 4 ++++ 7 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h create mode 100644 unmodified_drivers/linux-2.6/platform-pci/platform-compat.c (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h new file mode 100644 index 0000000000..72b6fd4dee --- /dev/null +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @@ -0,0 +1,6 @@ +#ifndef COMPAT_INCLUDE_XEN_PLATFORM_COMPAT_H +#define COMPAT_INCLUDE_XEN_PLATFORM_COMPAT_H + +#include + +#endif diff --git a/unmodified_drivers/linux-2.6/overrides.mk b/unmodified_drivers/linux-2.6/overrides.mk index 74ef12c4c9..53a96d87a4 100644 --- a/unmodified_drivers/linux-2.6/overrides.mk +++ b/unmodified_drivers/linux-2.6/overrides.mk @@ -9,4 +9,4 @@ EXTRA_CFLAGS += -DCONFIG_XEN_SHADOW_MODE -DCONFIG_XEN_SHADOW_TRANSLATE EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRANT -DXEN_EVTCHN_MASK_OPS EXTRA_CFLAGS += -DCONFIG_XEN_NETDEV_GRANT_RX -DCONFIG_XEN_NETDEV_GRANT_TX EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030202 -EXTRA_CFLAGS += -I$(M)/include +EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_XEN_PLATFORM_COMPAT_H diff --git a/unmodified_drivers/linux-2.6/platform-pci/Kbuild b/unmodified_drivers/linux-2.6/platform-pci/Kbuild index a4c1961a8a..5cd0a348ad 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/Kbuild +++ b/unmodified_drivers/linux-2.6/platform-pci/Kbuild @@ -4,4 +4,4 @@ obj-m := xen-platform-pci.o EXTRA_CFLAGS += -I$(M)/platform-pci -xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o features.o +xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o features.o platform-compat.o diff --git a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c index a38c50c1c4..4bd9592754 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c +++ b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c @@ -36,6 +36,10 @@ #include #include "platform-pci.h" +#ifdef HAVE_XEN_PLATFORM_COMPAT_H +#include +#endif + void *shared_info_area; #define MAX_EVTCHN 256 diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c new file mode 100644 index 0000000000..61ae10dba1 --- /dev/null +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c @@ -0,0 +1,4 @@ +#include +#include + +#include diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c index 75f20dc1d7..9e7fc58ebf 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -39,6 +39,10 @@ #include "platform-pci.h" +#ifdef HAVE_XEN_PLATFORM_COMPAT_H +#include +#endif + #define DRV_NAME "xen-platform-pci" #define DRV_VERSION "0.10" #define DRV_RELDATE "03/03/2005" diff --git a/unmodified_drivers/linux-2.6/platform-pci/xen_support.c b/unmodified_drivers/linux-2.6/platform-pci/xen_support.c index b1a903b1c7..423d2f2e24 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/xen_support.c +++ b/unmodified_drivers/linux-2.6/platform-pci/xen_support.c @@ -26,6 +26,10 @@ #include #include "platform-pci.h" +#ifdef HAVE_XEN_PLATFORM_COMPAT_H +#include +#endif + void xen_machphys_update(unsigned long mfn, unsigned long pfn) { BUG(); -- cgit v1.2.3 From 3dd858632a6cfd1b55e38395f6fd143f7ae96f6c Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Add a compatibility linux/io.h for kernels before 2.6.16 Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- unmodified_drivers/linux-2.6/compat-include/linux/io.h | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 unmodified_drivers/linux-2.6/compat-include/linux/io.h (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/linux/io.h b/unmodified_drivers/linux-2.6/compat-include/linux/io.h new file mode 100644 index 0000000000..10499023a5 --- /dev/null +++ b/unmodified_drivers/linux-2.6/compat-include/linux/io.h @@ -0,0 +1,10 @@ +#ifndef _LINUX_IO_H +#define _LINUX_IO_H + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) +#error "This version of Linux should not need compat linux/io.h" +#endif + +#include + +#endif -- cgit v1.2.3 From 212cd2b3a01cedec944d143b8bb0024628a2f382 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Add a compatibility linux/mutex.h for kernels before 2.6.16. This implements the new mutex type in terms of the old semaphore type. Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- .../linux-2.6/compat-include/linux/mutex.h | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 unmodified_drivers/linux-2.6/compat-include/linux/mutex.h (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/linux/mutex.h b/unmodified_drivers/linux-2.6/compat-include/linux/mutex.h new file mode 100644 index 0000000000..fcb4a899c7 --- /dev/null +++ b/unmodified_drivers/linux-2.6/compat-include/linux/mutex.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2006 Cisco Systems. All rights reserved. + * + * This file is released under the GPLv2. + */ + +/* mutex compatibility for pre-2.6.16 kernels */ + +#ifndef __LINUX_MUTEX_H +#define __LINUX_MUTEX_H + +#include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) +#error "This version of Linux should not need compat mutex.h" +#endif + +#include +#include + +#define mutex semaphore +#define DEFINE_MUTEX(foo) DECLARE_MUTEX(foo) +#define mutex_init(foo) init_MUTEX(foo) +#define mutex_lock(foo) down(foo) +#define mutex_lock_interruptible(foo) down_interruptible(foo) +/* this function follows the spin_trylock() convention, so * + * it is negated to the down_trylock() return values! Be careful */ +#define mutex_trylock(foo) !down_trylock(foo) +#define mutex_unlock(foo) up(foo) + +#endif /* __LINUX_MUTEX_H */ -- cgit v1.2.3 From da611bef470513702e4d94979b289c5d9439e58d Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Include compatability headers for asm/pgtable-no{pmd,pud}.h for kernels before 2.6.11. Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- .../linux-2.6/compat-include/asm-generic/pgtable-nopmd.h | 14 ++++++++++++++ .../linux-2.6/compat-include/asm-generic/pgtable-nopud.h | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h create mode 100644 unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h b/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h new file mode 100644 index 0000000000..ebde567575 --- /dev/null +++ b/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h @@ -0,0 +1,14 @@ +#ifndef _PGTABLE_NOPMD_H +#define _PGTABLE_NOPMD_H + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) +#error "This version of Linux should not need compat pgtable-nopmd.h" +#endif + +#define pud_t pgd_t +#define pud_offset(d, va) d +#define pud_none(pud) 0 +#define pud_present(pud) 1 +#define PTRS_PER_PUD 1 + +#endif /* _PGTABLE_NOPMD_H */ diff --git a/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h b/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h new file mode 100644 index 0000000000..8b23299dd0 --- /dev/null +++ b/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h @@ -0,0 +1,14 @@ +#ifndef _PGTABLE_NOPUD_H +#define _PGTABLE_NOPUD_H + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) +#error "This version of Linux should not need compat pgtable-nopud.h" +#endif + +#define pud_t pgd_t +#define pud_offset(d, va) d +#define pud_none(pud) 0 +#define pud_present(pud) 1 +#define PTRS_PER_PUD 1 + +#endif /* _PGTABLE_NOPUD_H */ -- cgit v1.2.3 From 6b8b36040d478d336d3c93e87dec37594cc64a79 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-to-HVM: Add compatibility definitions of various #defines when they are not present in the kernel we are building against. Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- .../linux-2.6/compat-include/xen/platform-compat.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h index 72b6fd4dee..cccdabf258 100644 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @@ -3,4 +3,26 @@ #include +#include + +#if defined(__LINUX_COMPILER_H) && !defined(__always_inline) +#define __always_inline inline +#endif + +#if defined(__LINUX_SPINLOCK_H) && !defined(DEFINE_SPINLOCK) +#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED +#endif + +#if defined(_LINUX_INIT_H) && !defined(__init) +#define __init +#endif + +#if defined(__LINUX_CACHE_H) && !defined(__read_mostly) +#define __read_mostly +#endif + +#if defined(_LINUX_SKBUFF_H) && !defined(NET_IP_ALIGN) +#define NET_IP_ALIGN 0 +#endif + #endif -- cgit v1.2.3 From c957115a57ccc35365571c1950ef903fab95a434 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-to-HVM: Implement compatibility nonseekable_open as a nop on kernels before 2.6.9 Signed-off-by: Ian Campbell --- unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h index cccdabf258..191777a8ff 100644 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @@ -25,4 +25,8 @@ #define NET_IP_ALIGN 0 #endif +#if defined(_LINUX_FS_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) +#define nonseekable_open(inode, filp) /* Nothing to do */ +#endif + #endif -- cgit v1.2.3 From f3bebe5fecaa3bcee1f21fe528c0de85725d7715 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Define system_state as 1 (SYSTEM_RUNNING) on kernels prior to 2.6.7. These kernels did not export the system_state variable to modules. Signed-off-by: Ian Campbell --- unmodified_drivers/linux-2.6/platform-pci/platform-compat.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c index 61ae10dba1..c6fa5b81da 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c @@ -1,4 +1,11 @@ #include #include +#include + #include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) +static int system_state = 1; +EXPORT_SYMBOL(system_state); +#endif -- cgit v1.2.3 From 4bfff95df70a42b4540928566e664c0349cbd8cc Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Kernels prior to 2.6.8 did not export strcspn to modules therefore implement our own and export it. Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- .../linux-2.6/platform-pci/platform-compat.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c index c6fa5b81da..6538964ecf 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c @@ -9,3 +9,23 @@ static int system_state = 1; EXPORT_SYMBOL(system_state); #endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) +size_t strcspn(const char *s, const char *reject) +{ + const char *p; + const char *r; + size_t count = 0; + + for (p = s; *p != '\0'; ++p) { + for (r = reject; *r != '\0'; ++r) { + if (*p == *r) + return count; + } + ++count; + } + + return count; +} +EXPORT_SYMBOL(strcspn); +#endif -- cgit v1.2.3 From 5a246a63328b8768b0270490281c9945bb124fd5 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Include compatability vmalloc_to_pfn for kernels before 2.6.10 Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- .../linux-2.6/compat-include/xen/platform-compat.h | 4 ++++ unmodified_drivers/linux-2.6/platform-pci/platform-compat.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h index 191777a8ff..185a97449c 100644 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @@ -29,4 +29,8 @@ #define nonseekable_open(inode, filp) /* Nothing to do */ #endif +#if defined(_LINUX_MM_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) +unsigned long vmalloc_to_pfn(void *addr); +#endif + #endif diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c index 6538964ecf..b79006bc21 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c @@ -1,6 +1,7 @@ #include #include +#include #include #include @@ -29,3 +30,14 @@ size_t strcspn(const char *s, const char *reject) } EXPORT_SYMBOL(strcspn); #endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) +/* + * Map a vmalloc()-space virtual address to the physical page frame number. + */ +unsigned long vmalloc_to_pfn(void * vmalloc_addr) +{ + return page_to_pfn(vmalloc_to_page(vmalloc_addr)); +} +EXPORT_SYMBOL(vmalloc_to_pfn); +#endif -- cgit v1.2.3 From e46b787ee33cfbec5438c60ada2014184bf0abf0 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Implement compatibilty version of wait_for_completion_timeout for kernels before 2.6.11 Signed-off-by: Ian Campbell --- .../linux-2.6/compat-include/xen/platform-compat.h | 4 +++ .../linux-2.6/platform-pci/platform-compat.c | 32 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h index 185a97449c..1026f97653 100644 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @@ -33,4 +33,8 @@ unsigned long vmalloc_to_pfn(void *addr); #endif +#if defined(__LINUX_COMPLETION_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) +unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout); +#endif + #endif diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c index b79006bc21..f13d54b15c 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c @@ -3,6 +3,7 @@ #include #include +#include #include @@ -41,3 +42,34 @@ unsigned long vmalloc_to_pfn(void * vmalloc_addr) } EXPORT_SYMBOL(vmalloc_to_pfn); #endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) +unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout) +{ + might_sleep(); + + spin_lock_irq(&x->wait.lock); + if (!x->done) { + DECLARE_WAITQUEUE(wait, current); + + wait.flags |= WQ_FLAG_EXCLUSIVE; + __add_wait_queue_tail(&x->wait, &wait); + do { + __set_current_state(TASK_UNINTERRUPTIBLE); + spin_unlock_irq(&x->wait.lock); + timeout = schedule_timeout(timeout); + spin_lock_irq(&x->wait.lock); + if (!timeout) { + __remove_wait_queue(&x->wait, &wait); + goto out; + } + } while (!x->done); + __remove_wait_queue(&x->wait, &wait); + } + x->done--; +out: + spin_unlock_irq(&x->wait.lock); + return timeout; +} +EXPORT_SYMBOL(wait_for_completion_timeout); +#endif -- cgit v1.2.3 From cd77de667312b7d3c1117a019d1b183b36e16604 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Implement and export a compatibility version of do_exit(). Kernels prior to 2.6.12 did not export do_exit(). Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- .../linux-2.6/platform-pci/platform-compat.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c index f13d54b15c..2df38d806b 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c @@ -73,3 +73,18 @@ out: } EXPORT_SYMBOL(wait_for_completion_timeout); #endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12) +/* + fake do_exit using complete_and_exit + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) +asmlinkage NORET_TYPE void do_exit(long code) +#else +fastcall NORET_TYPE void do_exit(long code) +#endif +{ + complete_and_exit(NULL, code); +} +EXPORT_SYMBOL_GPL(do_exit); +#endif -- cgit v1.2.3 From f81a7efad89b56fa1782995b1527ba831e1a2057 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-to-HVM: Impletement compatibility version of schedule_timeout_interruptible for kernels before 2.6.14 Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- .../linux-2.6/compat-include/xen/platform-compat.h | 4 ++++ unmodified_drivers/linux-2.6/platform-pci/platform-compat.c | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h index 1026f97653..6c08dad47d 100644 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @@ -37,4 +37,8 @@ unsigned long vmalloc_to_pfn(void *addr); unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout); #endif +#if defined(_LINUX_SCHED_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) +signed long schedule_timeout_interruptible(signed long timeout); +#endif + #endif diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c index 2df38d806b..f7c8db7fcd 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c @@ -88,3 +88,12 @@ fastcall NORET_TYPE void do_exit(long code) } EXPORT_SYMBOL_GPL(do_exit); #endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) +signed long schedule_timeout_interruptible(signed long timeout) +{ + __set_current_state(TASK_INTERRUPTIBLE); + return schedule_timeout(timeout); +} +EXPORT_SYMBOL(schedule_timeout_interruptible); +#endif -- cgit v1.2.3 From 4a154f7453f2de0094505d13757c080345a5868e Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-on-HVM: Include compatibility kzalloc implementation for kernels before 2.6.14. Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- .../linux-2.6/compat-include/xen/platform-compat.h | 4 ++++ .../linux-2.6/platform-pci/platform-compat.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h index 6c08dad47d..219382c3c1 100644 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @@ -41,4 +41,8 @@ unsigned long wait_for_completion_timeout(struct completion *x, unsigned long ti signed long schedule_timeout_interruptible(signed long timeout); #endif +#if defined(_LINUX_SLAB_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) +void *kzalloc(size_t size, int flags); +#endif + #endif diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c index f7c8db7fcd..f3cef11620 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -97,3 +98,19 @@ signed long schedule_timeout_interruptible(signed long timeout) } EXPORT_SYMBOL(schedule_timeout_interruptible); #endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) +/** + * kzalloc - allocate memory. The memory is set to zero. + * @size: how many bytes of memory are required. + * @flags: the type of memory to allocate. + */ +void *kzalloc(size_t size, int flags) +{ + void *ret = kmalloc(size, flags); + if (ret) + memset(ret, 0, size); + return ret; +} +EXPORT_SYMBOL(kzalloc); +#endif -- cgit v1.2.3 From a0b780220aaf7562ceaf0e8ff32dd1047deef7c0 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Oct 2006 13:58:30 +0100 Subject: PV-to-HVM: Add a compatibility define for the end_that_request_last which changed prototype in 2.6.16. Signed-off-by: Ian Campbell Signed-off-by: K. Y. Srinivasan Signed-off-by: Tsunehisa Doi --- unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h index 219382c3c1..4978c63610 100644 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @@ -45,4 +45,8 @@ signed long schedule_timeout_interruptible(signed long timeout); void *kzalloc(size_t size, int flags); #endif +#if defined(_LINUX_BLKDEV_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) +#define end_that_request_last(req, uptodate) end_that_request_last(req) +#endif + #endif -- cgit v1.2.3