Skip to content

Commit e3f4329

Browse files
baruchsiachczankel
authored andcommitted
xtensa: ccount based sched_clock
Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Chris Zankel <chris@zankel.net>
1 parent 925f553 commit e3f4329

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

arch/xtensa/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ config XTENSA
1111
select VIRT_TO_BUS
1212
select GENERIC_IRQ_SHOW
1313
select GENERIC_CPU_DEVICES
14+
select GENERIC_SCHED_CLOCK
1415
select MODULES_USE_ELF_RELA
1516
select GENERIC_PCI_IOMAP
1617
select ARCH_WANT_IPC_PARSE_VERSION

arch/xtensa/kernel/time.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/profile.h>
2525
#include <linux/delay.h>
2626
#include <linux/irqdomain.h>
27+
#include <linux/sched_clock.h>
2728

2829
#include <asm/timex.h>
2930
#include <asm/platform.h>
@@ -37,6 +38,11 @@ static cycle_t ccount_read(struct clocksource *cs)
3738
return (cycle_t)get_ccount();
3839
}
3940

41+
static u32 notrace ccount_sched_clock_read(void)
42+
{
43+
return get_ccount();
44+
}
45+
4046
static struct clocksource ccount_clocksource = {
4147
.name = "ccount",
4248
.rating = 200,
@@ -134,6 +140,8 @@ void __init time_init(void)
134140
0xffffffff);
135141
setup_irq(ccount_timer.evt.irq, &timer_irqaction);
136142
ccount_timer.irq_enabled = 1;
143+
144+
setup_sched_clock(ccount_sched_clock_read, 32, ccount_freq);
137145
}
138146

139147
/*

0 commit comments

Comments
 (0)