Commit 4b7171ac authored by Eric Auger's avatar Eric Auger Committed by Christoffer Dall

arm/arm64: vgic: turn vgic_find_mmio_region into public

We plan to use vgic_find_mmio_region in vgic-its.c so let's
turn it into a public function.

Also let's take the opportunity to rename the region parameter
into regions to emphasize this latter is an array of regions.
Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
Reviewed-by: default avatarAndre Przywara <andre.przywara@arm.com>
Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Acked-by: default avatarChristoffer Dall <cdall@linaro.org>
parent 9ce91c72
...@@ -446,13 +446,12 @@ static int match_region(const void *key, const void *elt) ...@@ -446,13 +446,12 @@ static int match_region(const void *key, const void *elt)
return 0; return 0;
} }
/* Find the proper register handler entry given a certain address offset. */ const struct vgic_register_region *
static const struct vgic_register_region * vgic_find_mmio_region(const struct vgic_register_region *regions,
vgic_find_mmio_region(const struct vgic_register_region *region, int nr_regions, int nr_regions, unsigned int offset)
unsigned int offset)
{ {
return bsearch((void *)(uintptr_t)offset, region, nr_regions, return bsearch((void *)(uintptr_t)offset, regions, nr_regions,
sizeof(region[0]), match_region); sizeof(regions[0]), match_region);
} }
void vgic_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcr) void vgic_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcr)
......
...@@ -192,4 +192,9 @@ u64 vgic_sanitise_shareability(u64 reg); ...@@ -192,4 +192,9 @@ u64 vgic_sanitise_shareability(u64 reg);
u64 vgic_sanitise_field(u64 reg, u64 field_mask, int field_shift, u64 vgic_sanitise_field(u64 reg, u64 field_mask, int field_shift,
u64 (*sanitise_fn)(u64)); u64 (*sanitise_fn)(u64));
/* Find the proper register handler entry given a certain address offset */
const struct vgic_register_region *
vgic_find_mmio_region(const struct vgic_register_region *regions,
int nr_regions, unsigned int offset);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment