]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.xen/xen3-fixup-common
Updated xen patches taken from suse.
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.xen / xen3-fixup-common
1 Subject: Fix xen build.
2 From: jbeulich@novell.com
3 Patch-mainline: obsolete
4
5 --- sle11-2009-02-16.orig/drivers/acpi/hardware/hwsleep.c 2009-02-17 11:19:46.000000000 +0100
6 +++ sle11-2009-02-16/drivers/acpi/hardware/hwsleep.c 2009-02-16 16:01:39.000000000 +0100
7 @@ -430,6 +430,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_stat
8 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
9 *
10 ******************************************************************************/
11 +#ifndef CONFIG_XEN
12 acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
13 {
14 u32 in_value;
15 @@ -479,6 +480,7 @@ acpi_status asmlinkage acpi_enter_sleep_
16 }
17
18 ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
19 +#endif
20
21 /*******************************************************************************
22 *
23 --- sle11-2009-02-16.orig/drivers/base/cpu.c 2008-10-10 00:13:53.000000000 +0200
24 +++ sle11-2009-02-16/drivers/base/cpu.c 2009-02-17 11:26:03.000000000 +0100
25 @@ -78,7 +78,7 @@ static inline void register_cpu_control(
26 }
27 #endif /* CONFIG_HOTPLUG_CPU */
28
29 -#ifdef CONFIG_KEXEC
30 +#if defined(CONFIG_KEXEC) && !defined(CONFIG_XEN)
31 #include <linux/kexec.h>
32
33 static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute *attr,
34 @@ -173,7 +173,7 @@ int __cpuinit register_cpu(struct cpu *c
35 if (!error)
36 register_cpu_under_node(num, cpu_to_node(num));
37
38 -#ifdef CONFIG_KEXEC
39 +#if defined(CONFIG_KEXEC) && !defined(CONFIG_XEN)
40 if (!error)
41 error = sysdev_create_file(&cpu->sysdev, &attr_crash_notes);
42 #endif
43 --- sle11-2009-02-16.orig/drivers/ide/ide-lib.c 2009-02-17 11:19:46.000000000 +0100
44 +++ sle11-2009-02-16/drivers/ide/ide-lib.c 2009-02-16 16:01:39.000000000 +0100
45 @@ -177,6 +177,16 @@ void ide_toggle_bounce(ide_drive_t *driv
46 {
47 u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */
48
49 +#ifndef CONFIG_XEN
50 + if (!PCI_DMA_BUS_IS_PHYS) {
51 + addr = BLK_BOUNCE_ANY;
52 + } else if (on && drive->media == ide_disk) {
53 + struct device *dev = drive->hwif->dev;
54 +
55 + if (dev && dev->dma_mask)
56 + addr = *dev->dma_mask;
57 + }
58 +#else
59 if (on && drive->media == ide_disk) {
60 struct device *dev = drive->hwif->dev;
61
62 @@ -185,6 +195,7 @@ void ide_toggle_bounce(ide_drive_t *driv
63 else if (dev && dev->dma_mask)
64 addr = *dev->dma_mask;
65 }
66 +#endif
67
68 if (drive->queue)
69 blk_queue_bounce_limit(drive->queue, addr);
70 --- sle11-2009-02-16.orig/drivers/oprofile/buffer_sync.c 2009-02-17 11:19:46.000000000 +0100
71 +++ sle11-2009-02-16/drivers/oprofile/buffer_sync.c 2009-02-16 16:01:39.000000000 +0100
72 @@ -44,7 +44,9 @@ static cpumask_t marked_cpus = CPU_MASK_
73 static DEFINE_SPINLOCK(task_mortuary);
74 static void process_task_mortuary(void);
75
76 +#ifdef CONFIG_XEN
77 static int cpu_current_domain[NR_CPUS];
78 +#endif
79
80 /* Take ownership of the task struct and place it on the
81 * list for processing. Only after two full buffer syncs
82 @@ -153,11 +155,13 @@ static void end_sync(void)
83 int sync_start(void)
84 {
85 int err;
86 +#ifdef CONFIG_XEN
87 int i;
88
89 for (i = 0; i < NR_CPUS; i++) {
90 cpu_current_domain[i] = COORDINATOR_DOMAIN;
91 }
92 +#endif
93
94 start_cpu_work();
95
96 @@ -302,12 +306,14 @@ static void add_cpu_mode_switch(unsigned
97 }
98 }
99
100 +#ifdef CONFIG_XEN
101 static void add_domain_switch(unsigned long domain_id)
102 {
103 add_event_entry(ESCAPE_CODE);
104 add_event_entry(DOMAIN_SWITCH_CODE);
105 add_event_entry(domain_id);
106 }
107 +#endif
108
109 static void
110 add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
111 @@ -531,11 +537,14 @@ void sync_buffer(int cpu)
112
113 add_cpu_switch(cpu);
114
115 +#ifdef CONFIG_XEN
116 /* We need to assign the first samples in this CPU buffer to the
117 same domain that we were processing at the last sync_buffer */
118 if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
119 add_domain_switch(cpu_current_domain[cpu]);
120 }
121 +#endif
122 +
123 /* Remember, only we can modify tail_pos */
124
125 available = get_slots(cpu_buf);
126 @@ -553,8 +562,10 @@ void sync_buffer(int cpu)
127 } else if (s->event == CPU_TRACE_BEGIN) {
128 state = sb_bt_start;
129 add_trace_begin();
130 +#ifdef CONFIG_XEN
131 } else if (s->event == CPU_DOMAIN_SWITCH) {
132 - domain_switch = 1;
133 + domain_switch = 1;
134 +#endif
135 } else {
136 struct mm_struct * oldmm = mm;
137
138 @@ -568,21 +579,21 @@ void sync_buffer(int cpu)
139 add_user_ctx_switch(new, cookie);
140 }
141 } else {
142 +#ifdef CONFIG_XEN
143 if (domain_switch) {
144 cpu_current_domain[cpu] = s->eip;
145 add_domain_switch(s->eip);
146 domain_switch = 0;
147 - } else {
148 - if (cpu_current_domain[cpu] !=
149 + } else if (cpu_current_domain[cpu] !=
150 COORDINATOR_DOMAIN) {
151 - add_sample_entry(s->eip, s->event);
152 - }
153 - else if (state >= sb_bt_start &&
154 - !add_sample(mm, s, cpu_mode)) {
155 - if (state == sb_bt_start) {
156 - state = sb_bt_ignore;
157 - atomic_inc(&oprofile_stats.bt_lost_no_mapping);
158 - }
159 + add_sample_entry(s->eip, s->event);
160 + } else
161 +#endif
162 + if (state >= sb_bt_start &&
163 + !add_sample(mm, s, cpu_mode)) {
164 + if (state == sb_bt_start) {
165 + state = sb_bt_ignore;
166 + atomic_inc(&oprofile_stats.bt_lost_no_mapping);
167 }
168 }
169 }
170 @@ -591,10 +602,12 @@ void sync_buffer(int cpu)
171 }
172 release_mm(mm);
173
174 +#ifdef CONFIG_XEN
175 /* We reset domain to COORDINATOR at each CPU switch */
176 if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
177 add_domain_switch(COORDINATOR_DOMAIN);
178 }
179 +#endif
180
181 mark_done(cpu);
182
183 --- sle11-2009-02-16.orig/drivers/oprofile/cpu_buffer.c 2009-02-17 11:19:46.000000000 +0100
184 +++ sle11-2009-02-16/drivers/oprofile/cpu_buffer.c 2009-02-16 16:01:39.000000000 +0100
185 @@ -38,7 +38,11 @@ static void wq_sync_buffer(struct work_s
186 #define DEFAULT_TIMER_EXPIRE (HZ / 10)
187 static int work_enabled;
188
189 +#ifndef CONFIG_XEN
190 +#define current_domain COORDINATOR_DOMAIN
191 +#else
192 static int32_t current_domain = COORDINATOR_DOMAIN;
193 +#endif
194
195 void free_cpu_buffers(void)
196 {
197 @@ -303,6 +307,7 @@ void oprofile_add_trace(unsigned long pc
198 add_sample(cpu_buf, pc, 0);
199 }
200
201 +#ifdef CONFIG_XEN
202 int oprofile_add_domain_switch(int32_t domain_id)
203 {
204 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
205 @@ -321,6 +326,7 @@ int oprofile_add_domain_switch(int32_t d
206
207 return 1;
208 }
209 +#endif
210
211 /*
212 * This serves to avoid cpu buffer overflow, and makes sure
213 --- sle11-2009-02-16.orig/drivers/oprofile/oprof.c 2009-02-17 11:19:46.000000000 +0100
214 +++ sle11-2009-02-16/drivers/oprofile/oprof.c 2009-02-16 16:01:39.000000000 +0100
215 @@ -37,6 +37,7 @@ static DEFINE_MUTEX(start_mutex);
216 */
217 static int timer = 0;
218
219 +#ifdef CONFIG_XEN
220 int oprofile_set_active(int active_domains[], unsigned int adomains)
221 {
222 int err;
223 @@ -62,6 +63,7 @@ int oprofile_set_passive(int passive_dom
224 mutex_unlock(&start_mutex);
225 return err;
226 }
227 +#endif
228
229 int oprofile_setup(void)
230 {
231 --- sle11-2009-02-16.orig/drivers/oprofile/oprofile_files.c 2009-02-17 11:19:46.000000000 +0100
232 +++ sle11-2009-02-16/drivers/oprofile/oprofile_files.c 2009-02-16 16:01:39.000000000 +0100
233 @@ -124,6 +124,8 @@ static const struct file_operations dump
234 .write = dump_write,
235 };
236
237 +#ifdef CONFIG_XEN
238 +
239 #define TMPBUFSIZE 512
240
241 static unsigned int adomains = 0;
242 @@ -313,12 +315,16 @@ static struct file_operations passive_do
243 .write = pdomain_write,
244 };
245
246 +#endif /* CONFIG_XEN */
247 +
248 void oprofile_create_files(struct super_block * sb, struct dentry * root)
249 {
250 oprofilefs_create_file(sb, root, "enable", &enable_fops);
251 oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666);
252 +#ifdef CONFIG_XEN
253 oprofilefs_create_file(sb, root, "active_domains", &active_domain_ops);
254 oprofilefs_create_file(sb, root, "passive_domains", &passive_domain_ops);
255 +#endif
256 oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
257 oprofilefs_create_ulong(sb, root, "buffer_size", &fs_buffer_size);
258 oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
259 --- sle11-2009-02-16.orig/include/linux/mm.h 2009-02-17 11:19:46.000000000 +0100
260 +++ sle11-2009-02-16/include/linux/mm.h 2009-02-16 16:01:39.000000000 +0100
261 @@ -187,10 +187,12 @@ struct vm_operations_struct {
262 int (*access)(struct vm_area_struct *vma, unsigned long addr,
263 void *buf, int len, int write);
264
265 +#ifdef CONFIG_XEN
266 /* Area-specific function for clearing the PTE at @ptep. Returns the
267 * original value of @ptep. */
268 pte_t (*zap_pte)(struct vm_area_struct *vma,
269 unsigned long addr, pte_t *ptep, int is_fullmm);
270 +#endif
271 #ifdef CONFIG_NUMA
272 /*
273 * set_policy() op must add a reference to any non-NULL @new mempolicy
274 --- sle11-2009-02-16.orig/include/linux/oprofile.h 2009-02-17 11:19:46.000000000 +0100
275 +++ sle11-2009-02-16/include/linux/oprofile.h 2009-02-16 16:01:39.000000000 +0100
276 @@ -16,8 +16,9 @@
277 #include <linux/types.h>
278 #include <linux/spinlock.h>
279 #include <asm/atomic.h>
280 -
281 +#ifdef CONFIG_XEN
282 #include <xen/interface/xenoprof.h>
283 +#endif
284
285 /* Each escaped entry is prefixed by ESCAPE_CODE
286 * then one of the following codes, then the
287 @@ -50,11 +51,12 @@ struct oprofile_operations {
288 /* create any necessary configuration files in the oprofile fs.
289 * Optional. */
290 int (*create_files)(struct super_block * sb, struct dentry * root);
291 +#ifdef CONFIG_XEN
292 /* setup active domains with Xen */
293 int (*set_active)(int *active_domains, unsigned int adomains);
294 /* setup passive domains with Xen */
295 int (*set_passive)(int *passive_domains, unsigned int pdomains);
296 -
297 +#endif
298 /* Do any necessary interrupt setup. Optional. */
299 int (*setup)(void);
300 /* Do any necessary interrupt shutdown. Optional. */
301 --- sle11-2009-02-16.orig/kernel/kexec.c 2008-11-25 13:31:12.000000000 +0100
302 +++ sle11-2009-02-16/kernel/kexec.c 2009-02-17 11:27:16.000000000 +0100
303 @@ -44,8 +44,10 @@
304 #include <linux/kdb.h>
305 #endif
306
307 +#ifndef CONFIG_XEN
308 /* Per cpu memory for storing cpu states in case of system crash. */
309 note_buf_t* crash_notes;
310 +#endif
311 int dump_after_notifier;
312
313 /* vmcoreinfo stuff */
314 @@ -1167,6 +1169,7 @@ static void final_note(u32 *buf)
315 memcpy(buf, &note, sizeof(note));
316 }
317
318 +#ifndef CONFIG_XEN
319 void crash_save_cpu(struct pt_regs *regs, int cpu)
320 {
321 struct elf_prstatus prstatus;
322 @@ -1192,6 +1195,7 @@ void crash_save_cpu(struct pt_regs *regs
323 &prstatus, sizeof(prstatus));
324 final_note(buf);
325 }
326 +#endif
327
328 #ifdef CONFIG_SYSCTL
329 static ctl_table dump_after_notifier_table[] = {
330 @@ -1219,6 +1223,7 @@ static ctl_table kexec_sys_table[] = {
331
332 static int __init crash_notes_memory_init(void)
333 {
334 +#ifndef CONFIG_XEN
335 /* Allocate memory for saving cpu registers. */
336 crash_notes = alloc_percpu(note_buf_t);
337 if (!crash_notes) {
338 @@ -1226,6 +1231,7 @@ static int __init crash_notes_memory_ini
339 " states failed\n");
340 return -ENOMEM;
341 }
342 +#endif
343 #ifdef CONFIG_SYSCTL
344 register_sysctl_table(kexec_sys_table);
345 #endif
346 --- sle11-2009-02-16.orig/mm/memory.c 2009-02-17 11:19:46.000000000 +0100
347 +++ sle11-2009-02-16/mm/memory.c 2009-02-16 16:01:39.000000000 +0100
348 @@ -758,10 +758,12 @@ static unsigned long zap_pte_range(struc
349 page->index > details->last_index))
350 continue;
351 }
352 +#ifdef CONFIG_XEN
353 if (unlikely(vma->vm_ops && vma->vm_ops->zap_pte))
354 ptent = vma->vm_ops->zap_pte(vma, addr, pte,
355 tlb->fullmm);
356 else
357 +#endif
358 ptent = ptep_get_and_clear_full(mm, addr, pte,
359 tlb->fullmm);
360 tlb_remove_tlb_entry(tlb, pte, addr);