@@ -170,6 +170,10 @@ static inline unsigned int __bit_to_vq(unsigned int bit)
return SVE_VQ_MAX - bit;
}
+static inline unsigned int __bit_to_vl(unsigned int bit)
+{
+ return sve_vl_from_vq(__bit_to_vq(bit));
+}
struct vl_info {
enum vec_type type;
@@ -530,7 +530,7 @@ static unsigned int find_supported_vector_length(enum vec_type type,
bit = find_next_bit(info->vq_map, SVE_VQ_MAX,
__vq_to_bit(sve_vq_from_vl(vl)));
- return sve_vl_from_vq(__bit_to_vq(bit));
+ return __bit_to_vl(bit);
}
#if defined(CONFIG_ARM64_SVE) && defined(CONFIG_SYSCTL)
@@ -1103,7 +1103,7 @@ int vec_verify_vq_map(enum vec_type type)
* Mismatches above sve_max_virtualisable_vl are fine, since
* no guest is allowed to configure ZCR_EL2.LEN to exceed this:
*/
- if (sve_vl_from_vq(__bit_to_vq(b)) <= info->max_virtualisable_vl) {
+ if (__bit_to_vl(b) <= info->max_virtualisable_vl) {
pr_warn("%s: cpu%d: Unsupported vector length(s) present\n",
info->name, smp_processor_id());
return -EINVAL;
@@ -1169,7 +1169,7 @@ void __init sve_setup(void)
set_bit(__vq_to_bit(SVE_VQ_MIN), info->vq_map);
max_bit = find_first_bit(info->vq_map, SVE_VQ_MAX);
- info->max_vl = sve_vl_from_vq(__bit_to_vq(max_bit));
+ info->max_vl = __bit_to_vl(max_bit);
/*
* For the default VL, pick the maximum supported value <= 64.
@@ -1188,7 +1188,7 @@ void __init sve_setup(void)
/* No virtualisable VLs? This is architecturally forbidden. */
info->max_virtualisable_vl = SVE_VQ_MIN;
else /* b + 1 < SVE_VQ_MAX */
- info->max_virtualisable_vl = sve_vl_from_vq(__bit_to_vq(b + 1));
+ info->max_virtualisable_vl = __bit_to_vl(b + 1);
if (info->max_virtualisable_vl > info->max_vl)
info->max_virtualisable_vl = info->max_vl;
@@ -1305,10 +1305,10 @@ void __init sme_setup(void)
WARN_ON(bitmap_empty(info->vq_map, SVE_VQ_MAX));
min_bit = find_last_bit(info->vq_map, SVE_VQ_MAX);
- info->min_vl = sve_vl_from_vq(__bit_to_vq(min_bit));
+ info->min_vl = __bit_to_vl(min_bit);
max_bit = find_first_bit(info->vq_map, SVE_VQ_MAX);
- info->max_vl = sve_vl_from_vq(__bit_to_vq(max_bit));
+ info->max_vl = __bit_to_vl(max_bit);
WARN_ON(info->min_vl > info->max_vl);