Merge tag 'soc-defconfig-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-microblaze.git] / arch / arm64 / kernel / fpsimd.c
index 087c05a..91e44ac 100644 (file)
@@ -1179,9 +1179,6 @@ void sve_kernel_enable(const struct arm64_cpu_capabilities *__always_unused p)
  */
 u64 read_zcr_features(void)
 {
-       u64 zcr;
-       unsigned int vq_max;
-
        /*
         * Set the maximum possible VL, and write zeroes to all other
         * bits to see if they stick.
@@ -1189,12 +1186,8 @@ u64 read_zcr_features(void)
        sve_kernel_enable(NULL);
        write_sysreg_s(ZCR_ELx_LEN_MASK, SYS_ZCR_EL1);
 
-       zcr = read_sysreg_s(SYS_ZCR_EL1);
-       zcr &= ~(u64)ZCR_ELx_LEN_MASK; /* find sticky 1s outside LEN field */
-       vq_max = sve_vq_from_vl(sve_get_vl());
-       zcr |= vq_max - 1; /* set LEN field to maximum effective value */
-
-       return zcr;
+       /* Return LEN value that would be written to get the maximum VL */
+       return sve_vq_from_vl(sve_get_vl()) - 1;
 }
 
 void __init sve_setup(void)
@@ -1349,9 +1342,6 @@ void fa64_kernel_enable(const struct arm64_cpu_capabilities *__always_unused p)
  */
 u64 read_smcr_features(void)
 {
-       u64 smcr;
-       unsigned int vq_max;
-
        sme_kernel_enable(NULL);
 
        /*
@@ -1360,12 +1350,8 @@ u64 read_smcr_features(void)
        write_sysreg_s(read_sysreg_s(SYS_SMCR_EL1) | SMCR_ELx_LEN_MASK,
                       SYS_SMCR_EL1);
 
-       smcr = read_sysreg_s(SYS_SMCR_EL1);
-       smcr &= ~(u64)SMCR_ELx_LEN_MASK; /* Only the LEN field */
-       vq_max = sve_vq_from_vl(sme_get_vl());
-       smcr |= vq_max - 1; /* set LEN field to maximum effective value */
-
-       return smcr;
+       /* Return LEN value that would be written to get the maximum VL */
+       return sve_vq_from_vl(sme_get_vl()) - 1;
 }
 
 void __init sme_setup(void)