Subject: Fix xen build. From: jbeulich@novell.com Patch-mainline: n/a --- head-2010-05-25.orig/drivers/acpi/acpica/hwsleep.c 2010-03-24 14:53:41.000000000 +0100 +++ head-2010-05-25/drivers/acpi/acpica/hwsleep.c 2010-03-24 15:02:17.000000000 +0100 @@ -419,6 +419,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_stat * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ +#ifndef CONFIG_XEN acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) { u32 in_value; @@ -472,6 +473,7 @@ acpi_status asmlinkage acpi_enter_sleep_ } ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) +#endif /******************************************************************************* * --- head-2010-05-25.orig/drivers/base/cpu.c 2010-05-25 09:12:09.000000000 +0200 +++ head-2010-05-25/drivers/base/cpu.c 2010-04-15 09:51:36.000000000 +0200 @@ -106,7 +106,7 @@ static inline void register_cpu_control( } #endif /* CONFIG_HOTPLUG_CPU */ -#ifdef CONFIG_KEXEC +#if defined(CONFIG_KEXEC) && !defined(CONFIG_XEN) #include static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute *attr, @@ -231,7 +231,7 @@ int __cpuinit register_cpu(struct cpu *c if (!error) register_cpu_under_node(num, cpu_to_node(num)); -#ifdef CONFIG_KEXEC +#if defined(CONFIG_KEXEC) && !defined(CONFIG_XEN) if (!error) error = sysdev_create_file(&cpu->sysdev, &attr_crash_notes); #endif --- head-2010-05-25.orig/drivers/ide/ide-lib.c 2010-03-24 14:53:41.000000000 +0100 +++ head-2010-05-25/drivers/ide/ide-lib.c 2010-03-24 15:02:17.000000000 +0100 @@ -18,6 +18,16 @@ void ide_toggle_bounce(ide_drive_t *driv { u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ +#ifndef CONFIG_XEN + if (!PCI_DMA_BUS_IS_PHYS) { + addr = BLK_BOUNCE_ANY; + } else if (on && drive->media == ide_disk) { + struct device *dev = drive->hwif->dev; + + if (dev && dev->dma_mask) + addr = *dev->dma_mask; + } +#else if (on && drive->media == ide_disk) { struct device *dev = drive->hwif->dev; @@ -26,6 +36,7 @@ void ide_toggle_bounce(ide_drive_t *driv else if (dev && dev->dma_mask) addr = *dev->dma_mask; } +#endif if (drive->queue) blk_queue_bounce_limit(drive->queue, addr); --- head-2010-05-25.orig/drivers/oprofile/buffer_sync.c 2010-04-15 09:43:44.000000000 +0200 +++ head-2010-05-25/drivers/oprofile/buffer_sync.c 2010-04-15 09:51:29.000000000 +0200 @@ -47,7 +47,9 @@ static cpumask_var_t marked_cpus; static DEFINE_SPINLOCK(task_mortuary); static void process_task_mortuary(void); +#ifdef CONFIG_XEN static int cpu_current_domain[NR_CPUS]; +#endif /* Take ownership of the task struct and place it on the * list for processing. Only after two full buffer syncs @@ -159,11 +161,13 @@ static void end_sync(void) int sync_start(void) { int err; +#ifdef CONFIG_XEN int i; for (i = 0; i < NR_CPUS; i++) { cpu_current_domain[i] = COORDINATOR_DOMAIN; } +#endif if (!zalloc_cpumask_var(&marked_cpus, GFP_KERNEL)) return -ENOMEM; @@ -313,12 +317,14 @@ static void add_cpu_mode_switch(unsigned } } +#ifdef CONFIG_XEN static void add_domain_switch(unsigned long domain_id) { add_event_entry(ESCAPE_CODE); add_event_entry(DOMAIN_SWITCH_CODE); add_event_entry(domain_id); } +#endif static void add_user_ctx_switch(struct task_struct const *task, unsigned long cookie) @@ -541,10 +547,12 @@ void sync_buffer(int cpu) add_cpu_switch(cpu); +#ifdef CONFIG_XEN /* We need to assign the first samples in this CPU buffer to the same domain that we were processing at the last sync_buffer */ if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) add_domain_switch(cpu_current_domain[cpu]); +#endif op_cpu_buffer_reset(cpu); available = op_cpu_buffer_entries(cpu); @@ -554,12 +562,14 @@ void sync_buffer(int cpu) if (!sample) break; +#ifdef CONFIG_XEN if (domain_switch) { cpu_current_domain[cpu] = sample->eip; add_domain_switch(sample->eip); domain_switch = 0; continue; } +#endif if (is_code(sample->eip)) { flags = sample->event; @@ -585,17 +595,21 @@ void sync_buffer(int cpu) cookie = get_exec_dcookie(mm); add_user_ctx_switch(new, cookie); } +#ifdef CONFIG_XEN if (flags & DOMAIN_SWITCH) domain_switch = 1; +#endif if (op_cpu_buffer_get_size(&entry)) add_data(&entry, mm); continue; } +#ifdef CONFIG_XEN if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) { add_sample_entry(sample->eip, sample->event); continue; } +#endif if (state < sb_bt_start) /* ignore sample */ @@ -612,9 +626,11 @@ void sync_buffer(int cpu) } release_mm(mm); +#ifdef CONFIG_XEN /* We reset domain to COORDINATOR at each CPU switch */ if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) add_domain_switch(COORDINATOR_DOMAIN); +#endif mark_done(cpu); --- head-2010-05-25.orig/drivers/oprofile/cpu_buffer.c 2010-03-24 14:53:41.000000000 +0100 +++ head-2010-05-25/drivers/oprofile/cpu_buffer.c 2010-03-24 15:02:17.000000000 +0100 @@ -58,7 +58,11 @@ static void wq_sync_buffer(struct work_s #define DEFAULT_TIMER_EXPIRE (HZ / 10) static int work_enabled; +#ifndef CONFIG_XEN +#define current_domain COORDINATOR_DOMAIN +#else static int32_t current_domain = COORDINATOR_DOMAIN; +#endif unsigned long oprofile_get_cpu_buffer_size(void) { @@ -462,6 +466,7 @@ fail: return; } +#ifdef CONFIG_XEN int oprofile_add_domain_switch(int32_t domain_id) { struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()]; @@ -480,6 +485,7 @@ int oprofile_add_domain_switch(int32_t d return 1; } +#endif /* * This serves to avoid cpu buffer overflow, and makes sure --- head-2010-05-25.orig/drivers/oprofile/oprof.c 2010-03-24 14:53:41.000000000 +0100 +++ head-2010-05-25/drivers/oprofile/oprof.c 2010-03-24 15:02:17.000000000 +0100 @@ -39,6 +39,7 @@ static DEFINE_MUTEX(start_mutex); */ static int timer = 0; +#ifdef CONFIG_XEN int oprofile_set_active(int active_domains[], unsigned int adomains) { int err; @@ -64,6 +65,7 @@ int oprofile_set_passive(int passive_dom mutex_unlock(&start_mutex); return err; } +#endif int oprofile_setup(void) { --- head-2010-05-25.orig/drivers/oprofile/oprofile_files.c 2010-03-24 14:53:41.000000000 +0100 +++ head-2010-05-25/drivers/oprofile/oprofile_files.c 2010-03-24 15:02:17.000000000 +0100 @@ -171,6 +171,8 @@ static const struct file_operations dump .write = dump_write, }; +#ifdef CONFIG_XEN + #define TMPBUFSIZE 512 static unsigned int adomains = 0; @@ -360,6 +362,8 @@ static const struct file_operations pass .write = pdomain_write, }; +#endif /* CONFIG_XEN */ + void oprofile_create_files(struct super_block *sb, struct dentry *root) { /* reinitialize default values */ @@ -370,8 +374,10 @@ void oprofile_create_files(struct super_ oprofilefs_create_file(sb, root, "enable", &enable_fops); oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666); +#ifdef CONFIG_XEN oprofilefs_create_file(sb, root, "active_domains", &active_domain_ops); oprofilefs_create_file(sb, root, "passive_domains", &passive_domain_ops); +#endif oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops); oprofilefs_create_ulong(sb, root, "buffer_size", &oprofile_buffer_size); oprofilefs_create_ulong(sb, root, "buffer_watershed", &oprofile_buffer_watershed); --- head-2010-05-25.orig/drivers/xen/core/smpboot.c 2009-05-19 09:16:41.000000000 +0200 +++ head-2010-05-25/drivers/xen/core/smpboot.c 2010-03-24 15:02:17.000000000 +0100 @@ -57,7 +57,6 @@ u8 cpu_2_logical_apicid[NR_CPUS] = { [0 cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned; cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; -EXPORT_SYMBOL(cpu_core_map); #if defined(__i386__) u8 x86_cpu_to_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = 0xff }; --- head-2010-05-25.orig/include/linux/mm.h 2010-03-24 14:53:41.000000000 +0100 +++ head-2010-05-25/include/linux/mm.h 2010-03-24 15:02:17.000000000 +0100 @@ -211,6 +211,7 @@ struct vm_operations_struct { int (*access)(struct vm_area_struct *vma, unsigned long addr, void *buf, int len, int write); +#ifdef CONFIG_XEN /* Area-specific function for clearing the PTE at @ptep. Returns the * original value of @ptep. */ pte_t (*zap_pte)(struct vm_area_struct *vma, @@ -218,6 +219,7 @@ struct vm_operations_struct { /* called before close() to indicate no more pages should be mapped */ void (*unmap)(struct vm_area_struct *area); +#endif #ifdef CONFIG_NUMA /* --- head-2010-05-25.orig/include/linux/oprofile.h 2010-03-24 14:53:41.000000000 +0100 +++ head-2010-05-25/include/linux/oprofile.h 2010-03-24 15:02:17.000000000 +0100 @@ -16,8 +16,9 @@ #include #include #include - +#ifdef CONFIG_XEN #include +#endif /* Each escaped entry is prefixed by ESCAPE_CODE * then one of the following codes, then the @@ -55,11 +56,12 @@ struct oprofile_operations { /* create any necessary configuration files in the oprofile fs. * Optional. */ int (*create_files)(struct super_block * sb, struct dentry * root); +#ifdef CONFIG_XEN /* setup active domains with Xen */ int (*set_active)(int *active_domains, unsigned int adomains); /* setup passive domains with Xen */ int (*set_passive)(int *passive_domains, unsigned int pdomains); - +#endif /* Do any necessary interrupt setup. Optional. */ int (*setup)(void); /* Do any necessary interrupt shutdown. Optional. */ --- head-2010-05-25.orig/include/linux/page-flags.h 2010-03-24 14:53:41.000000000 +0100 +++ head-2010-05-25/include/linux/page-flags.h 2010-03-24 15:02:17.000000000 +0100 @@ -111,7 +111,7 @@ enum pageflags { #endif #ifdef CONFIG_XEN PG_foreign, /* Page is owned by foreign allocator. */ - PG_netback, /* Page is owned by netback */ + /* PG_netback, Page is owned by netback */ PG_blkback, /* Page is owned by blkback */ #endif __NR_PAGEFLAGS, @@ -355,9 +355,11 @@ CLEARPAGEFLAG(Uptodate, uptodate) #define PageForeignDestructor(_page, order) \ ((void (*)(struct page *, unsigned int))(_page)->index)(_page, order) +#if 0 #define PageNetback(page) test_bit(PG_netback, &(page)->flags) #define SetPageNetback(page) set_bit(PG_netback, &(page)->flags) #define ClearPageNetback(page) clear_bit(PG_netback, &(page)->flags) +#endif #define PageBlkback(page) test_bit(PG_blkback, &(page)->flags) #define SetPageBlkback(page) set_bit(PG_blkback, &(page)->flags) --- head-2010-05-25.orig/kernel/kexec.c 2010-03-24 14:53:41.000000000 +0100 +++ head-2010-05-25/kernel/kexec.c 2010-05-25 09:20:04.000000000 +0200 @@ -46,8 +46,10 @@ #include #endif +#ifndef CONFIG_XEN /* Per cpu memory for storing cpu states in case of system crash. */ note_buf_t __percpu *crash_notes; +#endif /* vmcoreinfo stuff */ static unsigned char vmcoreinfo_data[VMCOREINFO_BYTES]; @@ -1226,6 +1228,7 @@ static void final_note(u32 *buf) memcpy(buf, ¬e, sizeof(note)); } +#ifndef CONFIG_XEN void crash_save_cpu(struct pt_regs *regs, int cpu) { struct elf_prstatus prstatus; @@ -1251,9 +1254,11 @@ void crash_save_cpu(struct pt_regs *regs &prstatus, sizeof(prstatus)); final_note(buf); } +#endif static int __init crash_notes_memory_init(void) { +#ifndef CONFIG_XEN /* Allocate memory for saving cpu registers. */ crash_notes = alloc_percpu(note_buf_t); if (!crash_notes) { @@ -1261,6 +1266,7 @@ static int __init crash_notes_memory_ini " states failed\n"); return -ENOMEM; } +#endif return 0; } module_init(crash_notes_memory_init) --- head-2010-05-25.orig/mm/memory.c 2010-04-15 09:44:04.000000000 +0200 +++ head-2010-05-25/mm/memory.c 2010-04-15 09:51:22.000000000 +0200 @@ -944,10 +944,12 @@ static unsigned long zap_pte_range(struc page->index > details->last_index)) continue; } +#ifdef CONFIG_XEN if (unlikely(vma->vm_ops && vma->vm_ops->zap_pte)) ptent = vma->vm_ops->zap_pte(vma, addr, pte, tlb->fullmm); else +#endif ptent = ptep_get_and_clear_full(mm, addr, pte, tlb->fullmm); tlb_remove_tlb_entry(tlb, pte, addr); --- head-2010-05-25.orig/mm/mmap.c 2010-04-29 09:42:36.000000000 +0200 +++ head-2010-05-25/mm/mmap.c 2010-04-29 09:43:01.000000000 +0200 @@ -1946,8 +1946,10 @@ static void unmap_region(struct mm_struc static inline void unmap_vma(struct vm_area_struct *vma) { +#ifdef CONFIG_XEN if (unlikely(vma->vm_ops && vma->vm_ops->unmap)) vma->vm_ops->unmap(vma); +#endif } /* @@ -2304,8 +2306,10 @@ void exit_mmap(struct mm_struct *mm) arch_exit_mmap(mm); +#ifdef CONFIG_XEN for (vma = mm->mmap; vma; vma = vma->vm_next) unmap_vma(vma); +#endif vma = mm->mmap; if (!vma) /* Can happen if dup_mmap() received an OOM */