On 24 January 2017 at 16:58, Alex Bennée <alex.ben...@linaro.org> wrote:
>
> Peter Maydell <peter.mayd...@linaro.org> writes:
>> --- a/target/arm/machine.c
>> +++ b/target/arm/machine.c
>> @@ -96,15 +96,13 @@ static bool m_needed(void *opaque)
>>
>>  static const VMStateDescription vmstate_m = {
>>      .name = "cpu/m",
>> -    .version_id = 1,
>> -    .minimum_version_id = 1,
>> +    .version_id = 2,
>> +    .minimum_version_id = 2,
>>      .needed = m_needed,
>>      .fields = (VMStateField[]) {
>> -        VMSTATE_UINT32(env.v7m.other_sp, ARMCPU),
>>          VMSTATE_UINT32(env.v7m.vecbase, ARMCPU),
>>          VMSTATE_UINT32(env.v7m.basepri, ARMCPU),
>>          VMSTATE_UINT32(env.v7m.control, ARMCPU),
>> -        VMSTATE_INT32(env.v7m.current_sp, ARMCPU),
>>          VMSTATE_INT32(env.v7m.exception, ARMCPU),
>>          VMSTATE_END_OF_LIST()
>>      }
>
> Not that it matters for this but is there a way to add another level of
> indirection to the reading and writing of these fields to keep the same
> migration format?

It's possible. One approach would be to make the fields
versioned, so that if the source doesn't have them they stay
at whatever the CPU's reset values are. Or you could have
them in a separate vmstate subsection with a needed function
that does something clever. But since we don't claim to
support cross-version migration for M profile yet (and I
suspect also that none of our M profile boards have working
migration in all the devices) I took the easy route of
just bumping the version_id on this subfield. (It doesn't
affect migration compat for anything that's not M profile.)

thanks
-- PMM

Reply via email to