Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1640875imm; Wed, 20 Jun 2018 23:40:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLInj20H5K5EKYOMhTaa0w8CdxrvRuHTU16Q1W1vBYdFjvNggTVSvkLSVHNpdPBoHd5bQUh X-Received: by 2002:a63:7d4c:: with SMTP id m12-v6mr21071148pgn.201.1529563246669; Wed, 20 Jun 2018 23:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529563246; cv=none; d=google.com; s=arc-20160816; b=bgvkg37tWl1wE5WMYKhhpCnM+WE7ROr4vZCXdEWSd/pco0UxP1mAPy7jD3KWwLplGl XNBH5veMboGy9VsHYogko3aIQgTDXXmxU4PGTHG/EjgUq9Cr+pqaQtzJ6HJUlLrax63j 8vyMwMlM+eFSqFvgbTMnBB5MT51Jbt7c67ZSop2qa3tPQXNzItJ8t1iKVghGqbi8KyLw HgOTjDtpxfc4krtOHqRRJhCsCRLLWQN0J3F2bwMVDDiTwXr99TGqh7gcJuu8i7nG/pnV KA8307cfjUypz20RQfSARL07zURY8HZrPUi7GsUqMNGIbs7QoS8El8WdeqSUSQ+6utRd U1Wg== 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:dkim-signature:arc-authentication-results; bh=6UH3oU4c80d9ugL0Q2ed05L3TLL9PTD7C9HTLQVyXzY=; b=HjF83Cr+BQYuL3YUGRCNPKbHpyEqPiwievZn02EiWr4ZMn4Dc5TqitkenK7W3eYon7 eo1aB57t4XWpMcnabnYjqGWzeq8747nM/Ad899IECh/3IYYRQpTtln3G+JlWjp+hbvQe zZ+FQx1z7bmv9rg+wjilmusZqLWlmECX0LNMHU0lPs0fGXYM5Vd2NOtPA/h3BR1ADMnW +PMCAfWBXd8LQ/3czPFMlRs06pAGovrZr94vQTp5Sn2m5N7A0fz2lEIR2gIQSg6j3zRK 3bSX0w0Ubi+dg6U6DrDAZXpX1vAW5WR6sZ36YNon2lIv8g41kcJ2ywqN06+NnPDs1aJQ zKLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=LemMK+Ek; 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 3-v6si4449448plf.84.2018.06.20.23.40.32; Wed, 20 Jun 2018 23:40: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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=LemMK+Ek; 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 S1754183AbeFUGjn (ORCPT + 99 others); Thu, 21 Jun 2018 02:39:43 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34578 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754093AbeFUGjm (ORCPT ); Thu, 21 Jun 2018 02:39:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6UH3oU4c80d9ugL0Q2ed05L3TLL9PTD7C9HTLQVyXzY=; b=LemMK+EkN5XASQFMjwTtXGqSn 15jtZcgCeyBkWaBc2by5zMPjwJFN2wBr2zQZztOpmPN0n/0XL68kcWAZdDqHiHaGA4z97bBUqnCdy 22qYIClcG7grO2aIbdHggKNXEJT8iZ74VXN/OnywJHcxsdQmVIQiD/Au6lgfilc4X2Ax4MJVopRdr Ew+YxluXJCCrG/AW4DbNz870l84nQn12sqqJXzpEiqJ3ly2TXlSMbukOcMDuWZLjFwUAtzzyXkE23 ugbWqmQsshbqlI7BGLNsdEFmYEIZnYZ7lu3+ieyEQYfR2gVk5ENhMuCGaU+ADhZm7VUATAPzHl2fT nCnFd54ig==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVtFr-0002TQ-5U; Thu, 21 Jun 2018 06:39:39 +0000 Date: Wed, 20 Jun 2018 23:39:38 -0700 From: Christoph Hellwig To: Alan Kao Cc: Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Zong Li , Greentime Hu Subject: Re: [PATCH] riscv: Add support to no-FPU systems Message-ID: <20180621063938.GB19319@infradead.org> References: <1529544276-28103-1-git-send-email-alankao@andestech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1529544276-28103-1-git-send-email-alankao@andestech.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +ifeq ($(CONFIG_FPU),y) > KBUILD_AFLAGS += -march=$(KBUILD_MARCH)$(KBUILD_ARCH_A)fd$(KBUILD_ARCH_C) > +else > +KBUILD_AFLAGS += -march=$(KBUILD_MARCH)$(KBUILD_ARCH_A)$(KBUILD_ARCH_C) > +endif Can we refactor that KBUILD_ARCH code into something like riscv-march-y := riscv-march-$(CONFIG_ARCH_RV32I) += rv32im riscv-march-$(CONFIG_ARCH_RV64I) += rv64im riscv-march-$(CONFIG_RISCV_ISA_A) += a riscv-march-$(CONFIG_FPU) += fd riscv-march-$(CONFIG_RISCV_ISA_C) += c KBUILD_CFLAGS += -march=$(riscv-march-y) > +#ifdef CONFIG_FPU > regs->sstatus = SR_SPIE /* User mode, irqs on */ | SR_FS_INITIAL; > +#else > + regs->sstatus = SR_SPIE | SR_FS_OFF; > +#endif Having the comment in one branch, but not the other is odd. I'd be tempted to just remove t entirely, but if not it should be move up or duplicated. > int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) > { > +#ifdef CONFIG_FPU > fstate_save(src, task_pt_regs(src)); > +#endif Please provide a !CONFIG_FPU stub for fstate_save, please. > } > +#endif > > static long restore_sigcontext(struct pt_regs *regs, > struct sigcontext __user *sc) > @@ -63,6 +65,7 @@ static long restore_sigcontext(struct pt_regs *regs, > err = __copy_from_user(regs, &sc->sc_regs, sizeof(sc->sc_regs)); > if (unlikely(err)) > return err; > +#ifdef CONFIG_FPU > /* Restore the floating-point state. */ > err = restore_d_state(regs, &sc->sc_fpregs.d); > if (unlikely(err)) > @@ -76,6 +79,7 @@ static long restore_sigcontext(struct pt_regs *regs, > if (value != 0) > return -EINVAL; > } > +#endif Same here. > @@ -127,11 +131,13 @@ static long setup_sigcontext(struct rt_sigframe __user *frame, > size_t i; > /* sc_regs is structured the same as the start of pt_regs */ > err = __copy_to_user(&sc->sc_regs, regs, sizeof(sc->sc_regs)); > +#ifdef CONFIG_FPU > /* Save the floating-point state. */ > err |= save_d_state(regs, &sc->sc_fpregs.d); > /* We support no other extension state at this time. */ > for (i = 0; i < ARRAY_SIZE(sc->sc_fpregs.q.reserved); i++) > err |= __put_user(0, &sc->sc_fpregs.q.reserved[i]); > +#endif Same here.