Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751380AbdFFE4p (ORCPT ); Tue, 6 Jun 2017 00:56:45 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:33604 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751290AbdFFE4k (ORCPT ); Tue, 6 Jun 2017 00:56:40 -0400 Date: Mon, 05 Jun 2017 21:56:33 -0700 (PDT) X-Google-Original-Date: Mon, 05 Jun 2017 16:10:50 PDT (-0700) From: Palmer Dabbelt To: Arnd Bergmann CC: linux-kernel@vger.kernel.org CC: olof@lixom.net CC: albert@sifive.com Subject: Re: [PATCH 1/7] RISC-V: Top-Level Makefile for riscv{32,64} In-Reply-To: Message-ID: Mime-Version: 1.0 (MHng) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3331 Lines: 73 On Mon, 29 May 2017 03:50:47 PDT (-0700), Arnd Bergmann wrote: > On Sat, May 27, 2017 at 2:57 AM, Palmer Dabbelt wrote: >> On Tue, 23 May 2017 04:30:50 PDT (-0700), Arnd Bergmann wrote: >>> On Tue, May 23, 2017 at 2:41 AM, Palmer Dabbelt wrote: >>>> RISC-V has both 32-bit and 64-bit base ISAs, but they are very similar. >>>> Like some other platforms, we'd like to share one arch directory between >>>> the two of them. >>> >>> I think we mainly do the others for backwards-compatibility with ancient >>> build scripts, and we don't need that here. Instead, you could add one more >>> line to the 'SUBARCH:=' statement that interprets the uname output. >> >> I don't think that does the same thing. The desired effect of this diff is: >> >> * "uname -m" when running on a RISC-V machine returns either riscv32 or >> riscv64, as that's what tools like autoconf expect when trying to find >> tuples. >> >> * I can cross compile for riscv32 and riscv64. That's currently controlled by >> a Kconfig setting, but ARCH=riscv32 vs ARCH=riscv64 controlls what defconfig >> sets. >> >> * I can natively compile for riscv32 and riscv64. That uses the same Kconfig >> setting, and the same ARCH=riscv32 vs ARCH=riscv64 switch for defconfig. > > Right, but my point is that a new architecture should not rely on 'ARCH=' > to pick the defconfig, we only do that on a couple of architectures for > backwards compatibility with old scripts. > >> Neither of the two Kconfig issues is a big deal, but we de need "uname -m" to >> return "riscv64" or "riscv32" not "riscv". I think the only way to do that is >> to set SRCARCH, but I'd be happy to change it if there's a better way. I think >> if I just do this >> >> diff --git a/Makefile b/Makefile >> index 0606f28..4adc609 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -232,7 +232,8 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ >> -e s/arm.*/arm/ -e s/sa110/arm/ \ >> -e s/s390x/s390/ -e s/parisc64/parisc/ \ >> -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ >> - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) >> + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ >> + -e s/riscv.*/riscv/ ) >> >> # Cross compiling and selecting different set of gcc/bin-utils >> # --------------------------------------------------------------------------- >> @@ -269,14 +270,6 @@ ifeq ($(ARCH),x86_64) >> SRCARCH := x86 >> endif >> >> -# Additional ARCH settings for RISC-V >> -ifeq ($(ARCH),riscv32) >> - SRCARCH := riscv >> -endif >> -ifeq ($(ARCH),riscv64) >> - SRCARCH := riscv >> -endif >> - >> # Additional ARCH settings for sparc >> ifeq ($(ARCH),sparc32) >> SRCARCH := sparc >> >> then I'll end up with "uname -m" as "riscv" -- I haven't tried it, but that's >> why we ended up with this diff in the first place. > > Do you mean the "uname -m" output comes from "${SRCARCH}" at > the time of the kernel build? That would be easy enough to change > by simply hardcoding it depending on CONFIG_64BIT. OK, I didn't know about COMPAT_UTS_MACHINE. That's a much better solution, I'll use that.