From: Felix Fietkau Date: Tue, 17 Oct 2006 15:05:49 +0000 (+0000) Subject: move sched_use_tsc patch to generic-2.4 X-Git-Tag: reboot~30633 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=52f3d46c78798bc818575ea6011790f04d1086c2;p=openwrt%2Fstaging%2Fpepe2k.git move sched_use_tsc patch to generic-2.4 SVN-Revision: 5187 --- diff --git a/target/linux/ar7-2.4/patches/006-sched_use_tsc.patch b/target/linux/ar7-2.4/patches/006-sched_use_tsc.patch deleted file mode 100644 index 5b64310738..0000000000 --- a/target/linux/ar7-2.4/patches/006-sched_use_tsc.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c ---- linux.old/arch/mips/kernel/time.c 2005-11-14 11:06:38.661262000 +0100 -+++ linux.dev/arch/mips/kernel/time.c 2005-11-15 20:02:50.059676750 +0100 -@@ -151,6 +151,27 @@ - unsigned int (*mips_hpt_read)(void); - void (*mips_hpt_init)(unsigned int); - -+extern __u32 get_htscl(void) -+{ -+ return timerhi; -+} -+ -+static __u64 tscll_last = 0; -+ -+extern __u64 get_tscll(void) -+{ -+ __u64 h = (__u64) timerhi; -+ __u32 c = read_c0_count(); -+ -+ h <<= 32; -+ h += c; -+ -+ while (h < tscll_last) -+ h += (((__u64) 1) << 32); -+ -+ tscll_last = h; -+ return h; -+} - - /* - * timeofday services, for syscalls. -@@ -761,3 +782,5 @@ - EXPORT_SYMBOL(to_tm); - EXPORT_SYMBOL(rtc_set_time); - EXPORT_SYMBOL(rtc_get_time); -+EXPORT_SYMBOL(get_htscl); -+EXPORT_SYMBOL(get_tscll); -diff -urN linux.old/include/asm-mips/timex.h linux.dev/include/asm-mips/timex.h ---- linux.old/include/asm-mips/timex.h 2005-11-14 11:06:38.685263500 +0100 -+++ linux.dev/include/asm-mips/timex.h 2005-11-14 11:02:21.069163500 +0100 -@@ -31,6 +31,19 @@ - return read_c0_count(); - } - -+extern __u32 get_htscl(void); -+extern __u64 get_tscll(void); -+ -+#define rdtsc(low, high) \ -+ high = get_htscl(); \ -+ low = read_c0_count(); -+ -+#define rdtscl(low) \ -+ low = read_c0_count(); -+ -+#define rdtscll(val) \ -+ val = get_tscll(); -+ - #define vxtime_lock() do {} while (0) - #define vxtime_unlock() do {} while (0) - -diff -urN linux.old/include/net/pkt_sched.h linux.dev/include/net/pkt_sched.h ---- linux.old/include/net/pkt_sched.h 2005-11-14 11:06:38.709265000 +0100 -+++ linux.dev/include/net/pkt_sched.h 2005-11-14 11:02:21.069163500 +0100 -@@ -5,7 +5,11 @@ - #define PSCHED_JIFFIES 2 - #define PSCHED_CPU 3 - -+#ifdef __mips__ -+#define PSCHED_CLOCK_SOURCE PSCHED_CPU -+#else - #define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES -+#endif - - #include - #include -@@ -271,7 +275,7 @@ - #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz) - #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz) - --#ifdef CONFIG_X86_TSC -+#if defined(CONFIG_X86_TSC) || defined(__mips__) - - #define PSCHED_GET_TIME(stamp) \ - ({ u64 __cur; \ diff --git a/target/linux/brcm-2.4/patches/007-sched_use_tsc.patch b/target/linux/brcm-2.4/patches/007-sched_use_tsc.patch deleted file mode 100644 index 5b64310738..0000000000 --- a/target/linux/brcm-2.4/patches/007-sched_use_tsc.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c ---- linux.old/arch/mips/kernel/time.c 2005-11-14 11:06:38.661262000 +0100 -+++ linux.dev/arch/mips/kernel/time.c 2005-11-15 20:02:50.059676750 +0100 -@@ -151,6 +151,27 @@ - unsigned int (*mips_hpt_read)(void); - void (*mips_hpt_init)(unsigned int); - -+extern __u32 get_htscl(void) -+{ -+ return timerhi; -+} -+ -+static __u64 tscll_last = 0; -+ -+extern __u64 get_tscll(void) -+{ -+ __u64 h = (__u64) timerhi; -+ __u32 c = read_c0_count(); -+ -+ h <<= 32; -+ h += c; -+ -+ while (h < tscll_last) -+ h += (((__u64) 1) << 32); -+ -+ tscll_last = h; -+ return h; -+} - - /* - * timeofday services, for syscalls. -@@ -761,3 +782,5 @@ - EXPORT_SYMBOL(to_tm); - EXPORT_SYMBOL(rtc_set_time); - EXPORT_SYMBOL(rtc_get_time); -+EXPORT_SYMBOL(get_htscl); -+EXPORT_SYMBOL(get_tscll); -diff -urN linux.old/include/asm-mips/timex.h linux.dev/include/asm-mips/timex.h ---- linux.old/include/asm-mips/timex.h 2005-11-14 11:06:38.685263500 +0100 -+++ linux.dev/include/asm-mips/timex.h 2005-11-14 11:02:21.069163500 +0100 -@@ -31,6 +31,19 @@ - return read_c0_count(); - } - -+extern __u32 get_htscl(void); -+extern __u64 get_tscll(void); -+ -+#define rdtsc(low, high) \ -+ high = get_htscl(); \ -+ low = read_c0_count(); -+ -+#define rdtscl(low) \ -+ low = read_c0_count(); -+ -+#define rdtscll(val) \ -+ val = get_tscll(); -+ - #define vxtime_lock() do {} while (0) - #define vxtime_unlock() do {} while (0) - -diff -urN linux.old/include/net/pkt_sched.h linux.dev/include/net/pkt_sched.h ---- linux.old/include/net/pkt_sched.h 2005-11-14 11:06:38.709265000 +0100 -+++ linux.dev/include/net/pkt_sched.h 2005-11-14 11:02:21.069163500 +0100 -@@ -5,7 +5,11 @@ - #define PSCHED_JIFFIES 2 - #define PSCHED_CPU 3 - -+#ifdef __mips__ -+#define PSCHED_CLOCK_SOURCE PSCHED_CPU -+#else - #define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES -+#endif - - #include - #include -@@ -271,7 +275,7 @@ - #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz) - #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz) - --#ifdef CONFIG_X86_TSC -+#if defined(CONFIG_X86_TSC) || defined(__mips__) - - #define PSCHED_GET_TIME(stamp) \ - ({ u64 __cur; \ diff --git a/target/linux/generic-2.4/patches/114-sched_use_tsc.patch b/target/linux/generic-2.4/patches/114-sched_use_tsc.patch new file mode 100644 index 0000000000..5b64310738 --- /dev/null +++ b/target/linux/generic-2.4/patches/114-sched_use_tsc.patch @@ -0,0 +1,84 @@ +diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c +--- linux.old/arch/mips/kernel/time.c 2005-11-14 11:06:38.661262000 +0100 ++++ linux.dev/arch/mips/kernel/time.c 2005-11-15 20:02:50.059676750 +0100 +@@ -151,6 +151,27 @@ + unsigned int (*mips_hpt_read)(void); + void (*mips_hpt_init)(unsigned int); + ++extern __u32 get_htscl(void) ++{ ++ return timerhi; ++} ++ ++static __u64 tscll_last = 0; ++ ++extern __u64 get_tscll(void) ++{ ++ __u64 h = (__u64) timerhi; ++ __u32 c = read_c0_count(); ++ ++ h <<= 32; ++ h += c; ++ ++ while (h < tscll_last) ++ h += (((__u64) 1) << 32); ++ ++ tscll_last = h; ++ return h; ++} + + /* + * timeofday services, for syscalls. +@@ -761,3 +782,5 @@ + EXPORT_SYMBOL(to_tm); + EXPORT_SYMBOL(rtc_set_time); + EXPORT_SYMBOL(rtc_get_time); ++EXPORT_SYMBOL(get_htscl); ++EXPORT_SYMBOL(get_tscll); +diff -urN linux.old/include/asm-mips/timex.h linux.dev/include/asm-mips/timex.h +--- linux.old/include/asm-mips/timex.h 2005-11-14 11:06:38.685263500 +0100 ++++ linux.dev/include/asm-mips/timex.h 2005-11-14 11:02:21.069163500 +0100 +@@ -31,6 +31,19 @@ + return read_c0_count(); + } + ++extern __u32 get_htscl(void); ++extern __u64 get_tscll(void); ++ ++#define rdtsc(low, high) \ ++ high = get_htscl(); \ ++ low = read_c0_count(); ++ ++#define rdtscl(low) \ ++ low = read_c0_count(); ++ ++#define rdtscll(val) \ ++ val = get_tscll(); ++ + #define vxtime_lock() do {} while (0) + #define vxtime_unlock() do {} while (0) + +diff -urN linux.old/include/net/pkt_sched.h linux.dev/include/net/pkt_sched.h +--- linux.old/include/net/pkt_sched.h 2005-11-14 11:06:38.709265000 +0100 ++++ linux.dev/include/net/pkt_sched.h 2005-11-14 11:02:21.069163500 +0100 +@@ -5,7 +5,11 @@ + #define PSCHED_JIFFIES 2 + #define PSCHED_CPU 3 + ++#ifdef __mips__ ++#define PSCHED_CLOCK_SOURCE PSCHED_CPU ++#else + #define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES ++#endif + + #include + #include +@@ -271,7 +275,7 @@ + #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz) + #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz) + +-#ifdef CONFIG_X86_TSC ++#if defined(CONFIG_X86_TSC) || defined(__mips__) + + #define PSCHED_GET_TIME(stamp) \ + ({ u64 __cur; \