diff mbox series

[1/2] arm_gicv3_kvm: increase clroffset accordingly

Message ID 1521470177-14760-2-git-send-email-zhaoshenglong@huawei.com
State New
Headers show
Series two fixes for KVM GICv3 dist get/put functions | expand

Commit Message

Shannon Zhao March 19, 2018, 2:36 p.m. UTC
It forgot to increase clroffset during the loop. So it only clear the
first 4 bytes.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
---
 hw/intc/arm_gicv3_kvm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Peter Maydell March 19, 2018, 4:24 p.m. UTC | #1
On 19 March 2018 at 14:36, Shannon Zhao <zhaoshenglong@huawei.com> wrote:
> It forgot to increase clroffset during the loop. So it only clear the
> first 4 bytes.
>
> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
> ---
>  hw/intc/arm_gicv3_kvm.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
> index ec37177..7000716 100644
> --- a/hw/intc/arm_gicv3_kvm.c
> +++ b/hw/intc/arm_gicv3_kvm.c
> @@ -232,9 +232,10 @@ static void kvm_dist_getbmp(GICv3State *s, uint32_t offset, uint32_t *bmp)
>  static void kvm_dist_putbmp(GICv3State *s, uint32_t offset,
>                              uint32_t clroffset, uint32_t *bmp)
>  {
> -    uint32_t reg;
> +    uint32_t reg, clroffset_index;
>      int irq;
>
> +    clroffset_index = clroffset;
>      for_each_dist_irq_reg(irq, s->num_irq, 1) {
>          /* If this bitmap is a set/clear register pair, first write to the
>           * clear-reg to clear all bits before using the set-reg to write
> @@ -242,7 +243,8 @@ static void kvm_dist_putbmp(GICv3State *s, uint32_t offset,
>           */
>          if (clroffset != 0) {
>              reg = 0;
> -            kvm_gicd_access(s, clroffset, &reg, true);
> +            kvm_gicd_access(s, clroffset_index, &reg, true);
> +            clroffset_index += 4;
>          }
>          reg = *gic_bmp_ptr32(bmp, irq);
>          kvm_gicd_access(s, offset, &reg, true);

You might as well just use 'clroffset' directly rather than
creating a new clroffset_index variable, I think.

thanks
-- PMM
diff mbox series

Patch

diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
index ec37177..7000716 100644
--- a/hw/intc/arm_gicv3_kvm.c
+++ b/hw/intc/arm_gicv3_kvm.c
@@ -232,9 +232,10 @@  static void kvm_dist_getbmp(GICv3State *s, uint32_t offset, uint32_t *bmp)
 static void kvm_dist_putbmp(GICv3State *s, uint32_t offset,
                             uint32_t clroffset, uint32_t *bmp)
 {
-    uint32_t reg;
+    uint32_t reg, clroffset_index;
     int irq;
 
+    clroffset_index = clroffset;
     for_each_dist_irq_reg(irq, s->num_irq, 1) {
         /* If this bitmap is a set/clear register pair, first write to the
          * clear-reg to clear all bits before using the set-reg to write
@@ -242,7 +243,8 @@  static void kvm_dist_putbmp(GICv3State *s, uint32_t offset,
          */
         if (clroffset != 0) {
             reg = 0;
-            kvm_gicd_access(s, clroffset, &reg, true);
+            kvm_gicd_access(s, clroffset_index, &reg, true);
+            clroffset_index += 4;
         }
         reg = *gic_bmp_ptr32(bmp, irq);
         kvm_gicd_access(s, offset, &reg, true);