From 463f36c76fa4ec015c640ff63ccf52e7527abee0 Mon Sep 17 00:00:00 2001
From: Alexander Egorenkov <egorenar@linux.ibm.com>
Date: Fri, 16 Jul 2021 22:00:22 +0200
Subject: [PATCH] s390/boot: fix use of expolines in the DMA code
References: bsc#1188878 ltc#193771
Patch-mainline: v5.14-rc3
Git-commit: 463f36c76fa4ec015c640ff63ccf52e7527abee0
Description: s390/boot: fix use of expolines in the DMA code
Symptom: No expolines are used in the DMA text section if the s390 kernel
is built with expolines enabled.
Problem: The DMA code section of the decompressor must be compiled with
expolines if Spectre V2 mitigation has been enabled for
the decompressed kernel. This is required because although
the decompressor's image contains the DMA code section, it is
handed over to the decompressed kernel for use.
Solution: Because the DMA code is already slow w/o expolines, use
expolines always regardless whether the decompressed kernel is
using them or not. This simplifies the DMA code by dropping
the conditional compilation of expolines.
Reproduction: Build the s390 kernel with expolines enabled.
The DMA code section of the decompressor must be compiled with expolines
if Spectre V2 mitigation has been enabled for the decompressed kernel.
This is required because although the decompressor's image contains
the DMA code section, it is handed over to the decompressed kernel for use.
Because the DMA code is already slow w/o expolines, use expolines always
regardless whether the decompressed kernel is using them or not. This
simplifies the DMA code by dropping the conditional compilation of
expolines.
Fixes: bf72630130c2 ("s390: use proper expoline sections for .dma code")
Cc: <stable@vger.kernel.org> # 5.2
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Michal Suchanek <msuchanek@suse.de>
---
arch/s390/boot/text_dma.S | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/arch/s390/boot/text_dma.S b/arch/s390/boot/text_dma.S
index f7c77cd518f2..5ff5fee02801 100644
--- a/arch/s390/boot/text_dma.S
+++ b/arch/s390/boot/text_dma.S
@@ -9,16 +9,6 @@
#include <asm/errno.h>
#include <asm/sigp.h>
-#ifdef CC_USING_EXPOLINE
- .pushsection .dma.text.__s390_indirect_jump_r14,"axG"
-__dma__s390_indirect_jump_r14:
- larl %r1,0f
- ex 0,0(%r1)
- j .
-0: br %r14
- .popsection
-#endif
-
.section .dma.text,"ax"
/*
* Simplified version of expoline thunk. The normal thunks can not be used here,
@@ -27,11 +17,10 @@ __dma__s390_indirect_jump_r14:
* affects a few functions that are not performance-relevant.
*/
.macro BR_EX_DMA_r14
-#ifdef CC_USING_EXPOLINE
- jg __dma__s390_indirect_jump_r14
-#else
- br %r14
-#endif
+ larl %r1,0f
+ ex 0,0(%r1)
+ j .
+0: br %r14
.endm
/*
--
2.31.1