From nobody Wed Dec 31 16:08:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F595C00144 for ; Tue, 31 Oct 2023 20:37:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233873AbjJaUhI (ORCPT ); Tue, 31 Oct 2023 16:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbjJaUhG (ORCPT ); Tue, 31 Oct 2023 16:37:06 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C3F5F3; Tue, 31 Oct 2023 13:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1698784621; bh=W5TEpxfyI98GvsWGNdqegtj19Ji2ow6WvLtnijFpbxE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=n4hF25HXVWKd8mEbbgUYBm4ihR20qlzNQ+HSpVwYZ0Dyxux6K46kz0O/wE0STdQLi kAgIxiPHPb57Uq33RKDKEUlRTkQ2DcDl2RmFBBPFsx62v4zsFiNhcI8rhsH8ehzaCY QYpz+LR2raYl0jVsEE8m4/9Z6psF44ZSRRsOtdm8= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 31 Oct 2023 21:36:58 +0100 Subject: [PATCH 1/3] selftests/nolibc: use EFI -bios for LoongArch qemu MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20231031-nolibc-out-of-tree-v1-1-47c92f73590a@weissschuh.net> References: <20231031-nolibc-out-of-tree-v1-0-47c92f73590a@weissschuh.net> In-Reply-To: <20231031-nolibc-out-of-tree-v1-0-47c92f73590a@weissschuh.net> To: Willy Tarreau , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Shuah Khan Cc: Zhangjin Wu , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698784620; l=2150; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=W5TEpxfyI98GvsWGNdqegtj19Ji2ow6WvLtnijFpbxE=; b=xfctWRM9ByPw1ywv0Ip8sy2zDAjHMebbxY8PmyqXN0WXGJfH8FEL+EaPzaUfkLdhn+v4leaZJ gn5w5DGsQANAJ1fxefufQIpB4RQnW7gkA8yv1qsGCJhQiF5j71lHhT2 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org qemu for LoongArch does not work properly with direct kernel boot. The kernel will panic during initialization and hang without any output. When booting in EFI mode everything work correctly. While users most likely don't have the LoongArch EFI binary installed at least an explicit error about 'file not found' is better than a hanging test without output that can never succeed. Link: https://lore.kernel.org/loongarch/1738d60a-df3a-4102-b1da-d16a29b6e06= a@t-8ch.de/ Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Willy Tarreau --- tools/testing/selftests/nolibc/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte= sts/nolibc/Makefile index a0fc07253baf..eb258ae1d948 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -88,6 +88,13 @@ QEMU_ARCH_s390 =3D s390x QEMU_ARCH_loongarch =3D loongarch64 QEMU_ARCH =3D $(QEMU_ARCH_$(XARCH)) =20 +QEMU_BIOS_DIR =3D /usr/share/edk2/ +QEMU_BIOS_loongarch =3D $(QEMU_BIOS_DIR)/loongarch64/OVMF_CODE.fd + +ifneq ($(QEMU_BIOS_$(XARCH)),) +QEMU_ARGS_BIOS =3D -bios $(QEMU_BIOS_$(XARCH)) +endif + # QEMU_ARGS : some arch-specific args to pass to qemu QEMU_ARGS_i386 =3D -M pc -append "console=3DttyS0,9600 i8042.noaux p= anic=3D-1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_x86_64 =3D -M pc -append "console=3DttyS0,9600 i8042.noaux p= anic=3D-1 $(TEST:%=3DNOLIBC_TEST=3D%)" @@ -101,7 +108,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_s390 =3D -M s390-ccw-virtio -m 1G -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 $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_EXTRA) +QEMU_ARGS =3D $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_BIOS) $(QEMU_AR= GS_EXTRA) =20 # OUTPUT is only set when run from the main makefile, otherwise # it defaults to this nolibc directory. --=20 2.42.0 From nobody Wed Dec 31 16:08:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9023C4332F for ; Tue, 31 Oct 2023 20:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234108AbjJaUhO (ORCPT ); Tue, 31 Oct 2023 16:37:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231546AbjJaUhG (ORCPT ); Tue, 31 Oct 2023 16:37:06 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77B5CFE; Tue, 31 Oct 2023 13:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1698784621; bh=EnUH+FVtH/2LFDhbHmODszdfsWGWE/DcG346HqhXK2g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ILFzcJGCaPzR71nWlxIIPD1cs/We2OEt3ALO3BSVTtTWr1NTNNNy+kbFajQCMI0rl UF15W+0CBkN7+cnM5kKPHx5P2LpT9+waoCNmMjIiPA1ObsZCIp5EZVAISb71fAJuTp xD6mT5FVK/xv+w5le+r09255Ut6k1Vq+S1WHeUhk= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 31 Oct 2023 21:36:59 +0100 Subject: [PATCH 2/3] selftests/nolibc: anchor paths in $(srcdir) if possible MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20231031-nolibc-out-of-tree-v1-2-47c92f73590a@weissschuh.net> References: <20231031-nolibc-out-of-tree-v1-0-47c92f73590a@weissschuh.net> In-Reply-To: <20231031-nolibc-out-of-tree-v1-0-47c92f73590a@weissschuh.net> To: Willy Tarreau , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Shuah Khan Cc: Zhangjin Wu , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698784620; l=1515; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=EnUH+FVtH/2LFDhbHmODszdfsWGWE/DcG346HqhXK2g=; b=RyW5XWFgW1+NuFvftheWO5iwivD2gAnupVLHTHp8ifnMh4hICk7oPe+PXPm7mzSOXQmGA6qel RDDWr1IzXaRB4e+KhoiljXuY/mGYwi8aa8cQa/37gAFhDwayUvEqas3 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is easier to recognize paths from their well-known location in the source tree than having to resolve the relative path in ones head. Acked-by: Willy Tarreau Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/nolibc/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte= sts/nolibc/Makefile index eb258ae1d948..b1129be98376 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -174,7 +174,7 @@ sysroot: sysroot/$(ARCH)/include sysroot/$(ARCH)/include: $(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot $(QUIET_MKDIR)mkdir -p sysroot - $(Q)$(MAKE) -C ../../../include/nolibc ARCH=3D$(ARCH) OUTPUT=3D$(CURDIR)/= sysroot/ headers_standalone + $(Q)$(MAKE) -C $(srctree)/tools/include/nolibc ARCH=3D$(ARCH) OUTPUT=3D$(= CURDIR)/sysroot/ headers_standalone $(Q)mv sysroot/sysroot sysroot/$(ARCH) =20 ifneq ($(NOLIBC_SYSROOT),0) @@ -184,7 +184,7 @@ nolibc-test: nolibc-test.c nolibc-test-linkage.c sysroo= t/$(ARCH)/include else nolibc-test: nolibc-test.c nolibc-test-linkage.c $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \ - -nostdlib -static -include ../../../include/nolibc/nolibc.h nolibc-test= .c nolibc-test-linkage.c -lgcc + -nostdlib -static -include $(srctree)/tools/include/nolibc/nolibc.h nol= ibc-test.c nolibc-test-linkage.c -lgcc endif =20 libc-test: nolibc-test.c nolibc-test-linkage.c --=20 2.42.0 From nobody Wed Dec 31 16:08:16 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 578E1C4167D for ; Tue, 31 Oct 2023 20:37:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234090AbjJaUhL (ORCPT ); Tue, 31 Oct 2023 16:37:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbjJaUhG (ORCPT ); Tue, 31 Oct 2023 16:37:06 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62480F9; Tue, 31 Oct 2023 13:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1698784621; bh=LNx+nj4jlE223VhzZ9GFi7fWQ5Fyb/XHvEpIBKCFyVM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GHEQO9ebq4PLKKuavypuPdsKYAWA8jQ3FdQE572za9KmzKD/5aHkznU/oKFr+nvAA wHIZQ55uC4ZX8MAZWYAoXOUGqp2p4dNd2h5pWZ59WxUauUdl21qw5+f1Lm0V0nK8o+ unVBlzuKOc3qS32OuEc0ZTDD7jTZN0/RzvBRgrmk= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 31 Oct 2023 21:37:00 +0100 Subject: [PATCH 3/3] selftests/nolibc: support out-of-tree builds MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20231031-nolibc-out-of-tree-v1-3-47c92f73590a@weissschuh.net> References: <20231031-nolibc-out-of-tree-v1-0-47c92f73590a@weissschuh.net> In-Reply-To: <20231031-nolibc-out-of-tree-v1-0-47c92f73590a@weissschuh.net> To: Willy Tarreau , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Shuah Khan Cc: Zhangjin Wu , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698784620; l=4087; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=LNx+nj4jlE223VhzZ9GFi7fWQ5Fyb/XHvEpIBKCFyVM=; b=TyJDLtPEizhFex+t38T4ccb988q2/Hc4CqgbIfibOz8zcilrEO/oxpLY4PuAYAfPLiZ9Q5QzK /633oAtcuJ/AQUmBFWa6JJqhBE+U6Fxh8nQtdlKHFMuYgBkK4ZOqrdX X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Out of tree builds are much more convenient when building for multiple architectures or configurations in parallel. Only absolute O=3D parameters are supported as Makefile.include will always resolve relative paths in relation to $(srctree) instead of the current directory. Add a call to "make outputmakefile" to verify that the sourcetree is clean. This is based on Zhangjins out-of-tree patch. It extends that work for get_init_cpio support and also drops relative O=3D specifications explicitly. Link: https://lore.kernel.org/lkml/06d96bd81fe812a9718098a383678ad3beba98b1= .1691215074.git.falcon@tinylab.org/ Co-developed-by: Zhangjin Wu Signed-off-by: Zhangjin Wu Acked-by: Willy Tarreau Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/nolibc/Makefile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte= sts/nolibc/Makefile index b1129be98376..c5df1617cbc3 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -1,9 +1,16 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for nolibc tests include ../../../scripts/Makefile.include +include ../../../scripts/utilities.mak # We need this for the "cc-option" macro. include ../../../build/Build.include =20 +ifneq ($(O),) +ifneq ($(call is-absolute,$(O)),y) +$(error Only absolute O=3D parameters are supported) +endif +endif + # we're in ".../tools/testing/selftests/nolibc" ifeq ($(srctree),) srctree :=3D $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR))) @@ -14,6 +21,8 @@ include $(srctree)/scripts/subarch.include ARCH =3D $(SUBARCH) endif =20 +objtree ?=3D $(srctree) + # XARCH extends the kernel's ARCH with a few variants of the same # architecture that only differ by the configuration, the toolchain # and the Qemu program used. It is copied as-is into ARCH except for @@ -52,7 +61,7 @@ IMAGE_ppc64le =3D arch/powerpc/boot/zImage IMAGE_riscv =3D arch/riscv/boot/Image IMAGE_s390 =3D arch/s390/boot/bzImage IMAGE_loongarch =3D arch/loongarch/boot/vmlinuz.efi -IMAGE =3D $(IMAGE_$(XARCH)) +IMAGE =3D $(objtree)/$(IMAGE_$(XARCH)) IMAGE_NAME =3D $(notdir $(IMAGE)) =20 # default kernel configurations that appear to be usable @@ -174,6 +183,7 @@ sysroot: sysroot/$(ARCH)/include sysroot/$(ARCH)/include: $(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot $(QUIET_MKDIR)mkdir -p sysroot + $(Q)$(MAKE) -C $(srctree) outputmakefile $(Q)$(MAKE) -C $(srctree)/tools/include/nolibc ARCH=3D$(ARCH) OUTPUT=3D$(= CURDIR)/sysroot/ headers_standalone $(Q)mv sysroot/sysroot sysroot/$(ARCH) =20 @@ -206,7 +216,7 @@ run-user: nolibc-test $(Q)$(REPORT) $(CURDIR)/run.out =20 initramfs.cpio: kernel nolibc-test - $(QUIET_GEN)echo 'file /init nolibc-test 755 0 0' | $(srctree)/usr/gen_in= it_cpio - > initramfs.cpio + $(QUIET_GEN)echo 'file /init nolibc-test 755 0 0' | $(objtree)/usr/gen_in= it_cpio - > initramfs.cpio =20 initramfs: nolibc-test $(QUIET_MKDIR)mkdir -p initramfs @@ -224,12 +234,12 @@ kernel-standalone: initramfs =20 # run the tests after building the kernel run: kernel initramfs.cpio - $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)= /$(IMAGE)" -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/r= un.out" + $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" = -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" $(Q)$(REPORT) $(CURDIR)/run.out =20 # re-run the tests from an existing kernel rerun: - $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)= /$(IMAGE)" -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/r= un.out" + $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" = -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" $(Q)$(REPORT) $(CURDIR)/run.out =20 # report with existing test log --=20 2.42.0