diff options
author | Eric Auger <eric.auger@redhat.com> | 2018-05-22 09:55:12 +0200 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2018-05-25 12:29:26 +0100 |
commit | ccc27bf5be7b78f64b67902bf27f6ef484bedc2c (patch) | |
tree | 08ea46b5b09d5a5e074ab162fe1b1fdf7a063a6f /virt/kvm/arm/vgic/vgic.h | |
parent | 028bf278d31a0d04b096ebb5340949e9fc9e2010 (diff) | |
download | linux-stable-ccc27bf5be7b78f64b67902bf27f6ef484bedc2c.tar.gz linux-stable-ccc27bf5be7b78f64b67902bf27f6ef484bedc2c.tar.bz2 linux-stable-ccc27bf5be7b78f64b67902bf27f6ef484bedc2c.zip |
KVM: arm/arm64: Helper to register a new redistributor region
We introduce a new helper that creates and inserts a new redistributor
region into the rdist region list. This helper both handles the case
where the redistributor region size is known at registration time
and the legacy case where it is not (eventually depending on the number
of online vcpus). Depending on pfns, we perform all the possible checks
that we can do:
- end of memory crossing
- incorrect alignment of the base address
- collision with distributor region if already defined
- collision with already registered rdist regions
- check of the new index
Rdist regions must be inserted by increasing order of indices. Indices
must be contiguous.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt/kvm/arm/vgic/vgic.h')
-rw-r--r-- | virt/kvm/arm/vgic/vgic.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/virt/kvm/arm/vgic/vgic.h b/virt/kvm/arm/vgic/vgic.h index e9f192660097..1c8af4e4131c 100644 --- a/virt/kvm/arm/vgic/vgic.h +++ b/virt/kvm/arm/vgic/vgic.h @@ -286,6 +286,14 @@ vgic_v3_rd_region_size(struct kvm *kvm, struct vgic_redist_region *rdreg) } bool vgic_v3_rdist_overlap(struct kvm *kvm, gpa_t base, size_t size); +static inline bool vgic_dist_overlap(struct kvm *kvm, gpa_t base, size_t size) +{ + struct vgic_dist *d = &kvm->arch.vgic; + + return (base + size > d->vgic_dist_base) && + (base < d->vgic_dist_base + KVM_VGIC_V3_DIST_SIZE); +} + int vgic_its_resolve_lpi(struct kvm *kvm, struct vgic_its *its, u32 devid, u32 eventid, struct vgic_irq **irq); struct vgic_its *vgic_msi_to_its(struct kvm *kvm, struct kvm_msi *msi); |