Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp316233ybl; Tue, 13 Aug 2019 21:37:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVqCk5kBZORNsl9tyaReA/jInjP88L1x2K8XzpCec6//X0Z8sr/PR+MctvkRv8cu/z4BCY X-Received: by 2002:a62:1a45:: with SMTP id a66mr18918591pfa.142.1565757442392; Tue, 13 Aug 2019 21:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565757442; cv=none; d=google.com; s=arc-20160816; b=RS816aRhU2rGZ4EqU7jgi7Kk4OVd/nl4izhu76yKKTHAAYFblQhZbY3QonTAoWmLtk HeEkydr5ONvgK30w16GkllWby/RPYi2fB404/iBC1C+cU9APMI4uArElnGPPCmduEzD2 KIp2wPtheKTQp+0HRWQ0F1kd9ojJFyDhKN+KgEOdEaRfdQfU9q53YRgcS2Mz4xUDs24K WD47S/MGOyZUTvCL/szTib/XEkiP/LIQrgahZFdJHyHQ/Gb1Kps7B6X9/tHc80A1+eYC jOn55fG+Pl7MsEw+yB8hcMQQCd5oncS78BY0ruQWb6R6iJwoBmd/MinMS8wmeH8BcVH4 nXZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pV+BZosejnVq+UbFDlIrSTIrjbWgAUL/dp0FrbkginI=; b=Iw91zt8lhhTIf3IltddpGGlBtj7ra9UH6UY2HrSB/+U3sdYPF9sEmdLCiq6sOSpXqK kZBhXJ8VPT2x8TDVecA38Zh87/oQg3CVrwE9UvVEPG9dZq0E0Q5Arw1oLtTVSXxQpJL6 mFq/IdNLt0A3VP6cLQcDAur/8MbB+PxGCAYs92hT+l/Sx6teHw/Fw9GkcKXFcknRckZ8 TnTfzinsiJJX5I0Cnrv8C0SPwW+b2OAq8XPhleTK5rhiTJZuiDSspMctS0d4s7euFFlA Gjz3WKqAoS0scdLofuFV8VmhAYZ266SA9C2SrnAnus1QeNp69Vv+Ne+HqOTRh5p1RyGm HLBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k14si2139902pjq.53.2019.08.13.21.37.06; Tue, 13 Aug 2019 21:37:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727314AbfHNEfz (ORCPT + 99 others); Wed, 14 Aug 2019 00:35:55 -0400 Received: from verein.lst.de ([213.95.11.211]:34398 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbfHNEfz (ORCPT ); Wed, 14 Aug 2019 00:35:55 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 9889C68B02; Wed, 14 Aug 2019 06:35:51 +0200 (CEST) Date: Wed, 14 Aug 2019 06:35:51 +0200 From: Christoph Hellwig To: Alan Kao Cc: Christoph Hellwig , Palmer Dabbelt , Paul Walmsley , Damien Le Moal , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 13/15] riscv: clear the instruction cache and all registers when booting Message-ID: <20190814043551.GA22862@lst.de> References: <20190813154747.24256-1-hch@lst.de> <20190813154747.24256-14-hch@lst.de> <20190814010013.GA18655@andestech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190814010013.GA18655@andestech.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 14, 2019 at 09:00:14AM +0800, Alan Kao wrote: > But it doesn't really mean that the running system has an FPU given CONFIG_FPU > enabled. Normally the existence of an FPU is checked in riscv_fill_hwcap by > searching device tree, where the code looks like > > > bool has_fpu = false; // this one is global > ... > #ifdef CONFIG_FPU > if (elf_hwcap & (COMPAT_HWCAP_ISA_F | COMPAT_HWCAP_ISA_D)) > has_fpu = true; > #endif > > > Or does CONFIG_FPU have a more intuitive meaning when CONFIG_M_MODE is enabled? No, it doesn't.. > > > + csrr t0, CSR_MISA > > + andi t0, t0, (COMPAT_HWCAP_ISA_F | COMPAT_HWCAP_ISA_D) > > + bnez t0, .Lreset_regs_done ... which is why we have these few lines of code that check the caps returns from the misa CSR, similar to the elf_caps check quoted above.