Commit 7b749aad authored by Linus Walleij's avatar Linus Walleij Committed by Russell King (Oracle)
Browse files

ARM: 9393/1: mm: Use conditionals for CFI branches

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: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
parent 1a4fec49
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -112,7 +112,9 @@ SYM_FUNC_END(fa_flush_user_cache_range)
 *	- 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)

/*
+2 −0
Original line number Diff line number Diff line
@@ -104,7 +104,9 @@ SYM_FUNC_END(v4_coherent_user_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)

/*
+4 −0
Original line number Diff line number Diff line
@@ -136,7 +136,9 @@ SYM_FUNC_END(v4wb_flush_user_cache_range)
 */
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)

/*
@@ -150,7 +152,9 @@ 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)

/*
+2 −0
Original line number Diff line number Diff line
@@ -108,7 +108,9 @@ SYM_FUNC_END(v4wt_flush_user_cache_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)

/*
+2 −0
Original line number Diff line number Diff line
@@ -117,7 +117,9 @@ SYM_FUNC_END(v6_flush_user_cache_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)

/*
Loading