Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

openrisc: start CPU timer early in boot

In order to measure the boot process, the timer should be switched on as
early in boot as possible. As well, the commit defines the get_cycles
macro, like the previous patches in this series, so that generic code is
aware that it's implemented by the platform, as is done on other archs.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Acked-by: Stafford Horne <shorne@gmail.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

+10
+1
arch/openrisc/include/asm/timex.h
··· 23 23 { 24 24 return mfspr(SPR_TTCR); 25 25 } 26 + #define get_cycles get_cycles 26 27 27 28 /* This isn't really used any more */ 28 29 #define CLOCK_TICK_RATE 1000
+9
arch/openrisc/kernel/head.S
··· 521 521 l.ori r3,r0,0x1 522 522 l.mtspr r0,r3,SPR_SR 523 523 524 + /* 525 + * Start the TTCR as early as possible, so that the RNG can make use of 526 + * measurements of boot time from the earliest opportunity. Especially 527 + * important is that the TTCR does not return zero by the time we reach 528 + * rand_initialize(). 529 + */ 530 + l.movhi r3,hi(SPR_TTMR_CR) 531 + l.mtspr r0,r3,SPR_TTMR 532 + 524 533 CLEAR_GPR(r1) 525 534 CLEAR_GPR(r2) 526 535 CLEAR_GPR(r3)