sim: Fix clock_domain unserialization

This patch addresses an issue with the unserialization of clock
domains. Previously, the previous performance level was not restored
due to a bug in the code, which detected the post-unserialize update
as superfluous. This patch splits the setting of the clock domain into
two parts. The original interface of perfLevel is retained, but the
actual update takes place in signalPerfLevelUpdate, which is private
to the class. The perfLevel method checks that if the new performance
level is different to the previous performance level, and will only
call signalPerfLevelUpdate if there is a change. Therefore, the
performance level is only updated, and voltage domains notified, if
there is an actual change. The split functionality allows
signalPerfLevelUpdate to be called by startup() to explicitly force an
update post unserialization.
This commit is contained in:
Sascha Bischoff 2016-04-01 16:22:44 +01:00
parent f948f9fca9
commit ebc9e1d426
2 changed files with 11 additions and 1 deletions

View file

@ -147,6 +147,11 @@ SrcClockDomain::perfLevel(PerfLevel perf_level)
_perfLevel = perf_level;
signalPerfLevelUpdate();
}
void SrcClockDomain::signalPerfLevelUpdate()
{
// Signal the voltage domain that we have changed our perf level so that the
// voltage domain can recompute its performance level
voltageDomain()->sanitiseVoltages();
@ -174,7 +179,7 @@ SrcClockDomain::startup()
{
// Perform proper clock update when all related components have been
// created (i.e. after unserialization / object creation)
perfLevel(_perfLevel);
signalPerfLevelUpdate();
}
SrcClockDomain *

View file

@ -243,6 +243,11 @@ class SrcClockDomain : public ClockDomain
void unserialize(CheckpointIn &cp) override;
private:
/**
* Inform other components about the changed performance level
*/
void signalPerfLevelUpdate();
/**
* List of possible frequency operational points, should be in
* descending order