mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Ilya Leoshkevich <iii@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: [PATCH v2 09/10] s390/uaccess: Move s390_kernel_write() to asm/text-patching.h
Date: Tue, 27 Oct 2026 15:30:29 +0100	[thread overview]
Message-ID: <20261027143030.3154657-10-hca@linux.ibm.com> (raw)
In-Reply-To: <20261027143030.3154657-1-hca@linux.ibm.com>

s390_kernel_write() is a text-patching primitive, not a user access
function. Move its declaration and the inline wrapper from uaccess.h
to text-patching.h.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 arch/s390/include/asm/runtime-const.h |  2 +-
 arch/s390/include/asm/text-patching.h | 11 +++++++++++
 arch/s390/include/asm/uaccess.h       |  9 ---------
 arch/s390/kernel/alternative.c        |  2 +-
 arch/s390/kernel/jump_label.c         |  1 -
 arch/s390/kernel/module.c             |  1 +
 arch/s390/kernel/nospec-branch.c      |  2 ++
 arch/s390/kernel/stackprotector.c     |  2 +-
 arch/s390/mm/maccess.c                |  1 +
 9 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/arch/s390/include/asm/runtime-const.h b/arch/s390/include/asm/runtime-const.h
index 0e2402717e8b..4d73a198f63f 100644
--- a/arch/s390/include/asm/runtime-const.h
+++ b/arch/s390/include/asm/runtime-const.h
@@ -2,7 +2,7 @@
 #ifndef _ASM_S390_RUNTIME_CONST_H
 #define _ASM_S390_RUNTIME_CONST_H
 
-#include <linux/uaccess.h>
+#include <linux/text-patching.h>
 #include <linux/memory.h>
 
 #define runtime_const_ptr(sym)					\
diff --git a/arch/s390/include/asm/text-patching.h b/arch/s390/include/asm/text-patching.h
index b219056a8817..c2f87f20ff97 100644
--- a/arch/s390/include/asm/text-patching.h
+++ b/arch/s390/include/asm/text-patching.h
@@ -3,6 +3,8 @@
 #ifndef _ASM_S390_TEXT_PATCHING_H
 #define _ASM_S390_TEXT_PATCHING_H
 
+#include <linux/string.h>
+#include <linux/memory.h>
 #include <asm/barrier.h>
 
 static __always_inline void sync_core(void)
@@ -13,4 +15,13 @@ static __always_inline void sync_core(void)
 void text_poke_sync(void);
 void text_poke_sync_lock(void);
 
+void *__s390_kernel_write(void *dst, const void *src, size_t size);
+
+static inline void *s390_kernel_write(void *dst, const void *src, size_t size)
+{
+	if (__is_defined(__DECOMPRESSOR))
+		return memcpy(dst, src, size);
+	return __s390_kernel_write(dst, src, size);
+}
+
 #endif /* _ASM_S390_TEXT_PATCHING_H */
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
index ac99b32c6ceb..db6acea9e7b8 100644
--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -384,15 +384,6 @@ static __always_inline unsigned long __must_check clear_user(void __user *to, un
 	return __clear_user(to, n);
 }
 
-void *__s390_kernel_write(void *dst, const void *src, size_t size);
-
-static inline void *s390_kernel_write(void *dst, const void *src, size_t size)
-{
-	if (__is_defined(__DECOMPRESSOR))
-		return memcpy(dst, src, size);
-	return __s390_kernel_write(dst, src, size);
-}
-
 void __noreturn __mvc_kernel_nofault_bad(void);
 
 #if defined(CONFIG_CC_HAS_ASM_GOTO_OUTPUT) && defined(CONFIG_CC_HAS_ASM_AOR_FORMAT_FLAGS)
diff --git a/arch/s390/kernel/alternative.c b/arch/s390/kernel/alternative.c
index 6013a75f5241..8efd2165692b 100644
--- a/arch/s390/kernel/alternative.c
+++ b/arch/s390/kernel/alternative.c
@@ -4,9 +4,9 @@
 #define pr_fmt(fmt)	"alt: " fmt
 #endif
 
+#include <linux/text-patching.h>
 #include <linux/hex.h>
 #include <linux/memory.h>
-#include <linux/uaccess.h>
 #include <linux/printk.h>
 #include <asm/nospec-branch.h>
 #include <asm/abs_lowcore.h>
diff --git a/arch/s390/kernel/jump_label.c b/arch/s390/kernel/jump_label.c
index 548141eaa20b..5c3083c917bb 100644
--- a/arch/s390/kernel/jump_label.c
+++ b/arch/s390/kernel/jump_label.c
@@ -6,7 +6,6 @@
  * Author(s): Jan Glauber <jang@linux.vnet.ibm.com>
  */
 #include <linux/memory.h>
-#include <linux/uaccess.h>
 #include <linux/jump_label.h>
 #include <linux/module.h>
 #include <asm/text-patching.h>
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index 79bc80d7bd02..4e03f40d2b2e 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -10,6 +10,7 @@
  *  based on i386 version
  *    Copyright (C) 2001 Rusty Russell.
  */
+#include <linux/text-patching.h>
 #include <linux/module.h>
 #include <linux/elf.h>
 #include <linux/vmalloc.h>
diff --git a/arch/s390/kernel/nospec-branch.c b/arch/s390/kernel/nospec-branch.c
index 26cd5b278e8a..1d9d05e1def4 100644
--- a/arch/s390/kernel/nospec-branch.c
+++ b/arch/s390/kernel/nospec-branch.c
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+
+#include <linux/text-patching.h>
 #include <linux/memory.h>
 #include <linux/module.h>
 #include <linux/device.h>
diff --git a/arch/s390/kernel/stackprotector.c b/arch/s390/kernel/stackprotector.c
index d72aef57a40a..5da113c2c7f6 100644
--- a/arch/s390/kernel/stackprotector.c
+++ b/arch/s390/kernel/stackprotector.c
@@ -4,10 +4,10 @@
 #define pr_fmt(fmt)	"stackprot: " fmt
 #endif
 
+#include <linux/text-patching.h>
 #include <linux/export.h>
 #include <linux/hex.h>
 #include <linux/memory.h>
-#include <linux/uaccess.h>
 #include <linux/printk.h>
 #include <asm/abs_lowcore.h>
 #include <asm/sections.h>
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index f39968dd8063..6b25203fb05c 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -6,6 +6,7 @@
  *
  */
 
+#include <linux/text-patching.h>
 #include <linux/uaccess.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
-- 
2.53.0


  parent reply	other threads:[~2026-10-27 14:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 14:30 [PATCH v2 00/10] s390: Consistent usage of text_mutex Heiko Carstens
2026-10-27 14:30 ` [PATCH v2 01/10] s390/jump_label: Serialize text patching with text_mutex Heiko Carstens
2026-10-28 10:50   ` Ilya Leoshkevich
2026-10-27 14:30 ` [PATCH v2 02/10] s390/ftrace: " Heiko Carstens
2026-10-28 10:54   ` Ilya Leoshkevich
2026-10-27 14:30 ` [PATCH v2 03/10] s390/bpf: " Heiko Carstens
2026-10-28 10:56   ` Ilya Leoshkevich
2026-10-27 14:30 ` [PATCH v2 04/10] s390/runtime-const: " Heiko Carstens
2026-10-28 10:58   ` Ilya Leoshkevich
2026-10-28 11:09     ` Heiko Carstens
2026-10-28 12:22       ` Ilya Leoshkevich
2026-10-28 13:43         ` Heiko Carstens
2026-10-27 14:30 ` [PATCH v2 05/10] s390/module: " Heiko Carstens
2026-10-28 10:59   ` Ilya Leoshkevich
2026-10-27 14:30 ` [PATCH v2 06/10] s390/stackprotector: " Heiko Carstens
2026-10-28 12:23   ` Ilya Leoshkevich
2026-10-27 14:30 ` [PATCH v2 07/10] s390/nospec-branch: " Heiko Carstens
2026-10-28 12:24   ` Ilya Leoshkevich
2026-10-27 14:30 ` [PATCH v2 08/10] s390/alternative: " Heiko Carstens
2026-10-28 12:25   ` Ilya Leoshkevich
2026-10-27 14:30 ` Heiko Carstens [this message]
2026-10-28 12:26   ` [PATCH v2 09/10] s390/uaccess: Move s390_kernel_write() to asm/text-patching.h Ilya Leoshkevich
2026-10-27 14:30 ` [PATCH v2 10/10] s390/maccess: Remove spinlock from __s390_kernel_write() Heiko Carstens
2026-10-28 20:59   ` Ilya Leoshkevich
2026-10-29 10:57     ` Heiko Carstens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261027143030.3154657-10-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®