5 Automatically created from "patches.kernel.org/patch-2.6.18" by xen-port-patches.py
7 Acked-by: jbeulich@novell.com
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
19 config GENERIC_CMOS_UPDATE
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
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)
38 movl $__USER_CS,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
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
53 #if defined (__i386__)
54 #include <asm/i8259.h>
55 +#include <asm/i8253.h>
56 +DEFINE_SPINLOCK(i8253_lock);
57 +EXPORT_SYMBOL(i8253_lock);
62 int pit_latch_buggy; /* extern */
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);
69 -extern struct init_timer_opts timer_tsc_init;
70 -extern struct timer_opts timer_tsc;
71 -#define timer_none timer_tsc
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,
80 -#if 0 /* defined (__i386__) */
81 -int read_current_timer(unsigned long *timer_val)
88 void init_cpu_khz(void)
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);
96 static unsigned long get_usec_offset(struct shadow_time_info *shadow)
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);
105 static void __update_wallclock(time_t sec, long nsec)
107 @@ -379,6 +374,8 @@ void rtc_cmos_write(unsigned char val, u
109 EXPORT_SYMBOL(rtc_cmos_write);
111 +#ifdef CONFIG_X86_64
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)
118 EXPORT_SYMBOL(do_settimeofday);
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
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.
134 unsigned long long monotonic_clock(void)
136 +unsigned long long sched_clock(void)
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)
145 +#ifdef CONFIG_X86_64
146 EXPORT_SYMBOL(monotonic_clock);
149 unsigned long long sched_clock(void)
151 return monotonic_clock();
152 @@ -760,6 +763,89 @@ irqreturn_t timer_interrupt(int irq, voi
156 +#ifndef CONFIG_X86_64
161 + printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
162 + cpu_khz / 1000, cpu_khz % 1000);
167 +#include <linux/clocksource.h>
169 +void mark_tsc_unstable(void)
171 +#ifndef CONFIG_XEN /* XXX Should tell the hypervisor about this fact. */
175 +EXPORT_SYMBOL_GPL(mark_tsc_unstable);
177 +static cycle_t xen_clocksource_read(void)
180 + static cycle_t last_ret;
181 +#ifndef CONFIG_64BIT
182 + cycle_t last = cmpxchg64(&last_ret, 0, 0);
184 + cycle_t last = last_ret;
185 +#define cmpxchg64 cmpxchg
187 + cycle_t ret = sched_clock();
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);
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));
206 + cycle_t cur = cmpxchg64(&last_ret, last, ret);
208 + if (cur == last || (s64)(ret - cur) < 0)
213 + return sched_clock();
217 +static struct clocksource clocksource_xen = {
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,
227 +static int __init init_xen_clocksource(void)
229 + clocksource_xen.mult = clocksource_khz2mult(cpu_khz,
230 + clocksource_xen.shift);
232 + return clocksource_register(&clocksource_xen);
235 +module_init(init_xen_clocksource);
239 static void init_missing_ticks_accounting(unsigned int cpu)
241 struct vcpu_register_runstate_memory_area area;
242 @@ -948,11 +1034,11 @@ void __init time_init(void)
246 +#ifdef CONFIG_X86_64
248 printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
249 cpu_khz / 1000, cpu_khz % 1000);
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) {
263 - * Never use these in the common code.
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
272 #include <xen/interface/physdev.h>
274 /* flag for disabling the tsc */
275 -extern int tsc_disable;
276 +#define tsc_disable 0
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)
287 /* flags to check in __switch_to() */
289 #define _TIF_WORK_CTXSW \
290 (_TIF_IO_BITMAP|_TIF_DEBUGCTLMSR|_TIF_DS_AREA_MSR|_TIF_BTS_TRACE_TS| \
293 #define _TIF_WORK_CTXSW_PREV _TIF_WORK_CTXSW
294 #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
296 +#define _TIF_WORK_CTXSW _TIF_DEBUG
299 #define PREEMPT_ACTIVE 0x10000000
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)
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;