[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [PV-on-HVM] Make PV drivers on HVM kernels work on older kernels after



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Date 1169485827 0
# Node ID 687b1120765e0aebabc1d0a6bfbae2b9c4948aca
# Parent  dd55107d4a679512c08d2c426f4876f424a3ae93
[PV-on-HVM] Make PV drivers on HVM kernels work on older kernels after
update to 2.6.18.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c              |    8 ++++++
 linux-2.6-xen-sparse/drivers/xen/core/gnttab.c                    |    2 -
 unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h |   11 
++++++++
 unmodified_drivers/linux-2.6/platform-pci/platform-pci.c          |   13 
++++++++--
 4 files changed, 31 insertions(+), 3 deletions(-)

diff -r dd55107d4a67 -r 687b1120765e 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Jan 22 
17:07:16 2007 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Jan 22 
17:10:27 2007 +0000
@@ -272,13 +272,21 @@ static void backend_changed(struct xenbu
                if (bd == NULL)
                        xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
+               down(&bd->bd_sem);
+#else
                mutex_lock(&bd->bd_mutex);
+#endif
                if (info->users > 0)
                        xenbus_dev_error(dev, -EBUSY,
                                         "Device in use; refusing to close");
                else
                        blkfront_closing(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
+               up(&bd->bd_sem);
+#else
                mutex_unlock(&bd->bd_mutex);
+#endif
                bdput(bd);
                break;
        }
diff -r dd55107d4a67 -r 687b1120765e 
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c    Mon Jan 22 17:07:16 
2007 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c    Mon Jan 22 17:10:27 
2007 +0000
@@ -464,7 +464,7 @@ int gnttab_suspend(void)
 
 #endif /* !CONFIG_XEN */
 
-int __init gnttab_init(void)
+int __devinit gnttab_init(void)
 {
        int i;
 
diff -r dd55107d4a67 -r 687b1120765e 
unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
--- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h Mon Jan 
22 17:07:16 2007 +0000
+++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h Mon Jan 
22 17:10:27 2007 +0000
@@ -40,6 +40,13 @@
 #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_FS_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
 #define nonseekable_open(inode, filp) /* Nothing to do */
 #endif
@@ -69,4 +76,8 @@ extern char *kasprintf(gfp_t gfp, const 
        __attribute__ ((format (printf, 2, 3)));
 #endif
 
+#if defined(_I386_PAGE_H) && defined(CONFIG_X86_PAE)
+#define __supported_pte_mask ~0ULL
 #endif
+
+#endif
diff -r dd55107d4a67 -r 687b1120765e 
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Mon Jan 22 
17:07:16 2007 +0000
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Mon Jan 22 
17:10:27 2007 +0000
@@ -61,7 +61,7 @@ unsigned long *phys_to_machine_mapping;
 unsigned long *phys_to_machine_mapping;
 EXPORT_SYMBOL(phys_to_machine_mapping);
 
-static int __init init_xen_info(void)
+static int __devinit init_xen_info(void)
 {
        unsigned long shared_info_frame;
        struct xen_add_to_physmap xatp;
@@ -194,14 +194,23 @@ static uint64_t get_callback_via(struct 
               rid);
        return rid | IA64_CALLBACK_IRQ_RID;
 #else /* !__ia64__ */
+       u8 pin;
+
        if (pdev->irq < 16)
                return pdev->irq; /* ISA IRQ */
+
+#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)(pdev->pin - 1) & 3));
+               ((uint64_t)(pin - 1) & 3));
 #endif
 }
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.