Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp198400ybl; Tue, 13 Aug 2019 18:53:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDhZjOUyX9x9vnDEt6UexoAPBEhKZ7QUpVEPVxCJNf1DNL9TUIZ0WceEii9a4la2AavYHf X-Received: by 2002:a63:c055:: with SMTP id z21mr36212542pgi.380.1565747597523; Tue, 13 Aug 2019 18:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565747597; cv=none; d=google.com; s=arc-20160816; b=kZjqHv6zBuIv1ZLIDaAXgDX25SH7PQnhS005KtuxCnnWL2mh6pzEoMmv7c5WSPsD4M db53mMU3fuP+vZ3ORU+0GB1U6Jk/tbQIn4xX9z/flJfv5aNEojlRRcenHGvBuE2fdS6p SFQlUcIfD88jEFrMnq2Oor0aEJ9vxhz5Msw90aq+lvChpHLXRdmyJeJrG64t0omjhWYc a8Lu8mGHzshOizFOZFK50/9LFeX3sEUwbSwmj5/TAMH93ah+ms3VyfISsEBKy3LfgXnR w4Jtzz78e1dMmtI2jpJjv8a7ZUwZx9WT0ED0l3GMWGU0bf19PpNL9domshiZEItGqkxD bNkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8ug4XyDfcmMOuMpWVbRrmxyBe79U3+07+R7DrPjFhFk=; b=hN8rCDHj3GCrQROsSUUHChs2uwt8oBmKXt25GR5NNo1CqnQrhWfER9vstgR+SSCv7z O4XfdaYhq4FUTYwW9ISHfebOz5Lqkc6iBibCPGq3bDGGAP1ZI1iba8ODfMiyg/gROK52 BdIo4sW0PMNq/PsPy+N/uhR/7HsvL0iYK6nkjpyJlTMOIZx1xP8i6B4dpYiQ3I1NcMZF MDzgSiW0CnV5u+05yecOwREVE/hiFmvv2mg7waJ09jfQRUmKHyCq6gzWmaVMyqM55nPy not83cXu0Qd8srS6TikK8x7HZUxtTmJG/kfxVv7iKWGfQRuwUIoSae1Vnnn6Y+I1RfUM cmkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=H3Qpl43z; 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 7si13894157pll.330.2019.08.13.18.52.59; Tue, 13 Aug 2019 18:53:17 -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=pass header.i=@sifive.com header.s=google header.b=H3Qpl43z; 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 S1727039AbfHNBwW (ORCPT + 99 others); Tue, 13 Aug 2019 21:52:22 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:45695 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbfHNBwW (ORCPT ); Tue, 13 Aug 2019 21:52:22 -0400 Received: by mail-ot1-f67.google.com with SMTP id m24so25757253otp.12 for ; Tue, 13 Aug 2019 18:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8ug4XyDfcmMOuMpWVbRrmxyBe79U3+07+R7DrPjFhFk=; b=H3Qpl43zHubnuxu9OeDUV6gNsk9ptFFpiS3tjk+JhDbkCzO5OTUNJ+x6iHMyC3vCEx VbkQ8BjdNO+ZzE6JvWHFDZXdAAfL3wlIr74iP1WMr+un9rdwPj2rr1/qt/eZ9eWhECwm Q9/6UM3j2Rmcy8meLn/KdQjrKCmP10rnnRpjK5vipv8V0+azE4ZI8y+vHThYi4fV3lcr kmcSGolb6s6Rse18SFBm8A0G0B6iZuhypyyrhygGMEcW+/JxYBA99AZjSQ4xHiZMvDBJ c8CYz9uU4zagJrwSkP+YnoM0kakAgjJN0+LJauBeDSyNAA6mfx27pxnGrbWr0f0x2B07 O4QA== 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; bh=8ug4XyDfcmMOuMpWVbRrmxyBe79U3+07+R7DrPjFhFk=; b=LwHbuxuSxxHrjg8V00psQ7yXtvGxOb2ymG4FDqjjLnd5KcfPGxnXEtLszbFYN22N0N JN0UnVUL8FpQyOmOzN1hV4KGVjJST8Ue38P6ferUM0Eg2jGdBDbhgEumtS/0k2oSvWo+ xoyBjJHYW9N4gfCj/TwUfS9mfm8V2Yop07UhiGVubqvgEmltkvCw4fimC9Bk7WHLxmE/ xbG9DJ/Tx8GjQXGHHyd4jdK9ZrDhfdxZBqNxGTyG8Jxu6SJF1C6ofMaBqt4nz4zEVccr BTMx9Cg9wN8wOmpUjOSUJIVzh54+N8S5JCbunQStAyK3/sHod713ip942JxHRc1JDBRb MoFQ== X-Gm-Message-State: APjAAAUHlyGCEC9zXBw1KU8/ukiDE9woqbhwiaoHLaLMC+iR/bjE71Gp rVbqwTMJ+8+LcXXDd/1NIkFyWDgXVWVc5wMrI8Snyg== X-Received: by 2002:a5d:8550:: with SMTP id b16mr20860458ios.11.1565747541406; Tue, 13 Aug 2019 18:52:21 -0700 (PDT) MIME-Version: 1.0 References: <1565251121-28490-1-git-send-email-vincent.chen@sifive.com> <1565251121-28490-2-git-send-email-vincent.chen@sifive.com> <20190812145816.GD26897@infradead.org> In-Reply-To: <20190812145816.GD26897@infradead.org> From: Vincent Chen Date: Wed, 14 Aug 2019 09:52:10 +0800 Message-ID: Subject: Re: [PATCH 1/2] riscv: Correct the initialized flow of FP register To: Christoph Hellwig Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 12, 2019 at 10:58 PM Christoph Hellwig wrote: > > > +static inline void fstate_off(struct task_struct *task, > > + struct pt_regs *regs) > > +{ > > + regs->sstatus = (regs->sstatus & ~(SR_FS)) | SR_FS_OFF; > > No need for the inner braces here. Ok. > > > +} > > + > > static inline void fstate_save(struct task_struct *task, > > struct pt_regs *regs) > > { > > diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c > > index f23794b..e3077ee 100644 > > --- a/arch/riscv/kernel/process.c > > +++ b/arch/riscv/kernel/process.c > > @@ -64,8 +64,16 @@ void start_thread(struct pt_regs *regs, unsigned long pc, > > unsigned long sp) > > { > > regs->sstatus = SR_SPIE; > > - if (has_fpu) > > + if (has_fpu) { > > regs->sstatus |= SR_FS_INITIAL; > > +#ifdef CONFIG_FPU > > + /* > > + * Restore the initial value to the FP register > > + * before starting the user program. > > + */ > > + fstate_restore(current, regs); > > +#endif > > fstate_restore has a no-op stub for the !CONFIG_FPU case, so the ifdef > here is not needed. > You are right. I will remove the Ifdef condition. > Otherwise this looks good to me: > > Reviewed-by: Christoph Hellwig Thanks for your comments. Regards, Vincent Chen