Patchwork arm gic saving/loading fix

login
register
mail settings
Submitter Dmitry Koshelev
Date Oct. 17, 2011, 10:48 a.m.
Message ID <CAKUHwZqQa8BQGWEKgysuJmP2mHv-nS6k9+gNb6w3TsSNWSc_GQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/120153/
State New
Headers show

Comments

Dmitry Koshelev - Oct. 17, 2011, 10:48 a.m.
irq_target field saving/loading is in the wrong loop

Signed-off-by: Dmitry Koshelev <karagiozis@gmail.com>
---
 hw/arm_gic.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

         for (j = 0; j < GIC_NIRQ; j++)
@@ -715,6 +712,9 @@ static int gic_load(QEMUFile *f, void *opaque, int
version_id)
         s->priority2[i] = qemu_get_be32(f);
     }
     for (i = 0; i < GIC_NIRQ; i++) {
+#ifndef NVIC
+        s->irq_target[i] = qemu_get_be32(f);
+#endif
         s->irq_state[i].enabled = qemu_get_byte(f);
         s->irq_state[i].pending = qemu_get_byte(f);
         s->irq_state[i].active = qemu_get_byte(f);
Andreas Färber - Oct. 17, 2011, 10:54 a.m.
Am 17.10.2011 12:48, schrieb Dmitry Koshelev:
> irq_target field saving/loading is in the wrong loop
> 
> Signed-off-by: Dmitry Koshelev <karagiozis@gmail.com>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

> ---
>  hw/arm_gic.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/arm_gic.c b/hw/arm_gic.c
> index 8286a28..ba05131 100644
> --- a/hw/arm_gic.c
> +++ b/hw/arm_gic.c
> @@ -662,9 +662,6 @@ static void gic_save(QEMUFile *f, void *opaque)
>      qemu_put_be32(f, s->enabled);
>      for (i = 0; i < NUM_CPU(s); i++) {
>          qemu_put_be32(f, s->cpu_enabled[i]);
> -#ifndef NVIC
> -        qemu_put_be32(f, s->irq_target[i]);
> -#endif
>          for (j = 0; j < 32; j++)
>              qemu_put_be32(f, s->priority1[j][i]);
>          for (j = 0; j < GIC_NIRQ; j++)
> @@ -678,6 +675,9 @@ static void gic_save(QEMUFile *f, void *opaque)
>          qemu_put_be32(f, s->priority2[i]);
>      }
>      for (i = 0; i < GIC_NIRQ; i++) {
> +#ifndef NVIC
> +        qemu_put_be32(f, s->irq_target[i]);
> +#endif
>          qemu_put_byte(f, s->irq_state[i].enabled);
>          qemu_put_byte(f, s->irq_state[i].pending);
>          qemu_put_byte(f, s->irq_state[i].active);
> @@ -699,9 +699,6 @@ static int gic_load(QEMUFile *f, void *opaque, int
> version_id)
>      s->enabled = qemu_get_be32(f);
>      for (i = 0; i < NUM_CPU(s); i++) {
>          s->cpu_enabled[i] = qemu_get_be32(f);
> -#ifndef NVIC
> -        s->irq_target[i] = qemu_get_be32(f);
> -#endif
>          for (j = 0; j < 32; j++)
>              s->priority1[j][i] = qemu_get_be32(f);
>          for (j = 0; j < GIC_NIRQ; j++)
> @@ -715,6 +712,9 @@ static int gic_load(QEMUFile *f, void *opaque, int
> version_id)
>          s->priority2[i] = qemu_get_be32(f);
>      }
>      for (i = 0; i < GIC_NIRQ; i++) {
> +#ifndef NVIC
> +        s->irq_target[i] = qemu_get_be32(f);
> +#endif
>          s->irq_state[i].enabled = qemu_get_byte(f);
>          s->irq_state[i].pending = qemu_get_byte(f);
>          s->irq_state[i].active = qemu_get_byte(f);
Peter Maydell - Oct. 17, 2011, 11:17 a.m.
On 17 October 2011 11:54, Andreas Färber <afaerber@suse.de> wrote:
> Am 17.10.2011 12:48, schrieb Dmitry Koshelev:
>> irq_target field saving/loading is in the wrong loop
>>
>> Signed-off-by: Dmitry Koshelev <karagiozis@gmail.com>
>
> Reviewed-by: Andreas Färber <afaerber@suse.de>

Doesn't it need a vmstate version bump too?

-- PMM

> Andreas
>
>> ---
>>  hw/arm_gic.c |   12 ++++++------
>>  1 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/hw/arm_gic.c b/hw/arm_gic.c
>> index 8286a28..ba05131 100644
>> --- a/hw/arm_gic.c
>> +++ b/hw/arm_gic.c
>> @@ -662,9 +662,6 @@ static void gic_save(QEMUFile *f, void *opaque)
>>      qemu_put_be32(f, s->enabled);
>>      for (i = 0; i < NUM_CPU(s); i++) {
>>          qemu_put_be32(f, s->cpu_enabled[i]);
>> -#ifndef NVIC
>> -        qemu_put_be32(f, s->irq_target[i]);
>> -#endif
>>          for (j = 0; j < 32; j++)
>>              qemu_put_be32(f, s->priority1[j][i]);
>>          for (j = 0; j < GIC_NIRQ; j++)
>> @@ -678,6 +675,9 @@ static void gic_save(QEMUFile *f, void *opaque)
>>          qemu_put_be32(f, s->priority2[i]);
>>      }
>>      for (i = 0; i < GIC_NIRQ; i++) {
>> +#ifndef NVIC
>> +        qemu_put_be32(f, s->irq_target[i]);
>> +#endif
>>          qemu_put_byte(f, s->irq_state[i].enabled);
>>          qemu_put_byte(f, s->irq_state[i].pending);
>>          qemu_put_byte(f, s->irq_state[i].active);
>> @@ -699,9 +699,6 @@ static int gic_load(QEMUFile *f, void *opaque, int
>> version_id)
>>      s->enabled = qemu_get_be32(f);
>>      for (i = 0; i < NUM_CPU(s); i++) {
>>          s->cpu_enabled[i] = qemu_get_be32(f);
>> -#ifndef NVIC
>> -        s->irq_target[i] = qemu_get_be32(f);
>> -#endif
>>          for (j = 0; j < 32; j++)
>>              s->priority1[j][i] = qemu_get_be32(f);
>>          for (j = 0; j < GIC_NIRQ; j++)
>> @@ -715,6 +712,9 @@ static int gic_load(QEMUFile *f, void *opaque, int
>> version_id)
>>          s->priority2[i] = qemu_get_be32(f);
>>      }
>>      for (i = 0; i < GIC_NIRQ; i++) {
>> +#ifndef NVIC
>> +        s->irq_target[i] = qemu_get_be32(f);
>> +#endif
>>          s->irq_state[i].enabled = qemu_get_byte(f);
>>          s->irq_state[i].pending = qemu_get_byte(f);
>>          s->irq_state[i].active = qemu_get_byte(f);
>
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746, AG Nürnberg
>
Andreas Färber - Oct. 17, 2011, 11:31 a.m.
Am 17.10.2011 13:17, schrieb Peter Maydell:
> On 17 October 2011 11:54, Andreas Färber <afaerber@suse.de> wrote:
>> Am 17.10.2011 12:48, schrieb Dmitry Koshelev:
>>> irq_target field saving/loading is in the wrong loop
>>>
>>> Signed-off-by: Dmitry Koshelev <karagiozis@gmail.com>
>>
>> Reviewed-by: Andreas Färber <afaerber@suse.de>
> 
> Doesn't it need a vmstate version bump too?

Sorry, you're right. Still reading my way into savevm code. arm_gic fix
is correct but due to GIC_NIRQ vs. NUM_CPU(), no reordering of the code
can really avoid a version bump here.

Andreas

Patch

diff --git a/hw/arm_gic.c b/hw/arm_gic.c
index 8286a28..ba05131 100644
--- a/hw/arm_gic.c
+++ b/hw/arm_gic.c
@@ -662,9 +662,6 @@  static void gic_save(QEMUFile *f, void *opaque)
     qemu_put_be32(f, s->enabled);
     for (i = 0; i < NUM_CPU(s); i++) {
         qemu_put_be32(f, s->cpu_enabled[i]);
-#ifndef NVIC
-        qemu_put_be32(f, s->irq_target[i]);
-#endif
         for (j = 0; j < 32; j++)
             qemu_put_be32(f, s->priority1[j][i]);
         for (j = 0; j < GIC_NIRQ; j++)
@@ -678,6 +675,9 @@  static void gic_save(QEMUFile *f, void *opaque)
         qemu_put_be32(f, s->priority2[i]);
     }
     for (i = 0; i < GIC_NIRQ; i++) {
+#ifndef NVIC
+        qemu_put_be32(f, s->irq_target[i]);
+#endif
         qemu_put_byte(f, s->irq_state[i].enabled);
         qemu_put_byte(f, s->irq_state[i].pending);
         qemu_put_byte(f, s->irq_state[i].active);
@@ -699,9 +699,6 @@  static int gic_load(QEMUFile *f, void *opaque, int
version_id)
     s->enabled = qemu_get_be32(f);
     for (i = 0; i < NUM_CPU(s); i++) {
         s->cpu_enabled[i] = qemu_get_be32(f);
-#ifndef NVIC
-        s->irq_target[i] = qemu_get_be32(f);
-#endif
         for (j = 0; j < 32; j++)
             s->priority1[j][i] = qemu_get_be32(f);