aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Martin <Dave.Martin@arm.com>2019-04-11 12:23:00 -0400
committerMarc Zyngier <marc.zyngier@arm.com>2019-04-18 12:14:02 -0400
commitecfb6ed4f66e68129c3ab675c68cb6578c28ef9b (patch)
treec74cce8fb8468ec7514bf0f67521b83435842fa1
parent4bd774e57b29f5bbf296d1daf69cc761e1e75fa8 (diff)
KVM: arm64/sve: Explain validity checks in set_sve_vls()
Correct virtualization of SVE relies for correctness on code in set_sve_vls() that verifies consistency between the set of vector lengths requested by userspace and the set of vector lengths available on the host. However, the purpose of this code is not obvious, and not likely to be apparent at all to people who do not have detailed knowledge of the SVE system-level architecture. This patch adds a suitable comment to explain what these checks are for. No functional change. Suggested-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Dave Martin <Dave.Martin@arm.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--arch/arm64/kvm/guest.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index 5bb909c3ff7c..3ae2f82fca46 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -264,6 +264,13 @@ static int set_sve_vls(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
264 if (max_vq > sve_vq_from_vl(kvm_sve_max_vl)) 264 if (max_vq > sve_vq_from_vl(kvm_sve_max_vl))
265 return -EINVAL; 265 return -EINVAL;
266 266
267 /*
268 * Vector lengths supported by the host can't currently be
269 * hidden from the guest individually: instead we can only set a
270 * maxmium via ZCR_EL2.LEN. So, make sure the available vector
271 * lengths match the set requested exactly up to the requested
272 * maximum:
273 */
267 for (vq = SVE_VQ_MIN; vq <= max_vq; ++vq) 274 for (vq = SVE_VQ_MIN; vq <= max_vq; ++vq)
268 if (vq_present(&vqs, vq) != sve_vq_available(vq)) 275 if (vq_present(&vqs, vq) != sve_vq_available(vq))
269 return -EINVAL; 276 return -EINVAL;