WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] unmodified drivers adjustments

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] unmodified drivers adjustments
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Thu, 25 Oct 2007 10:12:40 +0100
Delivery-date: Thu, 25 Oct 2007 02:11:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Some of these changes may not fit the xen-unstable.hg/linux-2.6.18-xen.hg
pair so here are my respective considerations:

- 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@xxxxxxxxxx>

Index: 2007-10-10/unmodified_drivers/linux-2.6/README
===================================================================
--- 2007-10-10.orig/unmodified_drivers/linux-2.6/README 2007-06-11 
15:01:03.000000000 +0200
+++ 2007-10-10/unmodified_drivers/linux-2.6/README      2007-10-24 
08:40:49.000000000 +0200
@@ -1,12 +1,12 @@
 To build:
 
 1. ./mkbuildtree
-   NB. You can override paths to Xen sources and XenLinux sources via
-       the XEN and XL environment variable.
+   NB. You can override paths to Xen sources and a (stub) XenLinux
+       build tree via the XEN and XL environment variable.
 
-2. make -C /path/to/kernel/source M=$PWD modules
-   NB. The kernel sources here are your native kernel build tree, not
-       the XenLinux sources referred to in step 1.
+2. 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.
 
 You get four modules, xen-platform-pci.ko, xenbus.ko, xen-vbd.ko, and
 xen-vnif.ko.  Load xen-platform-pci first, then xenbus, and then
Index: 
2007-10-10/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
===================================================================
--- 
2007-10-10.orig/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
   2007-09-10 09:59:35.000000000 +0200
+++ 
2007-10-10/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h    
    2007-10-23 08:59:08.000000000 +0200
@@ -125,4 +125,12 @@ extern char *kasprintf(gfp_t gfp, const 
 #define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
 #endif
 
+#if defined(_LINUX_INTERRUPT_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+typedef irqreturn_t (*irq_handler_t)(int, void *, struct pt_regs *);
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
+#define setup_xen_features xen_setup_features
+#endif
+
 #endif
Index: 2007-10-10/unmodified_drivers/linux-2.6/overrides.mk
===================================================================
--- 2007-10-10.orig/unmodified_drivers/linux-2.6/overrides.mk   2007-04-16 
09:26:34.000000000 +0200
+++ 2007-10-10/unmodified_drivers/linux-2.6/overrides.mk        2007-10-22 
17:15:46.000000000 +0200
@@ -11,4 +11,4 @@ ifeq ($(ARCH),ia64)
   EXTRA_CFLAGS += -DCONFIG_VMX_GUEST
 endif
 
-EXTRA_CFLAGS += -include $(srctree)/include/linux/autoconf.h
+EXTRA_CFLAGS += -include $(objtree)/include/linux/autoconf.h
Index: 2007-10-10/unmodified_drivers/linux-2.6/platform-pci/evtchn.c
===================================================================
--- 2007-10-10.orig/unmodified_drivers/linux-2.6/platform-pci/evtchn.c  
2007-04-16 09:26:34.000000000 +0200
+++ 2007-10-10/unmodified_drivers/linux-2.6/platform-pci/evtchn.c       
2007-10-22 17:38:03.000000000 +0200
@@ -28,7 +28,6 @@
  * IN THE SOFTWARE.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
@@ -48,7 +47,7 @@ void *shared_info_area;
 
 static struct {
        spinlock_t lock;
-       irqreturn_t(*handler) (int, void *, struct pt_regs *);
+       irq_handler_t handler;
        void *dev_id;
        int evtchn;
        int close:1; /* close on unbind_from_irqhandler()? */
@@ -146,7 +145,7 @@ EXPORT_SYMBOL(unmask_evtchn);
 
 int bind_listening_port_to_irqhandler(
        unsigned int remote_domain,
-       irqreturn_t (*handler)(int, void *, struct pt_regs *),
+       irq_handler_t handler,
        unsigned long irqflags,
        const char *devname,
        void *dev_id)
@@ -187,7 +186,7 @@ EXPORT_SYMBOL(bind_listening_port_to_irq
 
 int bind_caller_port_to_irqhandler(
        unsigned int caller_port,
-       irqreturn_t (*handler)(int, void *, struct pt_regs *),
+       irq_handler_t handler,
        unsigned long irqflags,
        const char *devname,
        void *dev_id)
@@ -254,13 +253,18 @@ void notify_remote_via_irq(int irq)
 }
 EXPORT_SYMBOL(notify_remote_via_irq);
 
-static irqreturn_t evtchn_interrupt(int irq, void *dev_id,
-                                   struct pt_regs *regs)
+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, port;
        /* XXX: All events are bound to vcpu0 but irq may be redirected. */
        int cpu = 0; /*smp_processor_id();*/
-       irqreturn_t(*handler) (int, void *, struct pt_regs *);
+       irq_handler_t handler;
        shared_info_t *s = shared_info_area;
        vcpu_info_t *v = &s->vcpu_info[cpu];
        unsigned long l1, l2;
@@ -331,6 +335,10 @@ int xen_irq_init(struct pci_dev *pdev)
                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
+                          IRQF_SHARED | IRQF_SAMPLE_RANDOM | IRQF_DISABLED,
+#endif
                           "xen-platform-pci", pdev);
 }
Index: 2007-10-10/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
===================================================================
--- 2007-10-10.orig/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c  
2007-09-10 09:59:35.000000000 +0200
+++ 2007-10-10/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c       
2007-10-23 08:34:02.000000000 +0200
@@ -1,4 +1,3 @@
-#include <linux/config.h>
 #include <linux/cpumask.h>
 #include <linux/preempt.h>
 #include <xen/evtchn.h>
Index: 2007-10-10/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
===================================================================
--- 2007-10-10.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c    
2007-09-10 09:59:35.000000000 +0200
+++ 2007-10-10/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c 
2007-10-22 17:54:45.000000000 +0200
@@ -367,7 +367,11 @@ static int __init platform_pci_module_in
 {
        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");



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] unmodified drivers adjustments, Jan Beulich <=