forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers/timer/hpet: Extend qemu workaround
Qemu when running more than one processor has a known synchronization bug where counter values read from the HPET (notionally a single global device) can be seen going "backwards" when read from different CPUs. There was a pre-existing workaround in the ISR that knew about this, but the problem can crop up anywhere the counter value is used. In particular I caught it aliasing with the "max_ticks" computation in z_clock_set_timeout(), where it would cause a rollover and the resulting negative comparator value would result in no end of hilarity. Wrap all access to the counter register with a counter() inline that (when the workaround is enabled) forces the result to be monotonic by clamping it to a minimum of one more than the previously read value. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
- Loading branch information
Showing
1 changed file
with
41 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters