A bug of ptimer that the freq can't set more than 1000M
The ptimer is in the qemu/hw/core/ptimer.c
If we set freq more than 1000M,like this:
ptimer_set_freq(my_timer, 2000000000000ULL); //freq=2000M
the ptimer won't work, if we use ptimer_run(my_timer, 0). because s->period is zero in the function(ptimer_set_freq) but the period_frac is not zero, so can the function named ptimer_run be modified like this ?
/* when freq > 1000M, period = 0, but period_frac!=0 */
if (was_disabled && s->period == 0 && s->period_frac == 0) {
if (!qtest_enabled()) {
fprintf(stderr, "Timer with period zero, disabling\n");
}
return;
}
and can the function named ptimer_reload be modified like this ?
/* when freq > 1000M, period = 0, but period_frac!=0 */
if (s->period == 0 && s->period_frac == 0) {
if (!qtest_enabled()) {
fprintf(stderr, "Timer with period zero, disabling\n");
}
timer_del(s->timer);
s->enabled = 0;
return;
}
I just add a judgement condition of the two function(ptimer_run() and ptimer_reload()), then the ptimer can work, even the freq set more than 1000M.
Am I right?
Edited by 岳jianzhou