lkml.org 
[lkml]   [2018]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 06/12] KVM: arm/arm64: Helper to detect whether an RDIST is the last one
Date
The TYPER of an redistributor needs to reflect whether the rdist is
the last one of the redistributor region. With a single region we compared
the vcpu id against the number of online vcpus. With multiple regions,
we also need to check the region is not full.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
virt/kvm/arm/vgic/vgic-mmio-v3.c | 3 +--
virt/kvm/arm/vgic/vgic.h | 9 +++++++++
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c
index 227b8b6..5768034 100644
--- a/virt/kvm/arm/vgic/vgic-mmio-v3.c
+++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c
@@ -637,8 +637,7 @@ int vgic_register_redist_iodev(struct kvm_vcpu *vcpu)
}

rdreg->free_pfn_offset += 2;
- vgic_cpu->rdist_last =
- (vcpu->vcpu_id == atomic_read(&vcpu->kvm->online_vcpus) - 1);
+ vgic_cpu->rdist_last = vgic_v3_last_rdist(vcpu, rdreg);
out:
mutex_unlock(&kvm->slots_lock);
return ret;
diff --git a/virt/kvm/arm/vgic/vgic.h b/virt/kvm/arm/vgic/vgic.h
index 38b2406..04456d3 100644
--- a/virt/kvm/arm/vgic/vgic.h
+++ b/virt/kvm/arm/vgic/vgic.h
@@ -254,6 +254,15 @@ vgic_v3_redist_region_full(struct vgic_redist_region *region)
return (region->free_pfn_offset > region->pfns - 2);
}

+static inline bool
+vgic_v3_last_rdist(struct kvm_vcpu *vcpu, struct vgic_redist_region *region)
+{
+ if (vcpu->vcpu_id == atomic_read(&vcpu->kvm->online_vcpus) - 1)
+ return true;
+
+ return vgic_v3_redist_region_full(region);
+}
+
struct vgic_redist_region *vgic_v3_rdist_free_slot(struct list_head *rd_regions,
uint32_t *free_pfn_offset);

--
2.5.5
\
 
 \ /
  Last update: 2018-03-19 10:25    [W:0.162 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site