Skip to content

Commit 4fbbed7

Browse files
committed
Merge tag 'timers-core-2024-01-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner: "Updates for time and clocksources: - A fix for the idle and iowait time accounting vs CPU hotplug. The time is reset on CPU hotplug which makes the accumulated systemwide time jump backwards. - Assorted fixes and improvements for clocksource/event drivers" * tag 'timers-core-2024-01-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: tick-sched: Fix idle and iowait sleeptime accounting vs CPU hotplug clocksource/drivers/ep93xx: Fix error handling during probe clocksource/drivers/cadence-ttc: Fix some kernel-doc warnings clocksource/drivers/timer-ti-dm: Fix make W=n kerneldoc warnings clocksource/timer-riscv: Add riscv_clock_shutdown callback dt-bindings: timer: Add StarFive JH8100 clint dt-bindings: timer: thead,c900-aclint-mtimer: separate mtime and mtimecmp regs
2 parents 7b297a5 + 71fee48 commit 4fbbed7

File tree

7 files changed

+41
-12
lines changed

7 files changed

+41
-12
lines changed

Documentation/devicetree/bindings/timer/sifive,clint.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ properties:
3333
- sifive,fu540-c000-clint # SiFive FU540
3434
- starfive,jh7100-clint # StarFive JH7100
3535
- starfive,jh7110-clint # StarFive JH7110
36+
- starfive,jh8100-clint # StarFive JH8100
3637
- const: sifive,clint0 # SiFive CLINT v0 IP block
3738
- items:
3839
- enum:

Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ properties:
1717
- const: thead,c900-aclint-mtimer
1818

1919
reg:
20-
maxItems: 1
20+
items:
21+
- description: MTIMECMP Registers
22+
23+
reg-names:
24+
items:
25+
- const: mtimecmp
2126

2227
interrupts-extended:
2328
minItems: 1
@@ -28,6 +33,7 @@ additionalProperties: false
2833
required:
2934
- compatible
3035
- reg
36+
- reg-names
3137
- interrupts-extended
3238

3339
examples:
@@ -39,5 +45,6 @@ examples:
3945
<&cpu3intc 7>,
4046
<&cpu4intc 7>;
4147
reg = <0xac000000 0x00010000>;
48+
reg-names = "mtimecmp";
4249
};
4350
...

drivers/clocksource/timer-cadence-ttc.c

+16-6
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
* @base_addr: Base address of timer
7070
* @freq: Timer input clock frequency
7171
* @clk: Associated clock source
72-
* @clk_rate_change_nb Notifier block for clock rate changes
72+
* @clk_rate_change_nb: Notifier block for clock rate changes
7373
*/
7474
struct ttc_timer {
7575
void __iomem *base_addr;
@@ -134,7 +134,7 @@ static void ttc_set_interval(struct ttc_timer *timer,
134134
* @irq: IRQ number of the Timer
135135
* @dev_id: void pointer to the ttc_timer instance
136136
*
137-
* returns: Always IRQ_HANDLED - success
137+
* Returns: Always IRQ_HANDLED - success
138138
**/
139139
static irqreturn_t ttc_clock_event_interrupt(int irq, void *dev_id)
140140
{
@@ -151,8 +151,9 @@ static irqreturn_t ttc_clock_event_interrupt(int irq, void *dev_id)
151151

152152
/**
153153
* __ttc_clocksource_read - Reads the timer counter register
154+
* @cs: &clocksource to read from
154155
*
155-
* returns: Current timer counter register value
156+
* Returns: Current timer counter register value
156157
**/
157158
static u64 __ttc_clocksource_read(struct clocksource *cs)
158159
{
@@ -173,7 +174,7 @@ static u64 notrace ttc_sched_clock_read(void)
173174
* @cycles: Timer interval ticks
174175
* @evt: Address of clock event instance
175176
*
176-
* returns: Always 0 - success
177+
* Returns: Always %0 - success
177178
**/
178179
static int ttc_set_next_event(unsigned long cycles,
179180
struct clock_event_device *evt)
@@ -186,9 +187,12 @@ static int ttc_set_next_event(unsigned long cycles,
186187
}
187188

188189
/**
189-
* ttc_set_{shutdown|oneshot|periodic} - Sets the state of timer
190-
*
190+
* ttc_shutdown - Sets the state of timer
191191
* @evt: Address of clock event instance
192+
*
193+
* Used for shutdown or oneshot.
194+
*
195+
* Returns: Always %0 - success
192196
**/
193197
static int ttc_shutdown(struct clock_event_device *evt)
194198
{
@@ -202,6 +206,12 @@ static int ttc_shutdown(struct clock_event_device *evt)
202206
return 0;
203207
}
204208

209+
/**
210+
* ttc_set_periodic - Sets the state of timer
211+
* @evt: Address of clock event instance
212+
*
213+
* Returns: Always %0 - success
214+
*/
205215
static int ttc_set_periodic(struct clock_event_device *evt)
206216
{
207217
struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt);

drivers/clocksource/timer-ep93xx.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,8 @@ static int __init ep93xx_timer_of_init(struct device_node *np)
155155
ep93xx_tcu = tcu;
156156

157157
irq = irq_of_parse_and_map(np, 0);
158-
if (irq == 0)
159-
irq = -EINVAL;
160-
if (irq < 0) {
158+
if (!irq) {
159+
ret = -EINVAL;
161160
pr_err("EP93XX Timer Can't parse IRQ %d", irq);
162161
goto out_free;
163162
}

drivers/clocksource/timer-riscv.c

+7
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,19 @@ static int riscv_clock_next_event(unsigned long delta,
6161
return 0;
6262
}
6363

64+
static int riscv_clock_shutdown(struct clock_event_device *evt)
65+
{
66+
riscv_clock_event_stop();
67+
return 0;
68+
}
69+
6470
static unsigned int riscv_clock_event_irq;
6571
static DEFINE_PER_CPU(struct clock_event_device, riscv_clock_event) = {
6672
.name = "riscv_timer_clockevent",
6773
.features = CLOCK_EVT_FEAT_ONESHOT,
6874
.rating = 100,
6975
.set_next_event = riscv_clock_next_event,
76+
.set_state_shutdown = riscv_clock_shutdown,
7077
};
7178

7279
/*

drivers/clocksource/timer-ti-dm.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static inline u32 dmtimer_read(struct dmtimer *timer, u32 reg)
183183
* dmtimer_write - write timer registers in posted and non-posted mode
184184
* @timer: timer pointer over which write operation is to perform
185185
* @reg: lowest byte holds the register offset
186-
* @value: data to write into the register
186+
* @val: data to write into the register
187187
*
188188
* The posted mode bit is encoded in reg. Note that in posted mode, the write
189189
* pending bit must be checked. Otherwise a write on a register which has a
@@ -949,7 +949,7 @@ static int omap_dm_timer_set_int_enable(struct omap_dm_timer *cookie,
949949

950950
/**
951951
* omap_dm_timer_set_int_disable - disable timer interrupts
952-
* @timer: pointer to timer handle
952+
* @cookie: pointer to timer cookie
953953
* @mask: bit mask of interrupts to be disabled
954954
*
955955
* Disables the specified timer interrupts for a timer.

kernel/time/tick-sched.c

+5
Original file line numberDiff line numberDiff line change
@@ -1576,13 +1576,18 @@ void tick_setup_sched_timer(void)
15761576
void tick_cancel_sched_timer(int cpu)
15771577
{
15781578
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
1579+
ktime_t idle_sleeptime, iowait_sleeptime;
15791580

15801581
# ifdef CONFIG_HIGH_RES_TIMERS
15811582
if (ts->sched_timer.base)
15821583
hrtimer_cancel(&ts->sched_timer);
15831584
# endif
15841585

1586+
idle_sleeptime = ts->idle_sleeptime;
1587+
iowait_sleeptime = ts->iowait_sleeptime;
15851588
memset(ts, 0, sizeof(*ts));
1589+
ts->idle_sleeptime = idle_sleeptime;
1590+
ts->iowait_sleeptime = iowait_sleeptime;
15861591
}
15871592
#endif
15881593

0 commit comments

Comments
 (0)