Re: [PATCH 25/32] s390/pci: Convert inline assembly to EX_TABLE_INSN
From: Niklas Schnelle
Date: Fri Oct 02 2026 - 05:14:26 EST
On Thu, 2026-10-01 at 12:32 +0200, Heiko Carstens wrote:
> Convert all pci exception table entries to use EX_TABLE_INSN.
> With EX_TABLE_INSN entries always point to the faulting instruction,
> so duplicate entries are removed.
>
> Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
> ---
> arch/s390/pci/pci_clp.c | 12 ++++++------
> arch/s390/pci/pci_insn.c | 36 ++++++++++++++++++------------------
> arch/s390/pci/pci_mmio.c | 28 +++++++++++++++-------------
> 3 files changed, 39 insertions(+), 37 deletions(-)
--- snip ---
> diff --git a/arch/s390/pci/pci_mmio.c b/arch/s390/pci/pci_mmio.c
> index f3f79ba78410..8b49175b0031 100644
> --- a/arch/s390/pci/pci_mmio.c
> +++ b/arch/s390/pci/pci_mmio.c
> @@ -39,10 +39,10 @@ static inline int __pcistb_mio_inuser(
> asm_inline volatile (
> " sacf 256\n"
> "0: .insn rsy,0xeb00000000d4,%[len],%[ioaddr],%[src]\n"
> - "1: lhi %[exc],0\n"
> - "2: sacf 768\n"
> + " lhi %[exc],0\n"
> + "1: sacf 768\n"
> CC_IPM(cc)
> - EX_TABLE(0b, 2b) EX_TABLE(1b, 2b)
> + EX_TABLE_INSN(0b, 1b)
> : CC_OUT(cc, cc), [len] "+d" (len), [exc] "+d" (exception)
> : [ioaddr] "a" (ioaddr), [src] "Q" (*((u8 __force *)src))
> : CC_CLOBBER_LIST("memory"));
> @@ -72,15 +72,16 @@ static inline int __pcistg_mio_inuser(
> asm_inline volatile (
> " sacf 256\n"
> "0: llgc %[tmp],0(%[src])\n"
> - "4: sllg %[val],%[val],8\n"
> + " sllg %[val],%[val],8\n"
> " aghi %[src],1\n"
> " ogr %[val],%[tmp]\n"
> " brctg %[cnt],0b\n"
> "1: .insn rre,0xb9d40000,%[val],%[ioaddr_len]\n"
> - "2: lhi %[exc],0\n"
> - "3: sacf 768\n"
> + " lhi %[exc],0\n"
> + "2: sacf 768\n"
> CC_IPM(cc)
> - EX_TABLE(0b, 3b) EX_TABLE(4b, 3b) EX_TABLE(1b, 3b) EX_TABLE(2b, 3b)
> + EX_TABLE_INSN(0b, 2b)
> + EX_TABLE_INSN(1b, 2b)
:) this and the one in __pcilg_mio_inuser() must be one of the best
examples why the new approach is cleaner and easier to read. Well done!
> : [src] "+a" (src), [cnt] "+d" (cnt),
> [val] "+d" (val), [tmp] "=d" (tmp), [exc] "+d" (exception),
> CC_OUT(cc, cc), [ioaddr_len] "+&d" (ioaddr_len.pair)
> @@ -227,13 +228,13 @@ static inline int __pcilg_mio_inuser(
> asm_inline volatile (
> " sacf 256\n"
> "0: .insn rre,0xb9d60000,%[val],%[ioaddr_len]\n"
> - "1: lhi %[exc],0\n"
> + " lhi %[exc],0\n"
> " jne 4f\n"
> - "2: ahi %[shift],-8\n"
> + "1: ahi %[shift],-8\n"
> " srlg %[tmp],%[val],0(%[shift])\n"
> - "3: stc %[tmp],0(%[dst])\n"
> - "5: aghi %[dst],1\n"
> - " brctg %[cnt],2b\n"
> + "2: stc %[tmp],0(%[dst])\n"
> + " aghi %[dst],1\n"
> + " brctg %[cnt],1b\n"
> /*
> * Use xr to clear exc and set condition code to zero
> * to ensure flag output is correct for this branch.
> @@ -241,7 +242,8 @@ static inline int __pcilg_mio_inuser(
> " xr %[exc],%[exc]\n"
> "4: sacf 768\n"
> CC_IPM(cc)
> - EX_TABLE(0b, 4b) EX_TABLE(1b, 4b) EX_TABLE(3b, 4b) EX_TABLE(5b, 4b)
> + EX_TABLE_INSN(0b, 4b)
> + EX_TABLE_INSN(2b, 4b)
> : [ioaddr_len] "+&d" (ioaddr_len.pair), [exc] "+d" (exception),
> CC_OUT(cc, cc), [val] "=d" (val),
> [dst] "+a" (dst), [cnt] "+d" (cnt), [tmp] "=d" (tmp),
I went through the adjustments and they all look correct under the
explanations you gave in the cover letter and prerequisite patches.
So feel free to add my:
Reviewed-by: Niklas Schnelle <schnelle@xxxxxxxxxxxxx>
Thanks,
Niklas