diff mbox

[3/4] target-ppc: add CPU access_type into the migration stream

Message ID 1452104533-8516-4-git-send-email-mark.cave-ayland@ilande.co.uk
State New
Headers show

Commit Message

Mark Cave-Ayland Jan. 6, 2016, 6:22 p.m. UTC
This is referenced in cpu_ppc_handle_mmu_fault() and so should be included
in the migration stream.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 target-ppc/machine.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexey Kardashevskiy Jan. 8, 2016, 2:29 a.m. UTC | #1
On 01/07/2016 05:22 AM, Mark Cave-Ayland wrote:
> This is referenced in cpu_ppc_handle_mmu_fault() and so should be included
> in the migration stream.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>   target-ppc/machine.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target-ppc/machine.c b/target-ppc/machine.c
> index 322ce84..cb56423 100644
> --- a/target-ppc/machine.c
> +++ b/target-ppc/machine.c
> @@ -530,7 +530,7 @@ const VMStateDescription vmstate_ppc_cpu = {
>
>           /* Internal state */
>           VMSTATE_UINTTL(env.hflags_nmsr, PowerPCCPU),
> -        /* FIXME: access_type? */
> +        VMSTATE_INT32(env.access_type, PowerPCCPU),


VMSTATE_INT32_V and you need to change access_type's type from "int" to 
"int32_t" (or better use "uint8_t" as it is a simple enum with 3 possible 
values).


>
>           /* Interrupt state */
>           VMSTATE_UINT32(env.pending_interrupts, PowerPCCPU),
>
Alexander Graf Jan. 25, 2016, 7:03 p.m. UTC | #2
On 01/08/2016 03:29 AM, Alexey Kardashevskiy wrote:
> On 01/07/2016 05:22 AM, Mark Cave-Ayland wrote:
>> This is referenced in cpu_ppc_handle_mmu_fault() and so should be 
>> included
>> in the migration stream.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>>   target-ppc/machine.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/target-ppc/machine.c b/target-ppc/machine.c
>> index 322ce84..cb56423 100644
>> --- a/target-ppc/machine.c
>> +++ b/target-ppc/machine.c
>> @@ -530,7 +530,7 @@ const VMStateDescription vmstate_ppc_cpu = {
>>
>>           /* Internal state */
>>           VMSTATE_UINTTL(env.hflags_nmsr, PowerPCCPU),
>> -        /* FIXME: access_type? */
>> +        VMSTATE_INT32(env.access_type, PowerPCCPU),
>
>
> VMSTATE_INT32_V and you need to change access_type's type from "int" 
> to "int32_t" (or better use "uint8_t" as it is a simple enum with 3 
> possible values).

I don't think uint8_t is going to be safe, since vmstate works with 
pointers internally and the cast would only migrate the first *byte* of 
the value (so the highest byte on BE).


Alex
Alexey Kardashevskiy Jan. 27, 2016, 1:10 a.m. UTC | #3
On 01/26/2016 06:03 AM, Alexander Graf wrote:
>
>
> On 01/08/2016 03:29 AM, Alexey Kardashevskiy wrote:
>> On 01/07/2016 05:22 AM, Mark Cave-Ayland wrote:
>>> This is referenced in cpu_ppc_handle_mmu_fault() and so should be included
>>> in the migration stream.
>>>
>>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>> ---
>>>   target-ppc/machine.c |    2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/target-ppc/machine.c b/target-ppc/machine.c
>>> index 322ce84..cb56423 100644
>>> --- a/target-ppc/machine.c
>>> +++ b/target-ppc/machine.c
>>> @@ -530,7 +530,7 @@ const VMStateDescription vmstate_ppc_cpu = {
>>>
>>>           /* Internal state */
>>>           VMSTATE_UINTTL(env.hflags_nmsr, PowerPCCPU),
>>> -        /* FIXME: access_type? */
>>> +        VMSTATE_INT32(env.access_type, PowerPCCPU),
>>
>>
>> VMSTATE_INT32_V and you need to change access_type's type from "int" to
>> "int32_t" (or better use "uint8_t" as it is a simple enum with 3 possible
>> values).
>
> I don't think uint8_t is going to be safe, since vmstate works with
> pointers internally and the cast would only migrate the first *byte* of the
> value (so the highest byte on BE).

I meant that both env.access_type _and_ VMSTATE_INT32 should be changed to 
uint8_t and VMSTATE_UINT8.
diff mbox

Patch

diff --git a/target-ppc/machine.c b/target-ppc/machine.c
index 322ce84..cb56423 100644
--- a/target-ppc/machine.c
+++ b/target-ppc/machine.c
@@ -530,7 +530,7 @@  const VMStateDescription vmstate_ppc_cpu = {
 
         /* Internal state */
         VMSTATE_UINTTL(env.hflags_nmsr, PowerPCCPU),
-        /* FIXME: access_type? */
+        VMSTATE_INT32(env.access_type, PowerPCCPU),
 
         /* Interrupt state */
         VMSTATE_UINT32(env.pending_interrupts, PowerPCCPU),