]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.xen/xen3-patch-2.6.18
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.xen / xen3-patch-2.6.18
CommitLineData
cc90b958
BS
1From: www.kernel.org
2Subject: Linux 2.6.18
3Patch-mainline: 2.6.18
4
5Automatically created from "patches.kernel.org/patch-2.6.18" by xen-port-patches.py
6
7Acked-by: jbeulich@novell.com
8
00e5a55c
BS
9--- sle11-2009-05-14.orig/arch/x86/Kconfig 2009-02-05 10:20:53.000000000 +0100
10+++ sle11-2009-05-14/arch/x86/Kconfig 2009-04-20 11:36:10.000000000 +0200
cc90b958
BS
11@@ -44,7 +44,6 @@ config GENERIC_LOCKBREAK
12
13 config GENERIC_TIME
14 def_bool y
15- depends on !X86_XEN
16
17 config GENERIC_CMOS_UPDATE
18 def_bool y
00e5a55c
BS
19--- sle11-2009-05-14.orig/arch/x86/kernel/Makefile 2008-12-01 11:14:33.000000000 +0100
20+++ sle11-2009-05-14/arch/x86/kernel/Makefile 2009-04-20 11:36:10.000000000 +0200
cc90b958
BS
21@@ -124,5 +124,5 @@ ifeq ($(CONFIG_X86_64),y)
22 pci-dma_64-$(CONFIG_XEN) += pci-dma_32.o
23 endif
24
25-disabled-obj-$(CONFIG_XEN) := i8259_$(BITS).o reboot.o smpboot_$(BITS).o
26+disabled-obj-$(CONFIG_XEN) := i8253.o i8259_$(BITS).o reboot.o smpboot_$(BITS).o tsc_$(BITS).o
27 %/head_$(BITS).o %/head_$(BITS).s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) :=
00e5a55c
BS
28--- sle11-2009-05-14.orig/arch/x86/kernel/entry_32-xen.S 2009-05-14 11:01:13.000000000 +0200
29+++ sle11-2009-05-14/arch/x86/kernel/entry_32-xen.S 2009-05-14 11:01:46.000000000 +0200
cc90b958
BS
30@@ -388,8 +388,10 @@ ENTRY(sysenter_entry_pv)
31 movl %ebp,12(%esp)
32 movl $__USER_CS,4(%esp)
33 addl $4,%esp
34+ CFI_ADJUST_CFA_OFFSET -4
35 /* +5*4 is SS:ESP,EFLAGS,CS:EIP. +8 is esp0 setting. */
36 pushl (TI_sysenter_return-THREAD_SIZE+8+4*4)(%esp)
37+ CFI_ADJUST_CFA_OFFSET 4
38 /*
39 * Load the potential sixth argument from user stack.
40 * Careful about security.
00e5a55c
BS
41--- sle11-2009-05-14.orig/arch/x86/kernel/setup64-xen.c 2009-05-14 11:01:13.000000000 +0200
42+++ sle11-2009-05-14/arch/x86/kernel/setup64-xen.c 2009-04-20 11:36:10.000000000 +0200
43@@ -363,5 +363,7 @@ void __cpuinit cpu_init (void)
44
45 fpu_init();
46
47- raw_local_save_flags(kernel_eflags);
48+ asm ("pushfq; popq %0" : "=rm" (kernel_eflags));
49+ if (raw_irqs_disabled())
50+ kernel_eflags &= ~X86_EFLAGS_IF;
51 }
52--- sle11-2009-05-14.orig/arch/x86/kernel/time_32-xen.c 2009-03-18 12:51:05.000000000 +0100
53+++ sle11-2009-05-14/arch/x86/kernel/time_32-xen.c 2009-04-20 11:36:10.000000000 +0200
cc90b958
BS
54@@ -76,8 +76,13 @@
55
56 #if defined (__i386__)
57 #include <asm/i8259.h>
58+#include <asm/i8253.h>
59+DEFINE_SPINLOCK(i8253_lock);
60+EXPORT_SYMBOL(i8253_lock);
61 #endif
62
63+#define XEN_SHIFT 22
64+
65 int pit_latch_buggy; /* extern */
66
67 #if defined(__x86_64__)
68@@ -97,10 +102,6 @@ extern unsigned long wall_jiffies;
69 DEFINE_SPINLOCK(rtc_lock);
70 EXPORT_SYMBOL(rtc_lock);
71
72-extern struct init_timer_opts timer_tsc_init;
73-extern struct timer_opts timer_tsc;
74-#define timer_none timer_tsc
75-
76 /* These are peridically updated in shared_info, and then copied here. */
77 struct shadow_time_info {
78 u64 tsc_timestamp; /* TSC at last update of time vals. */
79@@ -229,14 +230,6 @@ static inline u64 scale_delta(u64 delta,
80 return product;
81 }
82
83-#if 0 /* defined (__i386__) */
84-int read_current_timer(unsigned long *timer_val)
85-{
86- rdtscl(*timer_val);
87- return 0;
88-}
89-#endif
90-
91 void init_cpu_khz(void)
92 {
93 u64 __cpu_khz = 1000000ULL << 32;
94@@ -256,6 +249,7 @@ static u64 get_nsec_offset(struct shadow
95 return scale_delta(delta, shadow->tsc_to_nsec_mul, shadow->tsc_shift);
96 }
97
98+#ifdef CONFIG_X86_64
99 static unsigned long get_usec_offset(struct shadow_time_info *shadow)
100 {
101 u64 now, delta;
102@@ -263,6 +257,7 @@ static unsigned long get_usec_offset(str
103 delta = now - shadow->tsc_timestamp;
104 return scale_delta(delta, shadow->tsc_to_usec_mul, shadow->tsc_shift);
105 }
106+#endif
107
108 static void __update_wallclock(time_t sec, long nsec)
109 {
00e5a55c 110@@ -377,6 +372,8 @@ void rtc_cmos_write(unsigned char val, u
cc90b958
BS
111 }
112 EXPORT_SYMBOL(rtc_cmos_write);
113
114+#ifdef CONFIG_X86_64
115+
116 /*
117 * This version of gettimeofday has microsecond resolution
118 * and better than microsecond precision on fast x86 machines with TSC.
00e5a55c 119@@ -512,6 +509,8 @@ int do_settimeofday(struct timespec *tv)
cc90b958
BS
120
121 EXPORT_SYMBOL(do_settimeofday);
122
123+#endif
124+
125 static void sync_xen_wallclock(unsigned long dummy);
126 static DEFINE_TIMER(sync_xen_wallclock_timer, sync_xen_wallclock, 0, 0);
127 static void sync_xen_wallclock(unsigned long dummy)
00e5a55c 128@@ -563,11 +562,15 @@ static int set_rtc_mmss(unsigned long no
cc90b958
BS
129 return retval;
130 }
131
132+#ifdef CONFIG_X86_64
133 /* monotonic_clock(): returns # of nanoseconds passed since time_init()
134 * Note: This function is required to return accurate
135 * time even in the absence of multiple timer ticks.
136 */
137 unsigned long long monotonic_clock(void)
138+#else
139+unsigned long long sched_clock(void)
140+#endif
141 {
142 unsigned int cpu = get_cpu();
143 struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu);
00e5a55c 144@@ -587,9 +590,9 @@ unsigned long long monotonic_clock(void)
cc90b958
BS
145
146 return time;
147 }
148+#ifdef CONFIG_X86_64
149 EXPORT_SYMBOL(monotonic_clock);
150
151-#ifdef __x86_64__
152 unsigned long long sched_clock(void)
153 {
154 return monotonic_clock();
00e5a55c 155@@ -759,6 +762,89 @@ irqreturn_t timer_interrupt(int irq, voi
cc90b958
BS
156 return IRQ_HANDLED;
157 }
158
159+#ifndef CONFIG_X86_64
160+
161+void tsc_init(void)
162+{
163+ init_cpu_khz();
164+ printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
165+ cpu_khz / 1000, cpu_khz % 1000);
166+
167+ use_tsc_delay();
168+}
169+
170+#include <linux/clocksource.h>
171+
172+void mark_tsc_unstable(void)
173+{
174+#ifndef CONFIG_XEN /* XXX Should tell the hypervisor about this fact. */
175+ tsc_unstable = 1;
176+#endif
177+}
178+EXPORT_SYMBOL_GPL(mark_tsc_unstable);
179+
180+static cycle_t xen_clocksource_read(void)
181+{
182+#ifdef CONFIG_SMP
183+ static cycle_t last_ret;
184+#ifndef CONFIG_64BIT
185+ cycle_t last = cmpxchg64(&last_ret, 0, 0);
186+#else
187+ cycle_t last = last_ret;
188+#define cmpxchg64 cmpxchg
189+#endif
190+ cycle_t ret = sched_clock();
191+
192+ if (unlikely((s64)(ret - last) < 0)) {
193+ if (last - ret > permitted_clock_jitter
194+ && printk_ratelimit()) {
195+ unsigned int cpu = get_cpu();
196+ struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu);
197+
198+ printk(KERN_WARNING "clocksource/%u: "
199+ "Time went backwards: "
200+ "ret=%Lx delta=%Ld shadow=%Lx offset=%Lx\n",
201+ cpu, ret, ret - last, shadow->system_timestamp,
202+ get_nsec_offset(shadow));
203+ put_cpu();
204+ }
205+ return last;
206+ }
207+
208+ for (;;) {
209+ cycle_t cur = cmpxchg64(&last_ret, last, ret);
210+
211+ if (cur == last || (s64)(ret - cur) < 0)
212+ return ret;
213+ last = cur;
214+ }
215+#else
216+ return sched_clock();
217+#endif
218+}
219+
220+static struct clocksource clocksource_xen = {
221+ .name = "xen",
222+ .rating = 400,
223+ .read = xen_clocksource_read,
224+ .mask = CLOCKSOURCE_MASK(64),
225+ .mult = 1 << XEN_SHIFT, /* time directly in nanoseconds */
226+ .shift = XEN_SHIFT,
227+ .is_continuous = 1,
228+};
229+
230+static int __init init_xen_clocksource(void)
231+{
232+ clocksource_xen.mult = clocksource_khz2mult(cpu_khz,
233+ clocksource_xen.shift);
234+
235+ return clocksource_register(&clocksource_xen);
236+}
237+
238+module_init(init_xen_clocksource);
239+
240+#endif
241+
242 static void init_missing_ticks_accounting(unsigned int cpu)
243 {
244 struct vcpu_register_runstate_memory_area area;
00e5a55c 245@@ -947,11 +1033,11 @@ void __init time_init(void)
cc90b958
BS
246
247 update_wallclock();
248
249+#ifdef CONFIG_X86_64
250 init_cpu_khz();
251 printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
252 cpu_khz / 1000, cpu_khz % 1000);
253
254-#if defined(__x86_64__)
255 vxtime.mode = VXTIME_TSC;
256 vxtime.quot = (1000000L << 32) / vxtime_hz;
257 vxtime.tsc_quot = (1000L << 32) / cpu_khz;
00e5a55c
BS
258--- sle11-2009-05-14.orig/drivers/oprofile/oprofile_files.c 2009-02-16 16:01:39.000000000 +0100
259+++ sle11-2009-05-14/drivers/oprofile/oprofile_files.c 2009-04-20 11:36:10.000000000 +0200
260@@ -217,7 +217,7 @@ static ssize_t adomain_read(struct file
261 }
262
263
264-static struct file_operations active_domain_ops = {
265+static const struct file_operations active_domain_ops = {
266 .read = adomain_read,
267 .write = adomain_write,
268 };
269@@ -310,7 +310,7 @@ static ssize_t pdomain_read(struct file
270 return retval;
271 }
272
273-static struct file_operations passive_domain_ops = {
274+static const struct file_operations passive_domain_ops = {
275 .read = pdomain_read,
276 .write = pdomain_write,
277 };
278--- sle11-2009-05-14.orig/drivers/xen/blktap/blktap.c 2009-04-20 11:35:40.000000000 +0200
279+++ sle11-2009-05-14/drivers/xen/blktap/blktap.c 2009-04-20 11:36:10.000000000 +0200
280@@ -931,7 +931,7 @@ static int req_increase(void)
281
282 static void mmap_req_del(int mmap)
283 {
284- BUG_ON(!spin_is_locked(&pending_free_lock));
285+ assert_spin_locked(&pending_free_lock);
286
287 kfree(pending_reqs[mmap]);
288 pending_reqs[mmap] = NULL;
289--- sle11-2009-05-14.orig/drivers/xen/core/smpboot.c 2009-05-14 11:01:13.000000000 +0200
290+++ sle11-2009-05-14/drivers/xen/core/smpboot.c 2009-04-28 16:02:07.000000000 +0200
291@@ -48,10 +48,6 @@ cpumask_t cpu_initialized_map;
292 struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
293 EXPORT_SYMBOL(cpu_data);
294
295-#ifdef CONFIG_HOTPLUG_CPU
296-DEFINE_PER_CPU(int, cpu_state) = { 0 };
297-#endif
298-
299 static DEFINE_PER_CPU(int, resched_irq);
300 static DEFINE_PER_CPU(int, callfunc_irq);
301 static char resched_name[NR_CPUS][15];
302--- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/pgtable_64.h 2008-12-15 11:13:45.000000000 +0100
303+++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/pgtable_64.h 2009-04-20 11:36:10.000000000 +0200
304@@ -394,7 +394,6 @@ static inline int pmd_large(pmd_t pte) {
cc90b958
BS
305
306 /*
307 * Level 4 access.
308- * Never use these in the common code.
309 */
310 #define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & PTE_MASK))
311 #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
00e5a55c
BS
312--- sle11-2009-05-14.orig/include/asm-x86/mach-xen/asm/processor_32.h 2009-05-14 11:01:13.000000000 +0200
313+++ sle11-2009-05-14/include/asm-x86/mach-xen/asm/processor_32.h 2009-04-20 11:36:10.000000000 +0200
cc90b958
BS
314@@ -23,7 +23,7 @@
315 #include <xen/interface/physdev.h>
316
317 /* flag for disabling the tsc */
318-extern int tsc_disable;
319+#define tsc_disable 0
320
321 struct desc_struct {
322 unsigned long a,b;
00e5a55c
BS
323--- sle11-2009-05-14.orig/include/asm-x86/thread_info.h 2009-05-14 11:01:13.000000000 +0200
324+++ sle11-2009-05-14/include/asm-x86/thread_info.h 2009-04-20 11:36:10.000000000 +0200
cc90b958
BS
325@@ -142,12 +142,16 @@ struct thread_info {
326 (_TIF_SIGPENDING|_TIF_MCE_NOTIFY|_TIF_NOTIFY_RESUME|_TIF_PERFMON_WORK)
327
328 /* flags to check in __switch_to() */
329+#ifndef CONFIG_XEN
330 #define _TIF_WORK_CTXSW \
331 (_TIF_IO_BITMAP|_TIF_DEBUGCTLMSR|_TIF_DS_AREA_MSR|_TIF_BTS_TRACE_TS| \
00e5a55c 332 _TIF_NOTSC|_TIF_PERFMON_CTXSW)
cc90b958
BS
333
334 #define _TIF_WORK_CTXSW_PREV _TIF_WORK_CTXSW
335 #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
336+#else
337+#define _TIF_WORK_CTXSW _TIF_DEBUG
338+#endif
339
340 #define PREEMPT_ACTIVE 0x10000000
341