Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2943868imm; Sun, 5 Aug 2018 16:33:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcty4LEobttSCJ6/dyt43qwGe58rvBlHVh6sZruQeTvWinfTR8jXejMeh23F57FEJZQ/kVs X-Received: by 2002:a62:47c4:: with SMTP id p65-v6mr14763668pfi.170.1533512026376; Sun, 05 Aug 2018 16:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533512026; cv=none; d=google.com; s=arc-20160816; b=q0tMeocRWpkHVf/GkSEQvG0FbO8GVf/J2Lk2nfPqIHiWirtM/90gIIvMraRHD4pkQj hkIpBuYF+D77Z5vnrM/Q8hwqRWTMwcHrcYFqJBHcN9o2xcu12y6N4XJ2YFcVrIjUi2wG Ypt9fIVrOe5vGmty/qiRvaOCNmNT9TSxDf8wuZbN/gmQ3oCxzX0hrOJ2ePqZWaHuHmrs eb0IYa/TxfvXqoOmnf/9ujtgzIPWLHGB5D8bF+ovReu4s+thH8V3jfGVQ9ZfIh5ztvu1 uaFwGjI+fNE6l74CIpnrxVznc+1lVmA4Vo3ZWYlpDXWOPVITdXxze7uxBeNUgxLf22pg 0kRg== 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:arc-authentication-results; bh=8XMDIIWiMh5oFM947o/wxtBET2slJIGHs5mjRF/2lp8=; b=mDi6vWob57zWynla32N8PdriDuucoD0HFzVUxL18v5NOmgnJUIcAmrGpxQ/rPE6nNr aa1oMFiNaphoKiFE4aLp2j1wyU3ZNXhuJXVuxhV4HQast8amuMGC3hhifG3AnYG7QGri 1J4C41SqgjamppBldaMO+qoK2pTQHgBRFFsDdxpEQ4eWcGc6YAnSbEa5S3brBxi7IUny jx+pyXO39YURaiAJuYIF7WWsbjjTyyoocggc0VRGEVxX0vFTj+WdoiFLzSP3hl+q+E4F 2MK0+D4PKPSh0RSZNrcntmZxJk1YlAQw7N89bQk/inNUzQmGfGYpzrWjixgHl9RAAdIk Lbzw== 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 j125-v6si11499135pfc.243.2018.08.05.16.33.31; Sun, 05 Aug 2018 16:33:46 -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 S1726971AbeHFBi2 (ORCPT + 99 others); Sun, 5 Aug 2018 21:38:28 -0400 Received: from exmail.andestech.com ([59.124.169.137]:37639 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726673AbeHFBi2 (ORCPT ); Sun, 5 Aug 2018 21:38:28 -0400 Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id w75NVIBs005553; Mon, 6 Aug 2018 07:31:18 +0800 (GMT-8) (envelope-from alankao@andestech.com) Received: from andestech.com (10.0.1.85) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.123.3; Mon, 6 Aug 2018 07:32:00 +0800 Date: Mon, 6 Aug 2018 07:32:01 +0800 From: Alan Kao To: Palmer Dabbelt CC: Andrew Waterman , , , , "Arnd Bergmann" , Christoph Hellwig , Darius Rad , , Subject: Re: [PATCH v2] riscv: Add support to no-FPU systems Message-ID: <20180805233201.GA15062@andestech.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.0.1.85] X-DNSRBL: X-MAIL: ATCSQR.andestech.com w75NVIBs005553 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 03, 2018 at 09:03:00PM -0700, Palmer Dabbelt wrote: > On Wed, 01 Aug 2018 11:23:43 PDT (-0700), Andrew Waterman wrote: > >On Wed, Aug 1, 2018 at 10:55 AM, Palmer Dabbelt wrote: > >>On Tue, 26 Jun 2018 21:22:26 PDT (-0700), alankao@andestech.com wrote: > >>> > >>>This patch adds an option, CONFIG_FPU, to enable/disable floating > >>>procedures. Also, some style issues are fixed. > >>> > >>>Signed-off-by: Alan Kao > >>>Cc: Greentime Hu > >>>Cc: Zong Li > >>>--- > >>> arch/riscv/Kconfig | 9 ++++ > >>> arch/riscv/Makefile | 19 +++---- > >>> arch/riscv/include/asm/switch_to.h | 6 +++ > >>> arch/riscv/kernel/entry.S | 3 +- > >>> arch/riscv/kernel/process.c | 7 ++- > >>> arch/riscv/kernel/signal.c | 82 +++++++++++++++++++++--------- > >>> 6 files changed, 90 insertions(+), 36 deletions(-) > >>> > >>>diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > >>>index 6debcc4afc72..6069597ba73f 100644 > >>>--- a/arch/riscv/Kconfig > >>>+++ b/arch/riscv/Kconfig > >>>@@ -232,6 +232,15 @@ config RISCV_BASE_PMU > >>> > >>> endmenu > >>> > >>>+config FPU > >>>+ bool "FPU support" > >>>+ default y > >>>+ help > >>>+ Say N here if you want to disable all floating-point related > >>>procedure > >>>+ in the kernel. > >>>+ > >>>+ If you don't know what to do here, say Y. > >>>+ > >>> endmenu > >> > >> > >>Sorry for letting this slide for a bit. While I'm not opposed to a solution > >>that requires a FPU Kconfig option, it'd be a bit better if we could detect > >>this at boot time. I think this should be possible because at one point > >>this actually worked and we could boot the same kernel on FPU and no-FPU > >>systems. > > > >I believe it would suffice to have start_thread set sstatus.FS to OFF > >for no-FPU systems (vs. INITIAL for systems with FPU). The ISA > >string in the devicetree should indicate whether F/D extensions are > >present. > > > >That said, it makes sense to me to additionally provide the Kconfig > >option. This would elide the sstatus.SD check for no-FPU systems, > >shaving a couple instructions off the context-switch path. It would > >also enable mimicking the behavior of a no-FPU system even when the > >FPU is present. > > That sounds like a good argument. Do you mind submitting a two-part patch > set, to: > > * Allow FPU kernels to detect and run correctly on non-FPU systems. You > should be able to detect these very early by writing to sstatus, or later > by looking at the device tree. > * Add a Kconfig option to disable the FPU entirely (which is pretty much > this patch). > > Thanks! > Thanks for the feedback from all of you. We will fix v3 according to Christph's suggestions, and append a new patch of the auto-detecting feature.