Since the LPPTEST driver depends on an x86-PC, make the Kconfig choice
do so as well.
Signed-off-by: Tom Rini <[email protected]>
drivers/char/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6.14/drivers/char/Kconfig
===================================================================
--- linux-2.6.14.orig/drivers/char/Kconfig
+++ linux-2.6.14/drivers/char/Kconfig
@@ -729,7 +729,7 @@ config BLOCKER
config LPPTEST
tristate "Parallel Port Based Latency Measurement Device"
- depends on !PARPORT
+ depends on !PARPORT && X86
default y
---help---
If you say Y here then a device will be created that the userspace
--
Tom
In a few different drivers we had what boiled down to a custom
implementation of get_cycles(). On i386 and ppc32 this was the same
code, and I assume similar for ARM and MIPS. In one case
(kernel/latency.c) it really was get_cycles() in the !i386 case. Always
using get_cycles() makes new platform bringup easier.
Signed-off-by: Tom Rini <[email protected]>
drivers/char/blocker.c | 37 +------------------------------------
drivers/char/lpptest.c | 39 ++-------------------------------------
kernel/latency.c | 35 +++++++++++------------------------
3 files changed, 14 insertions(+), 97 deletions(-)
Index: linux-2.6.14/drivers/char/blocker.c
===================================================================
--- linux-2.6.14.orig/drivers/char/blocker.c
+++ linux-2.6.14/drivers/char/blocker.c
@@ -13,47 +13,12 @@
#define MAX_LOCK_DEPTH 10
-/* this needs to be reconciled with driver/char/lpptest.c
- */
-static inline u64 notrace get_cpu_tick(void)
-{
- u64 tsc;
-#if defined(CONFIG_X86)
- __asm__ __volatile__("rdtsc" : "=A" (tsc));
-#elif defined(CONFIG_PPC)
- unsigned long hi, lo;
-
- do {
- hi = get_tbu();
- lo = get_tbl();
- } while (get_tbu() != hi);
- tsc = (u64)hi << 32 | lo;
-#elif defined(CONFIG_ARM)
- tsc = *oscr;
-#elif defined(CONFIG_MIPS)
-#define read_32bit_cp0_register(source) \
-({ int __res; \
- __asm__ __volatile__( \
- ".set\tpush\n\t" \
- ".set\treorder\n\t" \
- "mfc0\t%0,"STR(source)"\n\t" \
- ".set\tpop" \
- : "=r" (__res)); \
- __res;})
-
- tsc = read_32bit_cp0_register(CP0_COUNT);
-#else
- #error Implement get_cpu_tick()
-#endif
- return tsc;
-}
-
void loop(int loops)
{
int i;
for (i = 0; i < loops; i++)
- get_cpu_tick();
+ get_cycles();
}
static spinlock_t blocker_lock[MAX_LOCK_DEPTH];
Index: linux-2.6.14/drivers/char/lpptest.c
===================================================================
--- linux-2.6.14.orig/drivers/char/lpptest.c
+++ linux-2.6.14/drivers/char/lpptest.c
@@ -40,41 +40,6 @@ static char dev_id[] = "lpptest";
static unsigned char out = 0x5a;
-/* this needs to be reconciled with driver/char/blocker.c
- */
-static inline u64 notrace get_cpu_tick(void)
-{
- u64 tsc;
-#if defined(CONFIG_X86)
- __asm__ __volatile__("rdtsc" : "=A" (tsc));
-#elif defined(CONFIG_PPC)
- unsigned long hi, lo;
-
- do {
- hi = get_tbu();
- lo = get_tbl();
- } while (get_tbu() != hi);
- tsc = (u64)hi << 32 | lo;
-#elif defined(CONFIG_ARM)
- tsc = *oscr;
-#elif defined(CONFIG_MIPS)
-#define read_32bit_cp0_register(source) \
-({ int __res; \
- __asm__ __volatile__( \
- ".set\tpush\n\t" \
- ".set\treorder\n\t" \
- "mfc0\t%0,"STR(source)"\n\t" \
- ".set\tpop" \
- : "=r" (__res)); \
- __res;})
-
- tsc = read_32bit_cp0_register(CP0_COUNT);
-#else
- #error Implement get_cpu_tick()
-#endif
- return tsc;
-}
-
/**
* Interrupt handler. Flip a bit in the reply.
*/
@@ -96,7 +61,7 @@ static cycles_t test_response(void)
in = inb(0x379);
inb(0x378);
outb(0x08, 0x378);
- now = get_cpu_tick();
+ now = get_cycles();
while(1) {
if (inb(0x379) != in)
break;
@@ -107,7 +72,7 @@ static cycles_t test_response(void)
return 0;
}
}
- end = get_cpu_tick();
+ end = get_cycles();
outb(0x00, 0x378);
raw_local_irq_enable();
Index: linux-2.6.14/kernel/latency.c
===================================================================
--- linux-2.6.14.orig/kernel/latency.c
+++ linux-2.6.14/kernel/latency.c
@@ -33,19 +33,6 @@
# endif
#endif
-#ifdef __i386__
-static inline cycles_t cycles(void)
-{
- unsigned long long ret;
-
- rdtscll(ret);
-
- return ret;
-}
-#else
-# define cycles() get_cycles()
-#endif
-
#ifdef CONFIG_WAKEUP_TIMING
struct sch_struct {
raw_spinlock_t trace_lock;
@@ -525,7 +512,7 @@ ____trace(int cpu, enum trace_type type,
again:
idx = tr->trace_idx;
idx_next = idx + 1;
- timestamp = cycles();
+ timestamp = get_cycles();
if (unlikely(trace_freerunning && (idx_next >= MAX_TRACE)))
idx_next = 0;
@@ -1470,7 +1457,7 @@ check_critical_timing(int cpu, struct cp
* as long as possible:
*/
T0 = tr->preempt_timestamp;
- T1 = cycles();
+ T1 = get_cycles();
delta = T1-T0;
raw_local_save_flags(flags);
@@ -1484,7 +1471,7 @@ check_critical_timing(int cpu, struct cp
* might change it (it can only get larger so the latency
* is fair to be reported):
*/
- T2 = cycles();
+ T2 = get_cycles();
if (T2 < T1)
printk("bug: %016Lx < %016Lx!\n", T2, T1);
delta = T2-T0;
@@ -1535,7 +1522,7 @@ check_critical_timing(int cpu, struct cp
printk(" => ended at timestamp %lu: ", t1);
print_symbol("<%s>\n", tr->critical_end);
dump_stack();
- t1 = cycles_to_usecs(cycles());
+ t1 = cycles_to_usecs(get_cycles());
printk(" => dump-end timestamp %lu\n\n", t1);
#endif
@@ -1545,7 +1532,7 @@ check_critical_timing(int cpu, struct cp
out:
tr->critical_sequence = max_sequence;
- tr->preempt_timestamp = cycles();
+ tr->preempt_timestamp = get_cycles();
tr->early_warning = 0;
reset_trace_idx(cpu, tr);
_trace_cmdline(cpu, tr);
@@ -1593,7 +1580,7 @@ __start_critical_timing(unsigned long ei
atomic_inc(&tr->disabled);
tr->critical_sequence = max_sequence;
- tr->preempt_timestamp = cycles();
+ tr->preempt_timestamp = get_cycles();
tr->critical_start = eip;
atomic_set(&tr->overrun, 0);
reset_trace_idx(cpu, tr);
@@ -1843,7 +1830,7 @@ check_wakeup_timing(struct cpu_trace *tr
goto out;
T0 = tr->preempt_timestamp;
- T1 = cycles();
+ T1 = get_cycles();
/*
* maybe preempt_timestamp originated on another CPU,
* with a TSC drift:
@@ -1857,7 +1844,7 @@ check_wakeup_timing(struct cpu_trace *tr
raw_local_save_flags(flags);
____trace(smp_processor_id(), TRACE_FN, tr, CALLER_ADDR0, parent_eip, 0, 0, 0, flags);
- T2 = cycles();
+ T2 = get_cycles();
if (T2 < T1)
printk("bug2: %016Lx < %016Lx!\n", T2, T1);
delta = T2-T0;
@@ -1943,7 +1930,7 @@ void __trace_start_sched_wakeup(struct t
// if (!atomic_read(&tr->disabled)) {
atomic_inc(&tr->disabled);
tr->critical_sequence = max_sequence;
- tr->preempt_timestamp = cycles();
+ tr->preempt_timestamp = get_cycles();
tr->latency_type = WAKEUP_LATENCY;
tr->critical_start = CALLER_ADDR0;
atomic_set(&tr->overrun, 0);
@@ -2053,7 +2040,7 @@ long user_trace_start(void)
reset_trace_idx(cpu, tr);
tr->critical_sequence = max_sequence;
- tr->preempt_timestamp = cycles();
+ tr->preempt_timestamp = get_cycles();
tr->critical_start = CALLER_ADDR0;
atomic_set(&tr->overrun, 0);
_trace_cmdline(cpu, tr);
@@ -2106,7 +2093,7 @@ long user_trace_stop(void)
unsigned long long tmp0;
T0 = tr->preempt_timestamp;
- T1 = cycles();
+ T1 = get_cycles();
tmp0 = preempt_max_latency;
if (T1 < T0)
T0 = T1;
--
Tom
Make the ppc32 bootwrapper code mirror what the ppc64 version does to
clean out locking, etc, from lib/zlib_inflate/
Signed-off-by: Tom Rini <[email protected]>
arch/ppc/boot/lib/Makefile | 48 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 39 insertions(+), 9 deletions(-)
Index: linux-2.6.14/arch/ppc/boot/lib/Makefile
===================================================================
--- linux-2.6.14.orig/arch/ppc/boot/lib/Makefile
+++ linux-2.6.14/arch/ppc/boot/lib/Makefile
@@ -5,19 +5,49 @@
CFLAGS_kbd.o := -Idrivers/char
CFLAGS_vreset.o := -I$(srctree)/arch/ppc/boot/include
-zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
-
-lib-y += $(zlib:.c=.o) div64.o
-lib-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
-
+zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
+zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h
+zliblinuxheader := zlib.h zconf.h zutil.h
+
+$(addprefix $(obj)/,$(zlib)): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
+
+src-boot := div64.S
+src-boot += $(zlib)
+#src-boot := $(addprefix $(obj)/, $(src-boot))
+obj-boot := $(addsuffix .o, $(basename $(src-boot)))
-# zlib files needs header from their original place
-EXTRA_CFLAGS += -Ilib/zlib_inflate
+BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) $(CFLAGS)
quiet_cmd_copy_zlib = COPY $@
- cmd_copy_zlib = cat $< > $@
+ cmd_copy_zlib = sed "s@__attribute_used__@@;[email protected].<linux/module.h>@@;[email protected].<linux/spinlock.h>@@;s@.*spin.*lock.*@@;s@.*SPINLOCK.*@@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
+
+quiet_cmd_copy_zlibheader = COPY $@
+ cmd_copy_zlibheader = sed "s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
+# stddef.h for NULL
+quiet_cmd_copy_zliblinuxheader = COPY $@
+ cmd_copy_zliblinuxheader = sed "[email protected].<linux/string.h>@@;[email protected].<linux/errno.h>@@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
$(call cmd,copy_zlib)
-clean-files := $(zlib)
+$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
+ $(call cmd,copy_zlibheader)
+
+$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
+ $(call cmd,copy_zliblinuxheader)
+
+clean-files := $(zlib) $(zlibheader) $(zliblinuxheader)
+
+quiet_cmd_bootcc = BOOTCC $@
+ cmd_bootcc = $(CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
+
+quiet_cmd_bootas = BOOTAS $@
+ cmd_bootas = $(CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
+
+$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
+ $(call if_changed_dep,bootcc)
+$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
+ $(call if_changed_dep,bootas)
+
+lib-y += $(obj-boot)
+lib-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
--
Tom
* Tom Rini <[email protected]> wrote:
> Since the LPPTEST driver depends on an x86-PC, make the Kconfig choice
> do so as well.
>
> Signed-off-by: Tom Rini <[email protected]>
thanks, applied.
Ingo
* Tom Rini <[email protected]> wrote:
> In a few different drivers we had what boiled down to a custom
> implementation of get_cycles(). On i386 and ppc32 this was the same
> code, and I assume similar for ARM and MIPS. In one case
> (kernel/latency.c) it really was get_cycles() in the !i386 case.
> Always using get_cycles() makes new platform bringup easier.
>
> Signed-off-by: Tom Rini <[email protected]>
thanks, applied.
Ingo
* Tom Rini <[email protected]> wrote:
> Make the ppc32 bootwrapper code mirror what the ppc64 version does to
> clean out locking, etc, from lib/zlib_inflate/
>
> Signed-off-by: Tom Rini <[email protected]>
why is this needed in -rt? Shouldnt this go upstream?
Ingo
On Sat, Nov 12, 2005 at 03:24:28PM +0100, Ingo Molnar wrote:
>
> * Tom Rini <[email protected]> wrote:
>
> > Make the ppc32 bootwrapper code mirror what the ppc64 version does to
> > clean out locking, etc, from lib/zlib_inflate/
> >
> > Signed-off-by: Tom Rini <[email protected]>
>
> why is this needed in -rt? Shouldnt this go upstream?
This is only needed by the 'add spinlocks/etc to zlib_inflate' changes
that aren't in 2.6.14 stock at least, and I don't think will be in
2.6.15-rc1.
The slightly better solution is I need to talk with Matt Mackall about
his zlib changes and how he thinks p*pc* can be done better, but without
duplicating code again.
--
Tom Rini
http://gate.crashing.org/~trini/