[PATCH v3 03/23] s390: Move sske_frame() to a header

Claudio Imbrenda
2025-11-06T16:11:26Z

Move the sske_frame() function to asm/pgtable.h, so it can be used in
other modules too.

Opportunistically convert the .insn opcode specification to the
appropriate mnemonic.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
---
arch/s390/include/asm/pgtable.h | 7 +++++++
arch/s390/mm/pageattr.c | 7 -------
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index c1a7a92f0575..b9887ea6c045 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -1148,6 +1148,13 @@ static inline pte_t pte_mkhuge(pte_t pte)
}
#endif

+static inline unsigned long sske_frame(unsigned long addr, unsigned char skey)
+{
+ asm volatile("sske %[skey],%[addr],1"
+ : [addr] "+a" (addr) : [skey] "d" (skey));
+ return addr;
+}
+
#define IPTE_GLOBAL 0
#define IPTE_LOCAL 1

diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c
index 348e759840e7..ceeb04136cec 100644
--- a/arch/s390/mm/pageattr.c
+++ b/arch/s390/mm/pageattr.c
@@ -16,13 +16,6 @@
#include <asm/asm.h>
#include <asm/set_memory.h>

-static inline unsigned long sske_frame(unsigned long addr, unsigned char skey)
-{
- asm volatile(".insn rrf,0xb22b0000,%[skey],%[addr],1,0"
- : [addr] "+a" (addr) : [skey] "d" (skey));
- return addr;
-}
-
void __storage_key_init_range(unsigned long start, unsigned long end)
{
unsigned long boundary, size;
--
2.51.1