File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,12 @@ static inline bool unaligned_ctl_available(void)
81
81
82
82
#if defined(CONFIG_RISCV_MISALIGNED )
83
83
DECLARE_PER_CPU (long , misaligned_access_speed );
84
+ bool misaligned_traps_can_delegate (void );
85
+ #else
86
+ static inline bool misaligned_traps_can_delegate (void )
87
+ {
88
+ return false;
89
+ }
84
90
#endif
85
91
86
92
bool __init check_vector_unaligned_access_emulated_all_cpus (void );
Original file line number Diff line number Diff line change @@ -724,10 +724,10 @@ static int cpu_online_check_unaligned_access_emulated(unsigned int cpu)
724
724
}
725
725
#endif
726
726
727
- #ifdef CONFIG_RISCV_SBI
728
-
729
727
static bool misaligned_traps_delegated ;
730
728
729
+ #ifdef CONFIG_RISCV_SBI
730
+
731
731
static int cpu_online_sbi_unaligned_setup (unsigned int cpu )
732
732
{
733
733
if (sbi_fwft_set (SBI_FWFT_MISALIGNED_EXC_DELEG , 1 , 0 ) &&
@@ -763,6 +763,7 @@ static int cpu_online_sbi_unaligned_setup(unsigned int cpu __always_unused)
763
763
{
764
764
return 0 ;
765
765
}
766
+
766
767
#endif
767
768
768
769
int cpu_online_unaligned_access_init (unsigned int cpu )
@@ -775,3 +776,15 @@ int cpu_online_unaligned_access_init(unsigned int cpu)
775
776
776
777
return cpu_online_check_unaligned_access_emulated (cpu );
777
778
}
779
+
780
+ bool misaligned_traps_can_delegate (void )
781
+ {
782
+ /*
783
+ * Either we successfully requested misaligned traps delegation for all
784
+ * CPUs, or the SBI does not implement the FWFT extension but delegated
785
+ * the exception by default.
786
+ */
787
+ return misaligned_traps_delegated ||
788
+ all_cpus_unaligned_scalar_access_emulated ();
789
+ }
790
+ EXPORT_SYMBOL_GPL (misaligned_traps_can_delegate );
You can’t perform that action at this time.
0 commit comments