From patchwork Sat Aug 5 19:38:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13342668 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 60B83C001DB for ; Sat, 5 Aug 2023 19:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230302AbjHETi1 (ORCPT ); Sat, 5 Aug 2023 15:38:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230300AbjHETi0 (ORCPT ); Sat, 5 Aug 2023 15:38:26 -0400 X-Greylist: delayed 114 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 05 Aug 2023 12:38:22 PDT Received: from bg5.exmail.qq.com (bg5.exmail.qq.com [43.155.80.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F0B919B2 for ; Sat, 5 Aug 2023 12:38:21 -0700 (PDT) X-QQ-mid: bizesmtp82t1691264283te037nhn Received: from linux-lab-host.localdomain ( [116.30.131.233]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 06 Aug 2023 03:38:01 +0800 (CST) X-QQ-SSF: 01200000000000E0X000B00A0000000 X-QQ-FEAT: +Fw3Sd5mYDVqz4iAmVsa/lmFOKZPfF6chMKgeqPNECbG7H6X5GX9IjhBCT5TW FMmSjX/F+mQ4P9NIraT9+IyeVmeqTbHBFi70LeA2rhjEC3NSD8ZkH5KuwG14X1t0z2KhjKk CkCoYpnHjhx1P1T2+CVVfgZH9og9o6+WdcRYyvxeWSuR3AXvp4WCkSWJbaCOT5O2bghaC4J SKVKn7NDb2JJELT65wI4MiVAbycc0wUs7mkvQf1cyNwjmxXQCcmb56Ie2fFtmGZHGAUrK7p vywfLbTylX1T6dyP+kGsKuA24+NXuWpol8WAarUqpjw3s4OEc9g8OSfsWjrbF7rnlEqqIGD ZXRuhcGEuPoB7ao2/Bq4seBiVd3XsKYblhrG9FrE8hCwl7pUN57qAyC7fsKIPf3YCTrDXf/ X-QQ-GoodBg: 0 X-BIZMAIL-ID: 7154856130623740030 From: Zhangjin Wu To: w@1wt.eu Cc: falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v1 1/4] selftests/nolibc: allow use x86_64 toolchain for i386 Date: Sun, 6 Aug 2023 03:38:01 +0800 Message-Id: <4b0af38b9a799835b1bb89445da7a40b0df79b54.1691263493.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This allows to share the same x86_64 toolchain for i386 architecture. Pass '-m32' CFLAGS to tell x86_64 toolchains to generate i386 executable. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index b4171a754eb2..e2b02761ad44 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -122,6 +122,7 @@ else Q=@ endif +CFLAGS_i386 = -m32 CFLAGS_ppc = -m32 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64 = -m64 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64le = -m64 -mlittle-endian -mno-vsx $(call cc-option,-mabi=elfv2) From patchwork Sat Aug 5 19:44:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13342680 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 78539C001DB for ; Sat, 5 Aug 2023 19:44:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229558AbjHETop (ORCPT ); Sat, 5 Aug 2023 15:44:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjHETop (ORCPT ); Sat, 5 Aug 2023 15:44:45 -0400 X-Greylist: delayed 388 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 05 Aug 2023 12:44:39 PDT Received: from smtpbgeu1.qq.com (smtpbgeu1.qq.com [52.59.177.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B7D91732; Sat, 5 Aug 2023 12:44:38 -0700 (PDT) X-QQ-mid: bizesmtp70t1691264671t108lc7o Received: from linux-lab-host.localdomain ( [116.30.131.233]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 06 Aug 2023 03:44:30 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: zT6n3Y95oi1y8fInte+k+VHvD3XvDVwfE8g+6rqb4AalVd+4Dp8ranF9L+Uj4 FgiLWpRUWNssQ6BCu3QpEgULh0+D/vQtwuqkIXWYGYlD+YIAz5eQv/h/FUeYLMOXuvHWr3U iZVd5cYtdKsLGjzv0XBVn8z2/lm0WxRoq4SwkO4RpyypFtUdzMcoI1cJDkq62YP1K3/H/W+ wE6UYkpZpbAwgMGvNLShExMa42TNO0QIB4hfIYreA0tA1Hg7gukvqVND8Z0HWwXn6bT2kdP MSQLwxMRj5O4r50e1fdPek4yKGvwE/wGNjf29Tijk9xfzyE5HP/JMcYACthhu3MZ7M1uMch ji0eYxYDIBWe/zp5CyFRzpVGCZPo25ZKSscKXyVDtlNgvHXJQ1CPYQTW4+H9oUG8CotnEqf X-QQ-GoodBg: 0 X-BIZMAIL-ID: 7505355185918316706 From: Zhangjin Wu To: w@1wt.eu Cc: falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v1 2/4] selftests/nolibc: customize CROSS_COMPILE for many architectures Date: Sun, 6 Aug 2023 03:44:29 +0800 Message-Id: <3ec048008a9b2c1ed7406214c6899e5412a97596.1691263493.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This simplifies the 'make' commands for most of nolibc supported architectures, only requires the XARCH option now. Almost all distributions provide qemu and toolchains for i386, x86_64, arm64, arm, mips, riscv and s390, let's customize the local toolchains for them. The fresh new loongarch is an exception, which is not covered here. If want to use another toolchain which is not customized here, we can also pass CROSS_COMPILE, CROSS_COMPILE_$(XARCH) and even CC from command line. After carefully install and configure $(CROSS_COMPILE_$(XARCH)) and qemu-$(XARCH), it is able to run tests for the architectures or their variants like this: $ ARCHS="i386 x86_64 arm64 arm mips ppc ppc64 ppc64le riscv s390" $ for arch in ${ARCHS[@]}; do printf "%9s: " $arch; make run-user XARCH=$arch | grep status; done i386: 165 test(s): 157 passed, 8 skipped, 0 failed => status: warning x86_64: 165 test(s): 157 passed, 8 skipped, 0 failed => status: warning arm64: 165 test(s): 157 passed, 8 skipped, 0 failed => status: warning arm: 165 test(s): 156 passed, 9 skipped, 0 failed => status: warning mips: 165 test(s): 156 passed, 9 skipped, 0 failed => status: warning ppc: 165 test(s): 157 passed, 8 skipped, 0 failed => status: warning ppc64: 165 test(s): 157 passed, 8 skipped, 0 failed => status: warning ppc64le: 165 test(s): 157 passed, 8 skipped, 0 failed => status: warning riscv: 165 test(s): 156 passed, 9 skipped, 0 failed => status: warning s390: 165 test(s): 156 passed, 9 skipped, 0 failed => status: warning [1]: https://mirrors.edge.kernel.org/pub/tools/crosstool/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index e2b02761ad44..d32694656221 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -56,9 +56,17 @@ IMAGE = $(IMAGE_$(XARCH)) IMAGE_NAME = $(notdir $(IMAGE)) # CROSS_COMPILE: cross toolchain prefix by architecture +CROSS_COMPILE_i386 ?= x86_64-linux-gnu- +CROSS_COMPILE_x86_64 ?= x86_64-linux-gnu- +CROSS_COMPILE_x86 ?= x86_64-linux-gnu- +CROSS_COMPILE_arm64 ?= aarch64-linux-gnu- +CROSS_COMPILE_arm ?= arm-linux-gnueabi- +CROSS_COMPILE_mips ?= mipsel-linux-gnu- CROSS_COMPILE_ppc ?= powerpc-linux-gnu- CROSS_COMPILE_ppc64 ?= powerpc64le-linux-gnu- CROSS_COMPILE_ppc64le ?= powerpc64le-linux-gnu- +CROSS_COMPILE_riscv ?= riscv64-linux-gnu- +CROSS_COMPILE_s390 ?= s390x-linux-gnu- CROSS_COMPILE ?= $(CROSS_COMPILE_$(XARCH)) # make sure CC is prefixed with CROSS_COMPILE From patchwork Sat Aug 5 19:49:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13342689 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 E1FF7C001DB for ; Sat, 5 Aug 2023 19:49:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229602AbjHETt6 (ORCPT ); Sat, 5 Aug 2023 15:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjHETt5 (ORCPT ); Sat, 5 Aug 2023 15:49:57 -0400 Received: from smtpbg153.qq.com (smtpbg153.qq.com [13.245.218.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BACB1735; Sat, 5 Aug 2023 12:49:51 -0700 (PDT) X-QQ-mid: bizesmtp66t1691264978thj6pd57 Received: from linux-lab-host.localdomain ( [116.30.131.233]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 06 Aug 2023 03:49:36 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: lqtbexAaCVZhzOs8uzrbWiq+FweKzI5eb559canfa+LqYMjso6Pqha3omXgLC JZHlagED1Cz2ZhF4vz8byvY9U5LnxbK9ol/gNiTB7wMZUPpHEjFpkeBoTDrmx8V7Pfs5EMD qmfOIJ4RVrStZke1mKCzpn3Bwd/z7v7kDGnNvj4U9wAcgqwigNpQr0FekbOU8EjevHa5Gr4 cW+pNLZZuUK47jUvNmb6xbxfz2OEoy49vucbIbckzy45yYKwbwz8gyXCeJlxxMxFjAg+gBq M0OX69RBEpubuAmHOjMd895rSUFrAVQbYMwvl5e/wnscSNLgjDrxHlAmdrjRav/u5eJCivy PFty/wT9IKrPq9nvfxR8iWd7W49zUwb2U1u8G1DV4qbXFxi64qqOnk8WHhvvDN6lRjV2p80 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 1178898553885916269 From: Zhangjin Wu To: w@1wt.eu Cc: falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v1 3/4] selftests/nolibc: customize CROSS_COMPILE for loongarch Date: Sun, 6 Aug 2023 03:49:35 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Loongarch is a fresh new architecture, there is no prebuilt toolchain from most of local software repositories, let's use the one from [1]. [1]: https://mirrors.edge.kernel.org/pub/tools/crosstool/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index d32694656221..9cd6dc0e8b75 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -56,6 +56,14 @@ IMAGE = $(IMAGE_$(XARCH)) IMAGE_NAME = $(notdir $(IMAGE)) # CROSS_COMPILE: cross toolchain prefix by architecture +# +# Notes: +# - Loongarch may require toolchain from +# https://mirrors.edge.kernel.org/pub/tools/crosstool/ +# +# For an external toolchain, please add its bin/ path to 'PATH' and then pass +# CROSS_COMPLE, CROSS_COMPILE_$(XARCH), or even CC from command line. + CROSS_COMPILE_i386 ?= x86_64-linux-gnu- CROSS_COMPILE_x86_64 ?= x86_64-linux-gnu- CROSS_COMPILE_x86 ?= x86_64-linux-gnu- @@ -67,6 +75,7 @@ CROSS_COMPILE_ppc64 ?= powerpc64le-linux-gnu- CROSS_COMPILE_ppc64le ?= powerpc64le-linux-gnu- CROSS_COMPILE_riscv ?= riscv64-linux-gnu- CROSS_COMPILE_s390 ?= s390x-linux-gnu- +CROSS_COMPILE_loongarch ?= loongarch64-linux- CROSS_COMPILE ?= $(CROSS_COMPILE_$(XARCH)) # make sure CC is prefixed with CROSS_COMPILE From patchwork Sat Aug 5 19:51:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13342690 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 49455C001DE for ; Sat, 5 Aug 2023 19:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230018AbjHETvh (ORCPT ); Sat, 5 Aug 2023 15:51:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjHETvg (ORCPT ); Sat, 5 Aug 2023 15:51:36 -0400 Received: from smtpbg151.qq.com (smtpbg151.qq.com [18.169.211.239]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 372E31732; Sat, 5 Aug 2023 12:51:33 -0700 (PDT) X-QQ-mid: bizesmtp67t1691265086t04ajod9 Received: from linux-lab-host.localdomain ( [116.30.131.233]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 06 Aug 2023 03:51:25 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: 6/K5pWSRdGrRjODcvNiQftqMfOO2iuufKpsmwsfx8k2oOEX0y0jwaHhX2ETsf rx9aOsFRfFMpmmGQhGg7ZnoqsgnzgoX3xMBBdppRyprE2eUfr61jrxqePZmOxeQr67tR7Fc AYTVKv1+fTIkEn3loGGbkm8znfzaAeuWPMIF+SzyPr+cUI+Iculjh+vXksSfLlZVV0wvqWA 9cPejpIknACLC2qSp3Iqb88p58Vbi/xLLTG/aTQ7tNNyIBCSG+k2RS5ujZ9NMIMNFTuy8Ua 6zgrzkGt4PorpRdcZYLUL9dEFdPAtnOpMKfMj6A0T4xmZ7SJRwF33TrVr/kVKPAOq/qhQaQ NYDsiSLVf+SoRRzPFHi2dX2PT4vieUwYcXVQpl0pYhcTYjFYadtHN8zsUKpr2X3ol+8Xz5A X-QQ-GoodBg: 0 X-BIZMAIL-ID: 5326708501739933189 From: Zhangjin Wu To: w@1wt.eu Cc: falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v1 4/4] selftests/nolibc: add some notes about qemu tools Date: Sun, 6 Aug 2023 03:51:24 +0800 Message-Id: <6de680acbc2d87e13a680d4453ef022568bf489b.1691263493.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Almost all distributions provide qemu-system-$(XARCH), their firmwares and qemu-$(XARCH), but for the new riscv and loongarch, users may still need to download external firmwares or compile qemu from scratch, let's add some notes about them. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 9cd6dc0e8b75..1e92bb5138db 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -100,6 +100,18 @@ DEFCONFIG = $(DEFCONFIG_$(XARCH)) TEST = # QEMU_ARCH: arch names used by qemu +# +# Notes: +# - qemu-system of riscv may require latest firmware from +# https://github.com/riscv-software-src/opensbi/releases/ +# - qemu-system of loongarch may require latest firmware from +# https://github.com/loongson/Firmware/tree/main/LoongArchVirtMachine +# +# If qemu-$(XARCH) or qemu-system-$(XARCH) is missing from software repository, +# please compile them with help from https://wiki.qemu.org/Documentation +# +# To specify a firmware, please pass QEMU_ARGS_EXTRA="-bios dir/to/firmware" + QEMU_ARCH_i386 = i386 QEMU_ARCH_x86_64 = x86_64 QEMU_ARCH_x86 = x86_64 @@ -114,7 +126,7 @@ QEMU_ARCH_s390 = s390x QEMU_ARCH_loongarch = loongarch64 QEMU_ARCH = $(QEMU_ARCH_$(XARCH)) -# QEMU_ARGS : some arch-specific args to pass to qemu +# QEMU_ARGS: some arch-specific args to pass to qemu QEMU_ARGS_i386 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_x86_64 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_x86 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)"