[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] ARM/vgic: Use for_each_set_bit() in vgic_to_sgi()



commit 9429f1a6c4758ae91f3ae721a036f4bbf76fb2b8
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Aug 23 23:25:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Aug 27 18:08:19 2024 +0100

    ARM/vgic: Use for_each_set_bit() in vgic_to_sgi()
    
    The existing expression is just a very complicated way of expressing a loop
    over all bits of target->list.  Simplify the expression.
    
    While here, fix the two gprintk()'s.  Because of a quotes vs line 
continuation
    issue, there's a line of spaces in the middle of the format string.
    
      $ strings xen-syms-arm32 | grep -e VGIC -e GICD_SGIR
      <G><1>%pv VGIC: write r=%08x                         target->list=%hx, 
wrong CPUTargetList
      <G><1>%pv vGICD:unhandled GICD_SGIR write %08x                  with 
wrong mode
    
    not to mention trailing whitespace too.
    
    Rewrite them to be more concise and useful.  Use 0x prefixes for hex, rather
    than being ambiguous, and identify the problem target vCPU / mode, rather 
than
    simply saying something was wrong.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/arch/arm/vgic.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 7b54ccc7cb..8ffe099bcb 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -470,8 +470,7 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum 
gic_sgi_mode irqmode,
     struct domain *d = v->domain;
     int vcpuid;
     int i;
-    unsigned int base;
-    unsigned long int bitmap;
+    unsigned int base, bitmap;
 
     ASSERT( virq < 16 );
 
@@ -481,15 +480,16 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum 
gic_sgi_mode irqmode,
         perfc_incr(vgic_sgi_list);
         base = target->aff1 << 4;
         bitmap = target->list;
-        bitmap_for_each ( i, &bitmap, sizeof(target->list) * 8 )
+
+        for_each_set_bit ( i, bitmap )
         {
             vcpuid = base + i;
             if ( vcpuid >= d->max_vcpus || d->vcpu[vcpuid] == NULL ||
                  !is_vcpu_online(d->vcpu[vcpuid]) )
             {
-                gprintk(XENLOG_WARNING, "VGIC: write r=%"PRIregister" \
-                        target->list=%hx, wrong CPUTargetList \n",
-                        sgir, target->list);
+                gprintk(XENLOG_WARNING,
+                        "vGIC: write %#"PRIregister", target->list=%#x, bad 
target vcpu%d\n",
+                        sgir, target->list, vcpuid);
                 continue;
             }
             vgic_inject_irq(d, d->vcpu[vcpuid], virq, true);
@@ -510,8 +510,8 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum 
gic_sgi_mode irqmode,
         break;
     default:
         gprintk(XENLOG_WARNING,
-                "vGICD:unhandled GICD_SGIR write %"PRIregister" \
-                 with wrong mode\n", sgir);
+                "vGICD: GICD_SGIR write %#"PRIregister" with unhandled mode 
%d\n",
+                sgir, irqmode);
         return false;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.