diff -urN --exclude=SCCS --exclude=BitKeeper xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c xeno-ft/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c --- xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c 2005-06-04 18:07:26.000000000 -0400 +++ xeno-ft/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c 2005-06-04 18:14:40.000000000 -0400 @@ -109,11 +109,13 @@ retval = copy_ldt(&mm->context, &old_mm->context); up(&old_mm->context.sem); } +#ifndef CONFIG_XEN_SHADOW_MODE if (retval == 0) { spin_lock(&mm_unpinned_lock); list_add(&mm->context.unpinned, &mm_unpinned); spin_unlock(&mm_unpinned_lock); } +#endif return retval; } @@ -134,11 +136,13 @@ kfree(mm->context.ldt); mm->context.size = 0; } +#ifndef CONFIG_XEN_SHADOW_MODE if (!mm->context.pinned) { spin_lock(&mm_unpinned_lock); list_del(&mm->context.unpinned); spin_unlock(&mm_unpinned_lock); } +#endif } static int read_ldt(void __user * ptr, unsigned long bytecount) diff -urN --exclude=SCCS --exclude=BitKeeper xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c xeno-ft/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c --- xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c 2005-05-16 13:05:03.000000000 -0400 +++ xeno-ft/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c 2005-05-16 13:55:06.000000000 -0400 @@ -27,6 +27,7 @@ static void xen_contig_memory(unsigned long vstart, unsigned int order) { +#ifndef CONFIG_XEN_SHADOW_TRANSLATE_MODE /* * Ensure multi-page extents are contiguous in machine memory. * This code could be cleaned up some, and the number of @@ -69,6 +70,7 @@ flush_tlb_all(); balloon_unlock(flags); +#endif /* ! CONFIG_XEN_SHADOW_TRANSLATE_MODE */ } void *dma_alloc_coherent(struct device *dev, size_t size, diff -urN --exclude=SCCS --exclude=BitKeeper xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c xeno-ft/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c --- xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c 2005-05-16 13:05:03.000000000 -0400 +++ xeno-ft/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c 2005-05-16 13:55:06.000000000 -0400 @@ -360,8 +360,10 @@ shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page; EXPORT_SYMBOL(HYPERVISOR_shared_info); +#ifndef CONFIG_XEN_SHADOW_TRANSLATE_MODE unsigned int *phys_to_machine_mapping, *pfn_to_mfn_frame_list; EXPORT_SYMBOL(phys_to_machine_mapping); +#endif /* Raw start-of-day parameters from the hypervisor. */ union xen_start_info_union xen_start_info_union; @@ -1156,7 +1158,9 @@ } #endif +#ifndef CONFIG_XEN_SHADOW_TRANSLATE_MODE phys_to_machine_mapping = (unsigned int *)xen_start_info.mfn_list; +#endif return max_low_pfn; } @@ -1509,6 +1513,7 @@ find_smp_config(); #endif +#ifndef CONFIG_XEN_SHADOW_TRANSLATE_MODE /* Make sure we have a correctly sized P->M table. */ if (max_pfn != xen_start_info.nr_pages) { phys_to_machine_mapping = alloc_bootmem_low_pages( @@ -1545,7 +1550,7 @@ } HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list = virt_to_machine(pfn_to_mfn_frame_list) >> PAGE_SHIFT; - +#endif /* ! CONFIG_XEN_SHADOW_TRANSLATE_MODE */ /* * NOTE: at this point the bootmem allocator is fully available. diff -urN --exclude=SCCS --exclude=BitKeeper xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c xeno-ft/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c --- xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c 2005-06-01 14:06:28.000000000 -0400 +++ xeno-ft/linux-2.6.11-xen-sparse/arch/xen/i386/mm/pgtable.c 2005-06-01 15:08:44.000000000 -0400 @@ -408,6 +408,7 @@ } #endif /* CONFIG_XEN_SHADOW_MODE */ +#ifndef CONFIG_XEN_SHADOW_MODE LIST_HEAD(mm_unpinned); DEFINE_SPINLOCK(mm_unpinned_lock); @@ -454,6 +455,7 @@ } } + void mm_pin(struct mm_struct *mm) { spin_lock(&mm->page_table_lock); @@ -521,3 +523,4 @@ if ( mm->context.pinned && (atomic_read(&mm->mm_count) == 1) ) mm_unpin(mm); } +#endif /* CONFIG_XEN_SHADOW_MODE */ diff -urN --exclude=SCCS --exclude=BitKeeper xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/Kconfig xeno-ft/linux-2.6.11-xen-sparse/arch/xen/Kconfig --- xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/Kconfig 2005-05-16 13:05:03.000000000 -0400 +++ xeno-ft/linux-2.6.11-xen-sparse/arch/xen/Kconfig 2005-06-06 10:43:06.000000000 -0400 @@ -124,11 +124,21 @@ space. Odds are that you want to say N here. config XEN_SHADOW_MODE - bool "Fake shadow mode" + bool "Build linux to use Xen's shadow mode support (EXPERIMENTAL)" + depends on EXPERIMENTAL default n - help - fakes out a shadow mode kernel + help + Builds a xenolinux that expects Xen's shadow mode support to be + enabled. +config XEN_SHADOW_TRANSLATE_MODE + bool "Build linux to use Xen's shadow translate mode support (EXPERIMENTAL)" + depends on EXPERIMENTAL + depends on XEN_SHADOW_MODE + default n + help + Builds a xenolinux that expects Xen's shadow translate mode support + to be enabled. config XEN_SCRUB_PAGES bool "Scrub memory before freeing it to Xen" diff -urN --exclude=SCCS --exclude=BitKeeper xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c xeno-ft/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c --- xen-unstable.latest/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c 2005-06-04 18:07:26.000000000 -0400 +++ xeno-ft/linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c 2005-06-04 18:14:40.000000000 -0400 @@ -93,7 +93,9 @@ extern void time_suspend(void); extern void time_resume(void); extern unsigned long max_pfn; +#ifndef CONFIG_XEN_SHADOW_TRANSLATE_MODE extern unsigned int *pfn_to_mfn_frame_list; +#endif suspend_record = (suspend_record_t *)__get_free_page(GFP_KERNEL); if ( suspend_record == NULL ) @@ -139,6 +141,7 @@ memset(empty_zero_page, 0, PAGE_SIZE); +#ifndef CONFIG_XEN_SHADOW_TRANSLATE_MODE for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ ) { pfn_to_mfn_frame_list[j] = @@ -146,7 +149,7 @@ } HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list = virt_to_machine(pfn_to_mfn_frame_list) >> PAGE_SHIFT; - +#endif /* ! CONFIG_XEN_SHADOW_TRANSLATE_MODE */ gnttab_resume(); irq_resume(); diff -urN --exclude=SCCS --exclude=BitKeeper xen-unstable.latest/linux-2.6.11-xen-sparse/drivers/xen/balloon/balloon.c xeno-ft/linux-2.6.11-xen-sparse/drivers/xen/balloon/balloon.c --- xen-unstable.latest/linux-2.6.11-xen-sparse/drivers/xen/balloon/balloon.c 2005-04-13 05:44:49.000000000 -0400 +++ xeno-ft/linux-2.6.11-xen-sparse/drivers/xen/balloon/balloon.c 2005-05-16 13:06:46.000000000 -0400 @@ -197,12 +197,14 @@ BUG(); pfn = page - mem_map; +#ifndef CONFIG_XEN_SHADOW_TRANSLATE_MODE if ( phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY ) BUG(); /* Update P->M and M->P tables. */ phys_to_machine_mapping[pfn] = mfn_list[i]; xen_machphys_update(mfn_list[i], pfn); +#endif /* Link back into the page tables if it's not a highmem page. */ if ( pfn < max_low_pfn ) @@ -239,7 +241,11 @@ } pfn = page - mem_map; +#ifndef CONFIG_XEN_SHADOW_TRANSLATE_MODE mfn_list[i] = phys_to_machine_mapping[pfn]; +#else + mfn_list[i] = pfn; +#endif if ( !PageHighMem(page) ) { @@ -266,7 +272,9 @@ for ( i = 0; i < debt; i++ ) { pfn = mfn_to_pfn(mfn_list[i]); +#ifndef CONFIG_XEN_SHADOW_TRANSLATE_MODE phys_to_machine_mapping[pfn] = INVALID_P2M_ENTRY; +#endif balloon_append(pfn_to_page(pfn)); } diff -urN --exclude=SCCS --exclude=BitKeeper xen-unstable.latest/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h xeno-ft/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h --- xen-unstable.latest/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h 2005-06-01 14:06:28.000000000 -0400 +++ xeno-ft/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu_context.h 2005-06-01 14:17:39.000000000 -0400 @@ -41,9 +41,15 @@ : : "r" (0) ); } +#ifndef CONFIG_XEN_SHADOW_MODE extern void mm_pin(struct mm_struct *mm); extern void mm_unpin(struct mm_struct *mm); void mm_pin_all(void); +#else +#define mm_pin(_mm) ((void)0) +#define mm_unpin(_mm) ((void)0) +#define mm_pin_all() ((void)0) +#endif static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, diff -urN --exclude=SCCS --exclude=BitKeeper xen-unstable.latest/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu.h xeno-ft/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu.h --- xen-unstable.latest/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu.h 2005-06-01 14:06:28.000000000 -0400 +++ xeno-ft/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mmu.h 2005-06-01 15:15:30.000000000 -0400 @@ -16,6 +16,7 @@ struct list_head unpinned; } mm_context_t; +#ifndef CONFIG_XEN_SHADOW_MODE extern struct list_head mm_unpinned; extern spinlock_t mm_unpinned_lock; @@ -23,4 +24,6 @@ extern void _arch_exit_mmap(struct mm_struct *mm); #define arch_exit_mmap(_mm) _arch_exit_mmap(_mm) +#endif /* CONFIG_XEN_SHADOW_MODE */ + #endif diff -urN --exclude=SCCS --exclude=BitKeeper xen-unstable.latest/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/page.h xeno-ft/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/page.h --- xen-unstable.latest/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/page.h 2005-05-31 08:28:29.000000000 -0400 +++ xeno-ft/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/page.h 2005-06-06 16:17:09.000000000 -0400 @@ -58,9 +58,14 @@ #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/ +#ifdef CONFIG_XEN_SHADOW_MODE +# define pfn_to_mfn(_pfn) ((unsigned long)(_pfn)) +# define mfn_to_pfn(_mfn) ((unsigned long)(_mfn)) +#else extern unsigned int *phys_to_machine_mapping; -#define pfn_to_mfn(_pfn) ((unsigned long)(phys_to_machine_mapping[(_pfn)])) -#define mfn_to_pfn(_mfn) ((unsigned long)(machine_to_phys_mapping[(_mfn)])) +# define pfn_to_mfn(_pfn) ((unsigned long)(phys_to_machine_mapping[(_pfn)])) +# define mfn_to_pfn(_mfn) ((unsigned long)(machine_to_phys_mapping[(_mfn)])) +#endif static inline unsigned long phys_to_machine(unsigned long phys) { unsigned long machine = pfn_to_mfn(phys >> PAGE_SHIFT);