@@ -22,10 +22,11 @@
#define ERRATA_THEAD_NUMBER 3
#endif
-#define CPUFEATURE_SVPBMT (1 << 0)
-#define CPUFEATURE_ZICBOM (1 << 1)
-#define CPUFEATURE_ZBB (1 << 2)
-#define CPUFEATURE_NUMBER 3
+#define CPUFEATURE_SVPBMT (1 << 0)
+#define CPUFEATURE_ZICBOM (1 << 1)
+#define CPUFEATURE_ZBB (1 << 2)
+#define CPUFEATURE_FAST_UNALIGNED (1 << 3)
+#define CPUFEATURE_NUMBER 4
#ifdef __ASSEMBLY__
@@ -337,6 +337,23 @@ static bool __init_or_module cpufeature_probe_zbb(unsigned int stage)
return true;
}
+static bool __init_or_module cpufeature_probe_fast_unaligned(unsigned int stage)
+{
+ int cpu;
+
+ if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
+ return false;
+
+ for_each_possible_cpu(cpu) {
+ long perf = per_cpu(misaligned_access_speed, cpu);
+
+ if (perf != RISCV_HWPROBE_MISALIGNED_FAST)
+ return false;
+ }
+
+ return true;
+}
+
/*
* Probe presence of individual extensions.
*
@@ -358,6 +375,9 @@ static u32 __init_or_module cpufeature_probe(unsigned int stage)
if (cpufeature_probe_zbb(stage))
cpu_req_feature |= CPUFEATURE_ZBB;
+ if (cpufeature_probe_fast_unaligned(stage))
+ cpu_req_feature |= CPUFEATURE_FAST_UNALIGNED;
+
return cpu_req_feature;
}