ia64/xen-unstable

changeset 13569:687b1120765e

[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@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Mon Jan 22 17:10:27 2007 +0000 (2007-01-22)
parents dd55107d4a67
children bffe67212133
files linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/core/gnttab.c unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Mon Jan 22 17:07:16 2007 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Mon Jan 22 17:10:27 2007 +0000
     1.3 @@ -272,13 +272,21 @@ static void backend_changed(struct xenbu
     1.4  		if (bd == NULL)
     1.5  			xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
     1.6  
     1.7 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
     1.8 +		down(&bd->bd_sem);
     1.9 +#else
    1.10  		mutex_lock(&bd->bd_mutex);
    1.11 +#endif
    1.12  		if (info->users > 0)
    1.13  			xenbus_dev_error(dev, -EBUSY,
    1.14  					 "Device in use; refusing to close");
    1.15  		else
    1.16  			blkfront_closing(dev);
    1.17 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
    1.18 +		up(&bd->bd_sem);
    1.19 +#else
    1.20  		mutex_unlock(&bd->bd_mutex);
    1.21 +#endif
    1.22  		bdput(bd);
    1.23  		break;
    1.24  	}
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Mon Jan 22 17:07:16 2007 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Mon Jan 22 17:10:27 2007 +0000
     2.3 @@ -464,7 +464,7 @@ int gnttab_suspend(void)
     2.4  
     2.5  #endif /* !CONFIG_XEN */
     2.6  
     2.7 -int __init gnttab_init(void)
     2.8 +int __devinit gnttab_init(void)
     2.9  {
    2.10  	int i;
    2.11  
     3.1 --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h	Mon Jan 22 17:07:16 2007 +0000
     3.2 +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h	Mon Jan 22 17:10:27 2007 +0000
     3.3 @@ -40,6 +40,13 @@
     3.4  #define gfp_t unsigned
     3.5  #endif
     3.6  
     3.7 +#if defined (_LINUX_NOTIFIER_H) && !defined ATOMIC_NOTIFIER_HEAD
     3.8 +#define ATOMIC_NOTIFIER_HEAD(name) struct notifier_block *name
     3.9 +#define atomic_notifier_chain_register(chain,nb) notifier_chain_register(chain,nb)
    3.10 +#define atomic_notifier_chain_unregister(chain,nb) notifier_chain_unregister(chain,nb)
    3.11 +#define atomic_notifier_call_chain(chain,val,v) notifier_call_chain(chain,val,v)
    3.12 +#endif
    3.13 +
    3.14  #if defined(_LINUX_FS_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
    3.15  #define nonseekable_open(inode, filp) /* Nothing to do */
    3.16  #endif
    3.17 @@ -69,4 +76,8 @@ extern char *kasprintf(gfp_t gfp, const 
    3.18         __attribute__ ((format (printf, 2, 3)));
    3.19  #endif
    3.20  
    3.21 +#if defined(_I386_PAGE_H) && defined(CONFIG_X86_PAE)
    3.22 +#define __supported_pte_mask ~0ULL
    3.23  #endif
    3.24 +
    3.25 +#endif
     4.1 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	Mon Jan 22 17:07:16 2007 +0000
     4.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	Mon Jan 22 17:10:27 2007 +0000
     4.3 @@ -61,7 +61,7 @@ MODULE_LICENSE("GPL");
     4.4  unsigned long *phys_to_machine_mapping;
     4.5  EXPORT_SYMBOL(phys_to_machine_mapping);
     4.6  
     4.7 -static int __init init_xen_info(void)
     4.8 +static int __devinit init_xen_info(void)
     4.9  {
    4.10  	unsigned long shared_info_frame;
    4.11  	struct xen_add_to_physmap xatp;
    4.12 @@ -194,14 +194,23 @@ static uint64_t get_callback_via(struct 
    4.13  	       rid);
    4.14  	return rid | IA64_CALLBACK_IRQ_RID;
    4.15  #else /* !__ia64__ */
    4.16 +	u8 pin;
    4.17 +
    4.18  	if (pdev->irq < 16)
    4.19  		return pdev->irq; /* ISA IRQ */
    4.20 +
    4.21 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
    4.22 +	pin = pdev->pin;
    4.23 +#else
    4.24 +	pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin);
    4.25 +#endif
    4.26 +
    4.27  	/* We don't know the GSI. Specify the PCI INTx line instead. */
    4.28  	return (((uint64_t)0x01 << 56) | /* PCI INTx identifier */
    4.29  		((uint64_t)pci_domain_nr(pdev->bus) << 32) |
    4.30  		((uint64_t)pdev->bus->number << 16) |
    4.31  		((uint64_t)(pdev->devfn & 0xff) << 8) |
    4.32 -		((uint64_t)(pdev->pin - 1) & 3));
    4.33 +		((uint64_t)(pin - 1) & 3));
    4.34  #endif
    4.35  }
    4.36