Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1957642imu; Fri, 23 Nov 2018 02:42:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/West1LjF+J51nKZnoWak5zAa/Xai5qBelJsPUQGU7kdDH9lHLocYOk/6knU5cQxXSdckX5 X-Received: by 2002:a62:9f01:: with SMTP id g1mr9565580pfe.223.1542969725758; Fri, 23 Nov 2018 02:42:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542969725; cv=none; d=google.com; s=arc-20160816; b=obOcHIotdia6r4x2kgSfIRMj4y7ub3zLMJXEM5fXYe0BbRr81OnTIUH5ORQiWsF5Al uHeEYe6yom2qDXaZNlQwge2rcJ0KWVVH7cSd6eYVGIQ1JCUNfu7EgXmzUvToZyDlg0n/ HQAwNsinP565gBaxAYiGILT72f1OmfCVGxEeBxA70yfFUb2a8j93aTJkqTImKVs53Kgh UYhTRUHaVX0+xu0uHw6ww6kgdAYnEkDHxCF7ydJDV3Aw48q6S9kI8NeuTsLlAK1a/quf bh8Q9FnlfqgSuQ4PmqVQ2xXkW51DQ2/0WTT/iX3E60s/HbrwoVmu1bzqMX+xpRW0b2Xd 96CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HSvJahu1uRerfznMJOkPbm+lTH+CajCOTME1u3iZuuY=; b=rXa0XYad8KmHhJ7ofTYbvbD27Tpo0cxOafdMJbHVlLDjyhxuyGfuXO24dXKUs2LlRP ZhHhnxlZCjgoEXWfGoQEoh3t4xYbM4mj0OASaqogxqfe3i+J6osavSPwnCi9uEWbNluj OnQeRWMfx2aKyAx7u97J/XCB8NXq0Oe86hmvwzQ4fei+OyREUBrp1Z+9+0KRFXTFK5wr araSWDZe43LScVznvAi3QLcrfMzjkU0tN5RLH69MXwYHkDTR/TRCxh0sptsk1NLBcgTw HyVX1dnG1+hQfc9/rLVJXyvDKryfwjg5WUjawEjLmggEk+zpGd9cOdU9YG+a0zkA4gT3 NeoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vQpj79gw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z129si10697335pfz.13.2018.11.23.02.41.50; Fri, 23 Nov 2018 02:42:05 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vQpj79gw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405265AbeKVVA3 (ORCPT + 99 others); Thu, 22 Nov 2018 16:00:29 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40515 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731554AbeKVVA3 (ORCPT ); Thu, 22 Nov 2018 16:00:29 -0500 Received: by mail-ed1-f67.google.com with SMTP id d3so7247882edx.7 for ; Thu, 22 Nov 2018 02:21:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=HSvJahu1uRerfznMJOkPbm+lTH+CajCOTME1u3iZuuY=; b=vQpj79gwQrz1SCK8HSbM9pKA7ChOgwo3ylDojPMI7SNROt/1xur2jd+x7Ss0fWa/3a fkTeo37742qwgXalEoOHfy/X4YJEjz5BLnVwzTMEmXiuD3PI275YmIT+Xcf9DG1TZ59w nv5QEDO7dJhgy3peUS/w8fyVwd+4HuEjSbVF5ffdjC7mkHCGYdSL2PuM9Gl80E/FaBWf LoDXXvN9Qvd/4LzN8dZhfgYcOyBSqtQqBeRXuTwWOeTQ92AossgVlf2gN7Bjl0RkB4aa 37dvCxzL5HlsoYdEt537cPga25JbJEO/DSrMHI+2q9ccWKH6mO61ZvfXgfkZYLcDmenY yRfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=HSvJahu1uRerfznMJOkPbm+lTH+CajCOTME1u3iZuuY=; b=tZ3/YTmtBDYzdRTpDqSUDnwm+aN8XH37qRHHMAw4eewrDOWXIyAqt8YbyWDOjG9nad HsE2Khf0zBLk9vsYiIYR+AKaz2zHbpo+Bu/4P1rDcrRZ61wTEQ5E8NQoiKvWGR47Pkyr 9K2yinYCie8EcT0wblGpn/LBvV+Bbi7VWMpm4ynSS3k5lJOllsrCG9sYX6bWFENtwxEZ Thr5sITHkS3uQe+ovdt97S3v3ghTr5vpxo2ohRHl1y3hJGHEGYyRa6KpZMRWrb0b+i5J rYZZnKFDaylBkxGtFapThpyBTPE8/LwRMG5rW603yW6i7j/zEsux+tBCO32YBGHPHLl6 AzOA== X-Gm-Message-State: AGRZ1gJUC4ulDGbUP84gCt/lhHNnq1y51gEx0uPec8sYuQLMoI1CzOm4 2IQigmlefn7vp/9KCsm02jUduxava3Wb0g37cdk= X-Received: by 2002:a17:906:304b:: with SMTP id d11-v6mr7832632ejd.4.1542882099656; Thu, 22 Nov 2018 02:21:39 -0800 (PST) MIME-Version: 1.0 References: <1542856478-795-1-git-send-email-vincentc@andestech.com> In-Reply-To: <1542856478-795-1-git-send-email-vincentc@andestech.com> From: Greentime Hu Date: Thu, 22 Nov 2018 18:21:02 +0800 Message-ID: Subject: Re: [PATCH v4 0/5] nds32 FPU port To: Vincent Chen Cc: Arnd Bergmann , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vincent Chen =E6=96=BC 2018=E5=B9=B411=E6=9C=8822= =E6=97=A5 =E9=80=B1=E5=9B=9B =E4=B8=8A=E5=8D=8811:14=E5=AF=AB=E9=81=93=EF= =BC=9A > > This patch set contains basic components for supporting the nds32 FPU, > such as exception handlers and context switch for FPU registers. By > default, the lazy FPU scheme is supported and the user can configure it > via CONFIG_LZAY_FPU. In addition, a floating point emulator is required > to handle all arithmetic of denormalized number because it is not support= ed > by the nds32 FPU. > > As mentioned above, the nds32 FPU does not support denormalized number > This means the denormalized operands and results are not permitted. If an > instruction contains denormalized operands, the nds32 FPU will raise an > denormalized input exception to inform kernel to deal with this > instruction. If the result of the instruction is a denormalized number, > normally nds32 FPU will treat it as an underflow case and round the resul= t > to an appropriate value based on current rounding mode. Obviously, there = is > a precision gap for tininess number. To reduce this precision gap, kernel > will enable the underflow trap by default to direct all underflow cases t= o > the floating pointer emulator. By the floating pointer emulator, the > correct denormalized number can be derived in kernel and return to the us= er > program. The feature can be configured by > CONFIG_SUPPORT_DENORMAL_ARITHMETIC, and if the precision requirement is n= ot > critical for tininess number, user may disables this feature to keep > performance. > > The implementation of floating point emulator is based on soft-fp > which is located in include/math-emu folder. However, soft-fp is too > outdated to pass the current compiler check. The needed modifications > for soft-fp are included in this patch set > > Changes in v4: > - Fix compilation error > > Changes in v3: > - Kernel with FPU support enabled still can run on a CPU without FPU > - Rename CONFIG_UNLAZY_FPU to CONFIG_LAYZ_FPU > - Rename _switch() to _switch_fpu() > - Store FPU context when kernel suspends > - Modify the comments in code and patch > > Changes in v2: > - Remove the initilzation for floating pointer register before entering = to > signal handler. > > Vincent Chen (5): > nds32: nds32 FPU port > nds32: Support FP emulation > nds32: support denormalized result through FP emulator > math-emu/op-2.h: Use statement expressions to prevent negative > constant shift > math-emu/soft-fp.h: (_FP_ROUND_ZERO) cast 0 to void to fix warning > > arch/nds32/Kconfig | 1 + > arch/nds32/Kconfig.cpu | 34 +++ > arch/nds32/Makefile | 5 + > arch/nds32/include/asm/bitfield.h | 15 ++ > arch/nds32/include/asm/elf.h | 11 + > arch/nds32/include/asm/fpu.h | 126 +++++++++++ > arch/nds32/include/asm/fpuemu.h | 32 +++ > arch/nds32/include/asm/nds32_fpu_inst.h | 109 +++++++++ > arch/nds32/include/asm/processor.h | 7 + > arch/nds32/include/asm/sfp-machine.h | 158 +++++++++++++ > arch/nds32/include/asm/syscalls.h | 1 + > arch/nds32/include/uapi/asm/auxvec.h | 7 + > arch/nds32/include/uapi/asm/sigcontext.h | 14 ++ > arch/nds32/include/uapi/asm/udftrap.h | 13 + > arch/nds32/include/uapi/asm/unistd.h | 2 + > arch/nds32/kernel/Makefile | 4 + > arch/nds32/kernel/ex-entry.S | 24 ++- > arch/nds32/kernel/ex-exit.S | 13 +- > arch/nds32/kernel/ex-scall.S | 8 +- > arch/nds32/kernel/fpu.c | 269 ++++++++++++++++++++++ > arch/nds32/kernel/process.c | 64 +++++- > arch/nds32/kernel/setup.c | 12 +- > arch/nds32/kernel/signal.c | 62 +++++- > arch/nds32/kernel/sleep.S | 4 +- > arch/nds32/kernel/sys_nds32.c | 32 +++ > arch/nds32/kernel/traps.c | 16 ++ > arch/nds32/math-emu/Makefile | 7 + > arch/nds32/math-emu/faddd.c | 24 ++ > arch/nds32/math-emu/fadds.c | 24 ++ > arch/nds32/math-emu/fcmpd.c | 24 ++ > arch/nds32/math-emu/fcmps.c | 24 ++ > arch/nds32/math-emu/fd2s.c | 22 ++ > arch/nds32/math-emu/fdivd.c | 27 +++ > arch/nds32/math-emu/fdivs.c | 26 +++ > arch/nds32/math-emu/fmuld.c | 23 ++ > arch/nds32/math-emu/fmuls.c | 23 ++ > arch/nds32/math-emu/fnegd.c | 21 ++ > arch/nds32/math-emu/fnegs.c | 21 ++ > arch/nds32/math-emu/fpuemu.c | 357 ++++++++++++++++++++++++= ++++++ > arch/nds32/math-emu/fs2d.c | 23 ++ > arch/nds32/math-emu/fsqrtd.c | 21 ++ > arch/nds32/math-emu/fsqrts.c | 21 ++ > arch/nds32/math-emu/fsubd.c | 27 +++ > arch/nds32/math-emu/fsubs.c | 27 +++ > include/math-emu/op-2.h | 97 ++++----- > include/math-emu/soft-fp.h | 2 +- > 46 files changed, 1816 insertions(+), 68 deletions(-) > create mode 100644 arch/nds32/include/asm/fpu.h > create mode 100644 arch/nds32/include/asm/fpuemu.h > create mode 100644 arch/nds32/include/asm/nds32_fpu_inst.h > create mode 100644 arch/nds32/include/asm/sfp-machine.h > create mode 100644 arch/nds32/include/uapi/asm/udftrap.h > create mode 100644 arch/nds32/kernel/fpu.c > create mode 100644 arch/nds32/math-emu/Makefile > create mode 100644 arch/nds32/math-emu/faddd.c > create mode 100644 arch/nds32/math-emu/fadds.c > create mode 100644 arch/nds32/math-emu/fcmpd.c > create mode 100644 arch/nds32/math-emu/fcmps.c > create mode 100644 arch/nds32/math-emu/fd2s.c > create mode 100644 arch/nds32/math-emu/fdivd.c > create mode 100644 arch/nds32/math-emu/fdivs.c > create mode 100644 arch/nds32/math-emu/fmuld.c > create mode 100644 arch/nds32/math-emu/fmuls.c > create mode 100644 arch/nds32/math-emu/fnegd.c > create mode 100644 arch/nds32/math-emu/fnegs.c > create mode 100644 arch/nds32/math-emu/fpuemu.c > create mode 100644 arch/nds32/math-emu/fs2d.c > create mode 100644 arch/nds32/math-emu/fsqrtd.c > create mode 100644 arch/nds32/math-emu/fsqrts.c > create mode 100644 arch/nds32/math-emu/fsubd.c > create mode 100644 arch/nds32/math-emu/fsubs.c Hi Vincent, Thank you. Acked-by: Greentime Hu