Magellan Linux

Contents of /trunk/kernel26-xen/patches-2.6.25-r1/1017-2.6.25-xen-fixup-common.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 609 - (show annotations) (download)
Fri May 23 17:35:37 2008 UTC (16 years ago) by niro
File size: 11109 byte(s)
-using opensuse xen patchset, updated kernel configs

1 Subject: Fix xen build.
2 From: jbeulich@novell.com
3 Patch-mainline: obsolete
4
5 ---
6 drivers/acpi/hardware/hwsleep.c | 2 ++
7 drivers/ide/ide-lib.c | 11 +++++++++++
8 drivers/oprofile/buffer_sync.c | 35 ++++++++++++++++++++++++-----------
9 drivers/oprofile/cpu_buffer.c | 6 ++++++
10 drivers/oprofile/oprof.c | 2 ++
11 drivers/oprofile/oprofile_files.c | 6 ++++++
12 drivers/pci/bus.c | 2 ++
13 drivers/pci/quirks.c | 2 ++
14 include/linux/mm.h | 2 ++
15 include/linux/oprofile.h | 8 +++++---
16 include/linux/page-flags.h | 3 +--
17 kernel/timer.c | 14 ++++++++++----
18 mm/memory.c | 4 ++++
19 13 files changed, 77 insertions(+), 20 deletions(-)
20
21 --- a/drivers/acpi/hardware/hwsleep.c
22 +++ b/drivers/acpi/hardware/hwsleep.c
23 @@ -441,6 +441,7 @@
24 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
25 *
26 ******************************************************************************/
27 +#ifndef CONFIG_XEN
28 acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
29 {
30 u32 in_value;
31 @@ -490,6 +491,7 @@
32 }
33
34 ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
35 +#endif
36
37 /*******************************************************************************
38 *
39 --- a/drivers/ide/ide-lib.c
40 +++ b/drivers/ide/ide-lib.c
41 @@ -336,6 +336,16 @@
42 {
43 u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */
44
45 +#ifndef CONFIG_XEN
46 + if (!PCI_DMA_BUS_IS_PHYS) {
47 + addr = BLK_BOUNCE_ANY;
48 + } else if (on && drive->media == ide_disk) {
49 + struct device *dev = drive->hwif->dev;
50 +
51 + if (dev && dev->dma_mask)
52 + addr = *dev->dma_mask;
53 + }
54 +#else
55 if (on && drive->media == ide_disk) {
56 struct device *dev = drive->hwif->dev;
57
58 @@ -344,6 +354,7 @@
59 else if (dev && dev->dma_mask)
60 addr = *dev->dma_mask;
61 }
62 +#endif
63
64 if (drive->queue)
65 blk_queue_bounce_limit(drive->queue, addr);
66 --- a/drivers/oprofile/buffer_sync.c
67 +++ b/drivers/oprofile/buffer_sync.c
68 @@ -44,7 +44,9 @@
69 static DEFINE_SPINLOCK(task_mortuary);
70 static void process_task_mortuary(void);
71
72 +#ifdef CONFIG_XEN
73 static int cpu_current_domain[NR_CPUS];
74 +#endif
75
76 /* Take ownership of the task struct and place it on the
77 * list for processing. Only after two full buffer syncs
78 @@ -153,11 +155,13 @@
79 int sync_start(void)
80 {
81 int err;
82 +#ifdef CONFIG_XEN
83 int i;
84
85 for (i = 0; i < NR_CPUS; i++) {
86 cpu_current_domain[i] = COORDINATOR_DOMAIN;
87 }
88 +#endif
89
90 start_cpu_work();
91
92 @@ -302,12 +306,14 @@
93 }
94 }
95
96 +#ifdef CONFIG_XEN
97 static void add_domain_switch(unsigned long domain_id)
98 {
99 add_event_entry(ESCAPE_CODE);
100 add_event_entry(DOMAIN_SWITCH_CODE);
101 add_event_entry(domain_id);
102 }
103 +#endif
104
105 static void
106 add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
107 @@ -531,11 +537,14 @@
108
109 add_cpu_switch(cpu);
110
111 +#ifdef CONFIG_XEN
112 /* We need to assign the first samples in this CPU buffer to the
113 same domain that we were processing at the last sync_buffer */
114 if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
115 add_domain_switch(cpu_current_domain[cpu]);
116 }
117 +#endif
118 +
119 /* Remember, only we can modify tail_pos */
120
121 available = get_slots(cpu_buf);
122 @@ -553,8 +562,10 @@
123 } else if (s->event == CPU_TRACE_BEGIN) {
124 state = sb_bt_start;
125 add_trace_begin();
126 +#ifdef CONFIG_XEN
127 } else if (s->event == CPU_DOMAIN_SWITCH) {
128 - domain_switch = 1;
129 + domain_switch = 1;
130 +#endif
131 } else {
132 struct mm_struct * oldmm = mm;
133
134 @@ -568,21 +579,21 @@
135 add_user_ctx_switch(new, cookie);
136 }
137 } else {
138 +#ifdef CONFIG_XEN
139 if (domain_switch) {
140 cpu_current_domain[cpu] = s->eip;
141 add_domain_switch(s->eip);
142 domain_switch = 0;
143 - } else {
144 - if (cpu_current_domain[cpu] !=
145 + } else if (cpu_current_domain[cpu] !=
146 COORDINATOR_DOMAIN) {
147 - add_sample_entry(s->eip, s->event);
148 - }
149 - else if (state >= sb_bt_start &&
150 - !add_sample(mm, s, cpu_mode)) {
151 - if (state == sb_bt_start) {
152 - state = sb_bt_ignore;
153 - atomic_inc(&oprofile_stats.bt_lost_no_mapping);
154 - }
155 + add_sample_entry(s->eip, s->event);
156 + } else
157 +#endif
158 + if (state >= sb_bt_start &&
159 + !add_sample(mm, s, cpu_mode)) {
160 + if (state == sb_bt_start) {
161 + state = sb_bt_ignore;
162 + atomic_inc(&oprofile_stats.bt_lost_no_mapping);
163 }
164 }
165 }
166 @@ -591,10 +602,12 @@
167 }
168 release_mm(mm);
169
170 +#ifdef CONFIG_XEN
171 /* We reset domain to COORDINATOR at each CPU switch */
172 if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
173 add_domain_switch(COORDINATOR_DOMAIN);
174 }
175 +#endif
176
177 mark_done(cpu);
178
179 --- a/drivers/oprofile/cpu_buffer.c
180 +++ b/drivers/oprofile/cpu_buffer.c
181 @@ -38,7 +38,11 @@
182 #define DEFAULT_TIMER_EXPIRE (HZ / 10)
183 static int work_enabled;
184
185 +#ifndef CONFIG_XEN
186 +#define current_domain COORDINATOR_DOMAIN
187 +#else
188 static int32_t current_domain = COORDINATOR_DOMAIN;
189 +#endif
190
191 void free_cpu_buffers(void)
192 {
193 @@ -288,6 +292,7 @@
194 add_sample(cpu_buf, pc, 0);
195 }
196
197 +#ifdef CONFIG_XEN
198 int oprofile_add_domain_switch(int32_t domain_id)
199 {
200 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
201 @@ -306,6 +311,7 @@
202
203 return 1;
204 }
205 +#endif
206
207 /*
208 * This serves to avoid cpu buffer overflow, and makes sure
209 --- a/drivers/oprofile/oprof.c
210 +++ b/drivers/oprofile/oprof.c
211 @@ -37,6 +37,7 @@
212 */
213 static int timer = 0;
214
215 +#ifdef CONFIG_XEN
216 int oprofile_set_active(int active_domains[], unsigned int adomains)
217 {
218 int err;
219 @@ -62,6 +63,7 @@
220 mutex_unlock(&start_mutex);
221 return err;
222 }
223 +#endif
224
225 int oprofile_setup(void)
226 {
227 --- a/drivers/oprofile/oprofile_files.c
228 +++ b/drivers/oprofile/oprofile_files.c
229 @@ -124,6 +124,8 @@
230 .write = dump_write,
231 };
232
233 +#ifdef CONFIG_XEN
234 +
235 #define TMPBUFSIZE 512
236
237 static unsigned int adomains = 0;
238 @@ -313,12 +315,16 @@
239 .write = pdomain_write,
240 };
241
242 +#endif /* CONFIG_XEN */
243 +
244 void oprofile_create_files(struct super_block * sb, struct dentry * root)
245 {
246 oprofilefs_create_file(sb, root, "enable", &enable_fops);
247 oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666);
248 +#ifdef CONFIG_XEN
249 oprofilefs_create_file(sb, root, "active_domains", &active_domain_ops);
250 oprofilefs_create_file(sb, root, "passive_domains", &passive_domain_ops);
251 +#endif
252 oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
253 oprofilefs_create_ulong(sb, root, "buffer_size", &fs_buffer_size);
254 oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
255 --- a/drivers/pci/bus.c
256 +++ b/drivers/pci/bus.c
257 @@ -46,10 +46,12 @@
258
259 type_mask |= IORESOURCE_IO | IORESOURCE_MEM;
260
261 +#ifdef CONFIG_XEN
262 /* If the boot parameter 'pci-mem-align' was specified then we need to
263 align the memory addresses, at page size alignment. */
264 if (pci_mem_align && (align < (PAGE_SIZE-1)))
265 align = PAGE_SIZE - 1;
266 +#endif
267
268 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
269 struct resource *r = bus->resource[i];
270 --- a/drivers/pci/quirks.c
271 +++ b/drivers/pci/quirks.c
272 @@ -24,6 +24,7 @@
273 #include <linux/kallsyms.h>
274 #include "pci.h"
275
276 +#ifdef CONFIG_XEN
277 /* A global flag which signals if we should page-align PCI mem windows. */
278 int pci_mem_align = 0;
279
280 @@ -57,6 +58,7 @@
281 }
282 }
283 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_align_mem_resources);
284 +#endif
285
286 /* The Mellanox Tavor device gives false positive parity errors
287 * Mark this device with a broken_parity_status, to allow
288 --- a/include/linux/mm.h
289 +++ b/include/linux/mm.h
290 @@ -175,10 +175,12 @@
291 /* notification that a previously read-only page is about to become
292 * writable, if an error is returned it will cause a SIGBUS */
293 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
294 +#ifdef CONFIG_XEN
295 /* Area-specific function for clearing the PTE at @ptep. Returns the
296 * original value of @ptep. */
297 pte_t (*zap_pte)(struct vm_area_struct *vma,
298 unsigned long addr, pte_t *ptep, int is_fullmm);
299 +#endif
300 #ifdef CONFIG_NUMA
301 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
302 struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
303 --- a/include/linux/oprofile.h
304 +++ b/include/linux/oprofile.h
305 @@ -16,9 +16,10 @@
306 #include <linux/types.h>
307 #include <linux/spinlock.h>
308 #include <asm/atomic.h>
309 -
310 +#ifdef CONFIG_XEN
311 #include <xen/interface/xenoprof.h>
312 -
313 +#endif
314 +
315 /* Each escaped entry is prefixed by ESCAPE_CODE
316 * then one of the following codes, then the
317 * relevant data.
318 @@ -50,11 +51,12 @@
319 /* create any necessary configuration files in the oprofile fs.
320 * Optional. */
321 int (*create_files)(struct super_block * sb, struct dentry * root);
322 +#ifdef CONFIG_XEN
323 /* setup active domains with Xen */
324 int (*set_active)(int *active_domains, unsigned int adomains);
325 /* setup passive domains with Xen */
326 int (*set_passive)(int *passive_domains, unsigned int pdomains);
327 -
328 +#endif
329 /* Do any necessary interrupt setup. Optional. */
330 int (*setup)(void);
331 /* Do any necessary interrupt shutdown. Optional. */
332 --- a/include/linux/page-flags.h
333 +++ b/include/linux/page-flags.h
334 @@ -88,6 +88,7 @@
335
336 #define PG_mappedtodisk 16 /* Has blocks allocated on-disk */
337 #define PG_reclaim 17 /* To be reclaimed asap */
338 +#define PG_foreign 18 /* Page is owned by foreign allocator. */
339 #define PG_buddy 19 /* Page is free, on buddy lists */
340
341 /* PG_readahead is only used for file reads; PG_reclaim is only for writes */
342 @@ -97,8 +98,6 @@
343 #define PG_checked PG_owner_priv_1 /* Used by some filesystems */
344 #define PG_pinned PG_owner_priv_1 /* Xen pinned pagetable */
345
346 -#define PG_foreign 20 /* Page is owned by foreign allocator. */
347 -
348 #if (BITS_PER_LONG > 32)
349 /*
350 * 64-bit-only flags build down from bit 31
351 --- a/kernel/timer.c
352 +++ b/kernel/timer.c
353 @@ -802,7 +802,7 @@
354 unsigned long get_next_timer_interrupt(unsigned long now)
355 {
356 struct tvec_base *base = __get_cpu_var(tvec_bases);
357 - unsigned long expires, sl_next;
358 + unsigned long expires;
359
360 spin_lock(&base->lock);
361 expires = __next_timer_interrupt(base);
362 @@ -811,11 +811,17 @@
363 if (time_before_eq(expires, now))
364 return now;
365
366 +#ifndef CONFIG_XEN
367 + return cmp_next_hrtimer_event(now, expires);
368 +#else
369 expires = cmp_next_hrtimer_event(now, expires);
370 - sl_next = softlockup_get_next_event();
371 + {
372 + unsigned long sl_next = softlockup_get_next_event();
373
374 - return expires <= now || expires - now < sl_next
375 - ? expires : now + sl_next;
376 + return expires <= now || expires - now < sl_next
377 + ? expires : now + sl_next;
378 + }
379 +#endif
380 }
381
382 #ifdef CONFIG_NO_IDLE_HZ
383 --- a/mm/memory.c
384 +++ b/mm/memory.c
385 @@ -416,7 +416,9 @@
386 * and that the resulting page looks ok.
387 */
388 if (unlikely(!pfn_valid(pfn))) {
389 +#ifdef CONFIG_XEN
390 if (!(vma->vm_flags & VM_RESERVED))
391 +#endif
392 print_bad_pte(vma, pte, addr);
393 return NULL;
394 }
395 @@ -675,10 +677,12 @@
396 page->index > details->last_index))
397 continue;
398 }
399 +#ifdef CONFIG_XEN
400 if (unlikely(vma->vm_ops && vma->vm_ops->zap_pte))
401 ptent = vma->vm_ops->zap_pte(vma, addr, pte,
402 tlb->fullmm);
403 else
404 +#endif
405 ptent = ptep_get_and_clear_full(mm, addr, pte,
406 tlb->fullmm);
407 tlb_remove_tlb_entry(tlb, pte, addr);