Skip to content

Commit 89f5e14

Browse files
committed
Merge tag 'timers_urgent_for_v6.11_rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Borislav Petkov: - Remove percpu irq related code in the timer-of initialization routine as it is broken but also unused (Daniel Lezcano) - Fix return -ETIME when delta exceeds INT_MAX and the next event not taking effect sometimes (Jacky Bai) * tag 'timers_urgent_for_v6.11_rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: clocksource/drivers/imx-tpm: Fix next event not taking effect sometime clocksource/drivers/imx-tpm: Fix return -ETIME when delta exceeds INT_MAX clocksource/drivers/timer-of: Remove percpu irq related code
2 parents e203988 + 342123d commit 89f5e14

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

drivers/clocksource/timer-imx-tpm.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,28 @@ static u64 notrace tpm_read_sched_clock(void)
8383
static int tpm_set_next_event(unsigned long delta,
8484
struct clock_event_device *evt)
8585
{
86-
unsigned long next, now;
86+
unsigned long next, prev, now;
8787

88-
next = tpm_read_counter();
89-
next += delta;
88+
prev = tpm_read_counter();
89+
next = prev + delta;
9090
writel(next, timer_base + TPM_C0V);
9191
now = tpm_read_counter();
9292

93+
/*
94+
* Need to wait CNT increase at least 1 cycle to make sure
95+
* the C0V has been updated into HW.
96+
*/
97+
if ((next & 0xffffffff) != readl(timer_base + TPM_C0V))
98+
while (now == tpm_read_counter())
99+
;
100+
93101
/*
94102
* NOTE: We observed in a very small probability, the bus fabric
95103
* contention between GPU and A7 may results a few cycles delay
96104
* of writing CNT registers which may cause the min_delta event got
97105
* missed, so we need add a ETIME check here in case it happened.
98106
*/
99-
return (int)(next - now) <= 0 ? -ETIME : 0;
107+
return (now - prev) >= delta ? -ETIME : 0;
100108
}
101109

102110
static int tpm_set_state_oneshot(struct clock_event_device *evt)

drivers/clocksource/timer-of.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)
2525

2626
struct clock_event_device *clkevt = &to->clkevt;
2727

28-
if (of_irq->percpu)
29-
free_percpu_irq(of_irq->irq, clkevt);
30-
else
31-
free_irq(of_irq->irq, clkevt);
28+
free_irq(of_irq->irq, clkevt);
3229
}
3330

3431
/**
@@ -42,9 +39,6 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)
4239
* - Get interrupt number by name
4340
* - Get interrupt number by index
4441
*
45-
* When the interrupt is per CPU, 'request_percpu_irq()' is called,
46-
* otherwise 'request_irq()' is used.
47-
*
4842
* Returns 0 on success, < 0 otherwise
4943
*/
5044
static __init int timer_of_irq_init(struct device_node *np,
@@ -69,12 +63,9 @@ static __init int timer_of_irq_init(struct device_node *np,
6963
return -EINVAL;
7064
}
7165

72-
ret = of_irq->percpu ?
73-
request_percpu_irq(of_irq->irq, of_irq->handler,
74-
np->full_name, clkevt) :
75-
request_irq(of_irq->irq, of_irq->handler,
76-
of_irq->flags ? of_irq->flags : IRQF_TIMER,
77-
np->full_name, clkevt);
66+
ret = request_irq(of_irq->irq, of_irq->handler,
67+
of_irq->flags ? of_irq->flags : IRQF_TIMER,
68+
np->full_name, clkevt);
7869
if (ret) {
7970
pr_err("Failed to request irq %d for %pOF\n", of_irq->irq, np);
8071
return ret;

drivers/clocksource/timer-of.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
struct of_timer_irq {
1212
int irq;
1313
int index;
14-
int percpu;
1514
const char *name;
1615
unsigned long flags;
1716
irq_handler_t handler;

0 commit comments

Comments
 (0)