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@citrix.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
Andrew Cooper committed 2024-08-27 18:08:19 +01:00
1 parent 8d820e3581
commit 9429f1a6c4
1 file changed
+8 -8
+8 -8
View File
@@ -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;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.