All of lore.kernel.org
 help / color / mirror / Atom feed
From: alankao@andestech.com (Alan Kao)
To: linux-riscv@lists.infradead.org
Subject: [PATCH v2] riscv: Add support to no-FPU systems
Date: Mon, 6 Aug 2018 07:32:01 +0800	[thread overview]
Message-ID: <20180805233201.GA15062@andestech.com> (raw)
In-Reply-To: <mhng-d4977eb5-94cc-4b3f-b548-e27158814ed7@palmer-si-x1c4>

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 <palmer@sifive.com> wrote:
> >>On Tue, 26 Jun 2018 21:22:26 PDT (-0700), alankao at 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 <alankao@andestech.com>
> >>>Cc: Greentime Hu <greentime@andestech.com>
> >>>Cc: Zong Li <zong@andestech.com>
> >>>---
> >>> 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.

WARNING: multiple messages have this Message-ID (diff)
From: Alan Kao <alankao@andestech.com>
To: Palmer Dabbelt <palmer@sifive.com>
Cc: Andrew Waterman <andrew@sifive.com>, <albert@sifive.com>,
	<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	Christoph Hellwig <hch@infradead.org>,
	Darius Rad <darius@bluespec.com>, <greentime@andestech.com>,
	<zong@andestech.com>
Subject: Re: [PATCH v2] riscv: Add support to no-FPU systems
Date: Mon, 6 Aug 2018 07:32:01 +0800	[thread overview]
Message-ID: <20180805233201.GA15062@andestech.com> (raw)
In-Reply-To: <mhng-d4977eb5-94cc-4b3f-b548-e27158814ed7@palmer-si-x1c4>

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 <palmer@sifive.com> 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 <alankao@andestech.com>
> >>>Cc: Greentime Hu <greentime@andestech.com>
> >>>Cc: Zong Li <zong@andestech.com>
> >>>---
> >>> 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.

  reply	other threads:[~2018-08-05 23:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27  4:22 [PATCH v2] riscv: Add support to no-FPU systems Alan Kao
2018-06-27  4:22 ` Alan Kao
2018-06-29  7:22 ` Christoph Hellwig
2018-06-29  7:22   ` Christoph Hellwig
2018-06-29  7:26   ` Christoph Hellwig
2018-06-29  7:26     ` Christoph Hellwig
2018-08-01 17:55 ` Palmer Dabbelt
2018-08-01 17:55   ` Palmer Dabbelt
2018-08-01 18:23   ` Andrew Waterman
2018-08-01 18:23     ` Andrew Waterman
2018-08-04  4:03     ` Palmer Dabbelt
2018-08-04  4:03       ` Palmer Dabbelt
2018-08-05 23:32       ` Alan Kao [this message]
2018-08-05 23:32         ` Alan Kao
2018-08-01 23:09   ` Alan Kao
2018-08-01 23:09     ` Alan Kao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180805233201.GA15062@andestech.com \
    --to=alankao@andestech.com \
    --cc=linux-riscv@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.