KVM: arm64: Implement vq_present() as a macro
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 10 Jun 2019 10:00:03 +0000 (15:30 +0530)
committerMarc Zyngier <marc.zyngier@arm.com>
Wed, 12 Jun 2019 14:53:33 +0000 (15:53 +0100)
This routine is a one-liner and doesn't really need to be function and
can be implemented as a macro.

Suggested-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
arch/arm64/kvm/guest.c

index 3ae2f82fca469eb0922e556e018647beebc46294..ae734fcfd4ea2e39eb90418c98f53d149385b399 100644 (file)
@@ -207,13 +207,7 @@ out:
 
 #define vq_word(vq) (((vq) - SVE_VQ_MIN) / 64)
 #define vq_mask(vq) ((u64)1 << ((vq) - SVE_VQ_MIN) % 64)
-
-static bool vq_present(
-       const u64 (*const vqs)[KVM_ARM64_SVE_VLS_WORDS],
-       unsigned int vq)
-{
-       return (*vqs)[vq_word(vq)] & vq_mask(vq);
-}
+#define vq_present(vqs, vq) ((vqs)[vq_word(vq)] & vq_mask(vq))
 
 static int get_sve_vls(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
 {
@@ -258,7 +252,7 @@ static int set_sve_vls(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
 
        max_vq = 0;
        for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; ++vq)
-               if (vq_present(&vqs, vq))
+               if (vq_present(vqs, vq))
                        max_vq = vq;
 
        if (max_vq > sve_vq_from_vl(kvm_sve_max_vl))
@@ -272,7 +266,7 @@ static int set_sve_vls(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
         * maximum:
         */
        for (vq = SVE_VQ_MIN; vq <= max_vq; ++vq)
-               if (vq_present(&vqs, vq) != sve_vq_available(vq))
+               if (vq_present(vqs, vq) != sve_vq_available(vq))
                        return -EINVAL;
 
        /* Can't run with no vector lengths at all: */