1

- 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)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmbdaf0ACgkQEsHwGGHe
 VUprQQ//TbFLLlE15VpQXIxjWhU2JgS+XyaIbh96v4yUdMKfLLTRdqlJd53l/v6k
 nJvUGYSxCzJOR3U4qT6wnr8KlNqWVCmk2bLu3gltScw4QjfbrTScii+kj1yRbISH
 OXr1OwIYXqOYwgotLhb+MIrdqdOmXZ3WqoxcoLRaAShK3UF/V/ZCU6nPNA2cbOkR
 H6KMyeiBEmp4KjKjKkOGrvAQyGkoeK2WZ5+yCI0XjDskLyWh2moQ1/nBgkXLarAq
 sFmKBkoMtHAAVGt7ZhY0PgtIySb+esLSUpyNVht/YlQXTd5bl3uNt6vUdnwpYJQv
 JNM1p8sBtx+H6EK7LtyTDA+nE7mxxxKbd4y0EHwTY6JTJdX9dnUnU8IwxNFRhPKG
 rBfWSqi/lsIsGYSmCR1glNUo20X1C7zw8irqugYhgG1n2wNq9khDT1KXEwwMWY0q
 GsuoovfuwUV1Vtv0vPgAVYN25lQAspp6IUB18Eyjv/9zT+t06uUYwwx54e7RzdyY
 Gq/xDiAzCOmyStOvTL1ddHFIACcTj/UXzUHl0CitMU97pnW1YNaFzfyewyx1H2p3
 iMVCYIa+CH2ltai4Wt+xkEMd221EEnGCIPbjC1bR0yDnL7EZ2NHITx3Y4DphEVlM
 baCFuteisKSrjHE9mNLBOKo+hr7UsDkyeYsjaO1oBQ8qdkrWd44=
 =k7C0
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-09-08 10:25:25 -07:00
commit 89f5e14d05
3 changed files with 16 additions and 18 deletions

View File

@ -83,20 +83,28 @@ static u64 notrace tpm_read_sched_clock(void)
static int tpm_set_next_event(unsigned long delta,
struct clock_event_device *evt)
{
unsigned long next, now;
unsigned long next, prev, now;
next = tpm_read_counter();
next += delta;
prev = tpm_read_counter();
next = prev + delta;
writel(next, timer_base + TPM_C0V);
now = tpm_read_counter();
/*
* Need to wait CNT increase at least 1 cycle to make sure
* the C0V has been updated into HW.
*/
if ((next & 0xffffffff) != readl(timer_base + TPM_C0V))
while (now == tpm_read_counter())
;
/*
* NOTE: We observed in a very small probability, the bus fabric
* contention between GPU and A7 may results a few cycles delay
* of writing CNT registers which may cause the min_delta event got
* missed, so we need add a ETIME check here in case it happened.
*/
return (int)(next - now) <= 0 ? -ETIME : 0;
return (now - prev) >= delta ? -ETIME : 0;
}
static int tpm_set_state_oneshot(struct clock_event_device *evt)

View File

@ -25,10 +25,7 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)
struct clock_event_device *clkevt = &to->clkevt;
if (of_irq->percpu)
free_percpu_irq(of_irq->irq, clkevt);
else
free_irq(of_irq->irq, clkevt);
free_irq(of_irq->irq, clkevt);
}
/**
@ -42,9 +39,6 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)
* - Get interrupt number by name
* - Get interrupt number by index
*
* When the interrupt is per CPU, 'request_percpu_irq()' is called,
* otherwise 'request_irq()' is used.
*
* Returns 0 on success, < 0 otherwise
*/
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,
return -EINVAL;
}
ret = of_irq->percpu ?
request_percpu_irq(of_irq->irq, of_irq->handler,
np->full_name, clkevt) :
request_irq(of_irq->irq, of_irq->handler,
of_irq->flags ? of_irq->flags : IRQF_TIMER,
np->full_name, clkevt);
ret = request_irq(of_irq->irq, of_irq->handler,
of_irq->flags ? of_irq->flags : IRQF_TIMER,
np->full_name, clkevt);
if (ret) {
pr_err("Failed to request irq %d for %pOF\n", of_irq->irq, np);
return ret;

View File

@ -11,7 +11,6 @@
struct of_timer_irq {
int irq;
int index;
int percpu;
const char *name;
unsigned long flags;
irq_handler_t handler;