From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC239C433DF for ; Mon, 1 Jun 2020 08:15:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A824206C3 for ; Mon, 1 Jun 2020 08:15:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="OkUxzICY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728138AbgFAIP1 (ORCPT ); Mon, 1 Jun 2020 04:15:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726142AbgFAIP1 (ORCPT ); Mon, 1 Jun 2020 04:15:27 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A830C061A0E for ; Mon, 1 Jun 2020 01:15:27 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id c14so7227427qka.11 for ; Mon, 01 Jun 2020 01:15:27 -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:content-transfer-encoding; bh=Sk/qZ0PCKuKPpHB9HjPSmK4jmV57qb64kZf7c48kCF0=; b=OkUxzICYBcJ/T23uVyaiKrQRWk4oQTuGUExzoH9tTvqqLd0WJYCUcoC+rEJ5TNqtcr W3L5Vtj+3omzytqwnni8m1uWnj3zsYpe1gbZ6XAObufDkgRtCeV25VbM3ia2SYvculyS 0TZPqrYBhiSe0144ZS6jiCqOJtQQgT7B7TJFwYMqlFTPNMi7ze84O3hmXePGKuyQUqtc f+SP+b0/mYsZn6l4tF4VCwwlgUEEc8Yz5srZhVCu8VQJv7aNVVYritdidqgQSGEIjhTS hfWQBK3AVgEGmNLNk6wyEla/z/nZ/0I1Z8VnzEOUHxOZRWWyqvgAFtSO/Cd/E5O4B35C hfEg== 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=Sk/qZ0PCKuKPpHB9HjPSmK4jmV57qb64kZf7c48kCF0=; b=fKPTCHLB2lHiEQx0srCFo7tZVvpNpl/76Kj17UHmexNqgzLucEvR7ee/icXtdCwC/A Af1epLUnZ/s2wOPVmAnwW/japAXTqjPb7A9OD2I++nPIqNcP1pOkxy/j50F3BJIjA1+x baBbAjoNmXR7I2KywKVDYB4IsfdzVBawgkWzM/2VMlSJ/iq/Cu//qJLt415CaGMfKevk oNWitHI8z+O8u44sOwyhaN0DfMEU494pUa2t6VsTdKARxqOvDsHoAra9nRz88zqTGGBj 4ovKzeCQLpyc1dLMrExwLtKpERl+eHuiVuBbiFyQybtBnz19F7puNYZ/OacmF9kkTsTC Ndgg== X-Gm-Message-State: AOAM532quvLTb1Fg3nzntDz2ca0qBDJxep80k6DKyuj8T0snGwM2e0EC oUMB6Z6iUW/VFtqMrOz6HbC06mFniNhipcV3tCua6A== X-Google-Smtp-Source: ABdhPJwAZIYguqwZTxoHINg27uUeFDW9ssNvRHKAZfR70FyR5LAn3osu3KVqu7LBFqe+vVsr5skBCE0r7JFHOmVIU50= X-Received: by 2002:a37:9bd7:: with SMTP id d206mr19591161qke.113.1590999326270; Mon, 01 Jun 2020 01:15:26 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Greentime Hu Date: Mon, 1 Jun 2020 16:15:14 +0800 Message-ID: Subject: Re: [RFC PATCH v4 05/13] riscv: Add new csr defines related to vector extension To: Guo Ren Cc: Guo Ren , Vincent Chen , Paul Walmsley , Palmer Dabbelt , linux-riscv , Linux Kernel Mailing List , Oleg Nesterov 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 Guo Ren =E6=96=BC 2020=E5=B9=B45=E6=9C=8831=E6=97=A5 = =E9=80=B1=E6=97=A5 =E4=B8=8A=E5=8D=889:56=E5=AF=AB=E9=81=93=EF=BC=9A > > Hi Greentime, > > Why remove vxrm and xstat ? > > > Appendix B: Calling Convention > > In the RISC-V psABI, the vector registers v0-v31 are all caller-saved. = The vstart, vl, and vtype CSRs are also caller-saved. > > The vxrm and vxsat fields have thread storage duration. > Hi Guo, https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#vector-contro= l-and-status-register-vcsr "The vxrm and vxsat separate CSRs can also be accessed via fields in the vector control and status CSR, vcsr." Since vcsr will save all these information, I think it should be ok to save vcsr only. > As spec 0.9 mentioned above, vxrm and vxsat are thread storage duration. > > When timer 's interrupt coming, we still need to save them in context_swi= tch. > > On Tue, May 26, 2020 at 3:03 PM Greentime Hu wr= ote: > > > > From: Guo Ren > > > > Follow the riscv vector spec to add new csr number. > > > > [greentime.hu@sifive.com: update the defined value based on new spec an= d > > remove unused ones] > > Signed-off-by: Greentime Hu > > Signed-off-by: Guo Ren > > --- > > arch/riscv/include/asm/csr.h | 16 ++++++++++++++-- > > 1 file changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.= h > > index 8e18d2c64399..cc13626c4bbe 100644 > > --- a/arch/riscv/include/asm/csr.h > > +++ b/arch/riscv/include/asm/csr.h > > @@ -24,6 +24,12 @@ > > #define SR_FS_CLEAN _AC(0x00004000, UL) > > #define SR_FS_DIRTY _AC(0x00006000, UL) > > > > +#define SR_VS _AC(0x00000600, UL) /* Vector Status */ > > +#define SR_VS_OFF _AC(0x00000000, UL) > > +#define SR_VS_INITIAL _AC(0x00000200, UL) > > +#define SR_VS_CLEAN _AC(0x00000400, UL) > > +#define SR_VS_DIRTY _AC(0x00000600, UL) > > + > > #define SR_XS _AC(0x00018000, UL) /* Extension Status */ > > #define SR_XS_OFF _AC(0x00000000, UL) > > #define SR_XS_INITIAL _AC(0x00008000, UL) > > @@ -31,9 +37,9 @@ > > #define SR_XS_DIRTY _AC(0x00018000, UL) > > > > #ifndef CONFIG_64BIT > > -#define SR_SD _AC(0x80000000, UL) /* FS/XS dirty */ > > +#define SR_SD _AC(0x80000000, UL) /* FS/VS/XS dirty */ > > #else > > -#define SR_SD _AC(0x8000000000000000, UL) /* FS/XS dirty */ > > +#define SR_SD _AC(0x8000000000000000, UL) /* FS/VS/XS dirty *= / > > #endif > > > > /* SATP flags */ > > @@ -114,6 +120,12 @@ > > #define CSR_PMPADDR0 0x3b0 > > #define CSR_MHARTID 0xf14 > > > > +#define CSR_VSTART 0x8 > > +#define CSR_VCSR 0xf > > +#define CSR_VL 0xc20 > > +#define CSR_VTYPE 0xc21 > > +#define CSR_VLENB 0xc22 > > + > > #ifdef CONFIG_RISCV_M_MODE > > # define CSR_STATUS CSR_MSTATUS > > # define CSR_IE CSR_MIE > > -- > > 2.26.2 > > > > > > > -- > Best Regards > Guo Ren > > ML: https://lore.kernel.org/linux-csky/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C1B7C433E0 for ; Mon, 1 Jun 2020 08:15:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0A1620678 for ; Mon, 1 Jun 2020 08:15:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bq+P1mmi"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="OkUxzICY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0A1620678 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Sk/qZ0PCKuKPpHB9HjPSmK4jmV57qb64kZf7c48kCF0=; b=bq+P1mmitcWIZi 0b4FSFBJEh9Tl6gaR44jzDs/0GvTmJ+EAPUK0KfwyxPF+D2DRg34UEgi1+hLuxdhf+yvufW1I5bEW TOMhfKbbWKh0eWkg44el/nAsXiRR4kyQFhdCNSh8ZFgOd9717q89AABQ/JYdaCnY5wZvxVqqGpEk6 oFlu9iCk44hvGQ0Bg+FWNWINbViguOXSGGmugueRxcV305ykbua25b93+l7apKtV4upFuNQ+k9/Op hwAwFJ04eWiL3bx/FJYcHxo3iiSjuK5//lk8mfn+ukD69wKzZYo5n6xGwzrSvhlJ5owHoSwuk87p5 VxpMdkgIEWTutj9Z8RCA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jffbX-0000vB-1S; Mon, 01 Jun 2020 08:15:31 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jffbT-0000ul-UL for linux-riscv@lists.infradead.org; Mon, 01 Jun 2020 08:15:29 +0000 Received: by mail-qk1-x743.google.com with SMTP id q8so8231903qkm.12 for ; Mon, 01 Jun 2020 01:15:27 -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:content-transfer-encoding; bh=Sk/qZ0PCKuKPpHB9HjPSmK4jmV57qb64kZf7c48kCF0=; b=OkUxzICYBcJ/T23uVyaiKrQRWk4oQTuGUExzoH9tTvqqLd0WJYCUcoC+rEJ5TNqtcr W3L5Vtj+3omzytqwnni8m1uWnj3zsYpe1gbZ6XAObufDkgRtCeV25VbM3ia2SYvculyS 0TZPqrYBhiSe0144ZS6jiCqOJtQQgT7B7TJFwYMqlFTPNMi7ze84O3hmXePGKuyQUqtc f+SP+b0/mYsZn6l4tF4VCwwlgUEEc8Yz5srZhVCu8VQJv7aNVVYritdidqgQSGEIjhTS hfWQBK3AVgEGmNLNk6wyEla/z/nZ/0I1Z8VnzEOUHxOZRWWyqvgAFtSO/Cd/E5O4B35C hfEg== 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=Sk/qZ0PCKuKPpHB9HjPSmK4jmV57qb64kZf7c48kCF0=; b=O3auvscMKSwU0UZDl0H4wvhnPhD9f0asZMZX/T9ewOL6EMEoXcwkUzF1fBTIbjHxh6 15Hq+uNyTspxLKIGR8vcNZrrDVZR6Nm8QC42Yrq0g4VV/KJGoy1CaKJ8irK6ALYdWpR+ +SR9OmpKUvx94AJOMett4gTEE8/yFpJ1FPCoG/V0yOyZ1OceFzujTfQ/aaCexzdaixrh cU17WcAAG8Els/26YkdIhqeDzZVn6yOUwaXHezU1dHenekFYVmGF0qjEKQpQqytgtyKp o9coWGStnGfC+SnEfxH2obqc2YgmS4QhMS9zSbjrkbpotksa3kLX2m1+aODbr6A0MEn1 MIgA== X-Gm-Message-State: AOAM5321ZNOW+ehmmEuObF/hkIT//PeZQx3Ge17B+SEDVkUIehix1yjf X0dkmtOkeB8EPJRYlxdbeUpOp/q7NmD5UvbZHLMsnw== X-Google-Smtp-Source: ABdhPJwAZIYguqwZTxoHINg27uUeFDW9ssNvRHKAZfR70FyR5LAn3osu3KVqu7LBFqe+vVsr5skBCE0r7JFHOmVIU50= X-Received: by 2002:a37:9bd7:: with SMTP id d206mr19591161qke.113.1590999326270; Mon, 01 Jun 2020 01:15:26 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Greentime Hu Date: Mon, 1 Jun 2020 16:15:14 +0800 Message-ID: Subject: Re: [RFC PATCH v4 05/13] riscv: Add new csr defines related to vector extension To: Guo Ren Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200601_011528_010943_9F91C573 X-CRM114-Status: GOOD ( 14.42 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guo Ren , Palmer Dabbelt , Linux Kernel Mailing List , Oleg Nesterov , Vincent Chen , Paul Walmsley , linux-riscv Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org Guo Ren =E6=96=BC 2020=E5=B9=B45=E6=9C=8831=E6=97=A5 = =E9=80=B1=E6=97=A5 =E4=B8=8A=E5=8D=889:56=E5=AF=AB=E9=81=93=EF=BC=9A > > Hi Greentime, > > Why remove vxrm and xstat ? > > > Appendix B: Calling Convention > > In the RISC-V psABI, the vector registers v0-v31 are all caller-saved. = The vstart, vl, and vtype CSRs are also caller-saved. > > The vxrm and vxsat fields have thread storage duration. > Hi Guo, https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#vector-contro= l-and-status-register-vcsr "The vxrm and vxsat separate CSRs can also be accessed via fields in the vector control and status CSR, vcsr." Since vcsr will save all these information, I think it should be ok to save vcsr only. > As spec 0.9 mentioned above, vxrm and vxsat are thread storage duration. > > When timer 's interrupt coming, we still need to save them in context_swi= tch. > > On Tue, May 26, 2020 at 3:03 PM Greentime Hu wr= ote: > > > > From: Guo Ren > > > > Follow the riscv vector spec to add new csr number. > > > > [greentime.hu@sifive.com: update the defined value based on new spec an= d > > remove unused ones] > > Signed-off-by: Greentime Hu > > Signed-off-by: Guo Ren > > --- > > arch/riscv/include/asm/csr.h | 16 ++++++++++++++-- > > 1 file changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.= h > > index 8e18d2c64399..cc13626c4bbe 100644 > > --- a/arch/riscv/include/asm/csr.h > > +++ b/arch/riscv/include/asm/csr.h > > @@ -24,6 +24,12 @@ > > #define SR_FS_CLEAN _AC(0x00004000, UL) > > #define SR_FS_DIRTY _AC(0x00006000, UL) > > > > +#define SR_VS _AC(0x00000600, UL) /* Vector Status */ > > +#define SR_VS_OFF _AC(0x00000000, UL) > > +#define SR_VS_INITIAL _AC(0x00000200, UL) > > +#define SR_VS_CLEAN _AC(0x00000400, UL) > > +#define SR_VS_DIRTY _AC(0x00000600, UL) > > + > > #define SR_XS _AC(0x00018000, UL) /* Extension Status */ > > #define SR_XS_OFF _AC(0x00000000, UL) > > #define SR_XS_INITIAL _AC(0x00008000, UL) > > @@ -31,9 +37,9 @@ > > #define SR_XS_DIRTY _AC(0x00018000, UL) > > > > #ifndef CONFIG_64BIT > > -#define SR_SD _AC(0x80000000, UL) /* FS/XS dirty */ > > +#define SR_SD _AC(0x80000000, UL) /* FS/VS/XS dirty */ > > #else > > -#define SR_SD _AC(0x8000000000000000, UL) /* FS/XS dirty */ > > +#define SR_SD _AC(0x8000000000000000, UL) /* FS/VS/XS dirty *= / > > #endif > > > > /* SATP flags */ > > @@ -114,6 +120,12 @@ > > #define CSR_PMPADDR0 0x3b0 > > #define CSR_MHARTID 0xf14 > > > > +#define CSR_VSTART 0x8 > > +#define CSR_VCSR 0xf > > +#define CSR_VL 0xc20 > > +#define CSR_VTYPE 0xc21 > > +#define CSR_VLENB 0xc22 > > + > > #ifdef CONFIG_RISCV_M_MODE > > # define CSR_STATUS CSR_MSTATUS > > # define CSR_IE CSR_MIE > > -- > > 2.26.2 > > > > > > > -- > Best Regards > Guo Ren > > ML: https://lore.kernel.org/linux-csky/