diff options
author | Vasily Gorbik <gor@linux.ibm.com> | 2020-06-24 17:39:14 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-11 16:32:02 +0100 |
commit | e568ce830911507ffc11561327677c30b261957a (patch) | |
tree | c74bae691e5cb4ef7601577e75e082a0875ee3fc | |
parent | 215c0bacc2163196550b718abe74105b01738973 (diff) | |
download | linux-stable-e568ce830911507ffc11561327677c30b261957a.tar.gz linux-stable-e568ce830911507ffc11561327677c30b261957a.tar.bz2 linux-stable-e568ce830911507ffc11561327677c30b261957a.zip |
s390/maccess: add no DAT mode to kernel_write
commit d6df52e9996dcc2062c3d9c9123288468bb95b52 upstream.
To be able to patch kernel code before paging is initialized do plain
memcpy if DAT is off. This is required to enable early jump label
initialization.
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | arch/s390/mm/maccess.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c index 7be06475809b..a40739ea3805 100644 --- a/arch/s390/mm/maccess.c +++ b/arch/s390/mm/maccess.c @@ -58,13 +58,19 @@ static notrace long s390_kernel_write_odd(void *dst, const void *src, size_t siz */ void notrace s390_kernel_write(void *dst, const void *src, size_t size) { + unsigned long flags; long copied; - while (size) { - copied = s390_kernel_write_odd(dst, src, size); - dst += copied; - src += copied; - size -= copied; + flags = arch_local_save_flags(); + if (!(flags & PSW_MASK_DAT)) { + memcpy(dst, src, size); + } else { + while (size) { + copied = s390_kernel_write_odd(dst, src, size); + dst += copied; + src += copied; + size -= copied; + } } } |