mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
KVM: arm64: Implement vq_present() as a macro
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>
This commit is contained in:
parent
623e1528d4
commit
0c529ff789
@ -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: */
|
||||
|
Loading…
Reference in New Issue
Block a user