On Fri, 4 Oct 2019 at 12:57, Paolo Bonzini <pbonz...@redhat.com> wrote: > > On 04/10/19 13:48, Peter Maydell wrote: > > must be between matched calls to ptimer_transaction_begin() and > > ptimer_transaction_commit(). When ptimer_transaction_commit() is > > called it will evaluate the state of the timer after all the changes > > in the transaction, and call the callback if necessary. > > Could ptimer_stop/ptimer_run act as the begin and commit functions? > That is, ptimer_set_* can be called only between ptimer_stop and ptimer_run?
No, because stop/run causes the ptimer to "lose time" (we stop the underlying timer and restart it). It's very common for a device to want to change the ptimer properties without a stop/restart -- "set the ptimer count value when the guest writes to the device's counter register" is the common one. Of the three begin/commit blocks in the arm_timer.c conversion, only one of those involves calls to stop/run, and even there we only call stop/run if the write to the control register modified the enable bit. thanks -- PMM