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
^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.*
F: */*.ac
F: tools/
-UNMODIFIED LINUX PV DRIVERS
-M: Jan Beulich <jbeulich@suse.com>
-S: Obsolete
-L: xen-devel@lists.xenproject.org
-F: unmodified_drivers/linux-2.6/
-
VM EVENT, MEM ACCESS and MONITOR
M: Tamas K Lengyel <tamas@tklengyel.com>
R: Alexandru Isaila <aisaila@bitdefender.com>
+++ /dev/null
-include $(M)/overrides.mk
-
-obj-m += platform-pci/
-obj-m += balloon/
-obj-m += blkfront/
-obj-m += netfront/
-obj-m += scsifront/
-obj-m += usbfront/
+++ /dev/null
-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 [<arch>]
- 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.
+++ /dev/null
-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
+++ /dev/null
-ifneq ($(KERNELRELEASE),)
-include $(src)/Kbuild
-endif
+++ /dev/null
-include $(M)/overrides.mk
-
-obj-m += xen-vbd.o
-
-xen-vbd-objs := blkfront.o vbd.o
+++ /dev/null
-ifneq ($(KERNELRELEASE),)
-include $(src)/Kbuild
-endif
+++ /dev/null
-#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 */
+++ /dev/null
-#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 */
+++ /dev/null
-#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 <asm/io.h>
-
-#endif
+++ /dev/null
-/*
- * 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 <linux/version.h>
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-#error "This version of Linux should not need compat mutex.h"
-#endif
-
-#include <linux/version.h>
-#include <asm/semaphore.h>
-
-#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 */
+++ /dev/null
-#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 <asm/scatterlist.h>
-
-#endif /* _LINUX_SCATTERLIST_H */
+++ /dev/null
-#ifndef COMPAT_INCLUDE_XEN_PLATFORM_COMPAT_H
-#define COMPAT_INCLUDE_XEN_PLATFORM_COMPAT_H
-
-#include <linux/version.h>
-#include <linux/spinlock.h>
-#include <asm/maddr.h>
-
-#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 <asm-generic/pgtable-nopud.h>
-#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
+++ /dev/null
-#! /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
+++ /dev/null
-include $(M)/overrides.mk
-
-obj-m = xen-vnif.o
-xen-vnif-objs := netfront.o
-xen-vnif-objs += accel.o
+++ /dev/null
-ifneq ($(KERNELRELEASE),)
-include $(src)/Kbuild
-endif
+++ /dev/null
-# 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)
+++ /dev/null
-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
+++ /dev/null
-ifneq ($(KERNELRELEASE),)
-include $(src)/Kbuild
-endif
+++ /dev/null
-/******************************************************************************
- * evtchn.c
- *
- * A simplified event channel for para-drivers in unmodified linux
- *
- * Copyright (c) 2002-2005, K A Fraser
- * Copyright (c) 2005, Intel Corporation <xiaofeng.ling@intel.com>
- *
- * 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 <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/spinlock.h>
-#include <xen/evtchn.h>
-#include <xen/interface/hvm/ioreq.h>
-#include <xen/features.h>
-#include "platform-pci.h"
-
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#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);
-}
+++ /dev/null
-#include <linux/cpumask.h>
-#include <linux/preempt.h>
-#include <xen/evtchn.h>
-#include <xen/gnttab.h>
-#include <xen/xenbus.h>
-#include "platform-pci.h"
-#include <asm/hypervisor.h>
-
-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;
-}
+++ /dev/null
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/notifier.h>
-#include <asm/hypervisor.h>
-
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#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;
-}
+++ /dev/null
-#include <linux/version.h>
-
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-
-#include <xen/platform-compat.h>
-
-#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
+++ /dev/null
-/******************************************************************************
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <linux/crash_dump.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-#include <linux/version.h>
-#include <linux/interrupt.h>
-#include <linux/vmalloc.h>
-#include <linux/mm.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/hypervisor.h>
-#include <asm/pgtable.h>
-#include <xen/interface/memory.h>
-#include <xen/interface/hvm/params.h>
-#include <xen/features.h>
-#include <xen/evtchn.h>
-#ifdef __ia64__
-#include <asm/xen/xencomm.h>
-#endif
-
-#include "platform-pci.h"
-
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#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);
+++ /dev/null
-/******************************************************************************
- * platform-pci.h
- *
- * Xen platform PCI device driver
- * Copyright (c) 2004, Intel Corporation. <xiaofeng.ling@intel.com>
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _XEN_PLATFORM_PCI_H
-#define _XEN_PLATFORM_PCI_H
-
-#include <linux/pci.h>
-
-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 */
+++ /dev/null
-/******************************************************************************
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/mm.h>
-#include <xen/evtchn.h>
-#include <xen/interface/xen.h>
-#include <asm/hypervisor.h>
-#include "platform-pci.h"
-
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#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);
-
+++ /dev/null
-include $(M)/overrides.mk
-
-obj-m += xen-scsi.o
-
-xen-scsi-objs := scsifront.o xenbus.o
-
+++ /dev/null
-ifneq ($(KERNELRELEASE),)
-include $(src)/Kbuild
-endif
+++ /dev/null
-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
+++ /dev/null
-ifneq ($(KERNELRELEASE),)
-include $(src)/Kbuild
-endif