summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell2021-02-19 15:45:35 +0100
committerPeter Maydell2021-03-08 18:20:01 +0100
commite4341623a3b87e7eca87d42b7b88da967cd21c49 (patch)
tree302b7562c81f41d7d93b5d1eadc6986742b2390f /hw
parentclock: Add ClockEvent parameter to callbacks (diff)
downloadqemu-e4341623a3b87e7eca87d42b7b88da967cd21c49.tar.gz
qemu-e4341623a3b87e7eca87d42b7b88da967cd21c49.tar.xz
qemu-e4341623a3b87e7eca87d42b7b88da967cd21c49.zip
clock: Add ClockPreUpdate callback event type
Add a new callback event type ClockPreUpdate, which is called on period changes before the period is updated. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Luc Michel <luc@lmichel.fr> Reviewed-by: Hao Wu <wuhaotsh@google.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20210219144617.4782-3-peter.maydell@linaro.org
Diffstat (limited to 'hw')
-rw-r--r--hw/core/clock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/core/clock.c b/hw/core/clock.c
index 4479eff145..fc5a99683f 100644
--- a/hw/core/clock.c
+++ b/hw/core/clock.c
@@ -81,6 +81,9 @@ static void clock_propagate_period(Clock *clk, bool call_callbacks)
QLIST_FOREACH(child, &clk->children, sibling) {
if (child->period != clk->period) {
+ if (call_callbacks) {
+ clock_call_callback(child, ClockPreUpdate);
+ }
child->period = clk->period;
trace_clock_update(CLOCK_PATH(child), CLOCK_PATH(clk),
CLOCK_PERIOD_TO_HZ(clk->period),