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