[PATCH 14/32] s390/diag: Convert inline assembly to EX_TABLE_INSN

From: Heiko Carstens

Date: Thu Oct 01 2026 - 06:49:40 EST


Convert all diag exception table entries to use EX_TABLE_INSN.
With EX_TABLE_INSN entries always point to the faulting instruction,
so duplicate entries and nopr padding are no longer needed and removed.

Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/include/asm/diag.h | 5 ++---
arch/s390/include/asm/diag288.h | 6 +++---
arch/s390/kernel/diag/diag.c | 12 ++++++------
3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/arch/s390/include/asm/diag.h b/arch/s390/include/asm/diag.h
index 8db8db3b1018..1416ee1ad323 100644
--- a/arch/s390/include/asm/diag.h
+++ b/arch/s390/include/asm/diag.h
@@ -68,9 +68,8 @@ static inline void diag10_range(unsigned long start_pfn, unsigned long num_pfn)
diag_stat_inc(DIAG_STAT_X010);
asm_inline volatile(
"0: diag %0,%1,0x10\n"
- "1: nopr %%r7\n"
- EX_TABLE(0b, 1b)
- EX_TABLE(1b, 1b)
+ "1:\n"
+ EX_TABLE_INSN(0b, 1b)
: : "a" (start_addr), "a" (end_addr));
}

diff --git a/arch/s390/include/asm/diag288.h b/arch/s390/include/asm/diag288.h
index 5e1b43cea9d6..f0a37a80d672 100644
--- a/arch/s390/include/asm/diag288.h
+++ b/arch/s390/include/asm/diag288.h
@@ -28,10 +28,10 @@ static inline int __diag288(unsigned int func, unsigned int timeout,
int rc = -EINVAL;

asm volatile(
- " diag %[r1],%[r3],0x288\n"
- "0: lhi %[rc],0\n"
+ "0: diag %[r1],%[r3],0x288\n"
+ " lhi %[rc],0\n"
"1:"
- EX_TABLE(0b, 1b)
+ EX_TABLE_INSN(0b, 1b)
: [rc] "+d" (rc)
: [r1] "d" (r1.pair), [r3] "d" (r3.pair)
: "cc", "memory");
diff --git a/arch/s390/kernel/diag/diag.c b/arch/s390/kernel/diag/diag.c
index 56b862ba9be8..f23b3e2b070e 100644
--- a/arch/s390/kernel/diag/diag.c
+++ b/arch/s390/kernel/diag/diag.c
@@ -196,9 +196,9 @@ static inline int __diag204(unsigned long *subcode, unsigned long size, void *ad
union register_pair rp = { .even = *subcode, .odd = size };

asm_inline volatile(
- " diag %[addr],%[rp],0x204\n"
- "0: nopr %%r7\n"
- EX_TABLE(0b,0b)
+ "0: diag %[addr],%[rp],0x204\n"
+ "1:\n"
+ EX_TABLE_INSN(0b, 1b)
: [rp] "+&d" (rp.pair) : [addr] "d" (addr) : "memory");
*subcode = rp.even;
return rp.odd;
@@ -287,10 +287,10 @@ int diag224(void *ptr)

diag_stat_inc(DIAG_STAT_X224);
asm_inline volatile("\n"
- " diag %[type],%[addr],0x224\n"
- "0: lhi %[rc],0\n"
+ "0: diag %[type],%[addr],0x224\n"
+ " lhi %[rc],0\n"
"1:\n"
- EX_TABLE(0b,1b)
+ EX_TABLE_INSN(0b, 1b)
: [rc] "+d" (rc)
, "=m" (*(struct { char buf[PAGE_SIZE]; } *)ptr)
: [type] "d" (0), [addr] "d" (addr));
--
2.53.0