|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] ARM/vgic: Use for_each_set_bit() in vgic_mmio_write_sgir()
commit eeb679da8f8d5d96948315ce30e4d750be6a1f51
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Aug 30 14:25:28 2024 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Mar 27 11:54:23 2025 +0000
ARM/vgic: Use for_each_set_bit() in vgic_mmio_write_sgir()
The bitmap_for_each() expression only inspects the bottom 8 bits of targets.
Change it's type to uint8_t and use for_each_set_bit() which is more
efficient
over scalars.
GICD_SGI_TARGET_LIST_MASK is 2 bits wide. Two cases discard the prior
calculation of targets, and one case exits early.
Therefore, move the GICD_SGI_TARGET_MASK calculation into the only case
which
wants it, and use MASK_EXTR() to simplify the expression.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
xen/arch/arm/vgic/vgic-mmio-v2.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/xen/arch/arm/vgic/vgic-mmio-v2.c b/xen/arch/arm/vgic/vgic-mmio-v2.c
index 7d1391ac9b..b7c2d7ce99 100644
--- a/xen/arch/arm/vgic/vgic-mmio-v2.c
+++ b/xen/arch/arm/vgic/vgic-mmio-v2.c
@@ -88,13 +88,12 @@ static void vgic_mmio_write_sgir(struct vcpu *source_vcpu,
struct domain *d = source_vcpu->domain;
unsigned int nr_vcpus = d->max_vcpus;
unsigned int intid = val & GICD_SGI_INTID_MASK;
- unsigned long targets = (val & GICD_SGI_TARGET_MASK) >>
- GICD_SGI_TARGET_SHIFT;
- unsigned int vcpu_id;
+ uint8_t targets = 0;
switch ( val & GICD_SGI_TARGET_LIST_MASK )
{
case GICD_SGI_TARGET_LIST: /* as specified by targets */
+ targets = MASK_EXTR(val, GICD_SGI_TARGET_MASK);
targets &= GENMASK(nr_vcpus - 1, 0); /* limit to existing VCPUs */
break;
case GICD_SGI_TARGET_OTHERS:
@@ -109,7 +108,7 @@ static void vgic_mmio_write_sgir(struct vcpu *source_vcpu,
return;
}
- bitmap_for_each ( vcpu_id, &targets, 8 )
+ for_each_set_bit ( vcpu_id, targets )
{
struct vcpu *vcpu = d->vcpu[vcpu_id];
struct vgic_irq *irq = vgic_get_irq(d, vcpu, intid);
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |