clocksource: entend the max_delta_ns of timer-riscv andtimer-clint to ULONG_MAX
Subsystems (2)
RFC PATCH 1/1 clocksource: entend the max_delta_ns of timer-riscv andtimer-clint to ULONG_MAX
From: Vincentc Chen <[email protected]>
When registering the riscv-timer or clint-timer as a clock_event device, the driver needs to specify the value of max_delta_ticks. This value directly influences the max_delta_ns, which signifies the maximum time interval for configuring subsequent clock events. Currently, both riscv-timer and clint-timer are set with a max_delta_ticks value of 0x7fff_ffff. When the timer operates at a high frequency, such as 1GHz, this causes the system only can sleep for a short time. For the 1GHz case, the sleep cannot exceed two seconds. To address this limitation, refer to other timer implementations to extend it to 2^(bit-width of the timer) - 1. Because the bit-width of $mtimecmp is 64bit, so this value becomes ULONG_MAX (0xffff_ffff_ffff_ffff).
--- drivers/clocksource/timer-clint.c | 2 +- drivers/clocksource/timer-riscv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/timer-clint.c +1 -1
@@ -131,7 +131,7 @@ static int clint_timer_starting_cpu(unsigned int cpu)struct clock_event_device *ce =per_cpu_ptr (&clint_clock_event, cpu); ce->cpumask =cpumask_of (cpu); -clockevents_config_and_register (ce, clint_timer_freq,100 ,0x7fffffff ); +clockevents_config_and_register (ce, clint_timer_freq,100 ,ULONG_MAX );enable_percpu_irq (clint_timer_irq,irq_get_trigger_type (clint_timer_irq));
drivers/clocksource/timer-riscv.c +1 -1
@@ -94,7 +94,7 @@ static int riscv_timer_starting_cpu(unsigned int cpu) ce->irq = riscv_clock_event_irq;if (riscv_timer_cannot_wake_cpu) ce->features |=CLOCK_EVT_FEAT_C3STOP ; -clockevents_config_and_register (ce, riscv_timebase,100 ,0x7fffffff ); +clockevents_config_and_register (ce, riscv_timebase,100 ,ULONG_MAX );enable_percpu_irq (riscv_clock_event_irq,irq_get_trigger_type (riscv_clock_event_irq));
Signature · 7 lines
2.34.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Hey Vincent,
Quoted 13 lines · Vincent Chen
From: Vincentc Chen <[email protected]>
When registering the riscv-timer or clint-timer as a
clock_eventdevice, the driver needs to specify the value ofmax_delta_ticks. This value directly influences themax_delta_ns, which signifies the maximum time interval for configuring subsequent clock events. Currently, both riscv-timer and clint-timer are set with amax_delta_ticksvalue of 0x7fff_ffff. When the timer operates at a high frequency, such as 1GHz, this causes the system only can sleep for a short time. For the 1GHz case, the sleep cannot exceed two seconds. To address this limitation, refer to other timer implementations to extend it to 2^(bit-width of the timer) - 1. Because the bit-width of $mtimecmp is 64bit, so this value becomesULONG_MAX(0xffff_ffff_ffff_ffff).
You've marked this as RFC - what is it that you are unsure about that prevents this from being a regular patch?
Thanks,
Conor.
Quoted 41 lines
Signed-off-by Vincentc Chen <[email protected]>--- drivers/clocksource/timer-clint.c | 2 +- drivers/clocksource/timer-riscv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/clocksource/timer-clint.c +1
-1@@ -131,7 +131,7 @@ static int clint_timer_starting_cpu(unsigned int cpu)struct clock_event_device *ce =per_cpu_ptr (&clint_clock_event, cpu); ce->cpumask =cpumask_of (cpu); -clockevents_config_and_register (ce, clint_timer_freq,100 ,0x7fffffff ); +clockevents_config_and_register (ce, clint_timer_freq,100 ,ULONG_MAX );enable_percpu_irq (clint_timer_irq,irq_get_trigger_type (clint_timer_irq));drivers/clocksource/timer-riscv.c +1
-1@@ -94,7 +94,7 @@ static int riscv_timer_starting_cpu(unsigned int cpu) ce->irq = riscv_clock_event_irq;if (riscv_timer_cannot_wake_cpu) ce->features |=CLOCK_EVT_FEAT_C3STOP ; -clockevents_config_and_register (ce, riscv_timebase,100 ,0x7fffffff ); +clockevents_config_and_register (ce, riscv_timebase,100 ,ULONG_MAX );enable_percpu_irq (riscv_clock_event_irq,irq_get_trigger_type (riscv_clock_event_irq));Signature · 7 lines
2.34.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv