Message ID | 63bee74a7b3754a1b0e82bc57de52c18d2de003d.1684949268.git.falcon@tinylab.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp96032vqr; Wed, 24 May 2023 11:17:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ycLkqhC3TVYIOIqoW58WVOsEwJeZOcbbtt9MbQKfB35h6gV4PTls4pZ8ieZoWNaB6VTQ9 X-Received: by 2002:a05:6a00:1701:b0:643:ba77:f265 with SMTP id h1-20020a056a00170100b00643ba77f265mr5089837pfc.25.1684952261718; Wed, 24 May 2023 11:17:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684952261; cv=none; d=google.com; s=arc-20160816; b=YZloVeQr9ji6UMkkfMx+SAIpvoggx3kDzRqYmBOa4gLFa73g43isBhE7Zp4Y7m1FMG qvJQZU53T+c8YJd9hxsd6CgM/hkaFVr9eHvrbmx83vY22k9gJRTt0ILsmF2DK/e6lodq 7pby4wb3qS/uVGMthHNFOg/LfjPt8lan5rVJk3GgEWQjcR0Vup9zVscwnXM0nofBJoCl j/pWVEj5pwDiBV3Eshq3uwowzSmjWXF1MHYjcF+Yq07q+iU9pKbSFzlzK+uLjNSmOh0a CV0YD+P3qIlWDHTFBiZ33zDRv6rAo7azl298qk38GwT9xX7xxBAWZkGAixO5IhDu+Bfb SEHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=GX5mDlvK5xj+DUgjW2sXBWIKZyGeVQF/yEct508V02o=; b=sTI0QwteLSx52BfuPC9qILmxZ8SrQE0/qvf1Jm0ZZ68EgaGRBkeX91b353/bGWnkCr usC9zdmwU3oCgsA4MKK/cY1UtyfbDJZqkes3x+CIL+ngRR0HahUwC0OCcdh1Cpmfacg6 /dymdyy+SfqgFjQciMwQy+VlpRyBGH2g+TF35fqWg3fDIpxUGGEjA9P3lDBQ6i3jS6bg UL2LZkQMA44YVJ7ioyo2wikOiiRTgv2VFh28Z0IoQXQmmt68WeOTLN+VqMk2PhnMZddu vV2AO6gVlV1lLttiBsoYKtDHTNCETSCR3fbbD7bwRCZPw0zKg0wqBYlP0j5peEPXmLhI tIKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c187-20020a621cc4000000b006435b08fee8si611525pfc.196.2023.05.24.11.17.26; Wed, 24 May 2023 11:17:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229630AbjEXRxU (ORCPT <rfc822;jian.xie.xdx@gmail.com> + 99 others); Wed, 24 May 2023 13:53:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236347AbjEXRxS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 24 May 2023 13:53:18 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC982119; Wed, 24 May 2023 10:53:16 -0700 (PDT) X-QQ-mid: bizesmtp71t1684950791tp8m1e4l Received: from linux-lab-host.localdomain ( [116.30.125.36]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 25 May 2023 01:53:10 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: 7jw2iSiCazqOcSM2MVgG4xMJ96kdb0v9csKqpcqqtj1u7+0ZkGV3bSXiAUJcM aPAdZ6wZXqVvTeOt/M4goYfpVARuW8z6EguvDuAJLX/NMvw9T9A3DVvTtgOUPKl1YALRxBS TdLGLYANVLa841J7A+shvQ0d56mm3F+wZ2zfuMB4lB4eq2tK9eIeOca6d4tS+HIqWRd4Lr0 0CL0rD9Hk+708Xu1EYn2Ak3UMQlVPaHi14GgDDo8Tzi8zkdMP4S8OGl/mV4JGQvjMcYYFzY 5U0oHA1KcUDOfkfEGRI0VTMWnd1DPmcYH2nY7flo325+orDVrm0s9NfMyRhzR4T84rIEw17 27UMTVpM1ghVZtFwUpljIeOYNo9xmcTklQXF3dzYwF1eVQVUSdDO0Xd9JD7qA== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 2012140808971303429 From: Zhangjin Wu <falcon@tinylab.org> To: w@1wt.eu Cc: falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, palmer@dabbelt.com, paul.walmsley@sifive.com, thomas@t-8ch.de Subject: [PATCH 06/13] selftests/nolibc: allow specify a bios for qemu Date: Thu, 25 May 2023 01:52:29 +0800 Message-Id: <63bee74a7b3754a1b0e82bc57de52c18d2de003d.1684949268.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <cover.1684949267.git.falcon@tinylab.org> References: <cover.1684949267.git.falcon@tinylab.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766800503114800123?= X-GMAIL-MSGID: =?utf-8?q?1766800503114800123?= |
Series |
tools/nolibc: riscv: Add full rv32 support
|
|
Commit Message
Zhangjin Wu
May 24, 2023, 5:52 p.m. UTC
riscv qemu has a builtin bios (opensbi), but it may not match the latest
kernel and some old versions may hang during boot, let's allow user pass
a newer version to qemu via the -bios option.
we can use it like this:
$ make run BIOS=/path/to/new-bios ...
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
tools/testing/selftests/nolibc/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On 2023-05-25 01:52:29+0800, Zhangjin Wu wrote: > riscv qemu has a builtin bios (opensbi), but it may not match the latest > kernel and some old versions may hang during boot, let's allow user pass > a newer version to qemu via the -bios option. Nitpick: This seems very specific and hopefully only necessary temporarily. Instead it could be changed to some generic mechanim like "QEMU_ARGS_EXTRA"? > we can use it like this: > > $ make run BIOS=/path/to/new-bios ... > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > --- > tools/testing/selftests/nolibc/Makefile | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > index 9adc8944dd80..9213763ab3b6 100644 > --- a/tools/testing/selftests/nolibc/Makefile > +++ b/tools/testing/selftests/nolibc/Makefile > @@ -70,7 +70,8 @@ QEMU_ARGS_mips = -M malta -append "panic=-1 $(TEST:%=NOLIBC_TEST=%)" > QEMU_ARGS_riscv = -M virt -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" > QEMU_ARGS_s390 = -M s390-ccw-virtio -m 1G -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" > QEMU_ARGS_loongarch = -M virt -append "console=ttyS0,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" > -QEMU_ARGS = $(QEMU_ARGS_$(ARCH)) > +QEMU_ARGS_BIOS = $(if $(BIOS),-bios $(BIOS)) > +QEMU_ARGS = $(QEMU_ARGS_$(ARCH)) $(QEMU_ARGS_BIOS) > > # OUTPUT is only set when run from the main makefile, otherwise > # it defaults to this nolibc directory. > -- > 2.25.1 >
Hi, Thomas > On 2023-05-25 01:52:29+0800, Zhangjin Wu wrote: > > riscv qemu has a builtin bios (opensbi), but it may not match the latest > > kernel and some old versions may hang during boot, let's allow user pass > > a newer version to qemu via the -bios option. > > Nitpick: > > This seems very specific and hopefully only necessary temporarily. > RISC-V is such a new ISA and the Spec (especially the SBI) changes very frequently ;-) > Instead it could be changed to some generic mechanim like > "QEMU_ARGS_EXTRA"? > Good point, will apply it. Thanks, Zhangjin > > we can use it like this: > > > > $ make run BIOS=/path/to/new-bios ... > > > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > > --- > > tools/testing/selftests/nolibc/Makefile | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > > index 9adc8944dd80..9213763ab3b6 100644 > > --- a/tools/testing/selftests/nolibc/Makefile > > +++ b/tools/testing/selftests/nolibc/Makefile > > @@ -70,7 +70,8 @@ QEMU_ARGS_mips = -M malta -append "panic=-1 $(TEST:%=NOLIBC_TEST=%)" > > QEMU_ARGS_riscv = -M virt -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" > > QEMU_ARGS_s390 = -M s390-ccw-virtio -m 1G -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" > > QEMU_ARGS_loongarch = -M virt -append "console=ttyS0,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" > > -QEMU_ARGS = $(QEMU_ARGS_$(ARCH)) > > +QEMU_ARGS_BIOS = $(if $(BIOS),-bios $(BIOS)) > > +QEMU_ARGS = $(QEMU_ARGS_$(ARCH)) $(QEMU_ARGS_BIOS) > > > > # OUTPUT is only set when run from the main makefile, otherwise > > # it defaults to this nolibc directory.
On Fri, May 26, 2023 at 06:25:18PM +0800, Zhangjin Wu wrote: > > On 2023-05-25 01:52:29+0800, Zhangjin Wu wrote: > > > riscv qemu has a builtin bios (opensbi), but it may not match the latest > > > kernel and some old versions may hang during boot, let's allow user pass > > > a newer version to qemu via the -bios option. > > > > Nitpick: > > > > This seems very specific and hopefully only necessary temporarily. > > > > RISC-V is such a new ISA and the Spec (especially the SBI) changes very > frequently ;-) Huh. Could you please expand on which versions of QEMU will hang while booting an upstream or stable kernel? Which kernels would be good to know too. Thanks, Conor.
Hi, Conor. > > On Fri, May 26, 2023 at 06:25:18PM +0800, Zhangjin Wu wrote: > > > > On 2023-05-25 01:52:29+0800, Zhangjin Wu wrote: > > > > riscv qemu has a builtin bios (opensbi), but it may not match the latest > > > > kernel and some old versions may hang during boot, let's allow user pass > > > > a newer version to qemu via the -bios option. > > > > > > Nitpick: > > > > > > This seems very specific and hopefully only necessary temporarily. > > > > > > > RISC-V is such a new ISA and the Spec (especially the SBI) changes very > > frequently ;-) > > Huh. Could you please expand on which versions of QEMU will hang while > booting an upstream or stable kernel? Which kernels would be good to > know too. > As the cover letter listed (in the Environment section), the softwares we used are: // higher qemu version is better, latest version is v8.0.0+ $ qemu-system-riscv64 --version QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.18) Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers // opensbi version, higher is better, must match kernel version and qemu version // rv64: used version is 1.2, latest is 1.2 $ head -2 /labs/linux-lab/src/linux-stable/tools/testing/selftests/nolibc/run.out | tail -1 OpenSBI v1.2-116-g7919530 // rv32: used version is v0.9, latest is 1.2 $ head -2 /labs/linux-lab/src/linux-stable/tools/testing/selftests/nolibc/run.out | tail -1 OpenSBI v0.9-152-g754d511 The kernel version is the one this patchset based on (Willy's nolibc repo), it is v6.4-rc1. qemu v4.2.1 is the one systematically installed (/usr/bin) from the qemu-system-misc package and used to test this patchset in my Ubuntu 20.04 based test docker image. Just installed a v7.0.0 qemu from ppa:canonical-server/server-backports, there is no default opensbi, and re-checked, there is one prebuilt opensbi for rv64, but still no prebuilt opensbi for rv32. $ sudo add-apt-repository ppa:canonical-server/server-backports $ sudo apt install qemu-system-misc $ sudo apt install opensbi $ dpkg -S opensbi | grep -E "fw_*bin|elf" qemu-system-data: /usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.elf opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf $ qemu-system-riscv32 -display none -no-reboot -kernel build/riscv32/virt/linux/v6.4-rc1/arch/riscv/boot/Image -serial stdio -M virt -append "console=ttyS0 panic=-1" qemu-system-riscv32: Unable to load the RISC-V firmware "opensbi-riscv32-generic-fw_dynamic.bin" I used the one built myself, If not want to build such opensbi manually, we can download one (1.2 currently) from qemu source code: https://gitlab.com/qemu-project/qemu/-/blob/master/pc-bios/opensbi-riscv32-generic-fw_dynamic.bin Then, we can use it like this: $ qemu-system-riscv32 -display none -no-reboot -kernel build/riscv32/virt/linux/v6.4-rc1/arch/riscv/boot/Image -serial stdio -M virt -append "console=ttyS0 panic=-1" -bios /path/to/opensbi-riscv32-generic-fw_dynamic.bin Will append this extra info in the commit message of the coming new revision of this patch, thanks a lot. The hang issue I mentioned may be using one of my older prebuilt version of opensbi, I can not find which one it exactly is, so, please ignore that info, will update that description too. Btw, something not about this patch: qemu v8.0.0 seems not boot non-mmu v6.3, both sides have issues, not dig into it carefully, so, not report it yet. Thanks, Zhangjin > Thanks, > Conor.
On Fri, May 26, 2023 at 09:38:25PM +0800, Zhangjin Wu wrote: > Hi, Conor. > > > > > On Fri, May 26, 2023 at 06:25:18PM +0800, Zhangjin Wu wrote: > > > > > > On 2023-05-25 01:52:29+0800, Zhangjin Wu wrote: > > > > > riscv qemu has a builtin bios (opensbi), but it may not match the latest > > > > > kernel and some old versions may hang during boot, let's allow user pass > > > > > a newer version to qemu via the -bios option. > > > > > > > > Nitpick: > > > > > > > > This seems very specific and hopefully only necessary temporarily. > > > > > > > > > > RISC-V is such a new ISA and the Spec (especially the SBI) changes very > > > frequently ;-) > > > > Huh. Could you please expand on which versions of QEMU will hang while > > booting an upstream or stable kernel? Which kernels would be good to > > know too. > > > > As the cover letter listed (in the Environment section), the softwares we > used are: Not super interested in those ones since they work ;) > The kernel version is the one this patchset based on (Willy's nolibc > repo), it is v6.4-rc1. > > qemu v4.2.1 is the one systematically installed (/usr/bin) from the > qemu-system-misc package and used to test this patchset in my Ubuntu > 20.04 based test docker image. Okay, in the context of RISC-V, that is pretty ancient ;) > Just installed a v7.0.0 qemu from ppa:canonical-server/server-backports, > there is no default opensbi, and re-checked, there is one prebuilt > opensbi for rv64, but still no prebuilt opensbi for rv32. Ah, I see. > The hang issue I mentioned may be using one of my older prebuilt version of > opensbi, I can not find which one it exactly is, so, please ignore that info, > will update that description too. Okay. If you do manage to reproduce it, LMK! I was/am just worried we have some regressions because you should be able to keep booting with those older opensbi versions, modulo some Kconfig changes - although if it is something like qemu 4.2.1 specific I don't think I care all that much about dinosaurs ;) > Btw, something not about this patch: qemu v8.0.0 seems not boot non-mmu > v6.3, both sides have issues, not dig into it carefully, so, not report > it yet. Cool. Feel free to CC me on whatever you discover. nommu gets little enough testing in mainline, and even less in stable kernels. That reminds me, I do need to add 32-bit nommu to the patchwork automation for linux-riscv. Thanks, Conor.
On Fri, May 26, 2023 at 09:00:02AM +0200, Thomas Weißschuh wrote: > On 2023-05-25 01:52:29+0800, Zhangjin Wu wrote: > > riscv qemu has a builtin bios (opensbi), but it may not match the latest > > kernel and some old versions may hang during boot, let's allow user pass > > a newer version to qemu via the -bios option. > > Nitpick: > > This seems very specific and hopefully only necessary temporarily. > > Instead it could be changed to some generic mechanim like > "QEMU_ARGS_EXTRA"? FWIW I, too, think that QEMU_ARGS_EXTRA could be very convenient for various test cases on any architecture (change number of CPUs, RAM size, boot options etc). Willy
diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 9adc8944dd80..9213763ab3b6 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -70,7 +70,8 @@ QEMU_ARGS_mips = -M malta -append "panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_riscv = -M virt -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_s390 = -M s390-ccw-virtio -m 1G -append "console=ttyS0 panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_loongarch = -M virt -append "console=ttyS0,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" -QEMU_ARGS = $(QEMU_ARGS_$(ARCH)) +QEMU_ARGS_BIOS = $(if $(BIOS),-bios $(BIOS)) +QEMU_ARGS = $(QEMU_ARGS_$(ARCH)) $(QEMU_ARGS_BIOS) # OUTPUT is only set when run from the main makefile, otherwise # it defaults to this nolibc directory.