ia64/linux-2.6.18-xen.hg

changeset 506:ad7ad9af265e

merge with linux-2.6.18-xen.hg
author Alex Williamson <alex.williamson@hp.com>
date Tue Apr 01 11:29:31 2008 -0600 (2008-04-01)
parents bb2f8ba47833 06ffa3eb5e3f
children ec6e3e18ea31 636cd340e024
files
line diff
     1.1 --- a/Documentation/i2c/busses/i2c-i801	Tue Mar 25 12:37:54 2008 -0600
     1.2 +++ b/Documentation/i2c/busses/i2c-i801	Tue Apr 01 11:29:31 2008 -0600
     1.3 @@ -10,6 +10,11 @@ Supported adapters:
     1.4    * Intel 6300ESB
     1.5    * Intel 82801FB/FR/FW/FRW (ICH6)
     1.6    * Intel ICH7
     1.7 +  * Intel 82801G (ICH7)
     1.8 +  * Intel 82801H (ICH9)
     1.9 +  * Intel 82801I (ICH9)
    1.10 +  * Intel Tolapai
    1.11 +  * Intel ICH10
    1.12      Datasheets: Publicly available at the Intel website
    1.13  
    1.14  Authors: 
     2.1 --- a/arch/i386/kernel/pci-dma-xen.c	Tue Mar 25 12:37:54 2008 -0600
     2.2 +++ b/arch/i386/kernel/pci-dma-xen.c	Tue Apr 01 11:29:31 2008 -0600
     2.3 @@ -77,6 +77,39 @@ do {							\
     2.4  	}						\
     2.5  } while (0)
     2.6  
     2.7 +static int check_pages_physically_contiguous(unsigned long pfn, 
     2.8 +					     unsigned int offset,
     2.9 +					     size_t length)
    2.10 +{
    2.11 +	unsigned long next_mfn;
    2.12 +	int i;
    2.13 +	int nr_pages;
    2.14 +	
    2.15 +	next_mfn = pfn_to_mfn(pfn);
    2.16 +	nr_pages = (offset + length + PAGE_SIZE-1) >> PAGE_SHIFT;
    2.17 +	
    2.18 +	for (i = 1; i < nr_pages; i++) {
    2.19 +		if (pfn_to_mfn(++pfn) != ++next_mfn) 
    2.20 +			return 0;
    2.21 +	}
    2.22 +	return 1;
    2.23 +}
    2.24 +
    2.25 +int range_straddles_page_boundary(paddr_t p, size_t size)
    2.26 +{
    2.27 +	extern unsigned long *contiguous_bitmap;
    2.28 +	unsigned long pfn = p >> PAGE_SHIFT;
    2.29 +	unsigned int offset = p & ~PAGE_MASK;
    2.30 +
    2.31 +	if (offset + size <= PAGE_SIZE)
    2.32 +		return 0;
    2.33 +	if (test_bit(pfn, contiguous_bitmap))
    2.34 +		return 0;
    2.35 +	if (check_pages_physically_contiguous(pfn, offset, size))
    2.36 +		return 0;
    2.37 +	return 1;
    2.38 +}
    2.39 +
    2.40  int
    2.41  dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
    2.42  	   enum dma_data_direction direction)
     3.1 --- a/arch/i386/pci/irq-xen.c	Tue Mar 25 12:37:54 2008 -0600
     3.2 +++ b/arch/i386/pci/irq-xen.c	Tue Apr 01 11:29:31 2008 -0600
     3.3 @@ -553,6 +553,10 @@ static __init int intel_router_probe(str
     3.4  		case PCI_DEVICE_ID_INTEL_ICH9_3:
     3.5  		case PCI_DEVICE_ID_INTEL_ICH9_4:
     3.6  		case PCI_DEVICE_ID_INTEL_ICH9_5:
     3.7 +		case PCI_DEVICE_ID_INTEL_ICH10_0:
     3.8 +		case PCI_DEVICE_ID_INTEL_ICH10_1:
     3.9 +		case PCI_DEVICE_ID_INTEL_ICH10_2:
    3.10 +		case PCI_DEVICE_ID_INTEL_ICH10_3:
    3.11  			r->name = "PIIX/ICH";
    3.12  			r->get = pirq_piix_get;
    3.13  			r->set = pirq_piix_set;
     4.1 --- a/arch/i386/pci/irq.c	Tue Mar 25 12:37:54 2008 -0600
     4.2 +++ b/arch/i386/pci/irq.c	Tue Apr 01 11:29:31 2008 -0600
     4.3 @@ -549,6 +549,10 @@ static __init int intel_router_probe(str
     4.4  		case PCI_DEVICE_ID_INTEL_ICH9_3:
     4.5  		case PCI_DEVICE_ID_INTEL_ICH9_4:
     4.6  		case PCI_DEVICE_ID_INTEL_ICH9_5:
     4.7 +		case PCI_DEVICE_ID_INTEL_ICH10_0:
     4.8 +		case PCI_DEVICE_ID_INTEL_ICH10_1:
     4.9 +		case PCI_DEVICE_ID_INTEL_ICH10_2:
    4.10 +		case PCI_DEVICE_ID_INTEL_ICH10_3:
    4.11  			r->name = "PIIX/ICH";
    4.12  			r->get = pirq_piix_get;
    4.13  			r->set = pirq_piix_set;
     5.1 --- a/drivers/i2c/busses/Kconfig	Tue Mar 25 12:37:54 2008 -0600
     5.2 +++ b/drivers/i2c/busses/Kconfig	Tue Apr 01 11:29:31 2008 -0600
     5.3 @@ -126,6 +126,7 @@ config I2C_I801
     5.4  	    ESB2
     5.5  	    ICH8
     5.6  	    ICH9
     5.7 +	    ICH10
     5.8  
     5.9  	  This driver can also be built as a module.  If so, the module
    5.10  	  will be called i2c-i801.
     6.1 --- a/drivers/i2c/busses/i2c-i801.c	Tue Mar 25 12:37:54 2008 -0600
     6.2 +++ b/drivers/i2c/busses/i2c-i801.c	Tue Apr 01 11:29:31 2008 -0600
     6.3 @@ -34,6 +34,8 @@
     6.4      ESB2		269B
     6.5      ICH8		283E
     6.6      ICH9		2930
     6.7 +    ICH10		3A30
     6.8 +    ICH10		3A60
     6.9      This driver supports several versions of Intel's I/O Controller Hubs (ICH).
    6.10      For SMBus support, they are similar to the PIIX4 and are part
    6.11      of Intel's '810' and other chipsets.
    6.12 @@ -459,6 +461,8 @@ static struct pci_device_id i801_ids[] =
    6.13  	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) },
    6.14  	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) },
    6.15  	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_6) },
    6.16 +	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_4) },
    6.17 +	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_5) },
    6.18  	{ 0, }
    6.19  };
    6.20  
     7.1 --- a/drivers/scsi/ahci.c	Tue Mar 25 12:37:54 2008 -0600
     7.2 +++ b/drivers/scsi/ahci.c	Tue Apr 01 11:29:31 2008 -0600
     7.3 @@ -339,6 +339,12 @@ static const struct pci_device_id ahci_p
     7.4  	  board_ahci }, /* ICH9 */
     7.5  	{ PCI_VENDOR_ID_INTEL, 0x294e, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
     7.6  	  board_ahci }, /* ICH9M */
     7.7 +	{ PCI_VENDOR_ID_INTEL, 0x3a02, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
     7.8 +	  board_ahci }, /* ICH10 */
     7.9 +	{ PCI_VENDOR_ID_INTEL, 0x3a05, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
    7.10 +	  board_ahci }, /* ICH10 */
    7.11 +	{ PCI_VENDOR_ID_INTEL, 0x3a25, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
    7.12 +	  board_ahci }, /* ICH10 */
    7.13  
    7.14  	/* JMicron */
    7.15  	{ 0x197b, 0x2360, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
     8.1 --- a/drivers/scsi/ata_piix.c	Tue Mar 25 12:37:54 2008 -0600
     8.2 +++ b/drivers/scsi/ata_piix.c	Tue Apr 01 11:29:31 2008 -0600
     8.3 @@ -126,6 +126,7 @@ enum {
     8.4  	ich7m_sata_ahci		= 7,
     8.5  	ich8_sata_ahci		= 8,
     8.6  	ich9_sata_ahci		= 9,
     8.7 +	ich8_2port_sata		= 10,
     8.8  
     8.9  	/* constants for mapping table */
    8.10  	P0			= 0,  /* port 0 */
    8.11 @@ -193,10 +194,10 @@ static const struct pci_device_id piix_p
    8.12  	{ 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich7m_sata_ahci },
    8.13  	/* Enterprise Southbridge 2 (where's the datasheet?) */
    8.14  	{ 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
    8.15 -	/* SATA Controller 1 IDE (ICH8, no datasheet yet) */
    8.16 +	/* SATA Controller 1 IDE (ICH8) */
    8.17  	{ 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
    8.18 -	/* SATA Controller 2 IDE (ICH8, ditto) */
    8.19 -	{ 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
    8.20 +	/* SATA Controller 2 IDE (ICH8) */
    8.21 +	{ 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
    8.22  	/* Mobile SATA Controller IDE (ICH8M, ditto) */
    8.23  	{ 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
    8.24  	/* SATA Controller 1 IDE (ICH9) */
    8.25 @@ -211,6 +212,14 @@ static const struct pci_device_id piix_p
    8.26  	{ 0x8086, 0x292d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_sata_ahci },
    8.27  	/* Mobile SATA Controller 2 IDE (ICH9M) */
    8.28  	{ 0x8086, 0x292e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_sata_ahci },
    8.29 +	/* SATA Controller IDE (ICH10) */
    8.30 +	{ 0x8086, 0x3a00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
    8.31 +	/* SATA Controller IDE (ICH10) */
    8.32 +	{ 0x8086, 0x3a06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
    8.33 +	/* SATA Controller IDE (ICH10) */
    8.34 +	{ 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
    8.35 +	/* SATA Controller IDE (ICH10) */
    8.36 +	{ 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
    8.37  
    8.38  	{ }	/* terminate list */
    8.39  };
    8.40 @@ -394,6 +403,18 @@ static const struct piix_map_db ich9_map
    8.41  	},
    8.42  };
    8.43  
    8.44 +static const struct piix_map_db ich8_2port_map_db = {
    8.45 +	.mask = 0x3,
    8.46 +	.port_enable = 0x3,
    8.47 +	.map = {
    8.48 +		/* PM   PS   SM   SS       MAP */
    8.49 +		{  P0,  NA,  P1,  NA }, /* 00b */
    8.50 +		{  RV,  RV,  RV,  RV }, /* 01b */
    8.51 +		{  RV,  RV,  RV,  RV }, /* 10b */
    8.52 +		{  RV,  RV,  RV,  RV },
    8.53 +	},
    8.54 +};
    8.55 +
    8.56  static const struct piix_map_db *piix_map_db_table[] = {
    8.57  	[ich5_sata]		= &ich5_map_db,
    8.58  	[esb_sata]		= &ich5_map_db,
    8.59 @@ -403,6 +424,7 @@ static const struct piix_map_db *piix_ma
    8.60  	[ich7m_sata_ahci]	= &ich7m_map_db,
    8.61  	[ich8_sata_ahci]	= &ich8_map_db,
    8.62  	[ich9_sata_ahci]	= &ich9_map_db,
    8.63 +	[ich8_2port_sata]	= &ich8_2port_map_db,
    8.64  };
    8.65  
    8.66  static struct ata_port_info piix_port_info[] = {
    8.67 @@ -526,6 +548,18 @@ static struct ata_port_info piix_port_in
    8.68  		.udma_mask	= 0x7f, /* udma0-6 */
    8.69  		.port_ops	= &piix_sata_ops,
    8.70  	},
    8.71 +	
    8.72 +	/* ich8_2port_sata: 11: */
    8.73 +	{
    8.74 +		.sht		= &piix_sht,
    8.75 +		.host_flags	= ATA_FLAG_SATA |
    8.76 +				  PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR |
    8.77 +				  PIIX_FLAG_AHCI,
    8.78 +		.pio_mask	= 0x1f,	/* pio0-4 */
    8.79 +		.mwdma_mask	= 0x07, /* mwdma0-2 */
    8.80 +		.udma_mask	= ATA_UDMA6,
    8.81 +		.port_ops	= &piix_pata_ops,
    8.82 +	},
    8.83  };
    8.84  
    8.85  static struct pci_bits piix_enable_bits[] = {
     9.1 --- a/drivers/xen/balloon/sysfs.c	Tue Mar 25 12:37:54 2008 -0600
     9.2 +++ b/drivers/xen/balloon/sysfs.c	Tue Apr 01 11:29:31 2008 -0600
     9.3 @@ -39,7 +39,7 @@
     9.4  #include <xen/platform-compat.h>
     9.5  #endif
     9.6  
     9.7 -#define BALLOON_CLASS_NAME "memory"
     9.8 +#define BALLOON_CLASS_NAME "xen_memory"
     9.9  
    9.10  #define BALLOON_SHOW(name, format, args...)			\
    9.11  	static ssize_t show_##name(struct sys_device *dev,	\
    10.1 --- a/drivers/xen/blkback/blkback.c	Tue Mar 25 12:37:54 2008 -0600
    10.2 +++ b/drivers/xen/blkback/blkback.c	Tue Apr 01 11:29:31 2008 -0600
    10.3 @@ -173,8 +173,8 @@ static void fast_flush_area(pending_req_
    10.4  		handle = pending_handle(req, i);
    10.5  		if (handle == BLKBACK_INVALID_HANDLE)
    10.6  			continue;
    10.7 -		gnttab_set_unmap_op(&unmap[i], vaddr(req, i), GNTMAP_host_map,
    10.8 -				    handle);
    10.9 +		gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i),
   10.10 +				    GNTMAP_host_map, handle);
   10.11  		pending_handle(req, i) = BLKBACK_INVALID_HANDLE;
   10.12  		invcount++;
   10.13  	}
    11.1 --- a/drivers/xen/blkfront/blkfront.c	Tue Mar 25 12:37:54 2008 -0600
    11.2 +++ b/drivers/xen/blkfront/blkfront.c	Tue Apr 01 11:29:31 2008 -0600
    11.3 @@ -817,7 +817,7 @@ static void blkif_recover(struct blkfron
    11.4  	int j;
    11.5  
    11.6  	/* Stage 1: Make a safe copy of the shadow state. */
    11.7 -	copy = kmalloc(sizeof(info->shadow), GFP_KERNEL | __GFP_NOFAIL);
    11.8 +	copy = kmalloc(sizeof(info->shadow), GFP_KERNEL | __GFP_NOFAIL | __GFP_HIGH);
    11.9  	memcpy(copy, info->shadow, sizeof(info->shadow));
   11.10  
   11.11  	/* Stage 2: Set up free list. */
    12.1 --- a/drivers/xen/core/gnttab.c	Tue Mar 25 12:37:54 2008 -0600
    12.2 +++ b/drivers/xen/core/gnttab.c	Tue Apr 01 11:29:31 2008 -0600
    12.3 @@ -52,7 +52,7 @@
    12.4  /* External tools reserve first few grant table entries. */
    12.5  #define NR_RESERVED_ENTRIES 8
    12.6  #define GNTTAB_LIST_END 0xffffffff
    12.7 -#define GREFS_PER_GRANT_FRAME (PAGE_SIZE / sizeof(grant_entry_t))
    12.8 +#define ENTRIES_PER_GRANT_FRAME (PAGE_SIZE / sizeof(grant_entry_t))
    12.9  
   12.10  static grant_ref_t **gnttab_list;
   12.11  static unsigned int nr_grant_frames;
   12.12 @@ -70,6 +70,9 @@ static int gnttab_expand(unsigned int re
   12.13  #define RPP (PAGE_SIZE / sizeof(grant_ref_t))
   12.14  #define gnttab_entry(entry) (gnttab_list[(entry) / RPP][(entry) % RPP])
   12.15  
   12.16 +#define nr_freelist_frames(grant_frames)				\
   12.17 +	(((grant_frames) * ENTRIES_PER_GRANT_FRAME + RPP - 1) / RPP)
   12.18 +
   12.19  static int get_free_entries(int count)
   12.20  {
   12.21  	unsigned long flags;
   12.22 @@ -372,24 +375,25 @@ EXPORT_SYMBOL_GPL(gnttab_cancel_free_cal
   12.23  static int grow_gnttab_list(unsigned int more_frames)
   12.24  {
   12.25  	unsigned int new_nr_grant_frames, extra_entries, i;
   12.26 +	unsigned int nr_glist_frames, new_nr_glist_frames;
   12.27  
   12.28  	new_nr_grant_frames = nr_grant_frames + more_frames;
   12.29 -	extra_entries       = more_frames * GREFS_PER_GRANT_FRAME;
   12.30 +	extra_entries       = more_frames * ENTRIES_PER_GRANT_FRAME;
   12.31  
   12.32 -	for (i = nr_grant_frames; i < new_nr_grant_frames; i++)
   12.33 -	{
   12.34 +	nr_glist_frames = nr_freelist_frames(nr_grant_frames);
   12.35 +	new_nr_glist_frames = nr_freelist_frames(new_nr_grant_frames);
   12.36 +	for (i = nr_glist_frames; i < new_nr_glist_frames; i++) {
   12.37  		gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC);
   12.38  		if (!gnttab_list[i])
   12.39  			goto grow_nomem;
   12.40  	}
   12.41  
   12.42 -
   12.43 -	for (i = GREFS_PER_GRANT_FRAME * nr_grant_frames;
   12.44 -	     i < GREFS_PER_GRANT_FRAME * new_nr_grant_frames - 1; i++)
   12.45 +	for (i = ENTRIES_PER_GRANT_FRAME * nr_grant_frames;
   12.46 +	     i < ENTRIES_PER_GRANT_FRAME * new_nr_grant_frames - 1; i++)
   12.47  		gnttab_entry(i) = i + 1;
   12.48  
   12.49  	gnttab_entry(i) = gnttab_free_head;
   12.50 -	gnttab_free_head = GREFS_PER_GRANT_FRAME * nr_grant_frames;
   12.51 +	gnttab_free_head = ENTRIES_PER_GRANT_FRAME * nr_grant_frames;
   12.52  	gnttab_free_count += extra_entries;
   12.53  
   12.54  	nr_grant_frames = new_nr_grant_frames;
   12.55 @@ -399,7 +403,7 @@ static int grow_gnttab_list(unsigned int
   12.56  	return 0;
   12.57  	
   12.58  grow_nomem:
   12.59 -	for ( ; i >= nr_grant_frames; i--)
   12.60 +	for ( ; i >= nr_glist_frames; i--)
   12.61  		free_page((unsigned long) gnttab_list[i]);
   12.62  	return -ENOMEM;
   12.63  }
   12.64 @@ -699,8 +703,8 @@ static int gnttab_expand(unsigned int re
   12.65  	unsigned int cur, extra;
   12.66  
   12.67  	cur = nr_grant_frames;
   12.68 -	extra = ((req_entries + (GREFS_PER_GRANT_FRAME-1)) /
   12.69 -		 GREFS_PER_GRANT_FRAME);
   12.70 +	extra = ((req_entries + (ENTRIES_PER_GRANT_FRAME-1)) /
   12.71 +		 ENTRIES_PER_GRANT_FRAME);
   12.72  	if (cur + extra > max_nr_grant_frames())
   12.73  		return -ENOSPC;
   12.74  
   12.75 @@ -713,7 +717,7 @@ static int gnttab_expand(unsigned int re
   12.76  int __devinit gnttab_init(void)
   12.77  {
   12.78  	int i;
   12.79 -	unsigned int max_nr_glist_frames;
   12.80 +	unsigned int max_nr_glist_frames, nr_glist_frames;
   12.81  	unsigned int nr_init_grefs;
   12.82  
   12.83  	if (!is_running_on_xen())
   12.84 @@ -725,16 +729,15 @@ int __devinit gnttab_init(void)
   12.85  	/* Determine the maximum number of frames required for the
   12.86  	 * grant reference free list on the current hypervisor.
   12.87  	 */
   12.88 -	max_nr_glist_frames = (boot_max_nr_grant_frames *
   12.89 -			       GREFS_PER_GRANT_FRAME /
   12.90 -			       (PAGE_SIZE / sizeof(grant_ref_t)));
   12.91 +	max_nr_glist_frames = nr_freelist_frames(boot_max_nr_grant_frames);
   12.92  
   12.93  	gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *),
   12.94  			      GFP_KERNEL);
   12.95  	if (gnttab_list == NULL)
   12.96  		return -ENOMEM;
   12.97  
   12.98 -	for (i = 0; i < nr_grant_frames; i++) {
   12.99 +	nr_glist_frames = nr_freelist_frames(nr_grant_frames);
  12.100 +	for (i = 0; i < nr_glist_frames; i++) {
  12.101  		gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);
  12.102  		if (gnttab_list[i] == NULL)
  12.103  			goto ini_nomem;
  12.104 @@ -743,7 +746,7 @@ int __devinit gnttab_init(void)
  12.105  	if (gnttab_resume() < 0)
  12.106  		return -ENODEV;
  12.107  
  12.108 -	nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME;
  12.109 +	nr_init_grefs = nr_grant_frames * ENTRIES_PER_GRANT_FRAME;
  12.110  
  12.111  	for (i = NR_RESERVED_ENTRIES; i < nr_init_grefs - 1; i++)
  12.112  		gnttab_entry(i) = i + 1;
    13.1 --- a/drivers/xen/core/xen_sysfs.c	Tue Mar 25 12:37:54 2008 -0600
    13.2 +++ b/drivers/xen/core/xen_sysfs.c	Tue Apr 01 11:29:31 2008 -0600
    13.3 @@ -104,6 +104,10 @@ static ssize_t uuid_show(struct hyp_sysf
    13.4  {
    13.5  	char *vm, *val;
    13.6  	int ret;
    13.7 +	extern int xenstored_ready;
    13.8 +
    13.9 +	if (!xenstored_ready)
   13.10 +		return -EBUSY;
   13.11  
   13.12  	vm = xenbus_read(XBT_NIL, "vm", "", NULL);
   13.13  	if (IS_ERR(vm))
    14.1 --- a/drivers/xen/fbfront/xenfb.c	Tue Mar 25 12:37:54 2008 -0600
    14.2 +++ b/drivers/xen/fbfront/xenfb.c	Tue Apr 01 11:29:31 2008 -0600
    14.3 @@ -62,15 +62,21 @@ struct xenfb_info
    14.4  	struct xenfb_page	*page;
    14.5  	unsigned long 		*mfns;
    14.6  	int			update_wanted; /* XENFB_TYPE_UPDATE wanted */
    14.7 +	int			feature_resize; /* Backend has resize feature */
    14.8 +	struct xenfb_resize	resize;
    14.9 +	int			resize_dpy;
   14.10 +	spinlock_t		resize_lock;
   14.11  
   14.12  	struct xenbus_device	*xbdev;
   14.13  };
   14.14  
   14.15  /*
   14.16 - * How the locks work together
   14.17 + * There are three locks:
   14.18 + *    spinlock resize_lock protecting resize_dpy and resize
   14.19 + *    spinlock dirty_lock protecting the dirty rectangle
   14.20 + *    mutex mm_lock protecting mappings.
   14.21   *
   14.22 - * There are two locks: spinlock dirty_lock protecting the dirty
   14.23 - * rectangle, and mutex mm_lock protecting mappings.
   14.24 + * How the dirty and mapping locks work together
   14.25   *
   14.26   * The problem is that dirty rectangle and mappings aren't
   14.27   * independent: the dirty rectangle must cover all faulted pages in
   14.28 @@ -129,35 +135,62 @@ struct xenfb_info
   14.29   *
   14.30   * Oh well, we wont be updating the writes to this page anytime soon.
   14.31   */
   14.32 +#define MB_ (1024*1024)
   14.33 +#define XENFB_DEFAULT_FB_LEN (XENFB_WIDTH * XENFB_HEIGHT * XENFB_DEPTH / 8)
   14.34 +
   14.35 +enum {KPARAM_MEM, KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT};
   14.36 +static int video[KPARAM_CNT] = {2, XENFB_WIDTH, XENFB_HEIGHT};
   14.37 +module_param_array(video, int, NULL, 0);
   14.38 +MODULE_PARM_DESC(video,
   14.39 +		"Size of video memory in MB and width,height in pixels, default = (2,800,600)");
   14.40  
   14.41  static int xenfb_fps = 20;
   14.42 -static unsigned long xenfb_mem_len = XENFB_WIDTH * XENFB_HEIGHT * XENFB_DEPTH / 8;
   14.43  
   14.44  static int xenfb_remove(struct xenbus_device *);
   14.45 -static void xenfb_init_shared_page(struct xenfb_info *);
   14.46 +static void xenfb_init_shared_page(struct xenfb_info *, struct fb_info *);
   14.47  static int xenfb_connect_backend(struct xenbus_device *, struct xenfb_info *);
   14.48  static void xenfb_disconnect_backend(struct xenfb_info *);
   14.49  
   14.50 +static void xenfb_send_event(struct xenfb_info *info,
   14.51 +		union xenfb_out_event *event)
   14.52 +{
   14.53 +	__u32 prod;
   14.54 +
   14.55 +	prod = info->page->out_prod;
   14.56 +	/* caller ensures !xenfb_queue_full() */
   14.57 +	mb();			/* ensure ring space available */
   14.58 +	XENFB_OUT_RING_REF(info->page, prod) = *event;
   14.59 +	wmb();			/* ensure ring contents visible */
   14.60 +	info->page->out_prod = prod + 1;
   14.61 +
   14.62 +	notify_remote_via_irq(info->irq);
   14.63 +}
   14.64 +
   14.65  static void xenfb_do_update(struct xenfb_info *info,
   14.66  			    int x, int y, int w, int h)
   14.67  {
   14.68  	union xenfb_out_event event;
   14.69 -	__u32 prod;
   14.70  
   14.71 +	memset(&event, 0, sizeof(event));
   14.72  	event.type = XENFB_TYPE_UPDATE;
   14.73  	event.update.x = x;
   14.74  	event.update.y = y;
   14.75  	event.update.width = w;
   14.76  	event.update.height = h;
   14.77  
   14.78 -	prod = info->page->out_prod;
   14.79  	/* caller ensures !xenfb_queue_full() */
   14.80 -	mb();			/* ensure ring space available */
   14.81 -	XENFB_OUT_RING_REF(info->page, prod) = event;
   14.82 -	wmb();			/* ensure ring contents visible */
   14.83 -	info->page->out_prod = prod + 1;
   14.84 +	xenfb_send_event(info, &event);
   14.85 +}
   14.86  
   14.87 -	notify_remote_via_irq(info->irq);
   14.88 +static void xenfb_do_resize(struct xenfb_info *info)
   14.89 +{
   14.90 +	union xenfb_out_event event;
   14.91 +
   14.92 +	memset(&event, 0, sizeof(event));
   14.93 +	event.resize = info->resize;
   14.94 +
   14.95 +	/* caller ensures !xenfb_queue_full() */
   14.96 +	xenfb_send_event(info, &event);
   14.97  }
   14.98  
   14.99  static int xenfb_queue_full(struct xenfb_info *info)
  14.100 @@ -209,11 +242,26 @@ static void xenfb_update_screen(struct x
  14.101  	xenfb_do_update(info, x1, y1, x2 - x1, y2 - y1);
  14.102  }
  14.103  
  14.104 +static void xenfb_handle_resize_dpy(struct xenfb_info *info)
  14.105 +{
  14.106 +	unsigned long flags;
  14.107 +
  14.108 +	spin_lock_irqsave(&info->resize_lock, flags);
  14.109 +	if (info->resize_dpy) {
  14.110 +		if (!xenfb_queue_full(info)) {
  14.111 +			info->resize_dpy = 0;
  14.112 +			xenfb_do_resize(info);
  14.113 +		}
  14.114 +	}
  14.115 +	spin_unlock_irqrestore(&info->resize_lock, flags);
  14.116 +}
  14.117 +
  14.118  static int xenfb_thread(void *data)
  14.119  {
  14.120  	struct xenfb_info *info = data;
  14.121  
  14.122  	while (!kthread_should_stop()) {
  14.123 +		xenfb_handle_resize_dpy(info);
  14.124  		if (info->dirty) {
  14.125  			info->dirty = 0;
  14.126  			xenfb_update_screen(info);
  14.127 @@ -413,6 +461,57 @@ static int xenfb_mmap(struct fb_info *fb
  14.128  	return 0;
  14.129  }
  14.130  
  14.131 +static int
  14.132 +xenfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
  14.133 +{
  14.134 +	struct xenfb_info *xenfb_info;
  14.135 +	int required_mem_len;
  14.136 +
  14.137 +	xenfb_info = info->par;
  14.138 +
  14.139 +	if (!xenfb_info->feature_resize) {
  14.140 +		if (var->xres == video[KPARAM_WIDTH] &&
  14.141 +			var->yres == video[KPARAM_HEIGHT] &&
  14.142 +			var->bits_per_pixel == xenfb_info->page->depth) {
  14.143 +			return 0;
  14.144 +		}
  14.145 +		return -EINVAL;
  14.146 +	}
  14.147 +
  14.148 +	/* Can't resize past initial width and height */
  14.149 +	if (var->xres > video[KPARAM_WIDTH] || var->yres > video[KPARAM_HEIGHT])
  14.150 +		return -EINVAL;
  14.151 +
  14.152 +	required_mem_len = var->xres * var->yres * (xenfb_info->page->depth / 8);
  14.153 +	if (var->bits_per_pixel == xenfb_info->page->depth &&
  14.154 +		var->xres <= info->fix.line_length / (XENFB_DEPTH / 8) &&
  14.155 +		required_mem_len <= info->fix.smem_len) {
  14.156 +		var->xres_virtual = var->xres;
  14.157 +		var->yres_virtual = var->yres;
  14.158 +		return 0;
  14.159 +	}
  14.160 +	return -EINVAL;
  14.161 +}
  14.162 +
  14.163 +static int xenfb_set_par(struct fb_info *info)
  14.164 +{
  14.165 +	struct xenfb_info *xenfb_info;
  14.166 +	unsigned long flags;
  14.167 +
  14.168 +	xenfb_info = info->par;
  14.169 +
  14.170 +	spin_lock_irqsave(&xenfb_info->resize_lock, flags);
  14.171 +	xenfb_info->resize.type = XENFB_TYPE_RESIZE;
  14.172 +	xenfb_info->resize.width = info->var.xres;
  14.173 +	xenfb_info->resize.height = info->var.yres;
  14.174 +	xenfb_info->resize.stride = info->fix.line_length;
  14.175 +	xenfb_info->resize.depth = info->var.bits_per_pixel;
  14.176 +	xenfb_info->resize.offset = 0;
  14.177 +	xenfb_info->resize_dpy = 1;
  14.178 +	spin_unlock_irqrestore(&xenfb_info->resize_lock, flags);
  14.179 +	return 0;
  14.180 +}
  14.181 +
  14.182  static struct fb_ops xenfb_fb_ops = {
  14.183  	.owner		= THIS_MODULE,
  14.184  	.fb_setcolreg	= xenfb_setcolreg,
  14.185 @@ -420,6 +519,8 @@ static struct fb_ops xenfb_fb_ops = {
  14.186  	.fb_copyarea	= xenfb_copyarea,
  14.187  	.fb_imageblit	= xenfb_imageblit,
  14.188  	.fb_mmap	= xenfb_mmap,
  14.189 +	.fb_check_var	= xenfb_check_var,
  14.190 +	.fb_set_par     = xenfb_set_par,
  14.191  };
  14.192  
  14.193  static irqreturn_t xenfb_event_handler(int rq, void *dev_id,
  14.194 @@ -450,6 +551,8 @@ static int __devinit xenfb_probe(struct 
  14.195  {
  14.196  	struct xenfb_info *info;
  14.197  	struct fb_info *fb_info;
  14.198 +	int fb_size;
  14.199 +	int val;
  14.200  	int ret;
  14.201  
  14.202  	info = kzalloc(sizeof(*info), GFP_KERNEL);
  14.203 @@ -457,11 +560,27 @@ static int __devinit xenfb_probe(struct 
  14.204  		xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure");
  14.205  		return -ENOMEM;
  14.206  	}
  14.207 +
  14.208 +	/* Limit kernel param videoram amount to what is in xenstore */
  14.209 +	if (xenbus_scanf(XBT_NIL, dev->otherend, "videoram", "%d", &val) == 1) {
  14.210 +		if (val < video[KPARAM_MEM])
  14.211 +			video[KPARAM_MEM] = val;
  14.212 +	}
  14.213 +
  14.214 +	/* If requested res does not fit in available memory, use default */
  14.215 +	fb_size = video[KPARAM_MEM] * MB_;
  14.216 +	if (video[KPARAM_WIDTH] * video[KPARAM_HEIGHT] * XENFB_DEPTH/8 > fb_size) {
  14.217 +		video[KPARAM_WIDTH] = XENFB_WIDTH;
  14.218 +		video[KPARAM_HEIGHT] = XENFB_HEIGHT;
  14.219 +		fb_size = XENFB_DEFAULT_FB_LEN;
  14.220 +	}
  14.221 +
  14.222  	dev->dev.driver_data = info;
  14.223  	info->xbdev = dev;
  14.224  	info->irq = -1;
  14.225  	info->x1 = info->y1 = INT_MAX;
  14.226  	spin_lock_init(&info->dirty_lock);
  14.227 +	spin_lock_init(&info->resize_lock);
  14.228  	mutex_init(&info->mm_lock);
  14.229  	init_waitqueue_head(&info->wq);
  14.230  	init_timer(&info->refresh);
  14.231 @@ -469,12 +588,12 @@ static int __devinit xenfb_probe(struct 
  14.232  	info->refresh.data = (unsigned long)info;
  14.233  	INIT_LIST_HEAD(&info->mappings);
  14.234  
  14.235 -	info->fb = vmalloc(xenfb_mem_len);
  14.236 +	info->fb = vmalloc(fb_size);
  14.237  	if (info->fb == NULL)
  14.238  		goto error_nomem;
  14.239 -	memset(info->fb, 0, xenfb_mem_len);
  14.240 +	memset(info->fb, 0, fb_size);
  14.241  
  14.242 -	info->nr_pages = (xenfb_mem_len + PAGE_SIZE - 1) >> PAGE_SHIFT;
  14.243 +	info->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT;
  14.244  
  14.245  	info->pages = kmalloc(sizeof(struct page *) * info->nr_pages,
  14.246  			      GFP_KERNEL);
  14.247 @@ -490,8 +609,6 @@ static int __devinit xenfb_probe(struct 
  14.248  	if (!info->page)
  14.249  		goto error_nomem;
  14.250  
  14.251 -	xenfb_init_shared_page(info);
  14.252 -
  14.253  	fb_info = framebuffer_alloc(sizeof(u32) * 256, NULL);
  14.254  				/* see fishy hackery below */
  14.255  	if (fb_info == NULL)
  14.256 @@ -504,9 +621,9 @@ static int __devinit xenfb_probe(struct 
  14.257  	fb_info->screen_base = info->fb;
  14.258  
  14.259  	fb_info->fbops = &xenfb_fb_ops;
  14.260 -	fb_info->var.xres_virtual = fb_info->var.xres = info->page->width;
  14.261 -	fb_info->var.yres_virtual = fb_info->var.yres = info->page->height;
  14.262 -	fb_info->var.bits_per_pixel = info->page->depth;
  14.263 +	fb_info->var.xres_virtual = fb_info->var.xres = video[KPARAM_WIDTH];
  14.264 +	fb_info->var.yres_virtual = fb_info->var.yres = video[KPARAM_HEIGHT];
  14.265 +	fb_info->var.bits_per_pixel = XENFB_DEPTH;
  14.266  
  14.267  	fb_info->var.red = (struct fb_bitfield){16, 8, 0};
  14.268  	fb_info->var.green = (struct fb_bitfield){8, 8, 0};
  14.269 @@ -518,9 +635,9 @@ static int __devinit xenfb_probe(struct 
  14.270  	fb_info->var.vmode = FB_VMODE_NONINTERLACED;
  14.271  
  14.272  	fb_info->fix.visual = FB_VISUAL_TRUECOLOR;
  14.273 -	fb_info->fix.line_length = info->page->line_length;
  14.274 +	fb_info->fix.line_length = fb_info->var.xres * (XENFB_DEPTH / 8);
  14.275  	fb_info->fix.smem_start = 0;
  14.276 -	fb_info->fix.smem_len = xenfb_mem_len;
  14.277 +	fb_info->fix.smem_len = fb_size;
  14.278  	strcpy(fb_info->fix.id, "xen");
  14.279  	fb_info->fix.type = FB_TYPE_PACKED_PIXELS;
  14.280  	fb_info->fix.accel = FB_ACCEL_NONE;
  14.281 @@ -534,6 +651,8 @@ static int __devinit xenfb_probe(struct 
  14.282  		goto error;
  14.283  	}
  14.284  
  14.285 +	xenfb_init_shared_page(info, fb_info);
  14.286 +
  14.287  	ret = register_framebuffer(fb_info);
  14.288  	if (ret) {
  14.289  		fb_dealloc_cmap(&info->fb_info->cmap);
  14.290 @@ -571,7 +690,7 @@ static int xenfb_resume(struct xenbus_de
  14.291  	struct xenfb_info *info = dev->dev.driver_data;
  14.292  
  14.293  	xenfb_disconnect_backend(info);
  14.294 -	xenfb_init_shared_page(info);
  14.295 +	xenfb_init_shared_page(info, info->fb_info);
  14.296  	return xenfb_connect_backend(dev, info);
  14.297  }
  14.298  
  14.299 @@ -597,9 +716,11 @@ static int xenfb_remove(struct xenbus_de
  14.300  	return 0;
  14.301  }
  14.302  
  14.303 -static void xenfb_init_shared_page(struct xenfb_info *info)
  14.304 +static void xenfb_init_shared_page(struct xenfb_info *info,
  14.305 +                                   struct fb_info * fb_info)
  14.306  {
  14.307  	int i;
  14.308 +	int epd = PAGE_SIZE / sizeof(info->mfns[0]);
  14.309  
  14.310  	for (i = 0; i < info->nr_pages; i++)
  14.311  		info->pages[i] = vmalloc_to_page(info->fb + i * PAGE_SIZE);
  14.312 @@ -607,13 +728,14 @@ static void xenfb_init_shared_page(struc
  14.313  	for (i = 0; i < info->nr_pages; i++)
  14.314  		info->mfns[i] = vmalloc_to_mfn(info->fb + i * PAGE_SIZE);
  14.315  
  14.316 -	info->page->pd[0] = vmalloc_to_mfn(info->mfns);
  14.317 -	info->page->pd[1] = 0;
  14.318 -	info->page->width = XENFB_WIDTH;
  14.319 -	info->page->height = XENFB_HEIGHT;
  14.320 -	info->page->depth = XENFB_DEPTH;
  14.321 -	info->page->line_length = (info->page->depth / 8) * info->page->width;
  14.322 -	info->page->mem_length = xenfb_mem_len;
  14.323 +	for (i = 0; i * epd < info->nr_pages; i++)
  14.324 +		info->page->pd[i] = vmalloc_to_mfn(&info->mfns[i * epd]);
  14.325 +
  14.326 +	info->page->width = fb_info->var.xres;
  14.327 +	info->page->height = fb_info->var.yres;
  14.328 +	info->page->depth = fb_info->var.bits_per_pixel;
  14.329 +	info->page->line_length = fb_info->fix.line_length;
  14.330 +	info->page->mem_length = fb_info->fix.smem_len;
  14.331  	info->page->in_cons = info->page->in_prod = 0;
  14.332  	info->page->out_cons = info->page->out_prod = 0;
  14.333  }
  14.334 @@ -712,6 +834,11 @@ static void xenfb_backend_changed(struct
  14.335  			val = 0;
  14.336  		if (val)
  14.337  			info->update_wanted = 1;
  14.338 +
  14.339 +		if (xenbus_scanf(XBT_NIL, dev->otherend,
  14.340 +					"feature-resize", "%d", &val) < 0)
  14.341 +			val = 0;
  14.342 +		info->feature_resize = val;
  14.343  		break;
  14.344  
  14.345  	case XenbusStateClosing:
    15.1 --- a/drivers/xen/fbfront/xenkbd.c	Tue Mar 25 12:37:54 2008 -0600
    15.2 +++ b/drivers/xen/fbfront/xenkbd.c	Tue Apr 01 11:29:31 2008 -0600
    15.3 @@ -297,6 +297,16 @@ static void xenkbd_backend_changed(struc
    15.4  		 */
    15.5  		if (dev->state != XenbusStateConnected)
    15.6  			goto InitWait; /* no InitWait seen yet, fudge it */
    15.7 +
    15.8 +		/* Set input abs params to match backend screen res */
    15.9 +		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
   15.10 +				   "width", "%d", &val) > 0 )
   15.11 +			input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
   15.12 +
   15.13 +		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
   15.14 +				   "height", "%d", &val) > 0 )
   15.15 +			input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
   15.16 +
   15.17  		break;
   15.18  
   15.19  	case XenbusStateClosing:
    16.1 --- a/drivers/xen/pciback/passthrough.c	Tue Mar 25 12:37:54 2008 -0600
    16.2 +++ b/drivers/xen/pciback/passthrough.c	Tue Apr 01 11:29:31 2008 -0600
    16.3 @@ -47,6 +47,8 @@ int pciback_add_pci_dev(struct pciback_d
    16.4  	struct passthrough_dev_data *dev_data = pdev->pci_dev_data;
    16.5  	struct pci_dev_entry *dev_entry;
    16.6  	unsigned long flags;
    16.7 +	unsigned int domain, bus, devfn;
    16.8 +	int err;
    16.9  
   16.10  	dev_entry = kmalloc(sizeof(*dev_entry), GFP_KERNEL);
   16.11  	if (!dev_entry)
   16.12 @@ -57,9 +59,13 @@ int pciback_add_pci_dev(struct pciback_d
   16.13  	list_add_tail(&dev_entry->list, &dev_data->dev_list);
   16.14  	spin_unlock_irqrestore(&dev_data->lock, flags);
   16.15  
   16.16 -	/* TODO: Publish virtual domain:bus:slot.func here. */
   16.17 +	/* Publish this device. */
   16.18 +	domain = (unsigned int)pci_domain_nr(dev->bus);
   16.19 +	bus = (unsigned int)dev->bus->number;
   16.20 +	devfn = dev->devfn;
   16.21 +	err = publish_cb(pdev, domain, bus, devfn, devid);
   16.22  
   16.23 -	return 0;
   16.24 +	return err;
   16.25  }
   16.26  
   16.27  void pciback_release_pci_dev(struct pciback_device *pdev, struct pci_dev *dev)
    17.1 --- a/drivers/xen/pciback/xenbus.c	Tue Mar 25 12:37:54 2008 -0600
    17.2 +++ b/drivers/xen/pciback/xenbus.c	Tue Apr 01 11:29:31 2008 -0600
    17.3 @@ -348,7 +348,6 @@ static int pciback_reconfigure(struct pc
    17.4  			substate = XenbusStateUnknown;
    17.5  
    17.6  		switch (substate) {
    17.7 -		/* case XenbusStateUnknown: */
    17.8  		case XenbusStateInitialising:
    17.9  			dev_dbg(&pdev->xdev->dev, "Attaching dev-%d ...\n", i);
   17.10  
   17.11 @@ -382,10 +381,14 @@ static int pciback_reconfigure(struct pc
   17.12  			if (err)
   17.13  				goto out;
   17.14  
   17.15 -			/* TODO: if we are to support multiple pci roots
   17.16 -			 * (CONFIG_XEN_PCIDEV_BACKEND_PASS), publish newly
   17.17 -			 * added root here.
   17.18 -			 */
   17.19 +			/* Publish pci roots. */
   17.20 +			err = pciback_publish_pci_roots(pdev, pciback_publish_pci_root);
   17.21 +			if (err) {
   17.22 +				xenbus_dev_fatal(pdev->xdev, err,
   17.23 +						 "Error while publish PCI root"
   17.24 +						 "buses for frontend");
   17.25 +				goto out;
   17.26 +			}
   17.27  
   17.28  			err = xenbus_printf(XBT_NIL, pdev->xdev->nodename,
   17.29  					    state_str, "%d",
   17.30 @@ -431,10 +434,11 @@ static int pciback_reconfigure(struct pc
   17.31  			if(err)
   17.32  				goto out;
   17.33  
   17.34 -			/* TODO: if we are to support multiple pci roots
   17.35 -			 * (CONFIG_XEN_PCIDEV_BACKEND_PASS), remove unnecessary
   17.36 -			 * root here.
   17.37 +			/* TODO: If at some point we implement support for pci
   17.38 +			 * root hot-remove on pcifront side, we'll need to
   17.39 +			 * remove unnecessary xenstore nodes of pci roots here.
   17.40  			 */
   17.41 +
   17.42  			break;
   17.43  
   17.44  		default:
    18.1 --- a/drivers/xen/pcifront/xenbus.c	Tue Mar 25 12:37:54 2008 -0600
    18.2 +++ b/drivers/xen/pcifront/xenbus.c	Tue Apr 01 11:29:31 2008 -0600
    18.3 @@ -332,7 +332,7 @@ static int pcifront_detach_devices(struc
    18.4  			if (err >= 0)
    18.5  				err = -EINVAL;
    18.6  			xenbus_dev_fatal(pdev->xdev, err,
    18.7 -				 	 "Error reading PCI root %d", i);
    18.8 +				 	 "Error reading PCI device %d", i);
    18.9  			goto out;
   18.10  		}
   18.11  
    19.1 --- a/drivers/xen/xenbus/xenbus_xs.c	Tue Mar 25 12:37:54 2008 -0600
    19.2 +++ b/drivers/xen/xenbus/xenbus_xs.c	Tue Apr 01 11:29:31 2008 -0600
    19.3 @@ -629,6 +629,8 @@ void unregister_xenbus_watch(struct xenb
    19.4  	char token[sizeof(watch) * 2 + 1];
    19.5  	int err;
    19.6  
    19.7 +	BUG_ON(watch->flags & XBWF_new_thread);
    19.8 +
    19.9  	sprintf(token, "%lX", (long)watch);
   19.10  
   19.11  	down_read(&xs_state.watch_mutex);
   19.12 @@ -738,16 +740,29 @@ static int xenwatch_thread(void *unused)
   19.13  			list_del(ent);
   19.14  		spin_unlock(&watch_events_lock);
   19.15  
   19.16 -		if (ent != &watch_events) {
   19.17 -			msg = list_entry(ent, struct xs_stored_msg, list);
   19.18 -			if (msg->u.watch.handle->flags & XBWF_new_thread)
   19.19 -				kthread_run(xenwatch_handle_callback,
   19.20 -					    msg, "xenwatch_cb");
   19.21 -			else
   19.22 -				xenwatch_handle_callback(msg);
   19.23 +		if (ent == &watch_events) {
   19.24 +			mutex_unlock(&xenwatch_mutex);
   19.25 +			continue;
   19.26  		}
   19.27  
   19.28 -		mutex_unlock(&xenwatch_mutex);
   19.29 +		msg = list_entry(ent, struct xs_stored_msg, list);
   19.30 +
   19.31 +		/*
   19.32 +		 * Unlock the mutex before running an XBWF_new_thread
   19.33 +		 * handler. kthread_run can block which can deadlock
   19.34 +		 * against unregister_xenbus_watch() if we need to
   19.35 +		 * unregister other watches in order to make
   19.36 +		 * progress. This can occur on resume before the swap
   19.37 +		 * device is attached.
   19.38 +		 */
   19.39 +		if (msg->u.watch.handle->flags & XBWF_new_thread) {
   19.40 +			mutex_unlock(&xenwatch_mutex);
   19.41 +			kthread_run(xenwatch_handle_callback,
   19.42 +				    msg, "xenwatch_cb");
   19.43 +		} else {
   19.44 +			xenwatch_handle_callback(msg);
   19.45 +			mutex_unlock(&xenwatch_mutex);
   19.46 +		}
   19.47  	}
   19.48  
   19.49  	return 0;
    20.1 --- a/include/asm-i386/mach-xen/asm/dma-mapping.h	Tue Mar 25 12:37:54 2008 -0600
    20.2 +++ b/include/asm-i386/mach-xen/asm/dma-mapping.h	Tue Apr 01 11:29:31 2008 -0600
    20.3 @@ -22,13 +22,7 @@ address_needs_mapping(struct device *hwd
    20.4  	return (addr & ~mask) != 0;
    20.5  }
    20.6  
    20.7 -static inline int
    20.8 -range_straddles_page_boundary(paddr_t p, size_t size)
    20.9 -{
   20.10 -	extern unsigned long *contiguous_bitmap;
   20.11 -	return ((((p & ~PAGE_MASK) + size) > PAGE_SIZE) &&
   20.12 -		!test_bit(p >> PAGE_SHIFT, contiguous_bitmap));
   20.13 -}
   20.14 +extern int range_straddles_page_boundary(paddr_t p, size_t size);
   20.15  
   20.16  #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
   20.17  #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
    21.1 --- a/include/asm-i386/mach-xen/asm/page.h	Tue Mar 25 12:37:54 2008 -0600
    21.2 +++ b/include/asm-i386/mach-xen/asm/page.h	Tue Apr 01 11:29:31 2008 -0600
    21.3 @@ -126,9 +126,10 @@ typedef struct { unsigned long pgprot; }
    21.4  		    == _PAGE_PRESENT ?				\
    21.5  		    machine_to_phys(__pte_val(x)) :		\
    21.6  		    __pte_val(x))
    21.7 -#define __pte(x) ({ unsigned long _x = (x);				\
    21.8 -    (pte_t)(((_x) & (_PAGE_PRESENT|_PAGE_IO)) == _PAGE_PRESENT ?	\
    21.9 -    phys_to_machine(_x) : (_x)); })
   21.10 +#define __pte(x) ({ unsigned long _x = (x);			\
   21.11 +    if ((_x & (_PAGE_PRESENT|_PAGE_IO)) == _PAGE_PRESENT)	\
   21.12 +        _x = phys_to_machine(_x);				\
   21.13 +    ((pte_t) { _x }); })
   21.14  #define __pmd_val(x) __pud_val((x).pud)
   21.15  #define __pud_val(x) __pgd_val((x).pgd)
   21.16  #define __pgd(x) ({ unsigned long _x = (x); \
    22.1 --- a/include/linux/pci_ids.h	Tue Mar 25 12:37:54 2008 -0600
    22.2 +++ b/include/linux/pci_ids.h	Tue Apr 01 11:29:31 2008 -0600
    22.3 @@ -2209,6 +2209,12 @@
    22.4  #define PCI_DEVICE_ID_INTEL_MCH_PC	0x3599
    22.5  #define PCI_DEVICE_ID_INTEL_MCH_PC1	0x359a
    22.6  #define PCI_DEVICE_ID_INTEL_E7525_MCH	0x359e
    22.7 +#define PCI_DEVICE_ID_INTEL_ICH10_0	0x3a14
    22.8 +#define PCI_DEVICE_ID_INTEL_ICH10_1	0x3a16
    22.9 +#define PCI_DEVICE_ID_INTEL_ICH10_2	0x3a18
   22.10 +#define PCI_DEVICE_ID_INTEL_ICH10_3	0x3a1a
   22.11 +#define PCI_DEVICE_ID_INTEL_ICH10_4	0x3a30
   22.12 +#define PCI_DEVICE_ID_INTEL_ICH10_5	0x3a60
   22.13  #define PCI_DEVICE_ID_INTEL_82371SB_0	0x7000
   22.14  #define PCI_DEVICE_ID_INTEL_82371SB_1	0x7010
   22.15  #define PCI_DEVICE_ID_INTEL_82371SB_2	0x7020
    23.1 --- a/include/xen/interface/arch-ia64.h	Tue Mar 25 12:37:54 2008 -0600
    23.2 +++ b/include/xen/interface/arch-ia64.h	Tue Apr 01 11:29:31 2008 -0600
    23.3 @@ -23,9 +23,15 @@
    23.4   *
    23.5   */
    23.6  
    23.7 +#include "xen.h"
    23.8 +
    23.9  #ifndef __HYPERVISOR_IF_IA64_H__
   23.10  #define __HYPERVISOR_IF_IA64_H__
   23.11  
   23.12 +#if !defined(__GNUC__) || defined(__STRICT_ANSI__)
   23.13 +#error "Anonymous structs/unions are a GNU extension."
   23.14 +#endif
   23.15 +
   23.16  /* Structural guest handles introduced in 0x00030201. */
   23.17  #if __XEN_INTERFACE_VERSION__ >= 0x00030201
   23.18  #define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/include/xen/interface/arch-ia64/sioemu.h	Tue Apr 01 11:29:31 2008 -0600
    24.3 @@ -0,0 +1,42 @@
    24.4 +/******************************************************************************
    24.5 + * sioemu.h
    24.6 + *
    24.7 + * Copyright (c) 2008 Tristan Gingold <tgingold@free.fr>
    24.8 + *
    24.9 + * This program is free software; you can redistribute it and/or modify
   24.10 + * it under the terms of the GNU General Public License as published by
   24.11 + * the Free Software Foundation; either version 2 of the License, or
   24.12 + * (at your option) any later version.
   24.13 + *
   24.14 + * This program is distributed in the hope that it will be useful,
   24.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   24.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   24.17 + * GNU General Public License for more details.
   24.18 + *
   24.19 + * You should have received a copy of the GNU General Public License
   24.20 + * along with this program; if not, write to the Free Software
   24.21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   24.22 + *
   24.23 + */
   24.24 +
   24.25 +#ifndef __XEN_PUBLIC_IA64_SIOEMU_H__
   24.26 +#define __XEN_PUBLIC_IA64_SIOEMU_H__
   24.27 +
   24.28 +/* Defines the callback entry point.  r8=ip, r9=data.
   24.29 +   Must be called per-vcpu.  */
   24.30 +#define SIOEMU_HYPERCALL_SET_CALLBACK 0x01
   24.31 +
   24.32 +/* Finish sioemu fw initialization and start firmware.  r8=ip.  */
   24.33 +#define SIOEMU_HYPERCALL_START_FW 0x02
   24.34 +
   24.35 +/* Add IO pages in physmap.  */
   24.36 +#define SIOEMU_HYPERCALL_ADD_IO_PHYSMAP 0x03
   24.37 +
   24.38 +/* Get wallclock time.  */
   24.39 +#define SIOEMU_HYPERCALL_GET_TIME 0x04
   24.40 +
   24.41 +/* Return from callback.  r16=0.
   24.42 +   Unmask vcpu events.  */
   24.43 +#define SIOEMU_HYPERPRIVOP_CALLBACK_RETURN 0x01
   24.44 +
   24.45 +#endif /* __XEN_PUBLIC_IA64_SIOEMU_H__ */
    25.1 --- a/include/xen/interface/arch-powerpc.h	Tue Mar 25 12:37:54 2008 -0600
    25.2 +++ b/include/xen/interface/arch-powerpc.h	Tue Apr 01 11:29:31 2008 -0600
    25.3 @@ -22,6 +22,8 @@
    25.4   * Authors: Hollis Blanchard <hollisb@us.ibm.com>
    25.5   */
    25.6  
    25.7 +#include "xen.h"
    25.8 +
    25.9  #ifndef __XEN_PUBLIC_ARCH_PPC_64_H__
   25.10  #define __XEN_PUBLIC_ARCH_PPC_64_H__
   25.11  
    26.1 --- a/include/xen/interface/arch-x86/hvm/save.h	Tue Mar 25 12:37:54 2008 -0600
    26.2 +++ b/include/xen/interface/arch-x86/hvm/save.h	Tue Apr 01 11:29:31 2008 -0600
    26.3 @@ -271,8 +271,7 @@ struct hvm_hw_lapic {
    26.4  DECLARE_HVM_SAVE_TYPE(LAPIC, 5, struct hvm_hw_lapic);
    26.5  
    26.6  struct hvm_hw_lapic_regs {
    26.7 -    /* A 4k page of register state */
    26.8 -    uint8_t  data[0x400];
    26.9 +    uint8_t data[1024];
   26.10  };
   26.11  
   26.12  DECLARE_HVM_SAVE_TYPE(LAPIC_REGS, 6, struct hvm_hw_lapic_regs);
    27.1 --- a/include/xen/interface/arch-x86/xen-x86_64.h	Tue Mar 25 12:37:54 2008 -0600
    27.2 +++ b/include/xen/interface/arch-x86/xen-x86_64.h	Tue Apr 01 11:29:31 2008 -0600
    27.3 @@ -140,7 +140,7 @@ struct iret_context {
    27.4      /* Bottom of iret stack frame. */
    27.5  };
    27.6  
    27.7 -#ifdef __GNUC__
    27.8 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
    27.9  /* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */
   27.10  #define __DECL_REG(name) union { \
   27.11      uint64_t r ## name, e ## name; \
    28.1 --- a/include/xen/interface/arch-x86/xen.h	Tue Mar 25 12:37:54 2008 -0600
    28.2 +++ b/include/xen/interface/arch-x86/xen.h	Tue Apr 01 11:29:31 2008 -0600
    28.3 @@ -24,6 +24,8 @@
    28.4   * Copyright (c) 2004-2006, K A Fraser
    28.5   */
    28.6  
    28.7 +#include "../xen.h"
    28.8 +
    28.9  #ifndef __XEN_PUBLIC_ARCH_X86_XEN_H__
   28.10  #define __XEN_PUBLIC_ARCH_X86_XEN_H__
   28.11  
    29.1 --- a/include/xen/interface/domctl.h	Tue Mar 25 12:37:54 2008 -0600
    29.2 +++ b/include/xen/interface/domctl.h	Tue Apr 01 11:29:31 2008 -0600
    29.3 @@ -53,6 +53,9 @@ struct xen_domctl_createdomain {
    29.4   /* Is this an HVM guest (as opposed to a PV guest)? */
    29.5  #define _XEN_DOMCTL_CDF_hvm_guest 0
    29.6  #define XEN_DOMCTL_CDF_hvm_guest  (1U<<_XEN_DOMCTL_CDF_hvm_guest)
    29.7 + /* Use hardware-assisted paging if available? */
    29.8 +#define _XEN_DOMCTL_CDF_hap       1
    29.9 +#define XEN_DOMCTL_CDF_hap        (1U<<_XEN_DOMCTL_CDF_hap)
   29.10      uint32_t flags;
   29.11  };
   29.12  typedef struct xen_domctl_createdomain xen_domctl_createdomain_t;
   29.13 @@ -373,6 +376,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_hyper
   29.14  #define XEN_DOMAINSETUP_hvm_guest  (1UL<<_XEN_DOMAINSETUP_hvm_guest)
   29.15  #define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save)  */
   29.16  #define XEN_DOMAINSETUP_query  (1UL<<_XEN_DOMAINSETUP_query)
   29.17 +#define _XEN_DOMAINSETUP_sioemu_guest 2
   29.18 +#define XEN_DOMAINSETUP_sioemu_guest  (1UL<<_XEN_DOMAINSETUP_sioemu_guest)
   29.19  typedef struct xen_domctl_arch_setup {
   29.20      uint64_aligned_t flags;  /* XEN_DOMAINSETUP_* */
   29.21  #ifdef __ia64__
   29.22 @@ -436,6 +441,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_sendt
   29.23  /* Assign PCI device to HVM guest. Sets up IOMMU structures. */
   29.24  #define XEN_DOMCTL_assign_device      37
   29.25  #define XEN_DOMCTL_test_assign_device 45
   29.26 +#define XEN_DOMCTL_deassign_device 47
   29.27  struct xen_domctl_assign_device {
   29.28      uint32_t  machine_bdf;   /* machine PCI ID of assigned device */
   29.29  };
   29.30 @@ -445,6 +451,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_assig
   29.31  
   29.32  /* Pass-through interrupts: bind real irq -> hvm devfn. */
   29.33  #define XEN_DOMCTL_bind_pt_irq       38
   29.34 +#define XEN_DOMCTL_unbind_pt_irq     48
   29.35  typedef enum pt_irq_type_e {
   29.36      PT_IRQ_TYPE_PCI,
   29.37      PT_IRQ_TYPE_ISA
   29.38 @@ -554,6 +561,17 @@ struct xen_domctl_set_opt_feature {
   29.39  typedef struct xen_domctl_set_opt_feature xen_domctl_set_opt_feature_t;
   29.40  DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_opt_feature_t);
   29.41  
   29.42 +/*
   29.43 + * Set the target domain for a domain
   29.44 + */
   29.45 +#define XEN_DOMCTL_set_target    46
   29.46 +struct xen_domctl_set_target {
   29.47 +    domid_t target;
   29.48 +};
   29.49 +typedef struct xen_domctl_set_target xen_domctl_set_target_t;
   29.50 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_target_t);
   29.51 +
   29.52 +
   29.53  struct xen_domctl {
   29.54      uint32_t cmd;
   29.55      uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
   29.56 @@ -590,6 +608,7 @@ struct xen_domctl {
   29.57          struct xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
   29.58          struct xen_domctl_ext_vcpucontext   ext_vcpucontext;
   29.59          struct xen_domctl_set_opt_feature   set_opt_feature;
   29.60 +        struct xen_domctl_set_target        set_target;
   29.61          uint8_t                             pad[128];
   29.62      } u;
   29.63  };
    30.1 --- a/include/xen/interface/hvm/ioreq.h	Tue Mar 25 12:37:54 2008 -0600
    30.2 +++ b/include/xen/interface/hvm/ioreq.h	Tue Apr 01 11:29:31 2008 -0600
    30.3 @@ -34,14 +34,8 @@
    30.4  
    30.5  #define IOREQ_TYPE_PIO          0 /* pio */
    30.6  #define IOREQ_TYPE_COPY         1 /* mmio ops */
    30.7 -#define IOREQ_TYPE_AND          2
    30.8 -#define IOREQ_TYPE_OR           3
    30.9 -#define IOREQ_TYPE_XOR          4
   30.10 -#define IOREQ_TYPE_XCHG         5
   30.11 -#define IOREQ_TYPE_ADD          6
   30.12  #define IOREQ_TYPE_TIMEOFFSET   7
   30.13  #define IOREQ_TYPE_INVALIDATE   8 /* mapcache */
   30.14 -#define IOREQ_TYPE_SUB          9
   30.15  
   30.16  /*
   30.17   * VMExit dispatcher should cooperate with instruction decoder to
   30.18 @@ -114,11 +108,11 @@ struct buffered_piopage {
   30.19  };
   30.20  #endif /* defined(__ia64__) */
   30.21  
   30.22 -#if defined(__i386__) || defined(__x86_64__)
   30.23  #define ACPI_PM1A_EVT_BLK_ADDRESS           0x0000000000001f40
   30.24  #define ACPI_PM1A_CNT_BLK_ADDRESS           (ACPI_PM1A_EVT_BLK_ADDRESS + 0x04)
   30.25  #define ACPI_PM_TMR_BLK_ADDRESS             (ACPI_PM1A_EVT_BLK_ADDRESS + 0x08)
   30.26 -#endif /* defined(__i386__) || defined(__x86_64__) */
   30.27 +#define ACPI_GPE0_BLK_ADDRESS               (ACPI_PM_TMR_BLK_ADDRESS + 0x20)
   30.28 +#define ACPI_GPE0_BLK_LEN                   0x08
   30.29  
   30.30  #endif /* _IOREQ_H_ */
   30.31  
    31.1 --- a/include/xen/interface/hvm/params.h	Tue Mar 25 12:37:54 2008 -0600
    31.2 +++ b/include/xen/interface/hvm/params.h	Tue Apr 01 11:29:31 2008 -0600
    31.3 @@ -81,6 +81,9 @@
    31.4  #define HVMPTM_no_missed_ticks_pending   2
    31.5  #define HVMPTM_one_missed_tick_pending   3
    31.6  
    31.7 -#define HVM_NR_PARAMS          11
    31.8 +/* Boolean: Enable virtual HPET (high-precision event timer)? (x86-only) */
    31.9 +#define HVM_PARAM_HPET_ENABLED 11
   31.10 +
   31.11 +#define HVM_NR_PARAMS          12
   31.12  
   31.13  #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
    32.1 --- a/include/xen/interface/hvm/save.h	Tue Mar 25 12:37:54 2008 -0600
    32.2 +++ b/include/xen/interface/hvm/save.h	Tue Apr 01 11:29:31 2008 -0600
    32.3 @@ -39,6 +39,10 @@
    32.4   * Internal mechanisms should be kept in Xen-private headers.
    32.5   */
    32.6  
    32.7 +#if !defined(__GNUC__) || defined(__STRICT_ANSI__)
    32.8 +#error "Anonymous structs/unions are a GNU extension."
    32.9 +#endif
   32.10 +
   32.11  /* 
   32.12   * Each entry is preceded by a descriptor giving its type and length
   32.13   */
    33.1 --- a/include/xen/interface/io/fbif.h	Tue Mar 25 12:37:54 2008 -0600
    33.2 +++ b/include/xen/interface/io/fbif.h	Tue Apr 01 11:29:31 2008 -0600
    33.3 @@ -50,12 +50,29 @@ struct xenfb_update
    33.4      int32_t height; /* rect height */
    33.5  };
    33.6  
    33.7 +/*
    33.8 + * Framebuffer resize notification event
    33.9 + * Capable backend sets feature-resize in xenstore.
   33.10 + */
   33.11 +#define XENFB_TYPE_RESIZE 3
   33.12 +
   33.13 +struct xenfb_resize
   33.14 +{
   33.15 +    uint8_t type;    /* XENFB_TYPE_RESIZE */
   33.16 +    int32_t width;   /* width in pixels */
   33.17 +    int32_t height;  /* height in pixels */
   33.18 +    int32_t stride;  /* stride in bytes */
   33.19 +    int32_t depth;   /* depth in bits */
   33.20 +    int32_t offset;  /* offset of the framebuffer in bytes */
   33.21 +};
   33.22 +
   33.23  #define XENFB_OUT_EVENT_SIZE 40
   33.24  
   33.25  union xenfb_out_event
   33.26  {
   33.27      uint8_t type;
   33.28      struct xenfb_update update;
   33.29 +    struct xenfb_resize resize;
   33.30      char pad[XENFB_OUT_EVENT_SIZE];
   33.31  };
   33.32  
   33.33 @@ -109,15 +126,17 @@ struct xenfb_page
   33.34       * Each directory page holds PAGE_SIZE / sizeof(*pd)
   33.35       * framebuffer pages, and can thus map up to PAGE_SIZE *
   33.36       * PAGE_SIZE / sizeof(*pd) bytes.  With PAGE_SIZE == 4096 and
   33.37 -     * sizeof(unsigned long) == 4, that's 4 Megs.  Two directory
   33.38 -     * pages should be enough for a while.
   33.39 +     * sizeof(unsigned long) == 4/8, that's 4 Megs 32 bit and 2 Megs
   33.40 +     * 64 bit.  256 directories give enough room for a 512 Meg
   33.41 +     * framebuffer with a max resolution of 12,800x10,240.  Should
   33.42 +     * be enough for a while with room leftover for expansion.
   33.43       */
   33.44 -    unsigned long pd[2];
   33.45 +    unsigned long pd[256];
   33.46  };
   33.47  
   33.48  /*
   33.49 - * Wart: xenkbd needs to know resolution.  Put it here until a better
   33.50 - * solution is found, but don't leak it to the backend.
   33.51 + * Wart: xenkbd needs to know default resolution.  Put it here until a
   33.52 + * better solution is found, but don't leak it to the backend.
   33.53   */
   33.54  #ifdef __KERNEL__
   33.55  #define XENFB_WIDTH 800
    34.1 --- a/include/xen/interface/io/ring.h	Tue Mar 25 12:37:54 2008 -0600
    34.2 +++ b/include/xen/interface/io/ring.h	Tue Apr 01 11:29:31 2008 -0600
    34.3 @@ -27,6 +27,14 @@
    34.4  #ifndef __XEN_PUBLIC_IO_RING_H__
    34.5  #define __XEN_PUBLIC_IO_RING_H__
    34.6  
    34.7 +#include "../xen-compat.h"
    34.8 +
    34.9 +#if __XEN_INTERFACE_VERSION__ < 0x00030208
   34.10 +#define xen_mb()  mb()
   34.11 +#define xen_rmb() rmb()
   34.12 +#define xen_wmb() wmb()
   34.13 +#endif
   34.14 +
   34.15  typedef unsigned int RING_IDX;
   34.16  
   34.17  /* Round a 32-bit unsigned constant down to the nearest power of two. */
   34.18 @@ -211,12 +219,12 @@ typedef struct __name##_back_ring __name
   34.19      (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r))
   34.20  
   34.21  #define RING_PUSH_REQUESTS(_r) do {                                     \
   34.22 -    wmb(); /* back sees requests /before/ updated producer index */     \
   34.23 +    xen_wmb(); /* back sees requests /before/ updated producer index */ \
   34.24      (_r)->sring->req_prod = (_r)->req_prod_pvt;                         \
   34.25  } while (0)
   34.26  
   34.27  #define RING_PUSH_RESPONSES(_r) do {                                    \
   34.28 -    wmb(); /* front sees responses /before/ updated producer index */   \
   34.29 +    xen_wmb(); /* front sees resps /before/ updated producer index */   \
   34.30      (_r)->sring->rsp_prod = (_r)->rsp_prod_pvt;                         \
   34.31  } while (0)
   34.32  
   34.33 @@ -253,9 +261,9 @@ typedef struct __name##_back_ring __name
   34.34  #define RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(_r, _notify) do {           \
   34.35      RING_IDX __old = (_r)->sring->req_prod;                             \
   34.36      RING_IDX __new = (_r)->req_prod_pvt;                                \
   34.37 -    wmb(); /* back sees requests /before/ updated producer index */     \
   34.38 +    xen_wmb(); /* back sees requests /before/ updated producer index */ \
   34.39      (_r)->sring->req_prod = __new;                                      \
   34.40 -    mb(); /* back sees new requests /before/ we check req_event */      \
   34.41 +    xen_mb(); /* back sees new requests /before/ we check req_event */  \
   34.42      (_notify) = ((RING_IDX)(__new - (_r)->sring->req_event) <           \
   34.43                   (RING_IDX)(__new - __old));                            \
   34.44  } while (0)
   34.45 @@ -263,9 +271,9 @@ typedef struct __name##_back_ring __name
   34.46  #define RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(_r, _notify) do {          \
   34.47      RING_IDX __old = (_r)->sring->rsp_prod;                             \
   34.48      RING_IDX __new = (_r)->rsp_prod_pvt;                                \
   34.49 -    wmb(); /* front sees responses /before/ updated producer index */   \
   34.50 +    xen_wmb(); /* front sees resps /before/ updated producer index */   \
   34.51      (_r)->sring->rsp_prod = __new;                                      \
   34.52 -    mb(); /* front sees new responses /before/ we check rsp_event */    \
   34.53 +    xen_mb(); /* front sees new resps /before/ we check rsp_event */    \
   34.54      (_notify) = ((RING_IDX)(__new - (_r)->sring->rsp_event) <           \
   34.55                   (RING_IDX)(__new - __old));                            \
   34.56  } while (0)
   34.57 @@ -274,7 +282,7 @@ typedef struct __name##_back_ring __name
   34.58      (_work_to_do) = RING_HAS_UNCONSUMED_REQUESTS(_r);                   \
   34.59      if (_work_to_do) break;                                             \
   34.60      (_r)->sring->req_event = (_r)->req_cons + 1;                        \
   34.61 -    mb();                                                               \
   34.62 +    xen_mb();                                                           \
   34.63      (_work_to_do) = RING_HAS_UNCONSUMED_REQUESTS(_r);                   \
   34.64  } while (0)
   34.65  
   34.66 @@ -282,7 +290,7 @@ typedef struct __name##_back_ring __name
   34.67      (_work_to_do) = RING_HAS_UNCONSUMED_RESPONSES(_r);                  \
   34.68      if (_work_to_do) break;                                             \
   34.69      (_r)->sring->rsp_event = (_r)->rsp_cons + 1;                        \
   34.70 -    mb();                                                               \
   34.71 +    xen_mb();                                                           \
   34.72      (_work_to_do) = RING_HAS_UNCONSUMED_RESPONSES(_r);                  \
   34.73  } while (0)
   34.74  
    35.1 --- a/include/xen/interface/io/xs_wire.h	Tue Mar 25 12:37:54 2008 -0600
    35.2 +++ b/include/xen/interface/io/xs_wire.h	Tue Apr 01 11:29:31 2008 -0600
    35.3 @@ -46,7 +46,8 @@ enum xsd_sockmsg_type
    35.4      XS_WATCH_EVENT,
    35.5      XS_ERROR,
    35.6      XS_IS_DOMAIN_INTRODUCED,
    35.7 -    XS_RESUME
    35.8 +    XS_RESUME,
    35.9 +    XS_SET_TARGET
   35.10  };
   35.11  
   35.12  #define XS_WRITE_NONE "NONE"
    36.1 --- a/include/xen/interface/kexec.h	Tue Mar 25 12:37:54 2008 -0600
    36.2 +++ b/include/xen/interface/kexec.h	Tue Apr 01 11:29:31 2008 -0600
    36.3 @@ -130,10 +130,10 @@ typedef struct xen_kexec_load {
    36.4  #define KEXEC_RANGE_MA_XEN        1 /* machine address and size of Xen itself */
    36.5  #define KEXEC_RANGE_MA_CPU        2 /* machine address and size of a CPU note */
    36.6  #define KEXEC_RANGE_MA_XENHEAP    3 /* machine address and size of xenheap
    36.7 -				     * Note that although this is adjacent
    36.8 -				     * to Xen it exists in a separate EFI
    36.9 -				     * region on ia64, and thus needs to be
   36.10 -				     * inserted into iomem_machine separately */
   36.11 +                                     * Note that although this is adjacent
   36.12 +                                     * to Xen it exists in a separate EFI
   36.13 +                                     * region on ia64, and thus needs to be
   36.14 +                                     * inserted into iomem_machine separately */
   36.15  #define KEXEC_RANGE_MA_BOOT_PARAM 4 /* machine address and size of
   36.16                                       * the ia64_boot_param */
   36.17  #define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
    37.1 --- a/include/xen/interface/physdev.h	Tue Mar 25 12:37:54 2008 -0600
    37.2 +++ b/include/xen/interface/physdev.h	Tue Apr 01 11:29:31 2008 -0600
    37.3 @@ -81,7 +81,11 @@ DEFINE_XEN_GUEST_HANDLE(physdev_set_iopl
    37.4  #define PHYSDEVOP_set_iobitmap           7
    37.5  struct physdev_set_iobitmap {
    37.6      /* IN */
    37.7 -    XEN_GUEST_HANDLE_00030205(uint8) bitmap;
    37.8 +#if __XEN_INTERFACE_VERSION__ >= 0x00030205
    37.9 +    XEN_GUEST_HANDLE(uint8) bitmap;
   37.10 +#else
   37.11 +    uint8_t *bitmap;
   37.12 +#endif
   37.13      uint32_t nr_ports;
   37.14  };
   37.15  typedef struct physdev_set_iobitmap physdev_set_iobitmap_t;
    38.1 --- a/include/xen/interface/trace.h	Tue Mar 25 12:37:54 2008 -0600
    38.2 +++ b/include/xen/interface/trace.h	Tue Apr 01 11:29:31 2008 -0600
    38.3 @@ -141,6 +141,14 @@ struct t_rec {
    38.4   * field, indexes into an array of struct t_rec's.
    38.5   */
    38.6  struct t_buf {
    38.7 +    /* Assume the data buffer size is X.  X is generally not a power of 2.
    38.8 +     * CONS and PROD are incremented modulo (2*X):
    38.9 +     *     0 <= cons < 2*X
   38.10 +     *     0 <= prod < 2*X
   38.11 +     * This is done because addition modulo X breaks at 2^32 when X is not a
   38.12 +     * power of 2:
   38.13 +     *     (((2^32 - 1) % X) + 1) % X != (2^32) % X
   38.14 +     */
   38.15      uint32_t cons;   /* Offset of next item to be consumed by control tools. */
   38.16      uint32_t prod;   /* Offset of next item to be produced by Xen.           */
   38.17      /*  Records follow immediately after the meta-data header.    */
    39.1 --- a/include/xen/interface/xen-compat.h	Tue Mar 25 12:37:54 2008 -0600
    39.2 +++ b/include/xen/interface/xen-compat.h	Tue Apr 01 11:29:31 2008 -0600
    39.3 @@ -27,7 +27,7 @@
    39.4  #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
    39.5  #define __XEN_PUBLIC_XEN_COMPAT_H__
    39.6  
    39.7 -#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030207
    39.8 +#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030208
    39.9  
   39.10  #if defined(__XEN__) || defined(__XEN_TOOLS__)
   39.11  /* Xen is built with matching headers and implements the latest interface. */
   39.12 @@ -41,11 +41,4 @@
   39.13  #error "These header files do not support the requested interface version."
   39.14  #endif
   39.15  
   39.16 -/* Fields defined as a Xen guest handle since 0x00030205. */
   39.17 -#if __XEN_INTERFACE_VERSION__ >= 0x00030205
   39.18 -#define XEN_GUEST_HANDLE_00030205(type) XEN_GUEST_HANDLE(type)
   39.19 -#else
   39.20 -#define XEN_GUEST_HANDLE_00030205(type) type *
   39.21 -#endif
   39.22 -
   39.23  #endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
    40.1 --- a/include/xen/interface/xen.h	Tue Mar 25 12:37:54 2008 -0600
    40.2 +++ b/include/xen/interface/xen.h	Tue Apr 01 11:29:31 2008 -0600
    40.3 @@ -263,7 +263,11 @@ struct mmuext_op {
    40.4          /* SET_LDT */
    40.5          unsigned int nr_ents;
    40.6          /* TLB_FLUSH_MULTI, INVLPG_MULTI */
    40.7 -        XEN_GUEST_HANDLE_00030205(void) vcpumask;
    40.8 +#if __XEN_INTERFACE_VERSION__ >= 0x00030205
    40.9 +        XEN_GUEST_HANDLE(void) vcpumask;
   40.10 +#else
   40.11 +        void *vcpumask;
   40.12 +#endif
   40.13      } arg2;
   40.14  };
   40.15  typedef struct mmuext_op mmuext_op_t;
    41.1 --- a/sound/pci/hda/hda_intel.c	Tue Mar 25 12:37:54 2008 -0600
    41.2 +++ b/sound/pci/hda/hda_intel.c	Tue Apr 01 11:29:31 2008 -0600
    41.3 @@ -81,6 +81,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},
    41.4  			 "{Intel, ESB2},"
    41.5  			 "{Intel, ICH8},"
    41.6  			 "{Intel, ICH9},"
    41.7 +			 "{Intel, ICH10},"
    41.8  			 "{ATI, SB450},"
    41.9  			 "{ATI, SB600},"
   41.10  			 "{ATI, RS600},"
   41.11 @@ -1637,6 +1638,8 @@ static struct pci_device_id azx_ids[] = 
   41.12  	{ 0x8086, 0x284b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH8 */
   41.13  	{ 0x8086, 0x293e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH9 */
   41.14  	{ 0x8086, 0x293f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH9 */
   41.15 +	{ 0x8086, 0x3a3e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH10 */
   41.16 +	{ 0x8086, 0x3a6e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH10 */
   41.17  	{ 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */
   41.18  	{ 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */
   41.19  	{ 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */