On 20 May 2015 at 08:54, Kevin Wolf <kw...@redhat.com> wrote:
> Am 19.05.2015 um 22:57 hat Peter Maydell geschrieben:
>> Yeah, if there's genuinely an underlying state machine that's
>> not completely visible in registers you need to actually model it.
>> You should probably then model the register bits by calculating
>> them from the state rather than by changing them as you go along
>> in parallel with moving the state machine around.
>
> I think the combination of registers is actually enough to reconstruct
> what state we're in, so it is derived (otherwise I would have fixed a
> bug that I'm not aware of). Adding logic to derive it in a post-load
> handler should be good enough.

That handles migration, which is good. But I still think that
storing the same information in two places in the device
state (phase field and the register fields) is error-prone.
If we want to switch to having a phase field we should calculate
the relevant register bits on demand based on the phase, rather
than keeping both copies of the state in sync manually.

thanks
-- PMM

Reply via email to