Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6964191rwd; Tue, 6 Jun 2023 04:43:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7HWvtZB2M9ytQ2rEjvBQ2z97e3Rjy1dxyghFfiw3g24JD0gKlCofjsDKjVsaE8kU6wO4EP X-Received: by 2002:a17:902:ce84:b0:1b2:a63:95aa with SMTP id f4-20020a170902ce8400b001b20a6395aamr2217530plg.54.1686051817975; Tue, 06 Jun 2023 04:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686051817; cv=none; d=google.com; s=arc-20160816; b=Hp8BDWgnhlY+x6qLNbTJUOUSCPgTggrdE7BHHe6hhO+2oVNTi+s9ySZwzS4GAdWRP1 Y80hE1xF5y4vH7gserRJkOS8H7CB3tdb1ASt6Lmfh1ssXTMPzViipHhsXDGApk82f2+0 3mB7GQ1SSyWwd3janTvEj9EjL+9MIUD18b75q59Gjb4y0W8PWCdfZC2+f4LzlqV/t6Q4 /q1VelZBxbIj9ll/uek+IepxN+YzJPYPwvf/y03x6j/ewZ5Tkjt87nkfrdt3JKJ7BLP+ Y3K3VgclT9EHpVNkIKSetmJuN5jPazmYDZDpU7J3KeJctJDb5hRoZ4WVDKJruxDKHFo6 NZfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=1xn4EnfXPYPcSd+SYlCMqeGdlk7+uLOsdP8xB0JMCIg=; b=zmRaNlGqRJUtD1avfT/FNhGJ91HcKKn44M2mOWk3YOWus4fHtuBQ3C6soCmIOQ6P4p GcxHaimYuR8KuTfzvhuFT7FEyK6iv4idykZjd14BVGvbupyKHN/5e2pwAY+R4gc8JAdp L3lo4KHSVHEavRaVdpltGRXZt/NKYuqxZ6IQAGR116fdMl+kpcjbPx+r3S9WdRj5P8Un 41gTgD1cmqw1pa9+pPcAgrIkIe13VtufPtgdgOSOSAGi9pBt7L23AmP2fXuJGHjOiLhp dUjwUL8ase8ZjoINkGdGrbwKzbsra7NIJid8UH5/E5SZZqTSz2CgKdy06zb9aId26STS Uiqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=Ql8KhoFv; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=SoXI6SuT; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y19-20020a170902ed5300b001b06fa47450si6985060plb.531.2023.06.06.04.43.26; Tue, 06 Jun 2023 04:43:37 -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; dkim=pass header.i=@arndb.de header.s=fm1 header.b=Ql8KhoFv; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=SoXI6SuT; 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 S234238AbjFFLWB (ORCPT + 99 others); Tue, 6 Jun 2023 07:22:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234742AbjFFLVt (ORCPT ); Tue, 6 Jun 2023 07:21:49 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90568E5E; Tue, 6 Jun 2023 04:21:48 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id F33D95C01BC; Tue, 6 Jun 2023 07:21:47 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Tue, 06 Jun 2023 07:21:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1686050507; x=1686136907; bh=1x n4EnfXPYPcSd+SYlCMqeGdlk7+uLOsdP8xB0JMCIg=; b=Ql8KhoFvs6janwDPYm OzFnqZbirQ3Y1K/vaWQUlfwmD6LLsen3JVt1Trqjhmh1d6XJaad8lWQ/Lnqi3H60 f0DMSkIZbX1RAd1S3OiQgOy/huyUyDrgIK311sNrC9SVe4CMaC12/NySF6Oi6SYI T0xJtHVXbRqTxA346xGMtBCkMTiR2bjcah9oeGV2pehTWN+Q3m3QOs4UtlEHfor1 ATqjmdDuCG/8IVRJsw19UFeisjALKMEEuIhKJdMFkSP8zmyYOXO9cjCwPMV7JrHG 1moLS1VazweI4fT39KVr/Wvxh/U+JubvzNVd6GTLfWGvvbT4Ax8XHQg7Qeu0d1jz oE9g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1686050507; x=1686136907; bh=1xn4EnfXPYPcS d+SYlCMqeGdlk7+uLOsdP8xB0JMCIg=; b=SoXI6SuToid++cgZQHF+nQwl5JUOj B7iVXV2kSaTM6n4O/WMF/pZSxe14Lp/NszNzLEzghNRlmhh6PkKz9aQA5GIadIcy sVd8mf1y9DyNR4aAqyb+xyfP7lC4ROYB24Y7TcxuPswg7T83xu0gmOF1rJTnXQf2 5RpPjxVsykYqTUgp8VfuoP85DUjrQDAf4b6iBvcm3gTGn1cjnadFvHmfy8jA4aRd DKGFVTgCMoPfmpDSn1XVpoU4/ymakGZlF+kuwniJd/wRlYPDe6tOvonLCmNdwqUw vcOxpswbtRteBo6hIP4O69/NM0zUMLBp+pp81ElMQehHzbt1h+AwapsAg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedtuddggedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id DC0D9B60086; Tue, 6 Jun 2023 07:21:46 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-447-ge2460e13b3-fm-20230525.001-ge2460e13 Mime-Version: 1.0 Message-Id: <63133024-e986-44e2-86f5-efc1c42207ac@app.fastmail.com> In-Reply-To: <20230606111216.524384-1-falcon@tinylab.org> References: <20230606111216.524384-1-falcon@tinylab.org> Date: Tue, 06 Jun 2023 13:21:26 +0200 From: "Arnd Bergmann" To: "Zhangjin Wu" , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , "Willy Tarreau" Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v3 3/3] selftests/nolibc: riscv: customize makefile for rv32 Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 6, 2023, at 13:12, Zhangjin Wu wrote: >> On Sat, Jun 3, 2023, at 11:05, Zhangjin Wu wrote: >> would seem more consistent with how x86 is handled, and would >> probably be more easily extensible if we want to also make >> this work with other sub-targets like mipseb, armv5 or ppc32 >> in the future. > > As Arnd and Thomas suggested to align with x86, I just tried to find a > solution to avoid mixing the use of _ARCH and ARCH in this Makefile. > > Since both riscv32 and riscv64 share the same SRCARCH=riscv (arch/riscv), > and the kernel side doesn't accept riscv32 or riscv64 currently, we need to > manually convert them to _ARCH=riscv and pass them to the kernel makefile > like this: ARCH=$(_ARCH), it mixes the use of _ARCH and ARCH, this is why I > used the '$(if' method currently. > > The solution is adding something like x86 in the kernel Makefile: > > diff --git a/Makefile b/Makefile > index 9d765ebcccf1..a442c893d795 100644 > --- a/Makefile > +++ b/Makefile > @@ -415,6 +415,14 @@ ifeq ($(ARCH),parisc64) > SRCARCH := parisc > endif > > +# Additional ARCH settings for riscv > +ifeq ($(ARCH),riscv32) > + SRCARCH := riscv > +endif > +ifeq ($(ARCH),riscv64) > + SRCARCH := riscv > +endif > + > export cross_compiling := > ifneq ($(SRCARCH),$(SUBARCH)) > cross_compiling := 1 I've never been a big fan of the top-level $(ARCH) setting in the kernel, is there a reason this has to be the same as the variable in tools/include/nolibc? If not, I'd just leave the Linux Makefile unchanged. For userspace we have a lot more target names than arch/*/ directories in the kernel, and I don't think I'd want to enumerate all the possibilities in the build system globally. > b/tools/testing/selftests/nolibc/Makefile > index 4a3a105e1fdf..1b2247a6365d 100644 > --- a/tools/testing/selftests/nolibc/Makefile > +++ b/tools/testing/selftests/nolibc/Makefile > @@ -21,6 +21,8 @@ IMAGE_x86 = arch/x86/boot/bzImage > IMAGE_arm64 = arch/arm64/boot/Image > IMAGE_arm = arch/arm/boot/zImage > IMAGE_mips = vmlinuz > +IMAGE_riscv32 = arch/riscv/boot/Image > +IMAGE_riscv64 = arch/riscv/boot/Image > IMAGE_riscv = arch/riscv/boot/Image > IMAGE_s390 = arch/s390/boot/bzImage > IMAGE_loongarch = arch/loongarch/boot/vmlinuz.efi > @@ -34,6 +36,8 @@ DEFCONFIG_x86 = defconfig > DEFCONFIG_arm64 = defconfig > DEFCONFIG_arm = multi_v7_defconfig > DEFCONFIG_mips = malta_defconfig > +DEFCONFIG_riscv32 = rv32_defconfig > +DEFCONFIG_riscv64 = defconfig ... Right, that part looks good to me. Arnd