Blob Blame History Raw
Subject: Fix xen build.
From: jbeulich@novell.com
Patch-mainline: n/a

--- head-2011-01-30.orig/drivers/acpi/acpica/hwsleep.c	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/drivers/acpi/acpica/hwsleep.c	2011-01-31 17:01:49.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-2011-01-30.orig/drivers/base/cpu.c	2010-08-02 00:11:14.000000000 +0200
+++ head-2011-01-30/drivers/base/cpu.c	2011-01-31 17:01:49.000000000 +0100
@@ -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 <linux/kexec.h>
 
 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-2011-01-30.orig/drivers/ide/ide-lib.c	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/drivers/ide/ide-lib.c	2011-01-31 17:01:49.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-2011-01-30.orig/drivers/oprofile/buffer_sync.c	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/drivers/oprofile/buffer_sync.c	2011-01-31 17:01:49.000000000 +0100
@@ -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
@@ -149,11 +151,13 @@ static struct notifier_block module_load
 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;
@@ -314,12 +318,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)
@@ -542,10 +548,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);
@@ -555,12 +563,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;
@@ -586,17 +596,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 */
@@ -613,9 +627,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-2011-01-30.orig/drivers/oprofile/cpu_buffer.c	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/drivers/oprofile/cpu_buffer.c	2011-01-31 17:01:49.000000000 +0100
@@ -42,7 +42,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)
 {
@@ -435,6 +439,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()];
@@ -453,6 +458,7 @@ int oprofile_add_domain_switch(int32_t d
 
 	return 1;
 }
+#endif
 
 /*
  * This serves to avoid cpu buffer overflow, and makes sure
--- head-2011-01-30.orig/drivers/oprofile/oprof.c	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/drivers/oprofile/oprof.c	2011-01-31 17:01:49.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-2011-01-30.orig/drivers/oprofile/oprofile_files.c	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/drivers/oprofile/oprofile_files.c	2011-01-31 17:01:49.000000000 +0100
@@ -180,6 +180,8 @@ static const struct file_operations dump
 	.llseek		= noop_llseek,
 };
 
+#ifdef CONFIG_XEN
+
 #define TMPBUFSIZE 512
 
 static unsigned int adomains = 0;
@@ -369,6 +371,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 */
@@ -379,8 +383,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-2011-01-30.orig/drivers/xen/core/smpboot.c	2010-11-08 17:27:03.000000000 +0100
+++ head-2011-01-30/drivers/xen/core/smpboot.c	2011-01-31 17:01:49.000000000 +0100
@@ -55,7 +55,6 @@ static char callfunc_name[NR_CPUS][15];
 
 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-2011-01-30.orig/include/linux/mm.h	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/include/linux/mm.h	2011-01-31 17:01:49.000000000 +0100
@@ -222,6 +222,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,
@@ -229,6 +230,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-2011-01-30.orig/include/linux/oprofile.h	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/include/linux/oprofile.h	2011-01-31 17:01:49.000000000 +0100
@@ -17,8 +17,9 @@
 #include <linux/spinlock.h>
 #include <linux/init.h>
 #include <asm/atomic.h>
-
+#ifdef CONFIG_XEN
 #include <xen/interface/xenoprof.h>
+#endif
  
 /* Each escaped entry is prefixed by ESCAPE_CODE
  * then one of the following codes, then the
@@ -56,11 +57,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-2011-01-30.orig/include/linux/page-flags.h	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/include/linux/page-flags.h	2011-01-31 17:01:49.000000000 +0100
@@ -110,7 +110,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,
@@ -351,9 +351,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-2011-01-30.orig/kernel/kexec.c	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/kernel/kexec.c	2011-01-31 17:01:49.000000000 +0100
@@ -40,8 +40,10 @@
 #include <asm/system.h>
 #include <asm/sections.h>
 
+#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];
@@ -1214,6 +1216,7 @@ static void final_note(u32 *buf)
 	memcpy(buf, &note, sizeof(note));
 }
 
+#ifndef CONFIG_XEN
 void crash_save_cpu(struct pt_regs *regs, int cpu)
 {
 	struct elf_prstatus prstatus;
@@ -1239,9 +1242,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) {
@@ -1249,6 +1254,7 @@ static int __init crash_notes_memory_ini
 		" states failed\n");
 		return -ENOMEM;
 	}
+#endif
 	return 0;
 }
 module_init(crash_notes_memory_init)
--- head-2011-01-30.orig/mm/memory.c	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/mm/memory.c	2011-01-31 17:01:49.000000000 +0100
@@ -960,10 +960,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-2011-01-30.orig/mm/mmap.c	2011-01-31 14:53:38.000000000 +0100
+++ head-2011-01-30/mm/mmap.c	2011-01-31 17:01:49.000000000 +0100
@@ -1928,8 +1928,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
 }
 
 /*
@@ -2291,8 +2293,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 */