ia64/xen-unstable

changeset 16242:3d97c1c1f7c8

pv-on-hvm: fixes for unmodified drivers build and modern Linux

- The adjustments to README and overrides.mk are generic.
- The removal of explicit linux/config.h inclusion should also not
cause any issues.
- The introduction of irq_handler_t should eliminiate warnings on
2.6.19+ kernels (I didn't check they're there, but since the
request_irq prototype changed, I'm sure there's at least
one. However, as a result changes to the Linux tree are expected to
be required.
- The change setup_xen_features -> xen_setup_features follows the
naming in mainline 2.6.23 but would apparently also require changes
to the Linux tree.
- The changes SA_* -> IRQF_ and pci_module_init ->
pci_register_driver should also not cause issues.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir@xensource.com>
date Thu Oct 25 15:54:19 2007 +0100 (2007-10-25)
parents 01d45050a808
children c3b41281b1fc
files unmodified_drivers/linux-2.6/README unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h unmodified_drivers/linux-2.6/overrides.mk unmodified_drivers/linux-2.6/platform-pci/evtchn.c unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
line diff
     1.1 --- a/unmodified_drivers/linux-2.6/README	Thu Oct 25 15:04:33 2007 +0100
     1.2 +++ b/unmodified_drivers/linux-2.6/README	Thu Oct 25 15:54:19 2007 +0100
     1.3 @@ -1,12 +1,12 @@
     1.4  To build:
     1.5  
     1.6  1. ./mkbuildtree
     1.7 -   NB. You can override paths to Xen sources and XenLinux sources via
     1.8 -       the XEN and XL environment variable.
     1.9 +   NB. You can override paths to Xen sources and a (stub) XenLinux
    1.10 +       build tree via the XEN and XL environment variable.
    1.11  
    1.12 -2. make -C /path/to/kernel/source M=$PWD modules
    1.13 -   NB. The kernel sources here are your native kernel build tree, not
    1.14 -       the XenLinux sources referred to in step 1.
    1.15 +2. make -C /path/to/kernel/build M=$PWD modules
    1.16 +   NB. This is your native kernel build tree (or a distro provided
    1.17 +       stub), not the XenLinux sources referred to in step 1.
    1.18  
    1.19  You get four modules, xen-platform-pci.ko, xenbus.ko, xen-vbd.ko, and
    1.20  xen-vnif.ko.  Load xen-platform-pci first, then xenbus, and then
     2.1 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h	Thu Oct 25 15:04:33 2007 +0100
     2.2 +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h	Thu Oct 25 15:54:19 2007 +0100
     2.3 @@ -125,4 +125,12 @@ extern char *kasprintf(gfp_t gfp, const 
     2.4  #define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
     2.5  #endif
     2.6  
     2.7 +#if defined(_LINUX_INTERRUPT_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
     2.8 +typedef irqreturn_t (*irq_handler_t)(int, void *, struct pt_regs *);
     2.9  #endif
    2.10 +
    2.11 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
    2.12 +#define setup_xen_features xen_setup_features
    2.13 +#endif
    2.14 +
    2.15 +#endif
     3.1 --- a/unmodified_drivers/linux-2.6/overrides.mk	Thu Oct 25 15:04:33 2007 +0100
     3.2 +++ b/unmodified_drivers/linux-2.6/overrides.mk	Thu Oct 25 15:54:19 2007 +0100
     3.3 @@ -11,4 +11,4 @@ ifeq ($(ARCH),ia64)
     3.4    EXTRA_CFLAGS += -DCONFIG_VMX_GUEST
     3.5  endif
     3.6  
     3.7 -EXTRA_CFLAGS += -include $(srctree)/include/linux/autoconf.h
     3.8 +EXTRA_CFLAGS += -include $(objtree)/include/linux/autoconf.h
     4.1 --- a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c	Thu Oct 25 15:04:33 2007 +0100
     4.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c	Thu Oct 25 15:54:19 2007 +0100
     4.3 @@ -28,7 +28,6 @@
     4.4   * IN THE SOFTWARE.
     4.5   */
     4.6  
     4.7 -#include <linux/config.h>
     4.8  #include <linux/module.h>
     4.9  #include <linux/kernel.h>
    4.10  #include <linux/spinlock.h>
    4.11 @@ -48,7 +47,7 @@ void *shared_info_area;
    4.12  
    4.13  static struct {
    4.14  	spinlock_t lock;
    4.15 -	irqreturn_t(*handler) (int, void *, struct pt_regs *);
    4.16 +	irq_handler_t handler;
    4.17  	void *dev_id;
    4.18  	int evtchn;
    4.19  	int close:1; /* close on unbind_from_irqhandler()? */
    4.20 @@ -146,7 +145,7 @@ EXPORT_SYMBOL(unmask_evtchn);
    4.21  
    4.22  int bind_listening_port_to_irqhandler(
    4.23  	unsigned int remote_domain,
    4.24 -	irqreturn_t (*handler)(int, void *, struct pt_regs *),
    4.25 +	irq_handler_t handler,
    4.26  	unsigned long irqflags,
    4.27  	const char *devname,
    4.28  	void *dev_id)
    4.29 @@ -187,7 +186,7 @@ EXPORT_SYMBOL(bind_listening_port_to_irq
    4.30  
    4.31  int bind_caller_port_to_irqhandler(
    4.32  	unsigned int caller_port,
    4.33 -	irqreturn_t (*handler)(int, void *, struct pt_regs *),
    4.34 +	irq_handler_t handler,
    4.35  	unsigned long irqflags,
    4.36  	const char *devname,
    4.37  	void *dev_id)
    4.38 @@ -254,13 +253,18 @@ void notify_remote_via_irq(int irq)
    4.39  }
    4.40  EXPORT_SYMBOL(notify_remote_via_irq);
    4.41  
    4.42 -static irqreturn_t evtchn_interrupt(int irq, void *dev_id,
    4.43 -				    struct pt_regs *regs)
    4.44 +static irqreturn_t evtchn_interrupt(int irq, void *dev_id
    4.45 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
    4.46 +				    , struct pt_regs *regs
    4.47 +#else
    4.48 +# define handler(irq, dev_id, regs) handler(irq, dev_id)
    4.49 +#endif
    4.50 +				    )
    4.51  {
    4.52  	unsigned int l1i, port;
    4.53  	/* XXX: All events are bound to vcpu0 but irq may be redirected. */
    4.54  	int cpu = 0; /*smp_processor_id();*/
    4.55 -	irqreturn_t(*handler) (int, void *, struct pt_regs *);
    4.56 +	irq_handler_t handler;
    4.57  	shared_info_t *s = shared_info_area;
    4.58  	vcpu_info_t *v = &s->vcpu_info[cpu];
    4.59  	unsigned long l1, l2;
    4.60 @@ -331,6 +335,10 @@ int xen_irq_init(struct pci_dev *pdev)
    4.61  		spin_lock_init(&irq_evtchn[irq].lock);
    4.62  
    4.63  	return request_irq(pdev->irq, evtchn_interrupt,
    4.64 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
    4.65  			   SA_SHIRQ | SA_SAMPLE_RANDOM | SA_INTERRUPT,
    4.66 +#else
    4.67 +			   IRQF_SHARED | IRQF_SAMPLE_RANDOM | IRQF_DISABLED,
    4.68 +#endif
    4.69  			   "xen-platform-pci", pdev);
    4.70  }
     5.1 --- a/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c	Thu Oct 25 15:04:33 2007 +0100
     5.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c	Thu Oct 25 15:54:19 2007 +0100
     5.3 @@ -1,4 +1,3 @@
     5.4 -#include <linux/config.h>
     5.5  #include <linux/cpumask.h>
     5.6  #include <linux/preempt.h>
     5.7  #include <xen/evtchn.h>
     6.1 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	Thu Oct 25 15:04:33 2007 +0100
     6.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	Thu Oct 25 15:54:19 2007 +0100
     6.3 @@ -367,7 +367,11 @@ static int __init platform_pci_module_in
     6.4  {
     6.5  	int rc;
     6.6  
     6.7 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
     6.8  	rc = pci_module_init(&platform_driver);
     6.9 +#else
    6.10 +	rc = pci_register_driver(&platform_driver);
    6.11 +#endif
    6.12  	if (rc) {
    6.13  		printk(KERN_INFO DRV_NAME
    6.14  		       ": No platform pci device model found\n");