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

--- head.orig/drivers/acpi/acpica/hwxfsleep.c	2012-05-08 10:45:52.000000000 +0200
+++ head/drivers/acpi/acpica/hwxfsleep.c	2012-04-10 16:07:17.000000000 +0200
@@ -167,6 +167,7 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_wak
  *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
  *
  ******************************************************************************/
+#ifndef CONFIG_XEN
 acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
 {
 	u32 in_value;
@@ -220,6 +221,7 @@ acpi_status asmlinkage acpi_enter_sleep_
 }
 
 ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
+#endif
 #endif				/* !ACPI_REDUCED_HARDWARE */
 /*******************************************************************************
  *
--- head.orig/drivers/base/cpu.c	2012-05-08 10:45:52.000000000 +0200
+++ head/drivers/base/cpu.c	2012-02-21 11:38:23.000000000 +0100
@@ -108,7 +108,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 device *dev, struct device_attribute *attr,
@@ -256,7 +256,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 = device_create_file(&cpu->dev, &dev_attr_crash_notes);
 #endif
--- head.orig/drivers/ide/ide-lib.c	2011-11-16 17:01:48.000000000 +0100
+++ head/drivers/ide/ide-lib.c	2011-11-17 10:44:59.000000000 +0100
@@ -19,6 +19,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;
 
@@ -27,6 +37,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.orig/drivers/xen/console/console.c	2012-03-22 13:27:48.000000000 +0100
+++ head/drivers/xen/console/console.c	2012-03-22 13:40:44.000000000 +0100
@@ -86,7 +86,6 @@ static int __init xencons_setup(char *st
 {
 	char *q;
 	int n;
-	extern int console_use_vt;
 
 	console_use_vt = 1;
 	if (!strncmp(str, "ttyS", 4)) {
--- head.orig/drivers/xen/core/smpboot.c	2012-04-04 08:57:09.000000000 +0200
+++ head/drivers/xen/core/smpboot.c	2012-01-20 14:38:21.000000000 +0100
@@ -53,7 +53,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.orig/include/linux/mm.h	2012-04-10 15:41:09.000000000 +0200
+++ head/include/linux/mm.h	2012-04-10 16:07:34.000000000 +0200
@@ -228,6 +228,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,
@@ -235,6 +236,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.orig/include/linux/page-flags.h	2012-04-10 15:41:11.000000000 +0200
+++ head/include/linux/page-flags.h	2012-04-10 16:07:40.000000000 +0200
@@ -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,
@@ -339,9 +339,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.orig/kernel/kexec.c	2012-04-10 15:40:13.000000000 +0200
+++ head/kernel/kexec.c	2012-04-10 16:06:52.000000000 +0200
@@ -39,8 +39,10 @@
 #include <asm/io.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];
@@ -1243,6 +1245,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;
@@ -1268,9 +1271,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) {
@@ -1278,6 +1283,7 @@ static int __init crash_notes_memory_ini
 		" states failed\n");
 		return -ENOMEM;
 	}
+#endif
 	return 0;
 }
 module_init(crash_notes_memory_init)
--- head.orig/mm/memory.c	2012-04-10 15:39:45.000000000 +0200
+++ head/mm/memory.c	2012-04-10 16:07:48.000000000 +0200
@@ -1144,10 +1144,12 @@ again:
 				     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.orig/mm/mmap.c	2012-05-08 10:48:15.000000000 +0200
+++ head/mm/mmap.c	2012-05-08 10:48:27.000000000 +0200
@@ -1926,8 +1926,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
 }
 
 /*
@@ -2303,8 +2305,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 */
--- head.orig/mm/tmem-xen.c	2011-05-23 10:40:00.000000000 +0200
+++ head/mm/tmem-xen.c	2011-05-23 11:03:08.000000000 +0200
@@ -7,8 +7,9 @@
 #include <linux/types.h>
 #include <xen/interface/xen.h>
 #include <asm/hypervisor.h>
+#include "tmem.h"
 
-int xen_tmem_op(u32 tmem_cmd, u32 tmem_pool, u64 object, u32 index,
+int xen_tmem_op(u32 tmem_cmd, u32 tmem_pool, struct tmem_oid oid, u32 index,
 	unsigned long gmfn, u32 tmem_offset, u32 pfn_offset, u32 len)
 {
 	struct tmem_op op;
@@ -16,8 +17,8 @@ int xen_tmem_op(u32 tmem_cmd, u32 tmem_p
 
 	op.cmd = tmem_cmd;
 	op.pool_id = tmem_pool;
-	op.u.gen.oid[0] = object;
-        op.u.gen.oid[1] = op.u.gen.oid[2] = 0;
+	BUILD_BUG_ON(sizeof(op.u.gen.oid) != sizeof(oid.oid));
+	memcpy(op.u.gen.oid, oid.oid, sizeof(op.u.gen.oid));
 	op.u.gen.index = index;
 	op.u.gen.tmem_offset = tmem_offset;
 	op.u.gen.pfn_offset = pfn_offset;
@@ -27,15 +28,28 @@ int xen_tmem_op(u32 tmem_cmd, u32 tmem_p
 	return rc;
 }
 
-int xen_tmem_new_pool(uint32_t tmem_cmd, uint64_t uuid_lo,
-	uint64_t uuid_hi, uint32_t flags)
+int xen_tmem_new_pool(uint32_t tmem_cmd, struct tmem_pool_uuid uuid,
+	uint32_t flags)
 {
 	struct tmem_op op;
 	int rc = 0;
 
 	op.cmd = tmem_cmd;
-	op.u.creat.uuid[0] = uuid_lo;
-	op.u.creat.uuid[1] = uuid_hi;
+	op.u.creat.uuid[0] = uuid.lo;
+	op.u.creat.uuid[1] = uuid.hi;
+#ifdef TMEM_SPEC_VERSION
+	switch (flags >> TMEM_POOL_VERSION_SHIFT) {
+	case 0:
+		flags |= TMEM_SPEC_VERSION << TMEM_POOL_VERSION_SHIFT;
+		break;
+	case TMEM_SPEC_VERSION:
+		break;
+	default:
+		WARN(1, "TMEM: Bogus version %u, expecting %u\n",
+		     flags >> TMEM_POOL_VERSION_SHIFT, TMEM_SPEC_VERSION);
+		return -ENOSYS;
+	}
+#endif
 	op.u.creat.flags = flags;
 	rc = HYPERVISOR_tmem_op(&op);
 	return rc;