riscv: Introduce riscv_v_vsize to record size of Vector context
[platform/kernel/linux-starfive.git] / arch / riscv / kernel / smpboot.c
index 445a4ef..66011bf 100644 (file)
@@ -31,6 +31,8 @@
 #include <asm/tlbflush.h>
 #include <asm/sections.h>
 #include <asm/smp.h>
+#include <uapi/asm/hwcap.h>
+#include <asm/vector.h>
 
 #include "head.h"
 
@@ -169,6 +171,11 @@ asmlinkage __visible void smp_callin(void)
        set_cpu_online(curr_cpuid, 1);
        probe_vendor_features(curr_cpuid);
 
+       if (has_vector()) {
+               if (riscv_v_setup_vsize())
+                       elf_hwcap &= ~COMPAT_HWCAP_ISA_V;
+       }
+
        /*
         * Remote TLB flushes are ignored while the CPU is offline, so emit
         * a local TLB flush right now just in case.