diff --git a/.gitignore b/.gitignore index 017856c93e..4ca679ddbc 100644 --- a/.gitignore +++ b/.gitignore @@ -326,10 +326,6 @@ xen/xen xen/xen-syms xen/xen-syms.map xen/xen.* -unmodified_drivers/linux-2.6/.tmp_versions -unmodified_drivers/linux-2.6/*.cmd -unmodified_drivers/linux-2.6/*.ko -unmodified_drivers/linux-2.6/*.mod.c LibVNCServer* tools/qemu-xen-dir-remote diff --git a/.hgignore b/.hgignore index 10025c8793..2d41670632 100644 --- a/.hgignore +++ b/.hgignore @@ -326,8 +326,4 @@ ^xen/xen$ ^xen/xen-syms$ ^xen/xen\..*$ -^unmodified_drivers/linux-2.6/\.tmp_versions -^unmodified_drivers/linux-2.6/.*\.cmd$ -^unmodified_drivers/linux-2.6/.*\.ko$ -^unmodified_drivers/linux-2.6/.*\.mod\.c$ ^LibVNCServer.* diff --git a/MAINTAINERS b/MAINTAINERS index 4f91842a60..d5edfc142a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -421,12 +421,6 @@ F: */configure F: */*.ac F: tools/ -UNMODIFIED LINUX PV DRIVERS -M: Jan Beulich -S: Obsolete -L: xen-devel@lists.xenproject.org -F: unmodified_drivers/linux-2.6/ - VM EVENT, MEM ACCESS and MONITOR M: Tamas K Lengyel R: Alexandru Isaila diff --git a/unmodified_drivers/linux-2.6/Makefile b/unmodified_drivers/linux-2.6/Makefile deleted file mode 100644 index a5c6967209..0000000000 --- a/unmodified_drivers/linux-2.6/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include $(M)/overrides.mk - -obj-m += platform-pci/ -obj-m += balloon/ -obj-m += blkfront/ -obj-m += netfront/ -obj-m += scsifront/ -obj-m += usbfront/ diff --git a/unmodified_drivers/linux-2.6/README b/unmodified_drivers/linux-2.6/README deleted file mode 100644 index 1d673eb50a..0000000000 --- a/unmodified_drivers/linux-2.6/README +++ /dev/null @@ -1,24 +0,0 @@ -These drivers provide paravirtualised drivers for pre-PVops Linux -kernels which have the classic-Xen patches applied. They do not work -with kernels which are not patched with the classic-Xen patches. In -particular this includes all PVops kernels. - -For 2.6.36 and newer you should use the "PVHVM" functionality which is -available in the mainline kernel. - -To build do one of: - - ./mkbuildtree [] - NB. You can override paths to Xen sources and a (stub) XenLinux - build tree via the XEN and XL environment variable. - -- or - - make -C /path/to/kernel/build M=$PWD modules - NB. This is your native kernel build tree (or a distro provided - stub), not the XenLinux sources referred to in step 1. - NB. If you are cross compiling, you need to set ARCH and - CROSS_COMPILE too. - -You get four modules, xen-platform-pci.ko, xen-vbd.ko, xen-vnif.ko and -xen-balloon.ko. Load xen-platform-pci first, and then -whichever of xen-vbd, xen-vnif and xen-balloon.ko you happen to need. diff --git a/unmodified_drivers/linux-2.6/balloon/Kbuild b/unmodified_drivers/linux-2.6/balloon/Kbuild deleted file mode 100644 index 316592d83a..0000000000 --- a/unmodified_drivers/linux-2.6/balloon/Kbuild +++ /dev/null @@ -1,8 +0,0 @@ -include $(M)/overrides.mk - -obj-m = xen-balloon.o - -EXTRA_CFLAGS += -I$(M)/platform-pci - -xen-balloon-y := balloon.o sysfs.o -xen-balloon-$(CONFIG_XEN_SCRUB_PAGES) += scrub.o diff --git a/unmodified_drivers/linux-2.6/balloon/Makefile b/unmodified_drivers/linux-2.6/balloon/Makefile deleted file mode 100644 index 64e7acd194..0000000000 --- a/unmodified_drivers/linux-2.6/balloon/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifneq ($(KERNELRELEASE),) -include $(src)/Kbuild -endif diff --git a/unmodified_drivers/linux-2.6/blkfront/Kbuild b/unmodified_drivers/linux-2.6/blkfront/Kbuild deleted file mode 100644 index 0a46fb22c3..0000000000 --- a/unmodified_drivers/linux-2.6/blkfront/Kbuild +++ /dev/null @@ -1,5 +0,0 @@ -include $(M)/overrides.mk - -obj-m += xen-vbd.o - -xen-vbd-objs := blkfront.o vbd.o diff --git a/unmodified_drivers/linux-2.6/blkfront/Makefile b/unmodified_drivers/linux-2.6/blkfront/Makefile deleted file mode 100644 index 64e7acd194..0000000000 --- a/unmodified_drivers/linux-2.6/blkfront/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifneq ($(KERNELRELEASE),) -include $(src)/Kbuild -endif 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 deleted file mode 100644 index ebde567575..0000000000 --- a/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h +++ /dev/null @@ -1,14 +0,0 @@ -#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 deleted file mode 100644 index 05c9675760..0000000000 --- a/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h +++ /dev/null @@ -1,15 +0,0 @@ -#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 pud_bad(pud) 0 -#define PTRS_PER_PUD 1 - -#endif /* _PGTABLE_NOPUD_H */ diff --git a/unmodified_drivers/linux-2.6/compat-include/linux/io.h b/unmodified_drivers/linux-2.6/compat-include/linux/io.h deleted file mode 100644 index 10499023a5..0000000000 --- a/unmodified_drivers/linux-2.6/compat-include/linux/io.h +++ /dev/null @@ -1,10 +0,0 @@ -#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 diff --git a/unmodified_drivers/linux-2.6/compat-include/linux/mutex.h b/unmodified_drivers/linux-2.6/compat-include/linux/mutex.h deleted file mode 100644 index fcb4a899c7..0000000000 --- a/unmodified_drivers/linux-2.6/compat-include/linux/mutex.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 */ diff --git a/unmodified_drivers/linux-2.6/compat-include/linux/scatterlist.h b/unmodified_drivers/linux-2.6/compat-include/linux/scatterlist.h deleted file mode 100644 index e26a6acb51..0000000000 --- a/unmodified_drivers/linux-2.6/compat-include/linux/scatterlist.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _LINUX_SCATTERLIST_H -#define _LINUX_SCATTERLIST_H - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) -#error "This version of Linux should not need compat linux/scatterlist.h" -#endif - -#include - -#endif /* _LINUX_SCATTERLIST_H */ 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 deleted file mode 100644 index 57afc726c7..0000000000 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef COMPAT_INCLUDE_XEN_PLATFORM_COMPAT_H -#define COMPAT_INCLUDE_XEN_PLATFORM_COMPAT_H - -#include -#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 - -#ifdef _LINUX_INIT_H - -#ifndef __init -#define __init -#endif - -#ifndef __devinit -#define __devinit -#define __devinitdata -#endif - -#endif /* _LINUX_INIT_H */ - -#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 - -#if defined(_LINUX_SKBUFF_H) && !defined(CHECKSUM_HW) -#define CHECKSUM_HW CHECKSUM_PARTIAL -#endif - -#if defined(_LINUX_ERR_H) && !defined(IS_ERR_VALUE) -#define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L) -#endif - -#if defined(_ASM_IA64_PGTABLE_H) && !defined(_PGTABLE_NOPUD_H) -#include -#endif - -/* Some kernels have this typedef backported so we cannot reliably - * detect based on version number, hence we forcibly #define it. - */ -#if defined(__LINUX_TYPES_H) || defined(__LINUX_GFP_H) || defined(_LINUX_KERNEL_H) -#define gfp_t unsigned -#endif - -#if defined(_LINUX_NOTIFIER_H) && !defined(ATOMIC_NOTIFIER_HEAD) -#define ATOMIC_NOTIFIER_HEAD(name) struct notifier_block *name -#define atomic_notifier_chain_register(chain,nb) notifier_chain_register(chain,nb) -#define atomic_notifier_chain_unregister(chain,nb) notifier_chain_unregister(chain,nb) -#define atomic_notifier_call_chain(chain,val,v) notifier_call_chain(chain,val,v) -#endif - -#if defined(_LINUX_NOTIFIER_H) && !defined(BLOCKING_NOTIFIER_HEAD) -#define BLOCKING_NOTIFIER_HEAD(name) struct notifier_block *name -#define blocking_notifier_chain_register(chain,nb) notifier_chain_register(chain,nb) -#define blocking_notifier_chain_unregister(chain,nb) notifier_chain_unregister(chain,nb) -#define blocking_notifier_call_chain(chain,val,v) notifier_call_chain(chain,val,v) -#endif - -#if defined(_LINUX_MM_H) && defined set_page_count -#define init_page_count(page) set_page_count(page, 1) -#endif - -#if defined(__LINUX_GFP_H) && !defined __GFP_NOMEMALLOC -#define __GFP_NOMEMALLOC 0 -#endif - -#if defined(_LINUX_FS_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) -#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 - -#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 - -#if defined(_LINUX_SCHED_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) -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 - -#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 - -#if defined(_LINUX_CAPABILITY_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) -#define capable(cap) (1) -#endif - -#if defined(_LINUX_KERNEL_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -extern char *kasprintf(gfp_t gfp, const char *fmt, ...) - __attribute__ ((format (printf, 2, 3))); -#endif - -#if defined(_LINUX_SYSRQ_H) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) -#define handle_sysrq(x,y,z) handle_sysrq(x,y) -#endif - -#if defined(_PAGE_PRESENT) && !defined(_PAGE_NX) -#define _PAGE_NX 0 -/* - * This variable at present is referenced by netfront, but only in code that - * is dead when running in hvm guests. To detect potential active uses of it - * in the future, don't try to supply a 'valid' value here, so that any - * mappings created with it will fault when accessed. - */ -#define __supported_pte_mask ((maddr_t)0) -#endif - -/* This code duplication is not ideal, but || does not seem to properly - * short circuit in a #if condition. - **/ -#if defined(_LINUX_NETDEVICE_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#if !defined(SLE_VERSION) -#define netif_tx_lock_bh(dev) spin_lock_bh(&(dev)->xmit_lock) -#define netif_tx_unlock_bh(dev) spin_unlock_bh(&(dev)->xmit_lock) -#elif SLE_VERSION_CODE < SLE_VERSION(10,1,0) -#define netif_tx_lock_bh(dev) spin_lock_bh(&(dev)->xmit_lock) -#define netif_tx_unlock_bh(dev) spin_unlock_bh(&(dev)->xmit_lock) -#endif -#endif - -#if defined(__LINUX_SEQLOCK_H) && !defined(DEFINE_SEQLOCK) -#define DEFINE_SEQLOCK(x) seqlock_t x = SEQLOCK_UNLOCKED -#endif - -/* Bug in RHEL4-U3: rw_lock_t is mistakenly defined in DEFINE_RWLOCK() macro */ -#if defined(__LINUX_SPINLOCK_H) && defined(DEFINE_RWLOCK) -#define rw_lock_t rwlock_t -#endif - -#if defined(__LINUX_SPINLOCK_H) && !defined(DEFINE_RWLOCK) -#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED -#endif - -#if defined(_LINUX_INTERRUPT_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -/** - * RHEL4-U5 pulled back this feature into the older kernel - * Since it is a typedef, and not a macro - detect this kernel via - * RHEL_VERSION - */ -#if !defined(RHEL_VERSION) || (RHEL_VERSION == 4 && RHEL_UPDATE < 5) -#if !defined(RHEL_MAJOR) || (RHEL_MAJOR == 4 && RHEL_MINOR < 5) -typedef irqreturn_t (*irq_handler_t)(int, void *, struct pt_regs *); -#endif -#endif -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) -#define setup_xen_features xen_setup_features -#endif - -#ifndef atomic_cmpxchg -#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) -#endif - -#ifdef sync_test_bit -#define synch_change_bit sync_change_bit -#define synch_clear_bit sync_clear_bit -#define synch_set_bit sync_set_bit -#define synch_test_and_change_bit sync_test_and_change_bit -#define synch_test_and_clear_bit sync_test_and_clear_bit -#define synch_test_and_set_bit sync_test_and_set_bit -#define synch_test_bit sync_test_bit -#endif - -#endif diff --git a/unmodified_drivers/linux-2.6/mkbuildtree b/unmodified_drivers/linux-2.6/mkbuildtree deleted file mode 100755 index 3aca16d6b0..0000000000 --- a/unmodified_drivers/linux-2.6/mkbuildtree +++ /dev/null @@ -1,100 +0,0 @@ -#! /bin/sh - -if [ $1 ]; then - uname="$1" -else - uname=`uname -m` - echo "Defaulting to this machine's architecture, $uname, for linking." - echo "This may be overridden on the command line (i386,x86_64,ia64)." -fi - -C=$(cd $(dirname $0) && pwd) -R=${C%/*/*} - -if [ -n "$XEN" -a -d "$XEN" ]; then - XEN=$(cd $XEN && pwd) -else - XEN=$R/xen -fi -echo "Xen tree: $XEN" - -if [ -n "$XL" -a -d "$XL" ]; then - XL=$(cd $XL && pwd) -else - XL=$R/linux-2.6.18-xen.hg -fi -echo "Linux tree: $XL" - -cd $C - -for d in $(find ${XL}/drivers/xen/ -mindepth 1 -maxdepth 1 -type d); do - test -d $(basename $d) || continue - lndir $d $(basename $d) > /dev/null 2>&1 -done - -ln -sf ${XL}/drivers/xen/core/gnttab.c platform-pci -if [ -f ${XL}/drivers/xen/core/features.c ]; then - ln -sf ${XL}/drivers/xen/core/features.c platform-pci -else - ln -sf ${XL}/drivers/xen/features.c platform-pci -fi -ln -sf ${XL}/drivers/xen/core/xen_proc.c xenbus -ln -sf ${XL}/drivers/xen/core/reboot.c platform-pci - -mkdir -p include/asm include/xen - -lndir -silent ${XL}/include/xen include/xen -ln -nsf ${XEN}/include/public include/xen/interface - -# Need to be quite careful here: we don't want the files we link in to -# risk overriding the native Linux ones (in particular, system.h must -# be native and not xenolinux). -case "$uname" in -i[34567]86|x86_64) - if [ -d ${XL}/arch/x86/include/mach-xen ]; then - ln -sf ${XL}/arch/x86/include/mach-xen/asm/hypervisor.h include/asm - ln -sf ${XL}/arch/x86/include/mach-xen/asm/hypercall*.h include/asm - ln -sf ${XL}/arch/x86/include/mach-xen/asm/synch_bitops*.h include/asm - ln -sf ${XL}/arch/x86/include/mach-xen/asm/maddr*.h include/asm - ln -sf ${XL}/arch/x86/include/mach-xen/asm/gnttab_dma.h include/asm - ln -sf ${XL}/arch/x86/lib/scrub.c balloon - elif [ -d ${XL}/include/asm-x86 ]; then - ln -sf ${XL}/include/asm-x86/mach-xen/asm/hypervisor.h include/asm - ln -sf ${XL}/include/asm-x86/mach-xen/asm/hypercall*.h include/asm - ln -sf ${XL}/include/asm-x86/mach-xen/asm/synch_bitops*.h include/asm - ln -sf ${XL}/include/asm-x86/mach-xen/asm/maddr*.h include/asm - ln -sf ${XL}/include/asm-x86/mach-xen/asm/gnttab_dma.h include/asm - ln -sf ${XL}/arch/x86/lib/scrub.c balloon - else - if [ $uname = x86_64 ]; then - mkdir -p include/asm-i386 - lndir -silent ${XL}/include/asm-i386 include/asm-i386 - else - uname=i386 - fi - ln -sf ${XL}/include/asm-$uname/mach-xen/asm/hypervisor.h include/asm - ln -sf ${XL}/include/asm-$uname/mach-xen/asm/hypercall.h include/asm - ln -sf ${XL}/include/asm-$uname/mach-xen/asm/synch_bitops.h include/asm - ln -sf ${XL}/include/asm-$uname/mach-xen/asm/maddr.h include/asm - ln -sf ${XL}/include/asm-$uname/mach-xen/asm/gnttab_dma.h include/asm - fi - ;; -"ia64") - ln -sf ${XL}/include/asm-ia64/hypervisor.h include/asm - ln -sf ${XL}/include/asm-ia64/hypercall.h include/asm - ln -sf ${XL}/include/asm-ia64/synch_bitops.h include/asm - ln -sf ${XL}/include/asm-ia64/maddr.h include/asm - ln -sf ${XL}/include/asm-ia64/gnttab_dma.h include/asm - mkdir -p include/asm/xen - ln -sf ${XL}/include/asm-ia64/xen/xcom_hcall.h include/asm/xen - ln -sf ${XL}/include/asm-ia64/xen/xencomm.h include/asm/xen - ln -sf ${XL}/arch/ia64/xen/xcom_hcall.c platform-pci/ - ln -sf ${XL}/arch/ia64/xen/xcom_asm.S platform-pci/ - ln -sf ${XL}/arch/ia64/xen/xencomm.c platform-pci/xencomm_arch.c - ln -sf ${XL}/drivers/xen/core/xencomm.c platform-pci - ;; -*) - echo unknown architecture $uname - exit 1 - ;; -esac diff --git a/unmodified_drivers/linux-2.6/netfront/Kbuild b/unmodified_drivers/linux-2.6/netfront/Kbuild deleted file mode 100644 index 486c2a0a77..0000000000 --- a/unmodified_drivers/linux-2.6/netfront/Kbuild +++ /dev/null @@ -1,5 +0,0 @@ -include $(M)/overrides.mk - -obj-m = xen-vnif.o -xen-vnif-objs := netfront.o -xen-vnif-objs += accel.o diff --git a/unmodified_drivers/linux-2.6/netfront/Makefile b/unmodified_drivers/linux-2.6/netfront/Makefile deleted file mode 100644 index 64e7acd194..0000000000 --- a/unmodified_drivers/linux-2.6/netfront/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifneq ($(KERNELRELEASE),) -include $(src)/Kbuild -endif diff --git a/unmodified_drivers/linux-2.6/overrides.mk b/unmodified_drivers/linux-2.6/overrides.mk deleted file mode 100644 index 803eccd3be..0000000000 --- a/unmodified_drivers/linux-2.6/overrides.mk +++ /dev/null @@ -1,18 +0,0 @@ -# Hack: we need to use the config which was used to build the kernel, -# except that that won't have the right headers etc., so duplicate -# some of the mach-xen infrastructure in here. -# -# (i.e. we need the native config for things like -mregparm, but -# a Xen kernel to find the right headers) -_XEN_CPPFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030205 -_XEN_CPPFLAGS += -DCONFIG_XEN_COMPAT=0xffffff -_XEN_CPPFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_XEN_PLATFORM_COMPAT_H -ifeq ($(ARCH),ia64) - _XEN_CPPFLAGS += -DCONFIG_VMX_GUEST -endif - -_XEN_CPPFLAGS += -include $(wildcard $(objtree)/include/*/autoconf.h) - -EXTRA_CFLAGS += $(_XEN_CPPFLAGS) -EXTRA_AFLAGS += $(_XEN_CPPFLAGS) -CPPFLAGS := -I$(M)/include $(CPPFLAGS) diff --git a/unmodified_drivers/linux-2.6/platform-pci/Kbuild b/unmodified_drivers/linux-2.6/platform-pci/Kbuild deleted file mode 100644 index 7b332ee804..0000000000 --- a/unmodified_drivers/linux-2.6/platform-pci/Kbuild +++ /dev/null @@ -1,22 +0,0 @@ -include $(M)/overrides.mk - -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 -xen-platform-pci-objs += features.o platform-compat.o -xen-platform-pci-objs += reboot.o machine_reboot.o -xen-platform-pci-objs += panic-handler.o - -xen-platform-pci-objs += ../xenbus/xenbus_comms.o -xen-platform-pci-objs += ../xenbus/xenbus_xs.o -xen-platform-pci-objs += ../xenbus/xenbus_probe.o -xen-platform-pci-objs += ../xenbus/xenbus_dev.o -xen-platform-pci-objs += ../xenbus/xenbus_client.o -xen-platform-pci-objs += ../xenbus/xen_proc.o - -# Can we do better ? -ifeq ($(ARCH),ia64) - xen-platform-pci-objs += xencomm.o xencomm_arch.o xcom_hcall.o xcom_asm.o -endif diff --git a/unmodified_drivers/linux-2.6/platform-pci/Makefile b/unmodified_drivers/linux-2.6/platform-pci/Makefile deleted file mode 100644 index 64e7acd194..0000000000 --- a/unmodified_drivers/linux-2.6/platform-pci/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifneq ($(KERNELRELEASE),) -include $(src)/Kbuild -endif diff --git a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c deleted file mode 100644 index b72e37a2dd..0000000000 --- a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c +++ /dev/null @@ -1,362 +0,0 @@ -/****************************************************************************** - * evtchn.c - * - * A simplified event channel for para-drivers in unmodified linux - * - * Copyright (c) 2002-2005, K A Fraser - * Copyright (c) 2005, Intel Corporation - * - * This file may be distributed separately from the Linux kernel, or - * incorporated into other software packages, subject to the following license: - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this source file (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, modify, - * merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include "platform-pci.h" - -#ifdef HAVE_XEN_PLATFORM_COMPAT_H -#include -#endif - -void *shared_info_area; - -#define is_valid_evtchn(x) ((x) != 0) -#define evtchn_from_irq(x) (irq_evtchn[irq].evtchn) - -static struct { - spinlock_t lock; - irq_handler_t handler; - void *dev_id; - int evtchn; - int close:1; /* close on unbind_from_irqhandler()? */ - int inuse:1; - int in_handler:1; -} irq_evtchn[256]; -static int evtchn_to_irq[NR_EVENT_CHANNELS] = { - [0 ... NR_EVENT_CHANNELS-1] = -1 }; - -static DEFINE_SPINLOCK(irq_alloc_lock); - -static int alloc_xen_irq(void) -{ - static int warned; - int irq; - - spin_lock(&irq_alloc_lock); - - for (irq = 1; irq < ARRAY_SIZE(irq_evtchn); irq++) { - if (irq_evtchn[irq].inuse) - continue; - irq_evtchn[irq].inuse = 1; - spin_unlock(&irq_alloc_lock); - return irq; - } - - if (!warned) { - warned = 1; - printk(KERN_WARNING "No available IRQ to bind to: " - "increase irq_evtchn[] size in evtchn.c.\n"); - } - - spin_unlock(&irq_alloc_lock); - - return -ENOSPC; -} - -static void free_xen_irq(int irq) -{ - spin_lock(&irq_alloc_lock); - irq_evtchn[irq].inuse = 0; - spin_unlock(&irq_alloc_lock); -} - -int irq_to_evtchn_port(int irq) -{ - return irq_evtchn[irq].evtchn; -} -EXPORT_SYMBOL(irq_to_evtchn_port); - -void mask_evtchn(int port) -{ - shared_info_t *s = shared_info_area; - synch_set_bit(port, &s->evtchn_mask[0]); -} -EXPORT_SYMBOL(mask_evtchn); - -void unmask_evtchn(int port) -{ - evtchn_unmask_t op = { .port = port }; - VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &op)); -} -EXPORT_SYMBOL(unmask_evtchn); - -int bind_listening_port_to_irqhandler( - unsigned int remote_domain, - irq_handler_t handler, - unsigned long irqflags, - const char *devname, - void *dev_id) -{ - struct evtchn_alloc_unbound alloc_unbound; - int err, irq; - - irq = alloc_xen_irq(); - if (irq < 0) - return irq; - - spin_lock_irq(&irq_evtchn[irq].lock); - - alloc_unbound.dom = DOMID_SELF; - alloc_unbound.remote_dom = remote_domain; - err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, - &alloc_unbound); - if (err) { - spin_unlock_irq(&irq_evtchn[irq].lock); - free_xen_irq(irq); - return err; - } - - irq_evtchn[irq].handler = handler; - irq_evtchn[irq].dev_id = dev_id; - irq_evtchn[irq].evtchn = alloc_unbound.port; - irq_evtchn[irq].close = 1; - - evtchn_to_irq[alloc_unbound.port] = irq; - - unmask_evtchn(alloc_unbound.port); - - spin_unlock_irq(&irq_evtchn[irq].lock); - - return irq; -} -EXPORT_SYMBOL(bind_listening_port_to_irqhandler); - -int bind_caller_port_to_irqhandler( - unsigned int caller_port, - irq_handler_t handler, - unsigned long irqflags, - const char *devname, - void *dev_id) -{ - int irq; - - irq = alloc_xen_irq(); - if (irq < 0) - return irq; - - spin_lock_irq(&irq_evtchn[irq].lock); - - irq_evtchn[irq].handler = handler; - irq_evtchn[irq].dev_id = dev_id; - irq_evtchn[irq].evtchn = caller_port; - irq_evtchn[irq].close = 0; - - evtchn_to_irq[caller_port] = irq; - - unmask_evtchn(caller_port); - - spin_unlock_irq(&irq_evtchn[irq].lock); - - return irq; -} -EXPORT_SYMBOL(bind_caller_port_to_irqhandler); - -void unbind_from_irqhandler(unsigned int irq, void *dev_id) -{ - int evtchn; - - spin_lock_irq(&irq_evtchn[irq].lock); - - evtchn = evtchn_from_irq(irq); - - if (is_valid_evtchn(evtchn)) { - evtchn_to_irq[evtchn] = -1; - mask_evtchn(evtchn); - if (irq_evtchn[irq].close) { - struct evtchn_close close = { .port = evtchn }; - if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close)) - BUG(); - } - } - - irq_evtchn[irq].handler = NULL; - irq_evtchn[irq].evtchn = 0; - - spin_unlock_irq(&irq_evtchn[irq].lock); - - while (irq_evtchn[irq].in_handler) - cpu_relax(); - - free_xen_irq(irq); -} -EXPORT_SYMBOL(unbind_from_irqhandler); - -void notify_remote_via_irq(int irq) -{ - int evtchn; - - evtchn = evtchn_from_irq(irq); - if (is_valid_evtchn(evtchn)) - notify_remote_via_evtchn(evtchn); -} -EXPORT_SYMBOL(notify_remote_via_irq); - -static DEFINE_PER_CPU(unsigned int, last_processed_l1i) = { BITS_PER_LONG - 1 }; -static DEFINE_PER_CPU(unsigned int, last_processed_l2i) = { BITS_PER_LONG - 1 }; - -static inline unsigned long active_evtchns(unsigned int cpu, shared_info_t *sh, - unsigned int idx) -{ - return (sh->evtchn_pending[idx] & ~sh->evtchn_mask[idx]); -} - -static irqreturn_t evtchn_interrupt(int irq, void *dev_id -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) - , struct pt_regs *regs -#else -# define handler(irq, dev_id, regs) handler(irq, dev_id) -#endif - ) -{ - unsigned int l1i, l2i, port; - unsigned long masked_l1, masked_l2; - /* XXX: All events are bound to vcpu0 but irq may be redirected. */ - int cpu = 0; /*smp_processor_id();*/ - irq_handler_t handler; - shared_info_t *s = shared_info_area; - vcpu_info_t *v = &s->vcpu_info[cpu]; - unsigned long l1, l2; - - v->evtchn_upcall_pending = 0; - -#ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */ - /* Clear master flag /before/ clearing selector flag. */ - wmb(); -#endif - l1 = xchg(&v->evtchn_pending_sel, 0); - - l1i = per_cpu(last_processed_l1i, cpu); - l2i = per_cpu(last_processed_l2i, cpu); - - while (l1 != 0) { - - l1i = (l1i + 1) % BITS_PER_LONG; - masked_l1 = l1 & ((~0UL) << l1i); - - if (masked_l1 == 0) { /* if we masked out all events, wrap around to the beginning */ - l1i = BITS_PER_LONG - 1; - l2i = BITS_PER_LONG - 1; - continue; - } - l1i = __ffs(masked_l1); - - do { - l2 = active_evtchns(cpu, s, l1i); - - l2i = (l2i + 1) % BITS_PER_LONG; - masked_l2 = l2 & ((~0UL) << l2i); - - if (masked_l2 == 0) { /* if we masked out all events, move on */ - l2i = BITS_PER_LONG - 1; - break; - } - l2i = __ffs(masked_l2); - - /* process port */ - port = (l1i * BITS_PER_LONG) + l2i; - synch_clear_bit(port, &s->evtchn_pending[0]); - - irq = evtchn_to_irq[port]; - if (irq < 0) - continue; - - spin_lock(&irq_evtchn[irq].lock); - handler = irq_evtchn[irq].handler; - dev_id = irq_evtchn[irq].dev_id; - if (unlikely(handler == NULL)) { - printk("Xen IRQ%d (port %d) has no handler!\n", - irq, port); - spin_unlock(&irq_evtchn[irq].lock); - continue; - } - irq_evtchn[irq].in_handler = 1; - spin_unlock(&irq_evtchn[irq].lock); - - local_irq_enable(); - handler(irq, irq_evtchn[irq].dev_id, regs); - local_irq_disable(); - - spin_lock(&irq_evtchn[irq].lock); - irq_evtchn[irq].in_handler = 0; - spin_unlock(&irq_evtchn[irq].lock); - - /* if this is the final port processed, we'll pick up here+1 next time */ - per_cpu(last_processed_l1i, cpu) = l1i; - per_cpu(last_processed_l2i, cpu) = l2i; - - } while (l2i != BITS_PER_LONG - 1); - - l2 = active_evtchns(cpu, s, l1i); - if (l2 == 0) /* we handled all ports, so we can clear the selector bit */ - l1 &= ~(1UL << l1i); - } - - return IRQ_HANDLED; -} - -void irq_resume(void) -{ - int evtchn, irq; - - for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) { - mask_evtchn(evtchn); - evtchn_to_irq[evtchn] = -1; - } - - for (irq = 0; irq < ARRAY_SIZE(irq_evtchn); irq++) - irq_evtchn[irq].evtchn = 0; -} - -int xen_irq_init(struct pci_dev *pdev) -{ - int irq; - - for (irq = 0; irq < ARRAY_SIZE(irq_evtchn); irq++) - spin_lock_init(&irq_evtchn[irq].lock); - - return request_irq(pdev->irq, evtchn_interrupt, -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) - SA_SHIRQ | SA_SAMPLE_RANDOM | SA_INTERRUPT, -#else -#ifdef IRQF_SAMPLE_RANDOM - IRQF_SAMPLE_RANDOM | -#endif -#ifdef IRQF_DISABLED - IRQF_DISABLED | -#endif - IRQF_SHARED, -#endif - "xen-platform-pci", pdev); -} diff --git a/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c b/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c deleted file mode 100644 index ad667128a2..0000000000 --- a/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c +++ /dev/null @@ -1,114 +0,0 @@ -#include -#include -#include -#include -#include -#include "platform-pci.h" -#include - -struct ap_suspend_info { - int do_spin; - atomic_t nr_spinning; -}; - -#ifdef CONFIG_SMP - -/* - * Spinning prevents, for example, APs touching grant table entries while - * the shared grant table is not mapped into the address space imemdiately - * after resume. - */ -static void ap_suspend(void *_info) -{ - struct ap_suspend_info *info = _info; - - BUG_ON(!irqs_disabled()); - - atomic_inc(&info->nr_spinning); - mb(); - - while (info->do_spin) - cpu_relax(); - - mb(); - atomic_dec(&info->nr_spinning); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) -#define initiate_ap_suspend(i) smp_call_function(ap_suspend, i, 0, 0) -#else -#define initiate_ap_suspend(i) smp_call_function(ap_suspend, i, 0) -#endif - -#else /* !defined(CONFIG_SMP) */ - -#define initiate_ap_suspend(i) 0 - -#endif - -static int bp_suspend(void) -{ - int suspend_cancelled; - - BUG_ON(!irqs_disabled()); - - suspend_cancelled = HYPERVISOR_suspend(0); - - if (!suspend_cancelled) { - platform_pci_resume(); - gnttab_resume(); - irq_resume(); - } - - return suspend_cancelled; -} - -int __xen_suspend(int fast_suspend, void (*resume_notifier)(int)) -{ - int err, suspend_cancelled, nr_cpus; - struct ap_suspend_info info; - - xenbus_suspend(); - - preempt_disable(); - - /* Prevent any races with evtchn_interrupt() handler. */ - disable_irq(xen_platform_pdev->irq); - - info.do_spin = 1; - atomic_set(&info.nr_spinning, 0); - smp_mb(); - - nr_cpus = num_online_cpus() - 1; - - err = initiate_ap_suspend(&info); - if (err < 0) { - preempt_enable(); - xenbus_suspend_cancel(); - return err; - } - - while (atomic_read(&info.nr_spinning) != nr_cpus) - cpu_relax(); - - local_irq_disable(); - suspend_cancelled = bp_suspend(); - resume_notifier(suspend_cancelled); - local_irq_enable(); - - smp_mb(); - info.do_spin = 0; - while (atomic_read(&info.nr_spinning) != 0) - cpu_relax(); - - enable_irq(xen_platform_pdev->irq); - - preempt_enable(); - - if (!suspend_cancelled) - xenbus_resume(); - else - xenbus_suspend_cancel(); - - return 0; -} diff --git a/unmodified_drivers/linux-2.6/platform-pci/panic-handler.c b/unmodified_drivers/linux-2.6/platform-pci/panic-handler.c deleted file mode 100644 index 7564d0c7d9..0000000000 --- a/unmodified_drivers/linux-2.6/platform-pci/panic-handler.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include -#include - -#ifdef HAVE_XEN_PLATFORM_COMPAT_H -#include -#endif - -MODULE_LICENSE("GPL"); - -#ifdef __ia64__ -static void -xen_panic_hypercall(struct unw_frame_info *info, void *arg) -{ - current->thread.ksp = (__u64)info->sw - 16; - HYPERVISOR_shutdown(SHUTDOWN_crash); - /* we're never actually going to get here... */ -} -#endif - -static int -xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr) -{ -#ifdef __ia64__ - unw_init_running(xen_panic_hypercall, NULL); -#else /* !__ia64__ */ - HYPERVISOR_shutdown(SHUTDOWN_crash); -#endif - /* we're never actually going to get here... */ - return NOTIFY_DONE; -} - -static struct notifier_block xen_panic_block = { - .notifier_call = xen_panic_event -}; - -int xen_panic_handler_init(void) -{ - atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block); - return 0; -} diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c b/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c deleted file mode 100644 index e4a766a909..0000000000 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c +++ /dev/null @@ -1,147 +0,0 @@ -#include - -#include -#include -#include -#include - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) -static int system_state = 1; -EXPORT_SYMBOL(system_state); -#endif - -void ctrl_alt_del(void) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) - kill_proc(1, SIGINT, 1); /* interrupt init */ -#else - kill_cad_pid(SIGINT, 1); -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -/* Simplified asprintf. */ -char *kasprintf(gfp_t gfp, const char *fmt, ...) -{ - va_list ap; - unsigned int len; - char *p, dummy[1]; - - va_start(ap, fmt); - len = vsnprintf(dummy, 0, fmt, ap); - va_end(ap); - - p = kmalloc(len + 1, gfp); - if (!p) - return NULL; - va_start(ap, fmt); - vsprintf(p, fmt, ap); - va_end(ap); - return p; -} -EXPORT_SYMBOL(kasprintf); -#endif diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c deleted file mode 100644 index 8e4e814d29..0000000000 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +++ /dev/null @@ -1,531 +0,0 @@ -/****************************************************************************** - * platform-pci.c - * - * Xen platform PCI device driver - * Copyright (c) 2005, Intel Corporation. - * Copyright (c) 2007, XenSource Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; If not, see . - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef __ia64__ -#include -#endif - -#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" - -static int max_hypercall_stub_pages, nr_hypercall_stub_pages; -char *hypercall_stubs; -EXPORT_SYMBOL(hypercall_stubs); - -MODULE_AUTHOR("ssmith@xensource.com"); -MODULE_DESCRIPTION("Xen platform PCI device"); -MODULE_LICENSE("GPL"); - -/* NB. [aux-]ide-disks options do not unplug IDE CD-ROM drives. */ -/* NB. aux-ide-disks is equiv to ide-disks except ignores primary master. */ -static char *dev_unplug; -module_param(dev_unplug, charp, 0644); -MODULE_PARM_DESC(dev_unplug, "Emulated devices to unplug: " - "[all,][ide-disks,][aux-ide-disks,][nics,][never] (default is 'all')\n"); - -struct pci_dev *xen_platform_pdev; - -static unsigned long shared_info_frame; -static uint64_t callback_via; - -static int __devinit init_xen_info(void) -{ - struct xen_add_to_physmap xatp; - extern void *shared_info_area; - -#ifdef __ia64__ - xencomm_initialize(); -#endif - - setup_xen_features(); - - shared_info_frame = alloc_xen_mmio(PAGE_SIZE) >> PAGE_SHIFT; - xatp.domid = DOMID_SELF; - xatp.idx = 0; - xatp.space = XENMAPSPACE_shared_info; - xatp.gpfn = shared_info_frame; - if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp)) - BUG(); - - shared_info_area = - ioremap(shared_info_frame << PAGE_SHIFT, PAGE_SIZE); - if (shared_info_area == NULL) - panic("can't map shared info\n"); - - return 0; -} - -static unsigned long platform_mmio; -static unsigned long platform_mmio_alloc; -static unsigned long platform_mmiolen; - -unsigned long alloc_xen_mmio(unsigned long len) -{ - unsigned long addr; - - addr = platform_mmio + platform_mmio_alloc; - platform_mmio_alloc += len; - BUG_ON(platform_mmio_alloc > platform_mmiolen); - - return addr; -} - -#ifndef __ia64__ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) -static uint32_t xen_cpuid_base(void) -{ - uint32_t base, eax, ebx, ecx, edx; - char signature[13]; - - for (base = 0x40000000; base < 0x40010000; base += 0x100) { - cpuid(base, &eax, &ebx, &ecx, &edx); - *(uint32_t*)(signature + 0) = ebx; - *(uint32_t*)(signature + 4) = ecx; - *(uint32_t*)(signature + 8) = edx; - signature[12] = 0; - - if (!strcmp("XenVMMXenVMM", signature) && ((eax - base) >= 2)) - return base; - } - - return 0; -} -#endif - -static int init_hypercall_stubs(void) -{ - uint32_t eax, ebx, ecx, edx, pages, msr, i, base; - - base = xen_cpuid_base(); - if (base == 0) { - printk(KERN_WARNING - "Detected Xen platform device but not Xen VMM?\n"); - return -EINVAL; - } - - cpuid(base + 1, &eax, &ebx, &ecx, &edx); - - printk(KERN_INFO "Xen version %d.%d.\n", eax >> 16, eax & 0xffff); - - /* - * Find largest supported number of hypercall pages. - * We'll create as many as possible up to this number. - */ - cpuid(base + 2, &pages, &msr, &ecx, &edx); - - /* - * Use __vmalloc() because vmalloc_exec() is not an exported symbol. - * PAGE_KERNEL_EXEC also is not exported, hence we use PAGE_KERNEL. - * hypercall_stubs = vmalloc_exec(pages * PAGE_SIZE); - */ - while (pages > 0) { - hypercall_stubs = __vmalloc( - pages * PAGE_SIZE, - GFP_KERNEL | __GFP_HIGHMEM, - __pgprot(__PAGE_KERNEL & ~_PAGE_NX)); - if (hypercall_stubs != NULL) - break; - pages--; /* vmalloc failed: try one fewer pages */ - } - - if (hypercall_stubs == NULL) - return -ENOMEM; - - for (i = 0; i < pages; i++) { - unsigned long pfn; - pfn = vmalloc_to_pfn((char *)hypercall_stubs + i*PAGE_SIZE); - wrmsrl(msr, ((u64)pfn << PAGE_SHIFT) + i); - } - - nr_hypercall_stub_pages = pages; - max_hypercall_stub_pages = pages; - - printk(KERN_INFO "Hypercall area is %u pages.\n", pages); - - return 0; -} - -static void resume_hypercall_stubs(void) -{ - uint32_t base, ecx, edx, pages, msr, i; - - base = xen_cpuid_base(); - BUG_ON(base == 0); - - cpuid(base + 2, &pages, &msr, &ecx, &edx); - - if (pages > max_hypercall_stub_pages) - pages = max_hypercall_stub_pages; - - for (i = 0; i < pages; i++) { - unsigned long pfn; - pfn = vmalloc_to_pfn((char *)hypercall_stubs + i*PAGE_SIZE); - wrmsrl(msr, ((u64)pfn << PAGE_SHIFT) + i); - } - - nr_hypercall_stub_pages = pages; -} - -#else /* __ia64__ */ - -#define init_hypercall_stubs() (0) -#define resume_hypercall_stubs() ((void)0) - -#endif - -static uint64_t get_callback_via(struct pci_dev *pdev) -{ - u8 pin; - int irq; - -#ifdef __ia64__ - for (irq = 0; irq < 16; irq++) { - if (isa_irq_to_vector(irq) == pdev->irq) - return irq; /* ISA IRQ */ - } -#else /* !__ia64__ */ - irq = pdev->irq; - if (irq < 16) - return irq; /* ISA IRQ */ -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) - pin = pdev->pin; -#else - pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin); -#endif - - /* We don't know the GSI. Specify the PCI INTx line instead. */ - return (((uint64_t)0x01 << 56) | /* PCI INTx identifier */ - ((uint64_t)pci_domain_nr(pdev->bus) << 32) | - ((uint64_t)pdev->bus->number << 16) | - ((uint64_t)(pdev->devfn & 0xff) << 8) | - ((uint64_t)(pin - 1) & 3)); -} - -static int set_callback_via(uint64_t via) -{ - struct xen_hvm_param a; - - a.domid = DOMID_SELF; - a.index = HVM_PARAM_CALLBACK_IRQ; - a.value = via; - return HYPERVISOR_hvm_op(HVMOP_set_param, &a); -} - -int xen_irq_init(struct pci_dev *pdev); -int xenbus_init(void); -int xen_reboot_init(void); -int xen_panic_handler_init(void); -int gnttab_init(void); - -#define XEN_IOPORT_BASE 0x10 - -#define XEN_IOPORT_PLATFLAGS (XEN_IOPORT_BASE + 0) /* 1 byte access (R/W) */ -#define XEN_IOPORT_MAGIC (XEN_IOPORT_BASE + 0) /* 2 byte access (R) */ -#define XEN_IOPORT_UNPLUG (XEN_IOPORT_BASE + 0) /* 2 byte access (W) */ -#define XEN_IOPORT_DRVVER (XEN_IOPORT_BASE + 0) /* 4 byte access (W) */ - -#define XEN_IOPORT_SYSLOG (XEN_IOPORT_BASE + 2) /* 1 byte access (W) */ -#define XEN_IOPORT_PROTOVER (XEN_IOPORT_BASE + 2) /* 1 byte access (R) */ -#define XEN_IOPORT_PRODNUM (XEN_IOPORT_BASE + 2) /* 2 byte access (W) */ - -#define XEN_IOPORT_MAGIC_VAL 0x49d2 -#define XEN_IOPORT_LINUX_PRODNUM 0xffff /* NB: register a proper one */ -#define XEN_IOPORT_LINUX_DRVVER ((LINUX_VERSION_CODE << 8) + 0x0) - -#define UNPLUG_ALL_IDE_DISKS 1 -#define UNPLUG_ALL_NICS 2 -#define UNPLUG_AUX_IDE_DISKS 4 -#define UNPLUG_ALL 7 - -static short unplug_value; -static void unplug_devices(void) -{ - outw(unplug_value, XEN_IOPORT_UNPLUG); -} - -static int check_platform_magic(struct device *dev, long ioaddr, long iolen) -{ - short magic, unplug = 0; - char protocol, *p, *q, *err; - - /* Unconditionally unplug everything */ - if (!dev_unplug) - unplug = UNPLUG_ALL; - - for (p = dev_unplug; p; p = q) { - q = strchr(dev_unplug, ','); - if (q) - *q++ = '\0'; - if (!strcmp(p, "all")) - unplug |= UNPLUG_ALL; - else if (!strcmp(p, "ide-disks")) - unplug |= UNPLUG_ALL_IDE_DISKS; - else if (!strcmp(p, "aux-ide-disks")) - unplug |= UNPLUG_AUX_IDE_DISKS; - else if (!strcmp(p, "nics")) - unplug |= UNPLUG_ALL_NICS; - else if (!strcmp(p, "never")) - unplug = 0; - else - dev_warn(dev, "unrecognised option '%s' " - "in module parameter 'dev_unplug'\n", p); - } - unplug_value = unplug; - - if (iolen < 0x16) { - err = "backend too old"; - goto no_dev; - } - - magic = inw(XEN_IOPORT_MAGIC); - - if (magic != XEN_IOPORT_MAGIC_VAL) { - err = "unrecognised magic value"; - goto no_dev; - } - - protocol = inb(XEN_IOPORT_PROTOVER); - - dev_info(dev, "I/O protocol version %d\n", protocol); - - switch (protocol) { - case 1: - outw(XEN_IOPORT_LINUX_PRODNUM, XEN_IOPORT_PRODNUM); - outl(XEN_IOPORT_LINUX_DRVVER, XEN_IOPORT_DRVVER); - if (inw(XEN_IOPORT_MAGIC) != XEN_IOPORT_MAGIC_VAL) { - dev_err(dev, "blacklisted by host\n"); - return -ENODEV; - } - /* Fall through */ - case 0: - unplug_devices(); - break; - default: - err = "unknown I/O protocol version"; - goto no_dev; - } - - return 0; - - no_dev: - dev_warn(dev, "failed backend handshake: %s\n", err); - if (!unplug) - return 0; - dev_err(dev, "failed to execute specified dev_unplug options!\n"); - return -ENODEV; -} - -#ifdef HAVE_OLDMEM_PFN_IS_RAM -static int xen_oldmem_pfn_is_ram(unsigned long pfn) -{ - struct xen_hvm_get_mem_type a; - int ret; - - a.domid = DOMID_SELF; - a.pfn = pfn; - if (HYPERVISOR_hvm_op(HVMOP_get_mem_type, &a)) - return -ENXIO; - - switch (a.mem_type) { - case HVMMEM_mmio_dm: - ret = 0; - break; - case HVMMEM_ram_rw: - case HVMMEM_ram_ro: - default: - ret = 1; - break; - } - - return ret; -} -#endif - -static int __devinit platform_pci_init(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - int i, ret; - long ioaddr, iolen; - long mmio_addr, mmio_len; - - if (xen_platform_pdev) - return -EBUSY; - xen_platform_pdev = pdev; - - i = pci_enable_device(pdev); - if (i) - return i; - - ioaddr = pci_resource_start(pdev, 0); - iolen = pci_resource_len(pdev, 0); - - mmio_addr = pci_resource_start(pdev, 1); - mmio_len = pci_resource_len(pdev, 1); - - callback_via = get_callback_via(pdev); - - if (mmio_addr == 0 || ioaddr == 0 || callback_via == 0) { - printk(KERN_WARNING DRV_NAME ":no resources found\n"); - return -ENOENT; - } - - ret = pci_request_region(pdev, 1, DRV_NAME); - if (ret < 0) - return ret; - - ret = pci_request_region(pdev, 0, DRV_NAME); - if (ret < 0) - goto mem_out; - - platform_mmio = mmio_addr; - platform_mmiolen = mmio_len; - - ret = init_hypercall_stubs(); - if (ret < 0) - goto out; - - ret = check_platform_magic(&pdev->dev, ioaddr, iolen); - if (ret < 0) - goto out; - - if ((ret = init_xen_info())) - goto out; - - if ((ret = gnttab_init())) - goto out; - - if ((ret = xen_irq_init(pdev))) - goto out; - - if ((ret = set_callback_via(callback_via))) - goto out; - - if ((ret = xenbus_init())) - goto out; - - if ((ret = xen_reboot_init())) - goto out; - - if ((ret = xen_panic_handler_init())) - goto out; - -#ifdef HAVE_OLDMEM_PFN_IS_RAM - register_oldmem_pfn_is_ram(&xen_oldmem_pfn_is_ram); -#endif - out: - if (ret) { - pci_release_region(pdev, 0); -mem_out: - pci_release_region(pdev, 1); - } - - return ret; -} - -#define XEN_PLATFORM_VENDOR_ID 0x5853 -#define XEN_PLATFORM_DEVICE_ID 0x0001 -static struct pci_device_id platform_pci_tbl[] __devinitdata = { - {XEN_PLATFORM_VENDOR_ID, XEN_PLATFORM_DEVICE_ID, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - /* Continue to recognise the old ID for now */ - {0xfffd, 0x0101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0,} -}; - -MODULE_DEVICE_TABLE(pci, platform_pci_tbl); - -static struct pci_driver platform_driver = { - name: DRV_NAME, - probe: platform_pci_init, - id_table: platform_pci_tbl, -}; - -static int pci_device_registered; - -void platform_pci_resume(void) -{ - struct xen_add_to_physmap xatp; - - resume_hypercall_stubs(); - - xatp.domid = DOMID_SELF; - xatp.idx = 0; - xatp.space = XENMAPSPACE_shared_info; - xatp.gpfn = shared_info_frame; - if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp)) - BUG(); - - if (set_callback_via(callback_via)) - printk("platform_pci_resume failure!\n"); - - unplug_devices(); -} - -static int __init platform_pci_module_init(void) -{ - int rc; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) - rc = pci_module_init(&platform_driver); -#else - rc = pci_register_driver(&platform_driver); -#endif - if (rc) { - printk(KERN_INFO DRV_NAME - ": No platform pci device model found\n"); - return rc; - } - - pci_device_registered = 1; - return 0; -} - -module_init(platform_pci_module_init); diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h deleted file mode 100644 index b834700f97..0000000000 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h +++ /dev/null @@ -1,31 +0,0 @@ -/****************************************************************************** - * platform-pci.h - * - * Xen platform PCI device driver - * Copyright (c) 2004, Intel Corporation. - * Copyright (c) 2007, XenSource Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; If not, see . - */ - -#ifndef _XEN_PLATFORM_PCI_H -#define _XEN_PLATFORM_PCI_H - -#include - -unsigned long alloc_xen_mmio(unsigned long len); -void platform_pci_resume(void); - -extern struct pci_dev *xen_platform_pdev; - -#endif /* _XEN_PLATFORM_PCI_H */ diff --git a/unmodified_drivers/linux-2.6/platform-pci/xen_support.c b/unmodified_drivers/linux-2.6/platform-pci/xen_support.c deleted file mode 100644 index 7818c0cd8b..0000000000 --- a/unmodified_drivers/linux-2.6/platform-pci/xen_support.c +++ /dev/null @@ -1,73 +0,0 @@ -/****************************************************************************** - * support.c - * Xen module support functions. - * Copyright (C) 2004, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; If not, see . - * - */ - -#include -#include -#include -#include -#include -#include -#include "platform-pci.h" - -#ifdef HAVE_XEN_PLATFORM_COMPAT_H -#include -#endif - -#if defined (__ia64__) -unsigned long __hypercall(unsigned long a1, unsigned long a2, - unsigned long a3, unsigned long a4, - unsigned long a5, unsigned long cmd) -{ - unsigned long __res; - __asm__ __volatile__ (";;\n" - "mov r2=%1\n" - "break 0x1000 ;;\n" - "mov %0=r8 ;;\n" - : "=r"(__res) : "r"(cmd) : "r2", "r8", "memory"); - - return __res; -} -EXPORT_SYMBOL(__hypercall); - -int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count) -{ - return xencomm_hypercall_grant_table_op(cmd, uop, count); -} -EXPORT_SYMBOL(HYPERVISOR_grant_table_op); - -/* without using balloon driver on PV-on-HVM for ia64 */ -void balloon_update_driver_allowance(long delta) -{ - /* nothing */ -} -EXPORT_SYMBOL_GPL(balloon_update_driver_allowance); - -void balloon_release_driver_page(struct page *page) -{ - /* nothing */ -} -EXPORT_SYMBOL_GPL(balloon_release_driver_page); -#endif /* __ia64__ */ - -void xen_machphys_update(unsigned long mfn, unsigned long pfn) -{ - BUG(); -} -EXPORT_SYMBOL(xen_machphys_update); - diff --git a/unmodified_drivers/linux-2.6/scsifront/Kbuild b/unmodified_drivers/linux-2.6/scsifront/Kbuild deleted file mode 100644 index 14875b3bca..0000000000 --- a/unmodified_drivers/linux-2.6/scsifront/Kbuild +++ /dev/null @@ -1,6 +0,0 @@ -include $(M)/overrides.mk - -obj-m += xen-scsi.o - -xen-scsi-objs := scsifront.o xenbus.o - diff --git a/unmodified_drivers/linux-2.6/scsifront/Makefile b/unmodified_drivers/linux-2.6/scsifront/Makefile deleted file mode 100644 index 64e7acd194..0000000000 --- a/unmodified_drivers/linux-2.6/scsifront/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifneq ($(KERNELRELEASE),) -include $(src)/Kbuild -endif diff --git a/unmodified_drivers/linux-2.6/usbfront/Kbuild b/unmodified_drivers/linux-2.6/usbfront/Kbuild deleted file mode 100644 index 321a35a122..0000000000 --- a/unmodified_drivers/linux-2.6/usbfront/Kbuild +++ /dev/null @@ -1,7 +0,0 @@ -include $(M)/overrides.mk - -obj-m += $(if $(shell grep '^\#include "\.\./\.\./' $(obj)/usbfront.h), \ - $(warning usbfront cannot be built), \ - xen-usb.o) - -xen-usb-objs := usbfront-hcd.o xenbus.o diff --git a/unmodified_drivers/linux-2.6/usbfront/Makefile b/unmodified_drivers/linux-2.6/usbfront/Makefile deleted file mode 100644 index 64e7acd194..0000000000 --- a/unmodified_drivers/linux-2.6/usbfront/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifneq ($(KERNELRELEASE),) -include $(src)/Kbuild -endif diff --git a/unmodified_drivers/linux-2.6/xenbus/empty_directory b/unmodified_drivers/linux-2.6/xenbus/empty_directory deleted file mode 100644 index e69de29bb2..0000000000