Commit 9385/2 introduced a few branches inside function
prototypes when using CFI in order to deal with the situation
where CFI inserts a few bytes of function information in front
of the symbol.
This is not good for older CPUs where every cycle counts.
Commit 9386/2 alleviated the situation a bit by using aliases
for the cache functions with identical signatures.
This leaves the coherent cache flush functions
*_coherent_kern_range() with these branches to the corresponing
*_coherent_user_range() around, since their return type differ and
they therefore cannot be aliased.
Solve this by a simple ifdef so at least we can use fallthroughs
when compiling without CFI enabled.
Link: https://lore.kernel.org/linux-arm-kernel/Zi+e9M%2Ff5b%2FSto9H@shell.armlinux.org.uk/
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(fa_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b fa_coherent_user_range
+#endif
SYM_FUNC_END(fa_coherent_kern_range)
/*
* - size - region size
*/
SYM_TYPED_FUNC_START(v4_flush_kern_dcache_area)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b v4_dma_flush_range
+#endif
SYM_FUNC_END(v4_flush_kern_dcache_area)
/*
*/
SYM_TYPED_FUNC_START(v4wb_flush_kern_dcache_area)
add r1, r0, r1
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b v4wb_coherent_user_range
+#endif
SYM_FUNC_END(v4wb_flush_kern_dcache_area)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(v4wb_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b v4wb_coherent_user_range
+#endif
SYM_FUNC_END(v4wb_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(v4wt_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b v4wt_coherent_user_range
+#endif
SYM_FUNC_END(v4wt_coherent_kern_range)
/*
* - the Icache does not read data from the write buffer
*/
SYM_TYPED_FUNC_START(v6_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b v6_coherent_user_range
+#endif
SYM_FUNC_END(v6_coherent_kern_range)
/*
* - the Icache does not read data from the write buffer
*/
SYM_TYPED_FUNC_START(v7_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b v7_coherent_user_range
+#endif
SYM_FUNC_END(v7_coherent_kern_range)
/*
* - the Icache does not read data from the write buffer
*/
SYM_TYPED_FUNC_START(v7m_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b v7m_coherent_user_range
+#endif
SYM_FUNC_END(v7m_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(arm1020_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b arm1020_coherent_user_range
+#endif
SYM_FUNC_END(arm1020_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(arm1020e_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b arm1020e_coherent_user_range
+#endif
SYM_FUNC_END(arm1020e_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(arm1022_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b arm1022_coherent_user_range
+#endif
SYM_FUNC_END(arm1022_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(arm1026_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b arm1026_coherent_user_range
+#endif
SYM_FUNC_END(arm1026_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(arm920_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b arm920_coherent_user_range
+#endif
SYM_FUNC_END(arm920_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(arm922_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b arm922_coherent_user_range
+#endif
SYM_FUNC_END(arm922_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(arm925_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b arm925_coherent_user_range
+#endif
SYM_FUNC_END(arm925_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(arm926_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b arm926_coherent_user_range
+#endif
SYM_FUNC_END(arm926_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(arm940_coherent_user_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b arm940_flush_kern_dcache_area
+#endif
SYM_FUNC_END(arm940_coherent_user_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(arm946_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b arm946_coherent_user_range
+#endif
SYM_FUNC_END(arm946_coherent_kern_range)
/*
*/
.align 5
SYM_TYPED_FUNC_START(feroceon_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b feroceon_coherent_user_range
+#endif
SYM_FUNC_END(feroceon_coherent_kern_range)
/*
* - end - virtual end address
*/
SYM_TYPED_FUNC_START(mohawk_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b mohawk_coherent_user_range
+#endif
SYM_FUNC_END(mohawk_coherent_kern_range)
/*
* it also trashes the mini I-cache used by JTAG debuggers.
*/
SYM_TYPED_FUNC_START(xsc3_coherent_kern_range)
+#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
b xsc3_coherent_user_range
+#endif
SYM_FUNC_END(xsc3_coherent_kern_range)
SYM_TYPED_FUNC_START(xsc3_coherent_user_range)