From nobody Sun Dec 14 23:05:34 2025 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D838E222580; Thu, 6 Feb 2025 07:10:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738825842; cv=none; b=pCtE568R0nJDgnlB9J09UyTZ5dq5GIJoKHiifH8cPHcvNWQWm7dLmRYXWzIZxKdqwzLSVNri/CBvjiCi4Go8/bzEhX2W/fIMII3JjT5bbRfu5UrzLnvtn3s0miUgXtMz5EbbMsQdHQ4lllz11wQtF6AnyCuCovDweXhRERI8gus= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738825842; c=relaxed/simple; bh=iLgnRxUsHgJaV0C3zj1YOxXH+/D/Uc2cktFIeX0auRs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RWWWdlRvLGpqVtCEn5QMe2ryhGHU0RvSpw22aKNYB8/i90cD+IWezqKqE0cMmBBPCCVvkaxkv6AQXFCPU0ordhzkuJnqRYiarOACkGSeyPrShJJiqWVIu/pusxgsomQO4cQAb88osfCOoWWvUtM6RmXU07aAuvR/5J+ylOU1JHs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=I3aTCbXN; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="I3aTCbXN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1738825829; bh=iLgnRxUsHgJaV0C3zj1YOxXH+/D/Uc2cktFIeX0auRs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=I3aTCbXNC1+tDm8YHro+guX07NnjC64VewDqiXHyU05uWQTI6mmhvHFBPf0NaW6kl b1HP9xceT+CGtE1a4Pfx7Cs8nwGrmlBb7L7xez6IoZAyaks/BQQwFiQtpi4El3Kg0E tk8w01xTGh7NtErmFUQUnjCzqAex4FsTd4PUn/oM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 06 Feb 2025 08:10:26 +0100 Subject: [PATCH v2 1/2] selftests/nolibc: rename s390 to s390x Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250206-nolibc-s390-v2-1-991ad97e3d58@weissschuh.net> References: <20250206-nolibc-s390-v2-0-991ad97e3d58@weissschuh.net> In-Reply-To: <20250206-nolibc-s390-v2-0-991ad97e3d58@weissschuh.net> To: Willy Tarreau , Shuah Khan , Sven Schnelle Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1738825829; l=4176; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=iLgnRxUsHgJaV0C3zj1YOxXH+/D/Uc2cktFIeX0auRs=; b=2fqYtQ3KP2ncqoOI2eR7Mmo2N8NQL1xiRFoMhVHYd7s70lBIUQWTyeL1qHBhyIpsU4cGrtfot 9WFRwwqIk+SDgK2O/ikDtUs2YP8bHDE/2VaZnTIcSTkzL2xKOKT5hNT X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Support for 32-bit s390 is about to be added. As "s39032" would look horrible, use the another naming scheme. 32-bit s390 is "s390" and 64-bit s390 is "s390x", similar to how it is handled in various toolchain components. Acked-by: Willy Tarreau Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/nolibc/Makefile | 11 ++++++----- tools/testing/selftests/nolibc/run-tests.sh | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte= sts/nolibc/Makefile index 983985b7529b65b7ce4a00c28f3f915d83974eea..97e08b92bee32300922c27ccd7c= 07e9eddc7162e 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -54,6 +54,7 @@ ARCH_mips32le =3D mips ARCH_mips32be =3D mips ARCH_riscv32 =3D riscv ARCH_riscv64 =3D riscv +ARCH_s390x =3D s390 ARCH :=3D $(or $(ARCH_$(XARCH)),$(XARCH)) =20 # kernel image names by architecture @@ -70,7 +71,7 @@ IMAGE_ppc64le =3D arch/powerpc/boot/zImage IMAGE_riscv =3D arch/riscv/boot/Image IMAGE_riscv32 =3D arch/riscv/boot/Image IMAGE_riscv64 =3D arch/riscv/boot/Image -IMAGE_s390 =3D arch/s390/boot/bzImage +IMAGE_s390x =3D arch/s390/boot/bzImage IMAGE_loongarch =3D arch/loongarch/boot/vmlinuz.efi IMAGE =3D $(objtree)/$(IMAGE_$(XARCH)) IMAGE_NAME =3D $(notdir $(IMAGE)) @@ -89,7 +90,7 @@ DEFCONFIG_ppc64le =3D powernv_defconfig DEFCONFIG_riscv =3D defconfig DEFCONFIG_riscv32 =3D rv32_defconfig DEFCONFIG_riscv64 =3D defconfig -DEFCONFIG_s390 =3D defconfig +DEFCONFIG_s390x =3D defconfig DEFCONFIG_loongarch =3D defconfig DEFCONFIG =3D $(DEFCONFIG_$(XARCH)) =20 @@ -112,7 +113,7 @@ QEMU_ARCH_ppc64le =3D ppc64 QEMU_ARCH_riscv =3D riscv64 QEMU_ARCH_riscv32 =3D riscv32 QEMU_ARCH_riscv64 =3D riscv64 -QEMU_ARCH_s390 =3D s390x +QEMU_ARCH_s390x =3D s390x QEMU_ARCH_loongarch =3D loongarch64 QEMU_ARCH =3D $(QEMU_ARCH_$(XARCH)) =20 @@ -140,7 +141,7 @@ QEMU_ARGS_ppc64le =3D -M powernv -append "console=3D= hvc0 panic=3D-1 $(TEST:%=3DNOLIBC QEMU_ARGS_riscv =3D -M virt -append "console=3DttyS0 panic=3D-1 $(TES= T:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_riscv32 =3D -M virt -append "console=3DttyS0 panic=3D-1 $(TES= T:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_riscv64 =3D -M virt -append "console=3DttyS0 panic=3D-1 $(TES= T:%=3DNOLIBC_TEST=3D%)" -QEMU_ARGS_s390 =3D -M s390-ccw-virtio -append "console=3DttyS0 panic= =3D-1 $(TEST:%=3DNOLIBC_TEST=3D%)" +QEMU_ARGS_s390x =3D -M s390-ccw-virtio -append "console=3DttyS0 panic= =3D-1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_loongarch =3D -M virt -append "console=3DttyS0,115200 panic=3D-= 1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS =3D -m 1G $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_BIOS) $(Q= EMU_ARGS_EXTRA) =20 @@ -158,7 +159,7 @@ CFLAGS_i386 =3D $(call cc-option,-m32) CFLAGS_ppc =3D -m32 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64 =3D -m64 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64le =3D -m64 -mlittle-endian -mno-vsx $(call cc-option,-mabi=3D= elfv2) -CFLAGS_s390 =3D -m64 +CFLAGS_s390x =3D -m64 CFLAGS_mips32le =3D -EL -mabi=3D32 -fPIC CFLAGS_mips32be =3D -EB -mabi=3D32 CFLAGS_STACKPROTECTOR ?=3D $(call cc-option,-mstack-protector-guard=3Dglob= al $(call cc-option,-fstack-protector-all)) diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/se= lftests/nolibc/run-tests.sh index bc4e92b4f1b98278a0a72345a5cd67f1a429b6a2..e1c6e86912d5d4910f45d7061ee= 619841cf1ffd9 100755 --- a/tools/testing/selftests/nolibc/run-tests.sh +++ b/tools/testing/selftests/nolibc/run-tests.sh @@ -17,7 +17,7 @@ perform_download=3D0 test_mode=3Dsystem werror=3D1 llvm=3D -archs=3D"i386 x86_64 arm64 arm mips32le mips32be ppc ppc64 ppc64le riscv32= riscv64 s390 loongarch" +archs=3D"i386 x86_64 arm64 arm mips32le mips32be ppc ppc64 ppc64le riscv32= riscv64 s390x loongarch" =20 TEMP=3D$(getopt -o 'j:d:c:b:a:m:pelh' -n "$0" -- "$@") =20 @@ -100,6 +100,7 @@ crosstool_arch() { riscv) echo riscv64;; loongarch) echo loongarch64;; mips*) echo mips;; + s390*) echo s390;; *) echo "$1";; esac } --=20 2.48.1 From nobody Sun Dec 14 23:05:34 2025 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D82CDFC0A; Thu, 6 Feb 2025 07:10:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738825842; cv=none; b=XGcvpWvNTe6duMz5AgFTzZJwSQqhrjiLaNi5bAWe7/vjquaTNaEyBGYMFFR5pp7gXhaQetd6tfO6kKMy2z1Gy9mpAwRqVPzTDXhuTJtHiDDt6S5tK4U00p1maQVxqqAxgNii4tKNc3GFy9Z9YGV9m0yUt0FwpyA3kJL/KGMLMyE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738825842; c=relaxed/simple; bh=Xsdq4NXE16lhcQ4MiAG9uVFtsVVpTdqUxfcUaUcEIGs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=km2qQ1OYGEoX/HIzzefa2tCm629eLKSgA6eA4+vbUsj+7zHDrc2IHxD+hIxBvsBPeSg6ICo/0hE1bNfZaDVjCIF+cX679+wqa5rs3CNT/ZcOkrANV/HxXpu13EQklYc0eVTEC/qoKb2wR41Abf/EgeZBgHbjn1dVuRM0L+GTr7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=YcfqLmcz; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="YcfqLmcz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1738825829; bh=Xsdq4NXE16lhcQ4MiAG9uVFtsVVpTdqUxfcUaUcEIGs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YcfqLmczTkw4gb7ICbUddeJpsRGZ5OYc7Tvqc6wGEiFwmByHp+omiEjmTLcPugtFy BjsTkpaiufmn+6zTCfJ2Iix7O+jv7aP24+xvyluU3o8xA28EEtw2PQJ+UCOe6J/k4E LrpJnvt8EvdCXaS1bthOGsdDUXQf+gGaXKTaN3jk= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 06 Feb 2025 08:10:27 +0100 Subject: [PATCH v2 2/2] tools/nolibc: add support for 32-bit s390 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250206-nolibc-s390-v2-2-991ad97e3d58@weissschuh.net> References: <20250206-nolibc-s390-v2-0-991ad97e3d58@weissschuh.net> In-Reply-To: <20250206-nolibc-s390-v2-0-991ad97e3d58@weissschuh.net> To: Willy Tarreau , Shuah Khan , Sven Schnelle Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1738825829; l=5296; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Xsdq4NXE16lhcQ4MiAG9uVFtsVVpTdqUxfcUaUcEIGs=; b=ZvZMOAMldk55CravjTao0fE5dAmoi1DKG/qtE+eyvw2i77hiyymuBLO6shDg3kNWeky50mWzi d3u1Y2Qiqd4Cr/85+FpSGKnvD65I9H2IuJoBKKGjUl7I3LcAWE6BgBb X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 32-bit s390 is very close to the existing 64-bit implementation. Some special handling is necessary as there is neither LLVM nor QEMU support. Also the kernel itself can not build natively for 32-bit s390, so instead the test program is executed with a 64-bit kernel. Acked-by: Willy Tarreau Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/arch-s390.h | 5 +++++ tools/include/nolibc/arch.h | 2 +- tools/testing/selftests/nolibc/Makefile | 5 +++++ tools/testing/selftests/nolibc/run-tests.sh | 6 +++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s= 390.h index f9ab83a219b8a2d5e53b0b303d8bf0bf78280d5f..acfee7e9d5e2bb65718cb947110= d2c5e1cdeba9b 100644 --- a/tools/include/nolibc/arch-s390.h +++ b/tools/include/nolibc/arch-s390.h @@ -143,8 +143,13 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protec= tor _start(void) { __asm__ volatile ( +#ifdef __s390x__ "lgr %r2, %r15\n" /* save stack pointer to %r2, as arg1 of _sta= rt_c */ "aghi %r15, -160\n" /* allocate new stackframe = */ +#else + "lr %r2, %r15\n" + "ahi %r15, -96\n" +#endif "xc 0(8,%r15), 0(%r15)\n" /* clear backchain = */ "brasl %r14, _start_c\n" /* transfer to c runtime = */ ); diff --git a/tools/include/nolibc/arch.h b/tools/include/nolibc/arch.h index c8f4e5d3add9eb5b8a438900c084dc0449fcfbd6..8a2c143c0fba288147e5a7bf9db= 38ffb08367616 100644 --- a/tools/include/nolibc/arch.h +++ b/tools/include/nolibc/arch.h @@ -29,7 +29,7 @@ #include "arch-powerpc.h" #elif defined(__riscv) #include "arch-riscv.h" -#elif defined(__s390x__) +#elif defined(__s390x__) || defined(__s390__) #include "arch-s390.h" #elif defined(__loongarch__) #include "arch-loongarch.h" diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte= sts/nolibc/Makefile index 97e08b92bee32300922c27ccd7c07e9eddc7162e..14fc8c7e7c3067efddf0f729890= fb78df731efb3 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -72,6 +72,7 @@ IMAGE_riscv =3D arch/riscv/boot/Image IMAGE_riscv32 =3D arch/riscv/boot/Image IMAGE_riscv64 =3D arch/riscv/boot/Image IMAGE_s390x =3D arch/s390/boot/bzImage +IMAGE_s390 =3D arch/s390/boot/bzImage IMAGE_loongarch =3D arch/loongarch/boot/vmlinuz.efi IMAGE =3D $(objtree)/$(IMAGE_$(XARCH)) IMAGE_NAME =3D $(notdir $(IMAGE)) @@ -91,6 +92,7 @@ DEFCONFIG_riscv =3D defconfig DEFCONFIG_riscv32 =3D rv32_defconfig DEFCONFIG_riscv64 =3D defconfig DEFCONFIG_s390x =3D defconfig +DEFCONFIG_s390 =3D defconfig compat.config DEFCONFIG_loongarch =3D defconfig DEFCONFIG =3D $(DEFCONFIG_$(XARCH)) =20 @@ -114,6 +116,7 @@ QEMU_ARCH_riscv =3D riscv64 QEMU_ARCH_riscv32 =3D riscv32 QEMU_ARCH_riscv64 =3D riscv64 QEMU_ARCH_s390x =3D s390x +QEMU_ARCH_s390 =3D s390x QEMU_ARCH_loongarch =3D loongarch64 QEMU_ARCH =3D $(QEMU_ARCH_$(XARCH)) =20 @@ -142,6 +145,7 @@ QEMU_ARGS_riscv =3D -M virt -append "console=3Dtty= S0 panic=3D-1 $(TEST:%=3DNOLIBC_T QEMU_ARGS_riscv32 =3D -M virt -append "console=3DttyS0 panic=3D-1 $(TES= T:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_riscv64 =3D -M virt -append "console=3DttyS0 panic=3D-1 $(TES= T:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_s390x =3D -M s390-ccw-virtio -append "console=3DttyS0 panic= =3D-1 $(TEST:%=3DNOLIBC_TEST=3D%)" +QEMU_ARGS_s390 =3D -M s390-ccw-virtio -append "console=3DttyS0 panic= =3D-1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_loongarch =3D -M virt -append "console=3DttyS0,115200 panic=3D-= 1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS =3D -m 1G $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_BIOS) $(Q= EMU_ARGS_EXTRA) =20 @@ -160,6 +164,7 @@ CFLAGS_ppc =3D -m32 -mbig-endian -mno-vsx $(call cc-opt= ion,-mmultiple) CFLAGS_ppc64 =3D -m64 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64le =3D -m64 -mlittle-endian -mno-vsx $(call cc-option,-mabi=3D= elfv2) CFLAGS_s390x =3D -m64 +CFLAGS_s390 =3D -m31 CFLAGS_mips32le =3D -EL -mabi=3D32 -fPIC CFLAGS_mips32be =3D -EB -mabi=3D32 CFLAGS_STACKPROTECTOR ?=3D $(call cc-option,-mstack-protector-guard=3Dglob= al $(call cc-option,-fstack-protector-all)) diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools/testing/se= lftests/nolibc/run-tests.sh index e1c6e86912d5d4910f45d7061ee619841cf1ffd9..fd01aa4900c912e62722603fb97= 50bd23f27e45c 100755 --- a/tools/testing/selftests/nolibc/run-tests.sh +++ b/tools/testing/selftests/nolibc/run-tests.sh @@ -17,7 +17,7 @@ perform_download=3D0 test_mode=3Dsystem werror=3D1 llvm=3D -archs=3D"i386 x86_64 arm64 arm mips32le mips32be ppc ppc64 ppc64le riscv32= riscv64 s390x loongarch" +archs=3D"i386 x86_64 arm64 arm mips32le mips32be ppc ppc64 ppc64le riscv32= riscv64 s390x s390 loongarch" =20 TEMP=3D$(getopt -o 'j:d:c:b:a:m:pelh' -n "$0" -- "$@") =20 @@ -170,6 +170,10 @@ test_arch() { exit 1 esac printf '%-15s' "$arch:" + if [ "$arch" =3D "s390" ] && ([ "$llvm" =3D "1" ] || [ "$test_mode" =3D "= user" ]); then + echo "Unsupported configuration" + return + fi =20 mkdir -p "$build_dir" swallow_output "${MAKE[@]}" defconfig --=20 2.48.1