rpms/kernel/devel linux-2.6-crash-xen.patch, NONE, 1.1 linux-2.6-devmem-xen.patch, NONE, 1.1 linux-2.6-xen-additional.patch, NONE, 1.1 linux-2.6-xen-compile.patch, NONE, 1.1 linux-2.6-xen.patch, NONE, 1.1 kernel-2.6.spec, 1.1607, 1.1608 linux-2.6.10-crash-xen.patch, 1.1, NONE linux-2.6.12-xen-additional.patch, 1.3, NONE linux-2.6.12-xen.patch, 1.1, NONE linux-2.6.8-devmem-xen.patch, 1.2, NONE linux-2.6.9-xen-compile.patch, 1.52, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Sat Oct 15 01:07:38 UTC 2005


Author: davej

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv5453

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-crash-xen.patch linux-2.6-devmem-xen.patch 
	linux-2.6-xen-additional.patch linux-2.6-xen-compile.patch 
	linux-2.6-xen.patch 
Removed Files:
	linux-2.6.10-crash-xen.patch linux-2.6.12-xen-additional.patch 
	linux-2.6.12-xen.patch linux-2.6.8-devmem-xen.patch 
	linux-2.6.9-xen-compile.patch 
Log Message:
rename xen diffs


linux-2.6-crash-xen.patch:
 init.c |    1 +
 1 files changed, 1 insertion(+)

--- NEW FILE linux-2.6-crash-xen.patch ---
--- linux-2.6.10/arch/xen/i386/mm/init.c.crash	2005-02-23 15:09:46.520537480 -0500
+++ linux-2.6.10/arch/xen/i386/mm/init.c	2005-02-23 15:10:05.259476105 -0500
@@ -244,6 +244,7 @@ static inline int page_is_ram(unsigned l
 	}
 	return 0;
 }
+EXPORT_SYMBOL_GPL(page_is_ram);
 
 #ifdef CONFIG_HIGHMEM
 pte_t *kmap_pte;

linux-2.6-devmem-xen.patch:
 linux-2.6.11/include/asm-xen/asm-i386/io.h  |   11 +++++++++++
 linux-2.6.8/include/asm-xen/asm-i386/page.h |    2 ++
 2 files changed, 13 insertions(+)

--- NEW FILE linux-2.6-devmem-xen.patch ---
--- linux-2.6.8/include/asm-xen/asm-i386/page.h.devmem	2004-10-15 15:24:02.000000000 -0400
+++ linux-2.6.8/include/asm-xen/asm-i386/page.h	2004-10-15 15:24:31.000000000 -0400
@@ -207,6 +207,8 @@ static __inline__ int get_order(unsigned
 #define virt_to_machine(_a)	(phys_to_machine(__pa(_a)))
 #define machine_to_virt(_m)	(__va(machine_to_phys(_m)))
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif /* _I386_PAGE_H */
--- linux-2.6.11/include/asm-xen/asm-i386/io.h.rc4	2005-05-16 16:30:29.000000000 -0400
+++ linux-2.6.11/include/asm-xen/asm-i386/io.h	2005-05-16 16:31:41.000000000 -0400
@@ -50,6 +50,17 @@
 #include <linux/vmalloc.h>
 #include <asm/fixmap.h>
 
+/*
+ * Convert a physical pointer to a virtual kernel pointer for /dev/mem
+ * access
+ */
+#define xlate_dev_mem_ptr(p)    __va(p)
+
+/*
+ * Convert a virtual cached pointer to an uncached pointer
+ */
+#define xlate_dev_kmem_ptr(p)   p
+
 /**
  *	virt_to_phys	-	map virtual addresses to physical
  *	@address: address to remap

linux-2.6-xen-additional.patch:
 linux-2.6.10/include/asm-x86_64/hw_irq.h                |    3 
 linux-2.6.10/include/asm-x86_64/irq.h                   |    5 
 linux-2.6.10/include/asm-x86_64/posix_types.h           |    4 
 linux-2.6.11-rcu/kernel/rcupdate.c                      |    5 
 linux-2.6.12.new/arch/i386/mm/init.c                    |    2 
 linux-2.6.12.new/arch/i386/mm/pageattr.c                |    2 
 linux-2.6.12.new/arch/i386/mm/pgtable.c                 |   40 ++++++-
 linux-2.6.12.new/include/asm-i386/pgtable-2level-defs.h |    2 
 linux-2.6.12.new/include/asm-i386/pgtable-3level-defs.h |    2 
 linux-2.6.12.post/arch/i386/Kconfig                     |   13 ++
 linux-2.6.12.post/arch/i386/kernel/Makefile             |    1 
 linux-2.6.12.post/arch/i386/kernel/smpalts.c            |   85 ++++++++++++++++
 linux-2.6.12.post/arch/i386/kernel/smpboot.c            |    5 
 linux-2.6.12.post/arch/i386/kernel/vmlinux.lds.S        |    7 +
 linux-2.6.12.post/include/asm-i386/atomic.h             |    7 -
 linux-2.6.12.post/include/asm-i386/bitops.h             |   19 +--
 linux-2.6.12.post/include/asm-i386/rwsem.h              |   17 +--
 linux-2.6.12.post/include/asm-i386/smp_alt.h            |   32 ++++++
 linux-2.6.12.post/include/asm-i386/spinlock.h           |   41 ++++++-
 linux-2.6.12.post/include/asm-i386/system.h             |   58 +++++++++-
 20 files changed, 297 insertions(+), 53 deletions(-)

--- NEW FILE linux-2.6-xen-additional.patch ---
diff -urNpP linux-2.6.12/arch/i386/mm/init.c linux-2.6.12.new/arch/i386/mm/init.c
--- linux-2.6.12/arch/i386/mm/init.c	2005-06-17 20:48:29.000000000 +0100
+++ linux-2.6.12.new/arch/i386/mm/init.c	2005-07-11 16:28:09.778165582 +0100
@@ -634,7 +634,7 @@ void __init pgtable_cache_init(void)
 				PTRS_PER_PGD*sizeof(pgd_t),
 				0,
 				pgd_ctor,
-				PTRS_PER_PMD == 1 ? pgd_dtor : NULL);
+				pgd_dtor);
 	if (!pgd_cache)
 		panic("pgtable_cache_init(): Cannot create pgd cache");
 }
diff -urNpP linux-2.6.12/arch/i386/mm/pageattr.c linux-2.6.12.new/arch/i386/mm/pageattr.c
--- linux-2.6.12/arch/i386/mm/pageattr.c	2005-06-17 20:48:29.000000000 +0100
+++ linux-2.6.12.new/arch/i386/mm/pageattr.c	2005-07-11 16:28:09.775165494 +0100
@@ -75,7 +75,7 @@ static void set_pmd_pte(pte_t *kpte, uns
 	unsigned long flags;
 
 	set_pte_atomic(kpte, pte); 	/* change init_mm */
-	if (PTRS_PER_PMD > 1)
+	if (HAVE_SHARED_KERNEL_PMD)
 		return;
 
 	spin_lock_irqsave(&pgd_lock, flags);
diff -urNpP linux-2.6.12/arch/i386/mm/pgtable.c linux-2.6.12.new/arch/i386/mm/pgtable.c
--- linux-2.6.12/arch/i386/mm/pgtable.c	2005-06-17 20:48:29.000000000 +0100
+++ linux-2.6.12.new/arch/i386/mm/pgtable.c	2005-07-11 16:32:01.478023726 +0100
@@ -199,14 +199,14 @@ void pgd_ctor(void *pgd, kmem_cache_t *c
 {
 	unsigned long flags;
 
-	if (PTRS_PER_PMD == 1)
+	if (!HAVE_SHARED_KERNEL_PMD)
 		spin_lock_irqsave(&pgd_lock, flags);
 
 	memcpy((pgd_t *)pgd + USER_PTRS_PER_PGD,
 			swapper_pg_dir + USER_PTRS_PER_PGD,
 			(PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
 
-	if (PTRS_PER_PMD > 1)
+	if (HAVE_SHARED_KERNEL_PMD)
 		return;
 
 	pgd_list_add(pgd);
@@ -214,11 +214,13 @@ void pgd_ctor(void *pgd, kmem_cache_t *c
 	memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t));
 }
 
-/* never called when PTRS_PER_PMD > 1 */
 void pgd_dtor(void *pgd, kmem_cache_t *cache, unsigned long unused)
 {
 	unsigned long flags; /* can be called from interrupt context */
 
+	if (HAVE_SHARED_KERNEL_PMD)
+		return;
+
 	spin_lock_irqsave(&pgd_lock, flags);
 	pgd_list_del(pgd);
 	spin_unlock_irqrestore(&pgd_lock, flags);
@@ -226,12 +228,29 @@ void pgd_dtor(void *pgd, kmem_cache_t *c
 
 pgd_t *pgd_alloc(struct mm_struct *mm)
 {
-	int i;
+	int i = 0;
 	pgd_t *pgd = kmem_cache_alloc(pgd_cache, GFP_KERNEL);
 
 	if (PTRS_PER_PMD == 1 || !pgd)
 		return pgd;
 
+	if (!HAVE_SHARED_KERNEL_PMD) {
+		/* alloc and copy kernel pmd */
+		unsigned long flags;
+		pgd_t *copy_pgd = pgd_offset_k(PAGE_OFFSET);
+		pud_t *copy_pud = pud_offset(copy_pgd, PAGE_OFFSET);
+		pmd_t *copy_pmd = pmd_offset(copy_pud, PAGE_OFFSET);
+		pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
+		if (0 == pmd)
+			goto out_oom;
+
+		spin_lock_irqsave(&pgd_lock, flags);
+		memcpy(pmd, copy_pmd, PAGE_SIZE);
+		spin_unlock_irqrestore(&pgd_lock, flags);
+		set_pgd(&pgd[USER_PTRS_PER_PGD], __pgd(1 + __pa(pmd)));
+	}
+
+	/* alloc user pmds */
 	for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
 		pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
 		if (!pmd)
@@ -252,9 +271,16 @@ void pgd_free(pgd_t *pgd)
 	int i;
 
 	/* in the PAE case user pgd entries are overwritten before usage */
-	if (PTRS_PER_PMD > 1)
-		for (i = 0; i < USER_PTRS_PER_PGD; ++i)
-			kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1));
+	if (PTRS_PER_PMD > 1) {
+		for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
+			pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
+			kmem_cache_free(pmd_cache, pmd);
+		}
+		if (!HAVE_SHARED_KERNEL_PMD) {
+			pmd_t *pmd = (void *)__va(pgd_val(pgd[USER_PTRS_PER_PGD])-1);
+			kmem_cache_free(pmd_cache, pmd);
+		}
+	}
 	/* in the non-PAE case, free_pgtables() clears user pgd entries */
 	kmem_cache_free(pgd_cache, pgd);
 }
diff -urNpP linux-2.6.12/include/asm-i386/pgtable-2level-defs.h linux-2.6.12.new/include/asm-i386/pgtable-2level-defs.h
--- linux-2.6.12/include/asm-i386/pgtable-2level-defs.h	2005-06-17 20:48:29.000000000 +0100
+++ linux-2.6.12.new/include/asm-i386/pgtable-2level-defs.h	2005-07-11 16:28:09.733164251 +0100
@@ -1,6 +1,8 @@
 #ifndef _I386_PGTABLE_2LEVEL_DEFS_H
 #define _I386_PGTABLE_2LEVEL_DEFS_H
 
+#define HAVE_SHARED_KERNEL_PMD 0
+
 /*
  * traditional i386 two-level paging structure:
  */
diff -urNpP linux-2.6.12/include/asm-i386/pgtable-3level-defs.h linux-2.6.12.new/include/asm-i386/pgtable-3level-defs.h
--- linux-2.6.12/include/asm-i386/pgtable-3level-defs.h	2005-06-17 20:48:29.000000000 +0100
+++ linux-2.6.12.new/include/asm-i386/pgtable-3level-defs.h	2005-07-11 16:28:09.755164902 +0100
@@ -1,6 +1,8 @@
 #ifndef _I386_PGTABLE_3LEVEL_DEFS_H
 #define _I386_PGTABLE_3LEVEL_DEFS_H
 
+#define HAVE_SHARED_KERNEL_PMD 1
+
 /*
  * PGDIR_SHIFT determines what a top-level page table entry can map
  */
diff -ur linux-2.6.11/kernel/rcupdate.c linux-2.6.11-rcu/kernel/rcupdate.c
--- linux-2.6.11/kernel/rcupdate.c	2005-05-30 10:51:41 +01:00
+++ linux-2.6.11-rcu/kernel/rcupdate.c	2005-05-30 10:53:53 +01:00
@@ -202,8 +202,11 @@
  */
 static void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp, struct rcu_state *rsp)
 {
+	cpumask_t mask;
+
 	cpu_clear(cpu, rsp->cpumask);
-	if (cpus_empty(rsp->cpumask)) {
+	cpus_andnot(mask, rsp->cpumask, nohz_cpu_mask);
+	if (cpus_empty(mask)) {
 		/* batch completed ! */
 		rcp->completed = rcp->cur;
 		rcu_start_batch(rcp, rsp, 0);
diff -Naur linux-2.6.12/arch/i386/Kconfig linux-2.6.12.post/arch/i386/Kconfig
--- linux-2.6.12/arch/i386/Kconfig	2005-06-17 15:48:29.000000000 -0400
+++ linux-2.6.12.post/arch/i386/Kconfig	2005-07-25 05:51:21.000000000 -0400
@@ -487,6 +487,19 @@
 
 	  If you don't know what to do here, say N.
 
+config SMP_ALTERNATIVES
+	bool "SMP alternatives support (EXPERIMENTAL)"
+	depends on SMP && EXPERIMENTAL
+	help
+	  Try to reduce the overhead of running an SMP kernel on a uniprocessor
+	  host slightly by replacing certain key instruction sequences
+	  according to whether we currently have more than one CPU available.
+	  This should provide a noticeable boost to performance when
+	  running SMP kernels on UP machines, and have negligible impact
+	  when running on an true SMP host.
+
+          If unsure, say N.
+	  
 config NR_CPUS
 	int "Maximum number of CPUs (2-255)"
 	range 2 255
diff -Naur linux-2.6.12/arch/i386/kernel/Makefile linux-2.6.12.post/arch/i386/kernel/Makefile
--- linux-2.6.12/arch/i386/kernel/Makefile	2005-06-17 15:48:29.000000000 -0400
+++ linux-2.6.12.post/arch/i386/kernel/Makefile	2005-07-25 05:51:21.000000000 -0400
@@ -33,6 +33,7 @@
 obj-$(CONFIG_HPET_TIMER) 	+= time_hpet.o
 obj-$(CONFIG_EFI) 		+= efi.o efi_stub.o
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
+obj-$(CONFIG_SMP_ALTERNATIVES)  += smpalts.o
 
 EXTRA_AFLAGS   := -traditional
 
diff -Naur linux-2.6.12/arch/i386/kernel/smpalts.c linux-2.6.12.post/arch/i386/kernel/smpalts.c
--- linux-2.6.12/arch/i386/kernel/smpalts.c	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.12.post/arch/i386/kernel/smpalts.c	2005-07-25 05:51:21.000000000 -0400
@@ -0,0 +1,85 @@
+#include <linux/kernel.h>
+#include <asm/system.h>
+#include <asm/smp_alt.h>
+#include <asm/processor.h>
+#include <asm/string.h>
+
+struct smp_replacement_record {
+	unsigned char targ_size;
+	unsigned char smp1_size;
+	unsigned char smp2_size;
+	unsigned char up_size;
+	unsigned char feature;
+	unsigned char data[0];
+};
+
+struct smp_alternative_record {
+	void *targ_start;
+	struct smp_replacement_record *repl;
+};
+
+extern struct smp_alternative_record __start_smp_alternatives_table,
+  __stop_smp_alternatives_table;
+extern unsigned long __init_begin, __init_end;
+
+void prepare_for_smp(void)
+{
+	struct smp_alternative_record *r;
+	printk(KERN_INFO "Enabling SMP...\n");
+	for (r = &__start_smp_alternatives_table;
+	     r != &__stop_smp_alternatives_table;
+	     r++) {
+		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
+		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
+		BUG_ON(r->repl->targ_size < r->repl->up_size);
+               if (system_state == SYSTEM_RUNNING &&
+                   r->targ_start >= (void *)&__init_begin &&
+                   r->targ_start < (void *)&__init_end)
+                       continue;
+		if (r->repl->feature != (unsigned char)-1 &&
+		    boot_cpu_has(r->repl->feature)) {
+			memcpy(r->targ_start,
+			       r->repl->data + r->repl->smp1_size,
+			       r->repl->smp2_size);
+			memset(r->targ_start + r->repl->smp2_size,
+			       0x90,
+			       r->repl->targ_size - r->repl->smp2_size);
+		} else {
+			memcpy(r->targ_start,
+			       r->repl->data,
+			       r->repl->smp1_size);
+			memset(r->targ_start + r->repl->smp1_size,
+			       0x90,
+			       r->repl->targ_size - r->repl->smp1_size);
+		}
+	}
+	/* Paranoia */
+	asm volatile ("jmp 1f\n1:");
+	mb();
+}
+
+void unprepare_for_smp(void)
+{
+	struct smp_alternative_record *r;
+	printk(KERN_INFO "Disabling SMP...\n");
+	for (r = &__start_smp_alternatives_table;
+	     r != &__stop_smp_alternatives_table;
+	     r++) {
+		BUG_ON(r->repl->targ_size < r->repl->smp1_size);
+		BUG_ON(r->repl->targ_size < r->repl->smp2_size);
+		BUG_ON(r->repl->targ_size < r->repl->up_size);
+               if (system_state == SYSTEM_RUNNING &&
+                   r->targ_start >= (void *)&__init_begin &&
+                   r->targ_start < (void *)&__init_end)
+                       continue;
+		memcpy(r->targ_start,
+		       r->repl->data + r->repl->smp1_size + r->repl->smp2_size,
+		       r->repl->up_size);
+		memset(r->targ_start + r->repl->up_size,
+		       0x90,
+		       r->repl->targ_size - r->repl->up_size);
+	}
+	/* Paranoia */
+	asm volatile ("jmp 1f\n1:");
+	mb();
+}
diff -Naur linux-2.6.12/arch/i386/kernel/smpboot.c linux-2.6.12.post/arch/i386/kernel/smpboot.c
--- linux-2.6.12/arch/i386/kernel/smpboot.c	2005-06-17 15:48:29.000000000 -0400
+++ linux-2.6.12.post/arch/i386/kernel/smpboot.c	2005-07-25 05:51:21.000000000 -0400
@@ -1130,6 +1135,11 @@
 		return -EIO;
 	}
 
+#ifdef CONFIG_SMP_ALTERNATIVES
+	if (num_online_cpus() == 1)
+		prepare_for_smp();
+#endif
+
 	local_irq_enable();
 	/* Unleash the CPU! */
 	cpu_set(cpu, smp_commenced_mask);
diff -Naur linux-2.6.12/arch/i386/kernel/vmlinux.lds.S linux-2.6.12.post/arch/i386/kernel/vmlinux.lds.S
--- linux-2.6.12/arch/i386/kernel/vmlinux.lds.S	2005-06-17 15:48:29.000000000 -0400
+++ linux-2.6.12.post/arch/i386/kernel/vmlinux.lds.S	2005-07-25 05:51:21.000000000 -0400
@@ -30,6 +30,13 @@
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;
 
+  . = ALIGN(16);
+  __start_smp_alternatives_table = .;
+  __smp_alternatives : { *(__smp_alternatives) }
+  __stop_smp_alternatives_table = .;
+
+  __smp_replacements : { *(__smp_replacements) }
+
   RODATA
 
   /* writeable */
diff -Naur linux-2.6.12/include/asm-i386/atomic.h linux-2.6.12.post/include/asm-i386/atomic.h
--- linux-2.6.12/include/asm-i386/atomic.h	2005-06-17 15:48:29.000000000 -0400
+++ linux-2.6.12.post/include/asm-i386/atomic.h	2005-07-25 05:51:21.000000000 -0400
@@ -4,18 +4,13 @@
 #include <linux/config.h>
 #include <linux/compiler.h>
 #include <asm/processor.h>
+#include <asm/smp_alt.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
  * resource counting etc..
  */
 
-#ifdef CONFIG_SMP
-#define LOCK "lock ; "
-#else
-#define LOCK ""
-#endif
-
 /*
  * Make sure gcc doesn't try to be clever and move things around
  * on us. We need to use _exactly_ the address the user gave us,
diff -Naur linux-2.6.12/include/asm-i386/bitops.h linux-2.6.12.post/include/asm-i386/bitops.h
--- linux-2.6.12/include/asm-i386/bitops.h	2005-06-17 15:48:29.000000000 -0400
+++ linux-2.6.12.post/include/asm-i386/bitops.h	2005-07-25 05:51:21.000000000 -0400
@@ -7,6 +7,7 @@
 
 #include <linux/config.h>
 #include <linux/compiler.h>
+#include <asm/smp_alt.h>
 
 /*
  * These have to be done with inline assembly: that way the bit-setting
@@ -16,12 +17,6 @@
  * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
  */
 
-#ifdef CONFIG_SMP
-#define LOCK_PREFIX "lock ; "
-#else
-#define LOCK_PREFIX ""
-#endif
-
 #define ADDR (*(volatile long *) addr)
 
 /**
@@ -41,7 +36,7 @@
  */
 static inline void set_bit(int nr, volatile unsigned long * addr)
 {
-	__asm__ __volatile__( LOCK_PREFIX
+	__asm__ __volatile__( LOCK
 		"btsl %1,%0"
 		:"=m" (ADDR)
 		:"Ir" (nr));
@@ -76,7 +71,7 @@
  */
 static inline void clear_bit(int nr, volatile unsigned long * addr)
 {
-	__asm__ __volatile__( LOCK_PREFIX
+	__asm__ __volatile__( LOCK
 		"btrl %1,%0"
 		:"=m" (ADDR)
 		:"Ir" (nr));
@@ -121,7 +116,7 @@
  */
 static inline void change_bit(int nr, volatile unsigned long * addr)
 {
-	__asm__ __volatile__( LOCK_PREFIX
+	__asm__ __volatile__( LOCK
 		"btcl %1,%0"
 		:"=m" (ADDR)
 		:"Ir" (nr));
@@ -140,7 +135,7 @@
 {
 	int oldbit;
 
-	__asm__ __volatile__( LOCK_PREFIX
+	__asm__ __volatile__( LOCK
 		"btsl %2,%1\n\tsbbl %0,%0"
 		:"=r" (oldbit),"=m" (ADDR)
 		:"Ir" (nr) : "memory");
@@ -180,7 +175,7 @@
 {
 	int oldbit;
 
-	__asm__ __volatile__( LOCK_PREFIX
+	__asm__ __volatile__( LOCK
 		"btrl %2,%1\n\tsbbl %0,%0"
 		:"=r" (oldbit),"=m" (ADDR)
 		:"Ir" (nr) : "memory");
@@ -231,7 +226,7 @@
 {
 	int oldbit;
 
-	__asm__ __volatile__( LOCK_PREFIX
+	__asm__ __volatile__( LOCK
 		"btcl %2,%1\n\tsbbl %0,%0"
 		:"=r" (oldbit),"=m" (ADDR)
 		:"Ir" (nr) : "memory");
diff -Naur linux-2.6.12/include/asm-i386/rwsem.h linux-2.6.12.post/include/asm-i386/rwsem.h
--- linux-2.6.12/include/asm-i386/rwsem.h	2005-06-17 15:48:29.000000000 -0400
+++ linux-2.6.12.post/include/asm-i386/rwsem.h	2005-07-25 05:51:21.000000000 -0400
@@ -40,6 +40,7 @@
 
 #include <linux/list.h>
 #include <linux/spinlock.h>
+#include <asm/smp_alt.h>
 
 struct rwsem_waiter;
 
@@ -99,7 +100,7 @@
 {
 	__asm__ __volatile__(
 		"# beginning down_read\n\t"
-LOCK_PREFIX	"  incl      (%%eax)\n\t" /* adds 0x00000001, returns the old value */
+LOCK	        "  incl      (%%eax)\n\t" /* adds 0x00000001, returns the old value */
 		"  js        2f\n\t" /* jump if we weren't granted the lock */
 		"1:\n\t"
 		LOCK_SECTION_START("")
@@ -130,7 +131,7 @@
 		"  movl	     %1,%2\n\t"
 		"  addl      %3,%2\n\t"
 		"  jle	     2f\n\t"
-LOCK_PREFIX	"  cmpxchgl  %2,%0\n\t"
+LOCK	        "  cmpxchgl  %2,%0\n\t"
 		"  jnz	     1b\n\t"
 		"2:\n\t"
 		"# ending __down_read_trylock\n\t"
@@ -150,7 +151,7 @@
 	tmp = RWSEM_ACTIVE_WRITE_BIAS;
 	__asm__ __volatile__(
 		"# beginning down_write\n\t"
-LOCK_PREFIX	"  xadd      %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */
+LOCK	        "  xadd      %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */
 		"  testl     %%edx,%%edx\n\t" /* was the count 0 before? */
 		"  jnz       2f\n\t" /* jump if we weren't granted the lock */
 		"1:\n\t"
@@ -188,7 +189,7 @@
 	__s32 tmp = -RWSEM_ACTIVE_READ_BIAS;
 	__asm__ __volatile__(
 		"# beginning __up_read\n\t"
-LOCK_PREFIX	"  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
+LOCK	        "  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
 		"  js        2f\n\t" /* jump if the lock is being waited upon */
 		"1:\n\t"
 		LOCK_SECTION_START("")
@@ -214,7 +215,7 @@
 	__asm__ __volatile__(
 		"# beginning __up_write\n\t"
 		"  movl      %2,%%edx\n\t"
-LOCK_PREFIX	"  xaddl     %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
+LOCK	        "  xaddl     %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
 		"  jnz       2f\n\t" /* jump if the lock is being waited upon */
 		"1:\n\t"
 		LOCK_SECTION_START("")
@@ -239,7 +240,7 @@
 {
 	__asm__ __volatile__(
 		"# beginning __downgrade_write\n\t"
-LOCK_PREFIX	"  addl      %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
+LOCK	        "  addl      %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
 		"  js        2f\n\t" /* jump if the lock is being waited upon */
 		"1:\n\t"
 		LOCK_SECTION_START("")
@@ -263,7 +264,7 @@
 static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
 {
 	__asm__ __volatile__(
-LOCK_PREFIX	"addl %1,%0"
+LOCK	          "addl %1,%0"
 		: "=m"(sem->count)
 		: "ir"(delta), "m"(sem->count));
 }
@@ -276,7 +277,7 @@
 	int tmp = delta;
 
 	__asm__ __volatile__(
-LOCK_PREFIX	"xadd %0,(%2)"
+LOCK  	          "xadd %0,(%2)"
 		: "+r"(tmp), "=m"(sem->count)
 		: "r"(sem), "m"(sem->count)
 		: "memory");
diff -Naur linux-2.6.12/include/asm-i386/smp_alt.h linux-2.6.12.post/include/asm-i386/smp_alt.h
--- linux-2.6.12/include/asm-i386/smp_alt.h	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.12.post/include/asm-i386/smp_alt.h	2005-07-25 05:51:21.000000000 -0400
@@ -0,0 +1,32 @@
+#ifndef __ASM_SMP_ALT_H__
+#define __ASM_SMP_ALT_H__
+
+#include <linux/config.h>
+
+#ifdef CONFIG_SMP
+#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE)
+#define LOCK \
+        "6677: nop\n" \
+	".section __smp_alternatives,\"a\"\n" \
+	".long 6677b\n" \
+	".long 6678f\n" \
+	".previous\n" \
+	".section __smp_replacements,\"a\"\n" \
+	"6678: .byte 1\n" \
+	".byte 1\n" \
+	".byte 0\n" \
+        ".byte 1\n" \
+	".byte -1\n" \
+	"lock\n" \
+	"nop\n" \
+	".previous\n"
+void prepare_for_smp(void);
+void unprepare_for_smp(void);
+#else
+#define LOCK "lock ; "
+#endif
+#else
+#define LOCK ""
+#endif
+
+#endif /* __ASM_SMP_ALT_H__ */
diff -Naur linux-2.6.12/include/asm-i386/spinlock.h linux-2.6.12.post/include/asm-i386/spinlock.h
--- linux-2.6.12/include/asm-i386/spinlock.h	2005-06-17 15:48:29.000000000 -0400
+++ linux-2.6.12.post/include/asm-i386/spinlock.h	2005-07-25 05:51:21.000000000 -0400
@@ -6,6 +6,7 @@
 #include <asm/page.h>
 #include <linux/config.h>
 #include <linux/compiler.h>
+#include <asm/smp_alt.h>
 
 asmlinkage int printk(const char * fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
@@ -47,8 +48,9 @@
 #define spin_unlock_wait(x)	do { barrier(); } while(spin_is_locked(x))
 
 #define spin_lock_string \
-	"\n1:\t" \
-	"lock ; decb %0\n\t" \
+        "1:\n" \
+	LOCK \
+	"decb %0\n\t" \
 	"jns 3f\n" \
 	"2:\t" \
 	"rep;nop\n\t" \
@@ -58,8 +60,9 @@
 	"3:\n\t"
 
 #define spin_lock_string_flags \
-	"\n1:\t" \
-	"lock ; decb %0\n\t" \
+        "1:\n" \
+	LOCK \
+	"decb %0\n\t" \
 	"jns 4f\n\t" \
 	"2:\t" \
 	"testl $0x200, %1\n\t" \
@@ -121,10 +124,34 @@
 static inline int _raw_spin_trylock(spinlock_t *lock)
 {
 	char oldval;
+#ifdef CONFIG_SMP_ALTERNATIVES
 	__asm__ __volatile__(
-		"xchgb %b0,%1"
+		"1:movb %1,%b0\n"
+		"movb $0,%1\n"
+		"2:"
+		".section __smp_alternatives,\"a\"\n"
+		".long 1b\n"
+		".long 3f\n"
+		".previous\n"
+		".section __smp_replacements,\"a\"\n"
+		"3: .byte 2b - 1b\n"
+		".byte 5f-4f\n"
+		".byte 0\n"
+		".byte 6f-5f\n"
+		".byte -1\n"
+		"4: xchgb %b0,%1\n"
+		"5: movb %1,%b0\n"
+		"movb $0,%1\n"
+		"6:\n"
+		".previous\n"
 		:"=q" (oldval), "=m" (lock->slock)
 		:"0" (0) : "memory");
+#else
+	__asm__ __volatile__(
+		"xchgb %b0,%1\n"
+		:"=q" (oldval), "=m" (lock->slock)
+		:"0" (0) : "memory");
+#endif
 	return oldval > 0;
 }
 
@@ -225,8 +252,8 @@
 	__build_write_lock(rw, "__write_lock_failed");
 }
 
-#define _raw_read_unlock(rw)		asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory")
-#define _raw_write_unlock(rw)	asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory")
+#define _raw_read_unlock(rw)	asm volatile(LOCK "incl %0" :"=m" ((rw)->lock) : : "memory")
+#define _raw_write_unlock(rw)	asm volatile(LOCK "addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory")
 
 static inline int _raw_read_trylock(rwlock_t *lock)
 {
diff -Naur linux-2.6.12/include/asm-i386/system.h linux-2.6.12.post/include/asm-i386/system.h
--- linux-2.6.12/include/asm-i386/system.h	2005-06-17 15:48:29.000000000 -0400
+++ linux-2.6.12.post/include/asm-i386/system.h	2005-07-25 05:51:21.000000000 -0400
@@ -5,7 +5,7 @@
 #include <linux/kernel.h>
 #include <asm/segment.h>
 #include <asm/cpufeature.h>
-#include <linux/bitops.h> /* for LOCK_PREFIX */
+#include <asm/smp_alt.h>
 
 #ifdef __KERNEL__
 
@@ -249,19 +249,19 @@
 	unsigned long prev;
 	switch (size) {
 	case 1:
-		__asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
+		__asm__ __volatile__(LOCK "cmpxchgb %b1,%2"
 				     : "=a"(prev)
 				     : "q"(new), "m"(*__xg(ptr)), "0"(old)
 				     : "memory");
 		return prev;
 	case 2:
-		__asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
+		__asm__ __volatile__(LOCK "cmpxchgw %w1,%2"
 				     : "=a"(prev)
 				     : "q"(new), "m"(*__xg(ptr)), "0"(old)
 				     : "memory");
 		return prev;
 	case 4:
-		__asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
+		__asm__ __volatile__(LOCK "cmpxchgl %1,%2"
 				     : "=a"(prev)
 				     : "q"(new), "m"(*__xg(ptr)), "0"(old)
 				     : "memory");
@@ -425,11 +425,55 @@
 #endif
 
 #ifdef CONFIG_SMP
-#define smp_mb()	mb()
-#define smp_rmb()	rmb()
 #define smp_wmb()	wmb()
-#define smp_read_barrier_depends()	read_barrier_depends()
+#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE)
+#define smp_alt_mb(instr)                                           \
+__asm__ __volatile__("6667:\nnop\nnop\nnop\nnop\nnop\nnop\n6668:\n" \
+		     ".section __smp_alternatives,\"a\"\n"          \
+		     ".long 6667b\n"                                \
+                     ".long 6673f\n"                                \
+		     ".previous\n"                                  \
+		     ".section __smp_replacements,\"a\"\n"          \
+		     "6673:.byte 6668b-6667b\n"                     \
+		     ".byte 6670f-6669f\n"                          \
+		     ".byte 6671f-6670f\n"                          \
+                     ".byte 0\n"                                    \
+		     ".byte %c0\n"                                  \
+		     "6669:lock;addl $0,0(%%esp)\n"                 \
+		     "6670:" instr "\n"                             \
+		     "6671:\n"                                      \
+		     ".previous\n"                                  \
+		     :                                              \
+		     : "i" (X86_FEATURE_XMM2)                       \
+		     : "memory")
+#define smp_rmb() smp_alt_mb("lfence")
+#define smp_mb()  smp_alt_mb("mfence")
+#define set_mb(var, value) do {                                     \
+unsigned long __set_mb_temp;                                        \
+__asm__ __volatile__("6667:movl %1, %0\n6668:\n"                    \
+		     ".section __smp_alternatives,\"a\"\n"          \
+		     ".long 6667b\n"                                \
+		     ".long 6673f\n"                                \
+		     ".previous\n"                                  \
+		     ".section __smp_replacements,\"a\"\n"          \
+		     "6673: .byte 6668b-6667b\n"                    \
+		     ".byte 6670f-6669f\n"                          \
+		     ".byte 0\n"                                    \
+		     ".byte 6671f-6670f\n"                          \
+		     ".byte -1\n"                                   \
+		     "6669: xchg %1, %0\n"                          \
+		     "6670:movl %1, %0\n"                           \
+		     "6671:\n"                                      \
+		     ".previous\n"                                  \
+		     : "=m" (var), "=r" (__set_mb_temp)             \
+		     : "1" (value)                                  \
+		     : "memory"); } while (0)
+#else
+#define smp_rmb()	rmb()
+#define smp_mb()	mb()
 #define set_mb(var, value) do { xchg(&var, value); } while (0)
+#endif
+#define smp_read_barrier_depends()	read_barrier_depends()
 #else
 #define smp_mb()	barrier()
 #define smp_rmb()	barrier()
diff -urN linux-2.6.10-orig/include/asm-x86_64/hw_irq.h linux-2.6.10/include/asm-x86_64/hw_irq.h
--- linux-2.6.10-orig/include/asm-x86_64/hw_irq.h	2005-01-06 00:34:38.000000000 -0500
+++ linux-2.6.10/include/asm-x86_64/hw_irq.h	2005-02-25 17:45:37.181518088 -0500
@@ -48,6 +48,7 @@
  *
  *  Vectors 0xf0-0xf9 are free (reserved for future Linux use).
  */
+#ifndef CONFIG_XEN
 #define SPURIOUS_APIC_VECTOR	0xff
 #define ERROR_APIC_VECTOR	0xfe
 #define INVALIDATE_TLB_VECTOR	0xfd
@@ -57,7 +58,7 @@
 #define KDB_VECTOR	0xf9
 
 #define THERMAL_APIC_VECTOR	0xf0
-
+#endif
 
 /*
  * Local APIC timer IRQ vector is on a different priority level,
diff -urN linux-2.6.10-orig/include/asm-x86_64/irq.h linux-2.6.10/include/asm-x86_64/irq.h
--- linux-2.6.10-orig/include/asm-x86_64/irq.h	2005-01-06 00:34:38.000000000 -0500
+++ linux-2.6.10/include/asm-x86_64/irq.h	2005-02-25 17:45:37.181518088 -0500
@@ -10,6 +10,9 @@
  *	<tomsoft at informatik.tu-chemnitz.de>
  */
 
+#ifdef CONFIG_XEN
+#include "irq_vectors.h"
+#endif
 #define TIMER_IRQ 0
 
 /*
@@ -22,6 +25,7 @@
  * the usable vector space is 0x20-0xff (224 vectors)
  */
 
+#ifndef CONFIG_XEN
 /*
  * The maximum number of vectors supported by x86_64 processors
  * is limited to 256. For processors other than x86_64, NR_VECTORS
@@ -38,6 +42,7 @@
 #define NR_IRQS 224
 #define NR_IRQ_VECTORS 1024
 #endif
+#endif
 
 static __inline__ int irq_canonicalize(int irq)
 {
diff -urN linux-2.6.10-orig/include/asm-x86_64/posix_types.h linux-2.6.10/include/asm-x86_64/posix_types.h
--- linux-2.6.10-orig/include/asm-x86_64/posix_types.h	2004-10-18 17:55:29.000000000 -0400
+++ linux-2.6.10/include/asm-x86_64/posix_types.h	2005-02-25 17:45:37.183517784 -0500
@@ -6,7 +6,7 @@
  * be a little careful about namespace pollution etc.  Also, we cannot
  * assume GCC is being used.
  */
-
+#ifndef __ASSEMBLY__
 typedef unsigned long	__kernel_ino_t;
 typedef unsigned int	__kernel_mode_t;
 typedef unsigned long	__kernel_nlink_t;
@@ -115,5 +115,5 @@
 }
 
 #endif /* defined(__KERNEL__) */
-
+#endif
 #endif

linux-2.6-xen-compile.patch:
 linux-2.6.10/arch/xen/i386/pci/irq.c                |    1 +
 linux-2.6.12/arch/i386/kernel/vmlinux.lds.S         |    4 ++--
 linux-2.6.12/arch/xen/Kconfig                       |    1 +
 linux-2.6.12/arch/xen/Kconfig.drivers               |    2 +-
 linux-2.6.12/arch/xen/i386/Kconfig                  |   11 +++++++++++
 linux-2.6.12/arch/xen/i386/kernel/i386_ksyms.c      |    8 +-------
 linux-2.6.12/arch/xen/i386/kernel/process.c         |    4 ++--
 linux-2.6.12/arch/xen/i386/kernel/setup.c           |    8 ++++++++
 linux-2.6.12/arch/xen/i386/kernel/signal.c          |    2 +-
 linux-2.6.12/arch/xen/i386/kernel/time.c            |    6 +-----
 linux-2.6.12/arch/xen/i386/kernel/traps.c           |    4 ++--
 linux-2.6.12/arch/xen/i386/mm/pgtable.c             |    2 +-
 linux-2.6.12/arch/xen/i386/pci/irq.c                |   17 +++++++++++------
 linux-2.6.12/arch/xen/kernel/reboot.c               |    6 ++++++
 linux-2.6.12/drivers/char/tty_io.c                  |   19 ++++++++++++-------
 linux-2.6.12/include/asm-i386/timex.h               |    2 ++
 linux-2.6.12/include/asm-xen/asm-i386/mmu_context.h |    4 +---
 linux-2.6.12/include/asm-xen/asm-i386/page.h        |    3 +++
 linux-2.6.12/include/asm-xen/asm-i386/pci.h         |    2 +-
 linux-2.6.12/include/asm-xen/asm-i386/ptrace.h      |    4 ++++
 linux-2.6.12/include/linux/skbuff.h                 |    6 ++++--
 linux-2.6.12/net/core/dev.c                         |    4 ++++
 linux-2.6.8/arch/xen/i386/kernel/time.c             |    2 +-
 linux-2.6.9/Makefile                                |    2 +-
 linux-2.6.9/arch/xen/Makefile                       |    3 +++
 linux-2.6.9/arch/xen/boot/Makefile                  |    3 +++
 linux-2.6.9/kernel/profile.c                        |    1 +
 27 files changed, 89 insertions(+), 42 deletions(-)

--- NEW FILE linux-2.6-xen-compile.patch ---
#
# Chunks that gave rejects in the upstream generated Xen patch.
#
--- linux-2.6.12/drivers/char/tty_io.c.fixup	2005-08-23 13:02:02.000000000 -0400
+++ linux-2.6.12/drivers/char/tty_io.c	2005-08-23 13:04:24.000000000 -0400
@@ -2979,14 +2979,19 @@
 #endif
 
 #ifdef CONFIG_VT
-	cdev_init(&vc0_cdev, &console_fops);
-	if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
-	    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
-		panic("Couldn't register /dev/tty0 driver\n");
-	devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0");
-	class_device_create(tty_class, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
+	if (console_use_vt) {
+		cdev_init(&vc0_cdev, &console_fops);
+		if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
+		    register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1,
+						"/dev/vc/0") < 0)
+			panic("Couldn't register /dev/tty0 driver\n");
+		devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR,
+				 "vc/0");
+		class_device_create(tty_class, MKDEV(TTY_MAJOR, 0), NULL,
+				 "tty0");
 
-	vty_init();
+		vty_init();
+	}
 #endif
 	return 0;
 }
--- linux-2.6.12/include/linux/skbuff.h.fixup	2005-08-23 13:02:10.000000000 -0400
+++ linux-2.6.12/include/linux/skbuff.h	2005-08-23 13:05:28.000000000 -0400
@@ -254,8 +254,10 @@
 	__u8			local_df:1,
 				cloned:1,
 				ip_summed:2,
-				nohdr:1;
-				/* 3 bits spare */
+				nohdr:1,
+				proto_csum_valid:1,
+				proto_csum_blank:1;
+				/* 1 bit spare */
 	__u8			pkt_type;
 	__be16			protocol;
 
--- linux-2.6.12/net/core/dev.c.fixup	2005-08-23 13:02:21.000000000 -0400
+++ linux-2.6.12/net/core/dev.c	2005-08-23 13:06:08.000000000 -0400
@@ -115,6 +115,10 @@
 #endif	/* CONFIG_NET_RADIO */
 #include <asm/current.h>
 
+#include <net/ip.h>
+#include <linux/tcp.h>
+#include <linux/udp.h>
+
 /*
  *	The list of packet types we will receive (as opposed to discard)
  *	and the routines to invoke.

#
# Other compile fixes
#
--- linux-2.6.8/arch/xen/i386/kernel/time.c.269	2004-10-15 13:40:26.000000000 -0400
+++ linux-2.6.8/arch/xen/i386/kernel/time.c	2004-10-15 13:40:40.000000000 -0400
@@ -68,7 +68,7 @@
 
 #include "io_ports.h"
 
-extern spinlock_t i8259A_lock;
+spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED;
 int pit_latch_buggy;              /* extern */
 
 #include "do_timer.h"
--- linux-2.6.9/kernel/profile.c~	2004-12-24 01:45:26.735454624 -0500
+++ linux-2.6.9/kernel/profile.c	2004-12-24 01:45:40.875305040 -0500
@@ -22,6 +22,7 @@
 #include <linux/cpumask.h>
 #include <linux/cpu.h>
 #include <linux/profile.h>
+#include <linux/ptrace.h>
 #include <linux/highmem.h>
 #include <asm/sections.h>
 #include <asm/semaphore.h>
--- linux-2.6.9/arch/xen/boot/Makefile.bzi	2004-11-17 22:07:46.000000000 -0500
+++ linux-2.6.9/arch/xen/boot/Makefile	2004-11-17 22:12:07.000000000 -0500
@@ -6,3 +6,6 @@ vmlinuz: vmlinux-stripped FORCE
 
 vmlinux-stripped: vmlinux FORCE
 	$(call if_changed,objcopy)
+
+bzImage: vmlinuz
+	ln -sf ../../../vmlinuz $(srctree)/arch/xen/boot/bzImage
unchanged:
--- linux-2.6.9/arch/xen/Makefile.bzi	2004-11-17 22:07:34.000000000 -0500
+++ linux-2.6.9/arch/xen/Makefile	2004-11-17 22:07:40.000000000 -0500
@@ -45,6 +45,9 @@ all: vmlinuz
 vmlinuz: vmlinux
 	$(Q)$(MAKE) $(build)=arch/xen/boot vmlinuz
 
+bzImage: vmlinuz
+	$(Q)$(MAKE) $(build)=arch/xen/boot bzImage
+
 XINSTALL_NAME ?= $(KERNELRELEASE)
 install: vmlinuz
 	mkdir -p $(INSTALL_PATH)/boot
--- linux-2.6.9/Makefile.xenness	2004-11-18 11:53:26.000000000 -0500
+++ linux-2.6.9/Makefile	2004-11-18 11:53:54.000000000 -0500
@@ -921,7 +921,7 @@ CLEAN_FILES +=	vmlinux System.map \
 MRPROPER_DIRS  += include/config include2
 MRPROPER_FILES += .config .config.old include/asm .version \
                   include/linux/autoconf.h include/linux/version.h \
-                  Module.symvers tags TAGS cscope*
+                  Module.symvers tags TAGS cscope* include/.asm-ignore
 
 # clean - Delete most, but leave enough to build external modules
 #
--- linux-2.6.10/arch/xen/i386/pci/irq.c.bk14	2005-01-11 17:45:55.000000000 -0500
+++ linux-2.6.10/arch/xen/i386/pci/irq.c	2005-01-11 17:47:04.000000000 -0500
@@ -37,6 +37,7 @@
 
 int (*pcibios_enable_irq)(struct pci_dev *dev) = NULL;
 
+static int pirq_enable_irq(struct pci_dev *);
 
 static int __init pcibios_irq_init(void)
 {
--- linux-2.6.12/arch/xen/i386/kernel/process.c.compile	2005-08-23 10:42:33.000000000 -0400
+++ linux-2.6.12/arch/xen/i386/kernel/process.c	2005-08-23 10:42:51.000000000 -0400
@@ -196,12 +196,12 @@
 
 			if (cpu_is_offline(cpu)) {
 				local_irq_disable();
+#if defined(CONFIG_XEN) && defined(CONFIG_HOTPLUG_CPU)
 				/* Ack it.  From this point on until
 				   we get woken up, we're not allowed
 				   to take any locks.  In particular,
 				   don't printk. */
 				__get_cpu_var(cpu_state) = CPU_DEAD;
-#if defined(CONFIG_XEN) && defined(CONFIG_HOTPLUG_CPU)
 				/* Tell hypervisor to take vcpu down. */
 				HYPERVISOR_vcpu_down(cpu);
 #endif
--- linux-2.6.12/arch/xen/i386/pci/irq.c.acpi	2005-08-15 11:03:50.000000000 -0400
+++ linux-2.6.12/arch/xen/i386/pci/irq.c	2005-08-15 11:07:05.000000000 -0400
@@ -56,6 +56,7 @@ struct irq_router_handler {
 };
 
 int (*pcibios_enable_irq)(struct pci_dev *dev) = NULL;
+void (*pcibios_disable_irq)(struct pci_dev *dev) = NULL;
 
 /*
  *  Search 0xf0000 -- 0xfffff for the PCI IRQ Routing Table.
@@ -1010,24 +1011,28 @@ static int __init pcibios_irq_init(void)
 subsys_initcall(pcibios_irq_init);
 
 
-static void pirq_penalize_isa_irq(int irq)
+static void pirq_penalize_isa_irq(int irq, int active)
 {
 	/*
 	 *  If any ISAPnP device reports an IRQ in its list of possible
 	 *  IRQ's, we try to avoid assigning it to PCI devices.
 	 */
-	if (irq < 16)
-		pirq_penalty[irq] += 100;
+	if (irq < 16) {
+		if (active)
+			pirq_penalty[irq] += 1000;
+		else
+			pirq_penalty[irq] += 100;
+	}
 }
 
-void pcibios_penalize_isa_irq(int irq)
+void pcibios_penalize_isa_irq(int irq, int active)
 {
 #ifdef CONFIG_ACPI_PCI
 	if (!acpi_noirq)
-		acpi_penalize_isa_irq(irq);
+		acpi_penalize_isa_irq(irq, active);
 	else
 #endif
-		pirq_penalize_isa_irq(irq);
+		pirq_penalize_isa_irq(irq, active);
 }
 
 static int pirq_enable_irq(struct pci_dev *dev)
--- linux-2.6.12/include/asm-xen/asm-i386/pci.h.acpi	2005-08-15 11:07:41.000000000 -0400
+++ linux-2.6.12/include/asm-xen/asm-i386/pci.h	2005-08-15 11:08:33.000000000 -0400
@@ -27,7 +27,7 @@ void pcibios_config_init(void);
 struct pci_bus * pcibios_scan_root(int bus);
 
 void pcibios_set_master(struct pci_dev *dev);
-void pcibios_penalize_isa_irq(int irq);
+void pcibios_penalize_isa_irq(int irq, int active);
 struct irq_routing_table *pcibios_get_irq_routing_table(void);
 int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
 

#
# Linux 2.6.13 related compile fixes
#
--- linux-2.6.12/arch/xen/i386/kernel/signal.c.2613	2005-08-23 13:16:40.000000000 -0400
+++ linux-2.6.12/arch/xen/i386/kernel/signal.c	2005-08-23 13:16:45.000000000 -0400
@@ -603,7 +603,7 @@
 		return 1;
 
 	if (current->flags & PF_FREEZE) {
-		refrigerator(0);
+		refrigerator();
 		goto no_signal;
 	}
 
--- linux-2.6.12/arch/xen/i386/kernel/traps.c.2613	2005-08-23 13:17:09.000000000 -0400
+++ linux-2.6.12/arch/xen/i386/kernel/traps.c	2005-08-23 13:21:54.000000000 -0400
@@ -27,6 +27,7 @@
 #include <linux/ptrace.h>
 #include <linux/utsname.h>
 #include <linux/kprobes.h>
+#include <linux/smp.h>
 
 #ifdef CONFIG_EISA
 #include <linux/ioport.h>
@@ -47,7 +48,6 @@
 #include <asm/i387.h>
 #include <asm/nmi.h>
 
-#include <asm/smp.h>
 #include <asm/arch_hooks.h>
 #include <asm/kdebug.h>
 
@@ -303,7 +303,7 @@
 	};
 	static int die_counter;
 
-	if (die.lock_owner != _smp_processor_id()) {
+	if (die.lock_owner != smp_processor_id()) {
 		console_verbose();
 		spin_lock_irq(&die.lock);
 		die.lock_owner = smp_processor_id();
--- linux-2.6.12/arch/xen/i386/kernel/time.c.2613	2005-08-23 13:18:17.000000000 -0400
+++ linux-2.6.12/arch/xen/i386/kernel/time.c	2005-08-23 13:22:32.000000000 -0400
@@ -88,11 +88,7 @@
 struct timezone __sys_tz __section_sys_tz;
 #endif
 
-#if defined(__x86_64__)
 unsigned int cpu_khz;	/* Detected as we calibrate the TSC */
-#else
-unsigned long cpu_khz;	/* Detected as we calibrate the TSC */
-#endif
 
 extern unsigned long wall_jiffies;
 
@@ -772,7 +768,7 @@
 	update_wallclock();
 
 	init_cpu_khz();
-	printk(KERN_INFO "Xen reported: %lu.%03lu MHz processor.\n",
+	printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
 	       cpu_khz / 1000, cpu_khz % 1000);
 
 #if defined(__x86_64__)
--- linux-2.6.12/arch/xen/i386/kernel/i386_ksyms.c.2613	2005-08-23 13:22:50.000000000 -0400
+++ linux-2.6.12/arch/xen/i386/kernel/i386_ksyms.c	2005-08-23 14:30:44.000000000 -0400
@@ -56,7 +56,7 @@
 EXPORT_SYMBOL(drive_info);
 #endif
 
-extern unsigned long cpu_khz;
+extern unsigned int cpu_khz;
 extern unsigned long get_cmos_time(void);
 
 /* platform dependent support */
@@ -69,7 +69,6 @@
 EXPORT_SYMBOL(xquad_portio);
 #endif
 EXPORT_SYMBOL(dump_thread);
-EXPORT_SYMBOL(dump_fpu);
 EXPORT_SYMBOL_GPL(kernel_fpu_begin);
 EXPORT_SYMBOL(__ioremap);
 EXPORT_SYMBOL(ioremap_nocache);
@@ -119,11 +118,6 @@
 EXPORT_SYMBOL(pci_mem_start);
 #endif
 
-#ifdef CONFIG_PCI_BIOS
-EXPORT_SYMBOL(pcibios_set_irq_routing);
-EXPORT_SYMBOL(pcibios_get_irq_routing_table);
-#endif
-
 #ifdef CONFIG_X86_USE_3DNOW
 EXPORT_SYMBOL(_mmx_memcpy);
 EXPORT_SYMBOL(mmx_clear_page);
--- linux-2.6.12/arch/xen/i386/mm/pgtable.c.2613	2005-08-23 13:26:16.000000000 -0400
+++ linux-2.6.12/arch/xen/i386/mm/pgtable.c	2005-08-23 13:27:39.000000000 -0400
@@ -41,7 +41,7 @@
 	printk("Free swap:       %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
 	for_each_pgdat(pgdat) {
 		for (i = 0; i < pgdat->node_spanned_pages; ++i) {
-			page = pgdat->node_mem_map + i;
+			page = pgdat_page_nr(pgdat, i);
 			total++;
 			if (PageHighMem(page))
 				highmem++;
--- linux-2.6.12/include/asm-xen/asm-i386/mmu_context.h.2613	2005-08-23 13:37:24.000000000 -0400
+++ linux-2.6.12/include/asm-xen/asm-i386/mmu_context.h	2005-08-23 14:25:43.000000000 -0400
@@ -23,9 +23,7 @@
 #endif
 }
 
-#define prepare_arch_switch(rq,next)	__prepare_arch_switch()
-#define finish_arch_switch(rq, next)	spin_unlock_irq(&(rq)->lock)
-#define task_running(rq, p)		((rq)->curr == (p))
+#define prepare_arch_switch(next)	__prepare_arch_switch()
 
 static inline void __prepare_arch_switch(void)
 {
--- linux-2.6.12/arch/i386/kernel/vmlinux.lds.S.2613	2005-08-23 19:42:43.000000000 -0400
+++ linux-2.6.12/arch/i386/kernel/vmlinux.lds.S	2005-08-23 19:43:25.000000000 -0400
@@ -35,10 +35,10 @@
 
   . = ALIGN(16);
   __start_smp_alternatives_table = .;
-  __smp_alternatives : { *(__smp_alternatives) }
+  __smp_alternatives : AT(ADDR(__smp_alternatives) - LOAD_OFFSET) { *(__smp_alternatives) }
   __stop_smp_alternatives_table = .;
 
-  __smp_replacements : { *(__smp_replacements) }
+  __smp_replacements : AT(ADDR(__smp_replacements) - LOAD_OFFSET) { *(__smp_replacements) }
 
   RODATA
 
--- linux-2.6.12/arch/xen/i386/Kconfig.2613	2005-08-23 20:19:47.000000000 -0400
+++ linux-2.6.12/arch/xen/i386/Kconfig	2005-08-23 20:21:29.000000000 -0400
@@ -940,6 +940,17 @@
 	depends on X86 && !EMBEDDED
 	default y
 
+config PHYSICAL_START
+	hex "Physical address where the kernel is loaded" if EMBEDDED
+	default "0x100000"
+	help
+	  This gives the physical address where the kernel is loaded.
+	  Primarily used in the case of kexec on panic where the
+	  fail safe kernel needs to run at a different address than
+	  the panic-ed kernel.
+
+	  Don't change this unless you know what you are doing.
+
 config SECCOMP
 	bool "Enable seccomp to safely compute untrusted bytecode"
 	depends on PROC_FS
--- linux-2.6.12/include/asm-xen/asm-i386/page.h.2613	2005-08-23 20:16:08.000000000 -0400
+++ linux-2.6.12/include/asm-xen/asm-i386/page.h	2005-08-23 20:18:05.000000000 -0400
@@ -216,9 +216,12 @@
 
 #ifdef __ASSEMBLY__
 #define __PAGE_OFFSET		(0xC0000000)
+#define __PHYSICAL_START	CONFIG_PHYSICAL_START
 #else
 #define __PAGE_OFFSET		(0xC0000000UL)
+#define __PHYSICAL_START	((unsigned long)CONFIG_PHYSICAL_START)
 #endif
+#define __KERNEL_START		(__PAGE_OFFSET + __PHYSICAL_START)
 
 
 #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
--- linux-2.6.12/arch/xen/i386/kernel/process.c.2613	2005-08-23 20:32:31.000000000 -0400
+++ linux-2.6.12/arch/xen/i386/kernel/process.c	2005-08-23 20:32:48.000000000 -0400
@@ -184,7 +184,7 @@
  */
 void cpu_idle (void)
 {
-	int cpu = _smp_processor_id();
+	int cpu = smp_processor_id();
 
 	/* endless idle loop with no priority at all */
 	while (1) {
--- linux-2.6.12/arch/xen/i386/kernel/setup.c.2613	2005-08-23 20:35:09.000000000 -0400
+++ linux-2.6.12/arch/xen/i386/kernel/setup.c	2005-08-23 20:36:23.000000000 -0400
@@ -58,6 +58,14 @@
 #include "setup_arch_pre.h"
 #include <bios_ebda.h>
 
+#ifdef CONFIG_HOTPLUG_CPU
+#define DEFAULT_SEND_IPI	(1)
+#else
+#define DEFAULT_SEND_IPI	(0)
+#endif
+
+int no_broadcast=DEFAULT_SEND_IPI;
+
 /* Allows setting of maximum possible memory size  */
 static unsigned long xen_override_max_pfn;
 
--- linux-2.6.12/arch/xen/kernel/reboot.c.2613	2005-08-23 20:41:22.000000000 -0400
+++ linux-2.6.12/arch/xen/kernel/reboot.c	2005-08-23 20:42:16.000000000 -0400
@@ -32,6 +32,12 @@
 	HYPERVISOR_reboot();
 }
 
+void machine_emergency_restart(void)
+{
+	char dummy;
+	machine_restart(&dummy);
+}
+
 void machine_halt(void)
 {
 	machine_power_off();
--- linux-2.6.12/include/asm-i386/timex.h.2613	2005-08-23 20:31:58.000000000 -0400
+++ linux-2.6.12/include/asm-i386/timex.h	2005-08-23 20:32:15.000000000 -0400
@@ -49,7 +49,9 @@
 
 extern unsigned int cpu_khz;
 
+#ifndef CONFIG_XEN
 extern int read_current_timer(unsigned long *timer_value);
 #define ARCH_HAS_READ_CURRENT_TIMER	1
+#endif
 
 #endif
--- linux-2.6.12/include/asm-xen/asm-i386/ptrace.h.2613	2005-08-23 20:37:02.000000000 -0400
+++ linux-2.6.12/include/asm-xen/asm-i386/ptrace.h	2005-08-23 20:38:09.000000000 -0400
@@ -55,9 +55,13 @@
 #define PTRACE_SET_THREAD_AREA    26
 
 #ifdef __KERNEL__
+
+#include <asm/vm86.h>
+
 struct task_struct;
 extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
 #define user_mode(regs) ((VM_MASK & (regs)->eflags) || (2 & (regs)->xcs))
+#define user_mode_vm(regs) (((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0)
 #define instruction_pointer(regs) ((regs)->eip)
 #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
 extern unsigned long profile_pc(struct pt_regs *regs);
--- linux-2.6.12/arch/xen/Kconfig.drivers~	2005-08-27 00:23:32.000000000 -0400
+++ linux-2.6.12/arch/xen/Kconfig.drivers	2005-08-27 00:23:49.000000000 -0400
@@ -30,7 +30,7 @@ source "drivers/ieee1394/Kconfig"
 source "drivers/message/i2o/Kconfig"
 endif
 
-source "net/Kconfig"
+source "drivers/net/Kconfig"
 
 if XEN_PHYSDEV_ACCESS
 source "drivers/isdn/Kconfig"
--- linux-2.6.12/arch/xen/Kconfig~	2005-08-27 00:23:54.000000000 -0400
+++ linux-2.6.12/arch/xen/Kconfig	2005-08-27 00:24:08.000000000 -0400
@@ -184,6 +184,7 @@ source "fs/Kconfig.binfmt"
 
 endmenu
 
+source "net/Kconfig"
 source "arch/xen/Kconfig.drivers"
 
 if XEN_PRIVILEGED_GUEST

linux-2.6-xen.patch:
 arch/xen/Kconfig                                      |  203 +
 arch/xen/Kconfig.debug                                |  129 
 arch/xen/Kconfig.drivers                              |   94 
 arch/xen/Makefile                                     |   91 
 arch/xen/boot/Makefile                                |    8 
 arch/xen/configs/xen0_defconfig_x86_32                | 1278 +++++++
 arch/xen/configs/xen0_defconfig_x86_64                | 1183 +++++++
 arch/xen/configs/xenU_defconfig_x86_32                |  564 +++
 arch/xen/configs/xenU_defconfig_x86_64                |  939 +++++
 arch/xen/configs/xen_defconfig_x86_32                 | 2998 ++++++++++++++++++
 arch/xen/configs/xen_defconfig_x86_64                 | 2425 ++++++++++++++
 arch/xen/i386/Kconfig                                 |  960 +++++
 arch/xen/i386/Makefile                                |  108 
 arch/xen/i386/kernel/Makefile                         |  102 
 arch/xen/i386/kernel/acpi/Makefile                    |   13 
 arch/xen/i386/kernel/acpi/boot.c                      |  912 +++++
 arch/xen/i386/kernel/apic.c                           |   83 
 arch/xen/i386/kernel/cpu/Makefile                     |   31 
 arch/xen/i386/kernel/cpu/common.c                     |  650 +++
 arch/xen/i386/kernel/cpu/mtrr/Makefile                |   16 
 arch/xen/i386/kernel/cpu/mtrr/main.c                  |  165 
 arch/xen/i386/kernel/entry.S                          |  753 ++++
 arch/xen/i386/kernel/head.S                           |  198 +
 arch/xen/i386/kernel/i386_ksyms.c                     |  190 +
 arch/xen/i386/kernel/init_task.c                      |   49 
 arch/xen/i386/kernel/io_apic.c                        | 2609 +++++++++++++++
 arch/xen/i386/kernel/ioport.c                         |  125 
 arch/xen/i386/kernel/irq.c                            |  299 +
 arch/xen/i386/kernel/ldt.c                            |  276 +
 arch/xen/i386/kernel/microcode.c                      |  163 
 arch/xen/i386/kernel/mpparse.c                        | 1126 ++++++
 arch/xen/i386/kernel/pci-dma.c                        |  315 +
 arch/xen/i386/kernel/process.c                        |  798 ++++
 arch/xen/i386/kernel/quirks.c                         |   49 
 arch/xen/i386/kernel/setup.c                          | 1712 ++++++++++
 arch/xen/i386/kernel/signal.c                         |  665 +++
 arch/xen/i386/kernel/smp.c                            |  624 +++
 arch/xen/i386/kernel/smpboot.c                        | 1640 +++++++++
 arch/xen/i386/kernel/swiotlb.c                        |  660 +++
 arch/xen/i386/kernel/time.c                           |  928 +++++
 arch/xen/i386/kernel/traps.c                          | 1026 ++++++
 arch/xen/i386/kernel/vsyscall.S                       |   15 
 arch/xen/i386/mach-default/Makefile                   |   12 
 arch/xen/i386/mm/Makefile                             |   24 
 arch/xen/i386/mm/fault.c                              |  598 +++
 arch/xen/i386/mm/highmem.c                            |   99 
 arch/xen/i386/mm/hypervisor.c                         |  416 ++
 arch/xen/i386/mm/init.c                               |  766 ++++
 arch/xen/i386/mm/ioremap.c                            |  424 ++
 arch/xen/i386/mm/pgtable.c                            |  558 +++
 arch/xen/i386/pci/Makefile                            |   33 
 arch/xen/i386/pci/irq.c                               | 1120 ++++++
 arch/xen/kernel/Makefile                              |   18 
 arch/xen/kernel/ctrl_if.c                             |  569 +++
 arch/xen/kernel/devmem.c                              |  158 
 arch/xen/kernel/evtchn.c                              |  803 ++++
 arch/xen/kernel/fixup.c                               |   87 
 arch/xen/kernel/gnttab.c                              |  396 ++
 arch/xen/kernel/reboot.c                              |  491 ++
 arch/xen/kernel/skbuff.c                              |   97 
 arch/xen/kernel/smp.c                                 |   16 
 arch/xen/kernel/xen_proc.c                            |   18 
 arch/xen/x86_64/Kconfig                               |  480 ++
 arch/xen/x86_64/Makefile                              |   93 
 arch/xen/x86_64/ia32/Makefile                         |   60 
 arch/xen/x86_64/ia32/ia32entry.S                      |  629 +++
 arch/xen/x86_64/ia32/syscall32.c                      |  149 
 arch/xen/x86_64/ia32/vsyscall-int80.S                 |   57 
 arch/xen/x86_64/kernel/Makefile                       |   71 
 arch/xen/x86_64/kernel/acpi/Makefile                  |   20 
 arch/xen/x86_64/kernel/apic.c                         |  201 +
 arch/xen/x86_64/kernel/e820.c                         |  609 +++
 arch/xen/x86_64/kernel/early_printk.c                 |  242 +
 arch/xen/x86_64/kernel/entry.S                        | 1060 ++++++
 arch/xen/x86_64/kernel/genapic.c                      |  123 
 arch/xen/x86_64/kernel/genapic_xen.c                  |  167 +
 arch/xen/x86_64/kernel/head.S                         |  272 +
 arch/xen/x86_64/kernel/head64.c                       |  127 
 arch/xen/x86_64/kernel/io_apic.c                      | 1991 +++++++++++
 arch/xen/x86_64/kernel/ioport.c                       |   57 
 arch/xen/x86_64/kernel/irq.c                          |  110 
 arch/xen/x86_64/kernel/ldt.c                          |  263 +
 arch/xen/x86_64/kernel/mpparse.c                      |  963 +++++
 arch/xen/x86_64/kernel/pci-nommu.c                    |   98 
 arch/xen/x86_64/kernel/process.c                      |  751 ++++
 arch/xen/x86_64/kernel/setup.c                        | 1467 ++++++++
 arch/xen/x86_64/kernel/setup64.c                      |  356 ++
 arch/xen/x86_64/kernel/signal.c                       |  493 ++
 arch/xen/x86_64/kernel/smp.c                          |  498 ++
 arch/xen/x86_64/kernel/smpboot.c                      | 1295 +++++++
 arch/xen/x86_64/kernel/traps.c                        |  982 +++++
 arch/xen/x86_64/kernel/vsyscall.c                     |  241 +
 arch/xen/x86_64/kernel/x8664_ksyms.c                  |  211 +
 arch/xen/x86_64/kernel/xen_entry.S                    |   41 
 arch/xen/x86_64/mm/Makefile                           |   31 
 arch/xen/x86_64/mm/fault.c                            |  589 +++
 arch/xen/x86_64/mm/init.c                             | 1026 ++++++
 arch/xen/x86_64/mm/pageattr.c                         |  254 +
 arch/xen/x86_64/pci/Makefile                          |   39 
 arch/xen/x86_64/pci/Makefile-BUS                      |   22 
 drivers/Makefile                                      |    1 
 drivers/acpi/tables.c                                 |    8 
 drivers/char/mem.c                                    |   12 
 drivers/char/tty_io.c                                 |    4 
 drivers/xen/Makefile                                  |   14 
 drivers/xen/balloon/Makefile                          |    2 
 drivers/xen/balloon/balloon.c                         |  499 ++
 drivers/xen/blkback/Makefile                          |    2 
 drivers/xen/blkback/blkback.c                         |  615 +++
 drivers/xen/blkback/common.h                          |  122 
 drivers/xen/blkback/interface.c                       |  162 
 drivers/xen/blkback/vbd.c                             |  224 +
 drivers/xen/blkback/xenbus.c                          |  303 +
 drivers/xen/blkfront/Kconfig                          |    6 
 drivers/xen/blkfront/Makefile                         |    3 
 drivers/xen/blkfront/blkfront.c                       | 1396 ++++++++
 drivers/xen/blkfront/block.h                          |  129 
 drivers/xen/blkfront/vbd.c                            |  367 ++
 drivers/xen/blktap/Makefile                           |    3 
 drivers/xen/blktap/blktap.c                           |   90 
 drivers/xen/blktap/blktap.h                           |  230 +
 drivers/xen/blktap/blktap_controlmsg.c                |  573 +++
 drivers/xen/blktap/blktap_datapath.c                  |  449 ++
 drivers/xen/blktap/blktap_userdev.c                   |  801 ++++
 drivers/xen/console/Makefile                          |    2 
 drivers/xen/console/console.c                         |  811 ++++
 drivers/xen/evtchn/Makefile                           |    2 
 drivers/xen/evtchn/evtchn.c                           |  430 ++
 drivers/xen/netback/Makefile                          |    2 
 drivers/xen/netback/common.h                          |  123 
 drivers/xen/netback/control.c                         |   58 
 drivers/xen/netback/interface.c                       |  465 ++
 drivers/xen/netback/loopback.c                        |  164 
 drivers/xen/netback/netback.c                         | 1005 ++++++
 drivers/xen/netfront/Kconfig                          |    6 
 drivers/xen/netfront/Makefile                         |    2 
 drivers/xen/netfront/netfront.c                       | 1658 +++++++++
 drivers/xen/privcmd/Makefile                          |    2 
 drivers/xen/privcmd/privcmd.c                         |  262 +
 drivers/xen/usbback/common.h                          |   84 
 drivers/xen/usbback/control.c                         |   61 
 drivers/xen/usbback/interface.c                       |  242 +
 drivers/xen/usbback/usbback.c                         | 1068 ++++++
 drivers/xen/usbfront/usbfront.c                       | 1736 ++++++++++
 drivers/xen/usbfront/xhci.h                           |  182 +
 drivers/xen/xenbus/Makefile                           |    6 
 drivers/xen/xenbus/xenbus_comms.c                     |  233 +
 drivers/xen/xenbus/xenbus_comms.h                     |   41 
 drivers/xen/xenbus/xenbus_probe.c                     |  648 +++
 drivers/xen/xenbus/xenbus_xs.c                        |  563 +++
 drivers/xen/xenbus/xenstored.h                        |   89 
 include/asm-generic/pgtable.h                         |   10 
 include/asm-xen/asm-i386/agp.h                        |   37 
 include/asm-xen/asm-i386/bug.h                        |   16 
 include/asm-xen/asm-i386/desc.h                       |  146 
 include/asm-xen/asm-i386/dma-mapping.h                |  156 
 include/asm-xen/asm-i386/fixmap.h                     |  168 +
 include/asm-xen/asm-i386/floppy.h                     |  147 
 include/asm-xen/asm-i386/highmem.h                    |   80 
 include/asm-xen/asm-i386/hw_irq.h                     |   71 
 include/asm-xen/asm-i386/hypercall.h                  |  579 +++
 include/asm-xen/asm-i386/io.h                         |  436 ++
 include/asm-xen/asm-i386/kmap_types.h                 |   32 
 include/asm-xen/asm-i386/mach-xen/irq_vectors.h       |  127 
 include/asm-xen/asm-i386/mach-xen/setup_arch_post.h   |   51 
 include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h    |    5 
 include/asm-xen/asm-i386/mach-xen/smpboot_hooks.h     |   55 
 include/asm-xen/asm-i386/mmu.h                        |   26 
 include/asm-xen/asm-i386/mmu_context.h                |  108 
 include/asm-xen/asm-i386/page.h                       |  252 +
 include/asm-xen/asm-i386/param.h                      |   23 
 include/asm-xen/asm-i386/pci.h                        |  114 
 include/asm-xen/asm-i386/pgalloc.h                    |   61 
 include/asm-xen/asm-i386/pgtable-2level-defs.h        |   21 
 include/asm-xen/asm-i386/pgtable-2level.h             |  126 
 include/asm-xen/asm-i386/pgtable-3level-defs.h        |   25 
 include/asm-xen/asm-i386/pgtable-3level.h             |  207 +
 include/asm-xen/asm-i386/pgtable.h                    |  493 ++
 include/asm-xen/asm-i386/processor.h                  |  703 ++++
 include/asm-xen/asm-i386/ptrace.h                     |   69 
 include/asm-xen/asm-i386/scatterlist.h                |   22 
 include/asm-xen/asm-i386/segment.h                    |   99 
 include/asm-xen/asm-i386/setup.h                      |   66 
 include/asm-xen/asm-i386/spinlock.h                   |  250 +
 include/asm-xen/asm-i386/swiotlb.h                    |   42 
 include/asm-xen/asm-i386/synch_bitops.h               |  140 
 include/asm-xen/asm-i386/system.h                     |  579 +++
 include/asm-xen/asm-i386/tlbflush.h                   |  102 
 include/asm-xen/asm-i386/vga.h                        |   20 
 include/asm-xen/asm-x86_64/arch_hooks.h               |   27 
 include/asm-xen/asm-x86_64/bootsetup.h                |   42 
 include/asm-xen/asm-x86_64/desc.h                     |  240 +
 include/asm-xen/asm-x86_64/dma-mapping.h              |    1 
 include/asm-xen/asm-x86_64/fixmap.h                   |  114 
 include/asm-xen/asm-x86_64/floppy.h                   |  204 +
 include/asm-xen/asm-x86_64/hw_irq.h                   |  138 
 include/asm-xen/asm-x86_64/hypercall.h                |  522 +++
 include/asm-xen/asm-x86_64/io.h                       |  374 ++
 include/asm-xen/asm-x86_64/irq.h                      |   36 
 include/asm-xen/asm-x86_64/mach-xen/io_ports.h        |   30 
 include/asm-xen/asm-x86_64/mach-xen/irq_vectors.h     |  125 
 include/asm-xen/asm-x86_64/mach-xen/mach_time.h       |  122 
 include/asm-xen/asm-x86_64/mach-xen/mach_timer.h      |   48 
 include/asm-xen/asm-x86_64/mach-xen/setup_arch_post.h |   47 
 include/asm-xen/asm-x86_64/mach-xen/setup_arch_pre.h  |    5 
 include/asm-xen/asm-x86_64/mach-xen/smpboot_hooks.h   |   55 
 include/asm-xen/asm-x86_64/mmu_context.h              |  126 
 include/asm-xen/asm-x86_64/page.h                     |  236 +
 include/asm-xen/asm-x86_64/param.h                    |   22 
 include/asm-xen/asm-x86_64/pci.h                      |  150 
 include/asm-xen/asm-x86_64/pgalloc.h                  |  172 +
 include/asm-xen/asm-x86_64/pgtable.h                  |  576 +++
 include/asm-xen/asm-x86_64/processor.h                |  486 ++
 include/asm-xen/asm-x86_64/ptrace.h                   |  124 
 include/asm-xen/asm-x86_64/segment.h                  |   46 
 include/asm-xen/asm-x86_64/smp.h                      |  139 
 include/asm-xen/asm-x86_64/system.h                   |  405 ++
 include/asm-xen/asm-x86_64/timer.h                    |   64 
 include/asm-xen/asm-x86_64/tlbflush.h                 |   97 
 include/asm-xen/asm-x86_64/vga.h                      |   20 
 include/asm-xen/asm-x86_64/xor.h                      |  328 +
 include/asm-xen/balloon.h                             |   60 
 include/asm-xen/ctrl_if.h                             |  160 
 include/asm-xen/evtchn.h                              |  135 
 include/asm-xen/foreign_page.h                        |   30 
 include/asm-xen/gnttab.h                              |   72 
 include/asm-xen/hypervisor.h                          |  195 +
 include/asm-xen/linux-public/privcmd.h                |   90 
 include/asm-xen/linux-public/suspend.h                |   43 
 include/asm-xen/queues.h                              |   81 
 include/asm-xen/synch_bitops.h                        |    2 
 include/asm-xen/xen-public/COPYING                    |   28 
 include/asm-xen/xen-public/acm.h                      |  172 +
 include/asm-xen/xen-public/acm_ops.h                  |   66 
 include/asm-xen/xen-public/arch-ia64.h                |  299 +
 include/asm-xen/xen-public/arch-x86_32.h              |  137 
 include/asm-xen/xen-public/arch-x86_64.h              |  195 +
 include/asm-xen/xen-public/dom0_ops.h                 |  414 ++
 include/asm-xen/xen-public/event_channel.h            |  191 +
 include/asm-xen/xen-public/grant_table.h              |  284 +
 include/asm-xen/xen-public/io/blkif.h                 |   71 
 include/asm-xen/xen-public/io/domain_controller.h     |  787 ++++
 include/asm-xen/xen-public/io/ioreq.h                 |   70 
 include/asm-xen/xen-public/io/netif.h                 |  108 
 include/asm-xen/xen-public/io/ring.h                  |  199 +
 include/asm-xen/xen-public/io/usbif.h                 |   66 
 include/asm-xen/xen-public/io/vmx_vlapic.h            |   57 
 include/asm-xen/xen-public/physdev.h                  |   70 
 include/asm-xen/xen-public/sched_ctl.h                |   58 
 include/asm-xen/xen-public/trace.h                    |   73 
 include/asm-xen/xen-public/version.h                  |   31 
 include/asm-xen/xen-public/vmx_assist.h               |  101 
 include/asm-xen/xen-public/xen.h                      |  469 ++
 include/asm-xen/xen_proc.h                            |   13 
 include/asm-xen/xenbus.h                              |  141 
 include/linux/gfp.h                                   |    6 
 include/linux/highmem.h                               |    2 
 include/linux/irq.h                                   |    1 
 include/linux/mm.h                                    |    7 
 include/linux/skbuff.h                                |    2 
 kernel/irq/manage.c                                   |   83 
 mm/highmem.c                                          |    9 
 mm/memory.c                                           |  118 
 mm/mmap.c                                             |    4 
 mm/page_alloc.c                                       |    6 
 net/core/dev.c                                        |   35 
 net/core/skbuff.c                                     |    2 
 267 files changed, 81974 insertions(+), 27 deletions(-)

--- NEW FILE linux-2.6-xen.patch ---
diff -Nurp ref-linux-2.6.12/arch/xen/Kconfig tmp-linux-2.6.12-xen.patch/arch/xen/Kconfig
--- ref-linux-2.6.12/arch/xen/Kconfig	1969-12-31 19:00:00.000000000 -0500
+++ tmp-linux-2.6.12-xen.patch/arch/xen/Kconfig	2005-08-23 13:12:36.000000000 -0400
@@ -0,0 +1,203 @@
+#
+# For a description of the syntax of this configuration file,
+# see Documentation/kbuild/kconfig-language.txt.
+#
+
+mainmenu "Linux Kernel Configuration"
+
+config XEN
+	bool
+	default y
+	help
+	  This is the Linux Xen port.
+
+config ARCH_XEN
+	bool
+	default y
+
+
+config NO_IDLE_HZ
+	bool
+	default y
+
+
+menu "XEN"
+
+config XEN_PRIVILEGED_GUEST
+	bool "Privileged Guest (domain 0)"
+	default n
+	select XEN_PHYSDEV_ACCESS
+	help
+	  Support for privileged operation (domain 0)
+
+config XEN_PHYSDEV_ACCESS
+	bool "Physical device access"
+	default XEN_PRIVILEGED_GUEST
+	help
+	  Assume access is available to physical hardware devices
+	  (e.g., hard drives, network cards). This allows you to configure
+	  such devices and also includes some low-level support that is
+	  otherwise not compiled into the kernel.
+
+config XEN_BLKDEV_BACKEND
+	bool "Block-device backend driver"
+	depends on XEN_PHYSDEV_ACCESS
+	default y
+	help
+	  The block-device backend driver allows the kernel to export its
+	  block devices to other guests via a high-performance shared-memory
+	  interface.
+
+config XEN_BLKDEV_TAP_BE
+        bool "Block Tap support for backend driver (DANGEROUS)"
+        depends on XEN_BLKDEV_BACKEND
+        default n
+        help
+          If you intend to use the block tap driver, the backend domain will
+          not know the domain id of the real frontend, and so will not be able
+          to map its data pages.  This modifies the backend to attempt to map
+          from both the tap domain and the real frontend.  This presents a
+          security risk, and so should ONLY be used for development
+          with the blktap.  This option will be removed as the block drivers are
+          modified to use grant tables.
+
+config XEN_NETDEV_BACKEND
+	bool "Network-device backend driver"
+	depends on XEN_PHYSDEV_ACCESS
+	default y
+	help
+	  The network-device backend driver allows the kernel to export its
+	  network devices to other guests via a high-performance shared-memory
+	  interface.
+
+config XEN_BLKDEV_FRONTEND
+	bool "Block-device frontend driver"
+	default y
+	help
+	  The block-device frontend driver allows the kernel to access block
+	  devices mounted within another guest OS. Unless you are building a
+	  dedicated device-driver domain, or your master control domain
+	  (domain 0), then you almost certainly want to say Y here.
+
+config XEN_NETDEV_FRONTEND
+	bool "Network-device frontend driver"
+	default y
+	help
+	  The network-device frontend driver allows the kernel to access
+	  network interfaces within another guest OS. Unless you are building a
+	  dedicated device-driver domain, or your master control domain
+	  (domain 0), then you almost certainly want to say Y here.
+
+config XEN_NETDEV_GRANT_TX
+        bool "Grant table substrate for net drivers tx path (DANGEROUS)"
+        default n
+        help
+          This introduces the use of grant tables as a data exhange mechanism
+          between the frontend and backend network drivers.
+
+config XEN_NETDEV_GRANT_RX
+        bool "Grant table substrate for net drivers rx path (DANGEROUS)"
+        default n
+        help
+          This introduces the use of grant tables as a data exhange mechanism
+          between the frontend and backend network drivers.
+
+config XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER
+	bool "Pipelined transmitter (DANGEROUS)"
+	depends on XEN_NETDEV_FRONTEND
+	default n
+	help
+	  The driver will assume that the backend is pipelining packets for
+	  transmission: whenever packets are pending in the remote backend,
+	  the driver will not send asynchronous notifications when it queues
+	  additional packets for transmission.
+	  If the backend is a dumb domain, such as a transparent Ethernet
+	  bridge with no local IP interface, it is safe to say Y here to get
+	  slightly lower network overhead.
+	  If the backend has a local IP interface; or may be doing smart things
+	  like reassembling packets to perform firewall filtering; or if you
+	  are unsure; or if you experience network hangs when this option is
+	  enabled; then you must say N here.
+
+config XEN_BLKDEV_TAP
+	bool "Block device tap driver"
+	default n
+	help
+	  This driver allows a VM to interact on block device channels
+	  to other VMs.  Block messages may be passed through or redirected
+	  to a character device, allowing device prototyping in application
+	  space.  Odds are that you want to say N here.
+
+config XEN_SHADOW_MODE
+	bool "Fake shadow mode"
+	default n
+    help
+      fakes out a shadow mode kernel
+
+
+config XEN_SCRUB_PAGES
+	bool "Scrub memory before freeing it to Xen"
+	default y
+	help
+	  Erase memory contents before freeing it back to Xen's global
+	  pool. This ensures that any secrets contained within that
+	  memory (e.g., private keys) cannot be found by other guests that
+	  may be running on the machine. Most people will want to say Y here.
+	  If security is not a concern then you may increase performance by
+	  saying N.
+
+choice
+	prompt "Processor Type"
+	default XEN_X86
+
+config XEN_X86
+	bool "X86"
+	help
+	  Choose this option if your computer is a X86 architecture.
+
+config XEN_X86_64
+	bool "X86_64"
+	help
+	  Choose this option if your computer is a X86_64 architecture.
+
+endchoice
+
+endmenu
+
+config HAVE_ARCH_DEV_ALLOC_SKB
+	bool
+	default y
+
+source "init/Kconfig"
+
+if XEN_X86
+source "arch/xen/i386/Kconfig"
+endif
+
+if XEN_X86_64
+source "arch/xen/x86_64/Kconfig"
+endif
+
+menu "Executable file formats"
+
+source "fs/Kconfig.binfmt"
+
+endmenu
+
+source "arch/xen/Kconfig.drivers"
+
+if XEN_PRIVILEGED_GUEST
+menu "Power management options"
+source "drivers/acpi/Kconfig"
+endmenu
+endif
+
+source "fs/Kconfig"
[...82888 lines suppressed...]
+                                    unsigned long addr, 
+                                    unsigned long end,
+                                    pte_fn_t fn, void *data)
+{
+	pte_t *pte;
+        int err;
+        struct page *pte_page;
+
+        pte = (mm == &init_mm) ? 
+                pte_alloc_kernel(mm, pmd, addr) :
+                pte_alloc_map(mm, pmd, addr);
+        if (!pte)
+                return -ENOMEM;
+
+        pte_page = pmd_page(*pmd);
+
+        do {
+                err = fn(pte, pte_page, addr, data);
+		if (err)
+                        break;
+        } while (pte++, addr += PAGE_SIZE, addr != end);
+
+        if (mm != &init_mm)
+                pte_unmap(pte-1);
+        return err;
+
+}
+
+static inline int generic_pmd_range(struct mm_struct *mm,
+                                    pud_t *pud, 
+                                    unsigned long addr, 
+                                    unsigned long end,
+                                    pte_fn_t fn, void *data)
+{
+	pmd_t *pmd;
+	unsigned long next;
+        int err;
+
+	pmd = pmd_alloc(mm, pud, addr);
+	if (!pmd)
+		return -ENOMEM;
+	do {
+		next = pmd_addr_end(addr, end);
+                err = generic_pte_range(mm, pmd, addr, next, fn, data);
+                if (err)
+                    break;
+	} while (pmd++, addr = next, addr != end);
+	return err;
+}
+
+static inline int generic_pud_range(struct mm_struct *mm, pgd_t *pgd, 
+                                    unsigned long addr,
+                                    unsigned long end,
+                                    pte_fn_t fn, void *data)
+{
+	pud_t *pud;
+	unsigned long next;
+        int err;
+
+	pud = pud_alloc(mm, pgd, addr);
+	if (!pud)
+		return -ENOMEM;
+	do {
+		next = pud_addr_end(addr, end);
+		err = generic_pmd_range(mm, pud, addr, next, fn, data);
+                if (err)
+			break;
+	} while (pud++, addr = next, addr != end);
+	return err;
+}
+
+/*
+ * Scan a region of virtual memory, filling in page tables as necessary
+ * and calling a provided function on each leaf page table.
+ */
+int generic_page_range(struct mm_struct *mm, unsigned long addr, 
+                  unsigned long size, pte_fn_t fn, void *data)
+{
+	pgd_t *pgd;
+	unsigned long next;
+	unsigned long end = addr + size;
+	int err;
+
+	BUG_ON(addr >= end);
+	pgd = pgd_offset(mm, addr);
+	spin_lock(&mm->page_table_lock);
+	do {
+		next = pgd_addr_end(addr, end);
+		err = generic_pud_range(mm, pgd, addr, next, fn, data);
+		if (err)
+			break;
+	} while (pgd++, addr = next, addr != end);
+	spin_unlock(&mm->page_table_lock);
+	return err;
+}
+
 /*
  * Do pte_mkwrite, but only if the vma says VM_WRITE.  We do this when
  * servicing faults for write access.  In the normal case, do always want
diff -Nurp ref-linux-2.6.12/mm/mmap.c tmp-linux-2.6.12-xen.patch/mm/mmap.c
--- ref-linux-2.6.12/mm/mmap.c	2005-06-17 15:48:29.000000000 -0400
+++ tmp-linux-2.6.12-xen.patch/mm/mmap.c	2005-07-11 13:20:28.000000000 -0400
@@ -1904,6 +1904,10 @@ void exit_mmap(struct mm_struct *mm)
 	unsigned long nr_accounted = 0;
 	unsigned long end;
 
+#ifdef arch_exit_mmap
+	arch_exit_mmap(mm);
+#endif
+
 	lru_add_drain();
 
 	spin_lock(&mm->page_table_lock);
diff -Nurp ref-linux-2.6.12/mm/page_alloc.c tmp-linux-2.6.12-xen.patch/mm/page_alloc.c
--- ref-linux-2.6.12/mm/page_alloc.c	2005-06-17 15:48:29.000000000 -0400
+++ tmp-linux-2.6.12-xen.patch/mm/page_alloc.c	2005-07-11 13:20:28.000000000 -0400
@@ -368,7 +368,8 @@ void __free_pages_ok(struct page *page, 
 	LIST_HEAD(list);
 	int i;
 
-	arch_free_page(page, order);
+	if (arch_free_page(page, order))
+		return;
 
 	mod_page_state(pgfree, 1 << order);
 
@@ -608,7 +609,8 @@ static void fastcall free_hot_cold_page(
 	struct per_cpu_pages *pcp;
 	unsigned long flags;
 
-	arch_free_page(page, 0);
+	if (arch_free_page(page, 0))
+		return;
 
 	kernel_map_pages(page, 1, 0);
 	inc_page_state(pgfree);
diff -Nurp ref-linux-2.6.12/net/core/dev.c tmp-linux-2.6.12-xen.patch/net/core/dev.c
--- ref-linux-2.6.12/net/core/dev.c	2005-06-17 15:48:29.000000000 -0400
+++ tmp-linux-2.6.12-xen.patch/net/core/dev.c	2005-07-11 13:20:28.000000000 -0400
@@ -1261,6 +1266,30 @@ int dev_queue_xmit(struct sk_buff *skb)
 	    __skb_linearize(skb, GFP_ATOMIC))
 		goto out_kfree_skb;
 
+	/* If a checksum-deferred packet is forwarded to a device that needs a
+	 * checksum, correct the pointers and force checksumming.
+	 */
+	if (skb->proto_csum_blank) {
+		if (skb->protocol != htons(ETH_P_IP))
+			goto out_kfree_skb;
+		skb->h.raw = (unsigned char *)skb->nh.iph + 4*skb->nh.iph->ihl;
+		if (skb->h.raw >= skb->tail)
+			goto out_kfree_skb;
+		switch (skb->nh.iph->protocol) {
+		case IPPROTO_TCP:
+			skb->csum = offsetof(struct tcphdr, check);
+			break;
+		case IPPROTO_UDP:
+			skb->csum = offsetof(struct udphdr, check);
+			break;
+		default:
+			goto out_kfree_skb;
+		}
+		if ((skb->h.raw + skb->csum + 2) > skb->tail)
+			goto out_kfree_skb;
+		skb->ip_summed = CHECKSUM_HW;
+	}
+
 	/* If packet is not checksummed and device does not support
 	 * checksumming for this protocol, complete checksumming here.
 	 */
@@ -1680,6 +1709,17 @@ int netif_receive_skb(struct sk_buff *sk
 	}
 #endif
 
+	switch (skb->ip_summed) {
+	case CHECKSUM_UNNECESSARY:
+		skb->proto_csum_valid = 1;
+		break;
+	case CHECKSUM_HW:
+		/* XXX Implement me. */
+	default:
+		skb->proto_csum_valid = 0;
+		break;
+	}
+
 	list_for_each_entry_rcu(ptype, &ptype_all, list) {
 		if (!ptype->dev || ptype->dev == skb->dev) {
 			if (pt_prev) 
diff -Nurp ref-linux-2.6.12/net/core/skbuff.c tmp-linux-2.6.12-xen.patch/net/core/skbuff.c
--- ref-linux-2.6.12/net/core/skbuff.c	2005-06-17 15:48:29.000000000 -0400
+++ tmp-linux-2.6.12-xen.patch/net/core/skbuff.c	2005-07-11 13:20:28.000000000 -0400
@@ -353,6 +353,8 @@ struct sk_buff *skb_clone(struct sk_buff
 	C(local_df);
 	n->cloned = 1;
 	n->nohdr = 0;
+	C(proto_csum_valid);
+	C(proto_csum_blank);
 	C(pkt_type);
 	C(ip_summed);
 	C(priority);


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.1607
retrieving revision 1.1608
diff -u -r1.1607 -r1.1608
--- kernel-2.6.spec	15 Oct 2005 01:02:03 -0000	1.1607
+++ kernel-2.6.spec	15 Oct 2005 01:07:27 -0000	1.1608
@@ -219,9 +219,9 @@
 # 600 - 699   sparc(64)
 
 # 700 - 799 Xen
-Patch700: linux-2.6.12-xen.patch
-Patch701: linux-2.6.12-xen-additional.patch
-Patch702: linux-2.6.9-xen-compile.patch
+Patch700: linux-2.6-xen.patch
+Patch701: linux-2.6-xen-additional.patch
+Patch702: linux-2.6-xen-compile.patch
 
 #
 # Patches 800 through 899 are reserved for bugfixes to the core system
@@ -266,10 +266,10 @@
 Patch1021: linux-2.6-debug-reference-discarded-return-result.patch
 
 Patch1050: linux-2.6.11-devmem.patch
-Patch1051: linux-2.6.8-devmem-xen.patch
+Patch1051: linux-2.6-devmem-xen.patch
 
 Patch1060: linux-2.6.3-crash-driver.patch
-Patch1061: linux-2.6.10-crash-xen.patch
+Patch1061: linux-2.6-crash-xen.patch
 Patch1070: linux-2.6.0-sleepon.patch
 
 # Tweak some defaults.


--- linux-2.6.10-crash-xen.patch DELETED ---


--- linux-2.6.12-xen-additional.patch DELETED ---


--- linux-2.6.12-xen.patch DELETED ---


--- linux-2.6.8-devmem-xen.patch DELETED ---


--- linux-2.6.9-xen-compile.patch DELETED ---




More information about the fedora-cvs-commits mailing list