[gemini] sync kernel config
[openwrt.git] / target / linux / generic-2.4 / patches / 114-sched_use_tsc.patch
1 --- a/arch/mips/kernel/time.c
2 +++ b/arch/mips/kernel/time.c
3 @@ -151,6 +151,27 @@ void (*mips_timer_ack)(void);
4 unsigned int (*mips_hpt_read)(void);
5 void (*mips_hpt_init)(unsigned int);
6
7 +extern __u32 get_htscl(void)
8 +{
9 + return timerhi;
10 +}
11 +
12 +static __u64 tscll_last = 0;
13 +
14 +extern __u64 get_tscll(void)
15 +{
16 + __u64 h = (__u64) timerhi;
17 + __u32 c = read_c0_count();
18 +
19 + h <<= 32;
20 + h += c;
21 +
22 + while (h < tscll_last)
23 + h += (((__u64) 1) << 32);
24 +
25 + tscll_last = h;
26 + return h;
27 +}
28
29 /*
30 * timeofday services, for syscalls.
31 @@ -761,3 +782,5 @@ EXPORT_SYMBOL(rtc_lock);
32 EXPORT_SYMBOL(to_tm);
33 EXPORT_SYMBOL(rtc_set_time);
34 EXPORT_SYMBOL(rtc_get_time);
35 +EXPORT_SYMBOL(get_htscl);
36 +EXPORT_SYMBOL(get_tscll);
37 --- a/include/asm-mips/timex.h
38 +++ b/include/asm-mips/timex.h
39 @@ -31,6 +31,19 @@ static inline cycles_t get_cycles (void)
40 return read_c0_count();
41 }
42
43 +extern __u32 get_htscl(void);
44 +extern __u64 get_tscll(void);
45 +
46 +#define rdtsc(low, high) \
47 + high = get_htscl(); \
48 + low = read_c0_count();
49 +
50 +#define rdtscl(low) \
51 + low = read_c0_count();
52 +
53 +#define rdtscll(val) \
54 + val = get_tscll();
55 +
56 #define vxtime_lock() do {} while (0)
57 #define vxtime_unlock() do {} while (0)
58
59 --- a/include/net/pkt_sched.h
60 +++ b/include/net/pkt_sched.h
61 @@ -5,7 +5,11 @@
62 #define PSCHED_JIFFIES 2
63 #define PSCHED_CPU 3
64
65 +#ifdef __mips__
66 +#define PSCHED_CLOCK_SOURCE PSCHED_CPU
67 +#else
68 #define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES
69 +#endif
70
71 #include <linux/config.h>
72 #include <linux/types.h>
73 @@ -261,7 +265,7 @@ extern int psched_clock_scale;
74 #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
75 #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
76
77 -#ifdef CONFIG_X86_TSC
78 +#if defined(CONFIG_X86_TSC) || defined(__mips__)
79
80 #define PSCHED_GET_TIME(stamp) \
81 ({ u64 __cur; \
This page took 0.044501 seconds and 5 git commands to generate.