From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Stübner Date: Sun, 02 Apr 2023 00:20:32 +0200 Subject: [PATCH -next v17 13/20] riscv: signal: Add sigcontext save/restore for vector In-Reply-To: <20230327164941.20491-14-andy.chiu@sifive.com> References: <20230327164941.20491-1-andy.chiu@sifive.com> <20230327164941.20491-14-andy.chiu@sifive.com> Message-ID: <2624132.Isy0gbHreE@diego> List-Id: To: kvm-riscv@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Am Montag, 27. M?rz 2023, 18:49:33 CEST schrieb Andy Chiu: > From: Greentime Hu > > This patch facilitates the existing fp-reserved words for placement of > the first extension's context header on the user's sigframe. A context > header consists of a distinct magic word and the size, including the > header itself, of an extension on the stack. Then, the frame is followed > by the context of that extension, and then a header + context body for > another extension if exists. If there is no more extension to come, then > the frame must be ended with a null context header. A special case is > rv64gc, where the kernel support no extensions requiring to expose > additional regfile to the user. In such case the kernel would place the > null context header right after the first reserved word of > __riscv_q_ext_state when saving sigframe. And the kernel would check if > all reserved words are zeros when a signal handler returns. > > __riscv_q_ext_state---->| |<-__riscv_extra_ext_header > ~ ~ > .reserved[0]--->|0 |<- .reserved > <-------|magic |<- .hdr > | |size |_______ end of sc_fpregs > | |ext-bdy| > | ~ ~ > +)size ------->|magic |<- another context header > |size | > |ext-bdy| > ~ ~ > |magic:0|<- null context header > |size:0 | > > The vector registers will be saved in datap pointer. The datap pointer > will be allocated dynamically when the task needs in kernel space. On > the other hand, datap pointer on the sigframe will be set right after > the __riscv_v_ext_state data structure. > > Co-developed-by: Vincent Chen > Signed-off-by: Vincent Chen > Signed-off-by: Greentime Hu > Suggested-by: Vineet Gupta > Suggested-by: Richard Henderson > Co-developed-by: Andy Chiu > Signed-off-by: Andy Chiu > Acked-by: Conor Dooley Acked-by: Heiko Stuebner Tested-by: Heiko Stuebner 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A1FCAC6FD1D for ; Sat, 1 Apr 2023 22:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/CxBhYgJVTQjjJk1bXNop7LHVKvLNwWfbkQG5jCrkX4=; b=By4zZLJoe/q4H1 AWu3lO3F7EZdm6Jm3mSTColMR1qcVp+ECjp+Z01LJNYv2wAURP9R9Vh4bC/kflhfrCtMVkOs5e64w shPtjBhd3LMXLQ9CU8nrIfqVw0zZaZpio+k42WUeyZf2Cq+Sh3jMGs7A99r2/PFbXE+flRt7F+grM gTfFv+hlP3ZhEzf7ZFx0w1ueTz3EWfoAoypQS7Mq+6QTA2E0QOaP07BN6B0OinvHnHsJiVqySixbZ zx7DPidcj3+HwYXQC0rpPUj2/1wN6GTF1QF8KfbEsBzYmr5jEvF0sY5zGM3VYAezcATYPW8dI+1IA 5PeD+93NtWbdD8Q8y52A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pijaV-00BNtA-2X; Sat, 01 Apr 2023 22:20:43 +0000 Received: from gloria.sntech.de ([185.11.138.130]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pijaS-00BNsY-2j; Sat, 01 Apr 2023 22:20:42 +0000 Received: from ip4d1634d3.dynamic.kabel-deutschland.de ([77.22.52.211] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pijaL-0004qG-20; Sun, 02 Apr 2023 00:20:33 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: linux-riscv@lists.infradead.org, palmer@dabbelt.com, anup@brainfault.org, atishp@atishpatra.org, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org Cc: vineetg@rivosinc.com, greentime.hu@sifive.com, guoren@linux.alibaba.com, Vincent Chen , Andy Chiu , Paul Walmsley , Albert Ou , Conor Dooley , Richard Henderson , Guo Ren , =?ISO-8859-1?Q?Bj=F6rn_T=F6pel?= , Andrew Jones , Xianting Tian , Jisheng Zhang , Wenting Zhang , Al Viro , Andrew Bresticker , Andy Chiu Subject: Re: [PATCH -next v17 13/20] riscv: signal: Add sigcontext save/restore for vector Date: Sun, 02 Apr 2023 00:20:32 +0200 Message-ID: <2624132.Isy0gbHreE@diego> In-Reply-To: <20230327164941.20491-14-andy.chiu@sifive.com> References: <20230327164941.20491-1-andy.chiu@sifive.com> <20230327164941.20491-14-andy.chiu@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230401_152040_889275_B7021FCA X-CRM114-Status: GOOD ( 14.67 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Am Montag, 27. M=E4rz 2023, 18:49:33 CEST schrieb Andy Chiu: > From: Greentime Hu > = > This patch facilitates the existing fp-reserved words for placement of > the first extension's context header on the user's sigframe. A context > header consists of a distinct magic word and the size, including the > header itself, of an extension on the stack. Then, the frame is followed > by the context of that extension, and then a header + context body for > another extension if exists. If there is no more extension to come, then > the frame must be ended with a null context header. A special case is > rv64gc, where the kernel support no extensions requiring to expose > additional regfile to the user. In such case the kernel would place the > null context header right after the first reserved word of > __riscv_q_ext_state when saving sigframe. And the kernel would check if > all reserved words are zeros when a signal handler returns. > = > __riscv_q_ext_state---->| |<-__riscv_extra_ext_header > ~ ~ > .reserved[0]--->|0 |<- .reserved > <-------|magic |<- .hdr > | |size |_______ end of sc_fpregs > | |ext-bdy| > | ~ ~ > +)size ------->|magic |<- another context header > |size | > |ext-bdy| > ~ ~ > |magic:0|<- null context header > |size:0 | > = > The vector registers will be saved in datap pointer. The datap pointer > will be allocated dynamically when the task needs in kernel space. On > the other hand, datap pointer on the sigframe will be set right after > the __riscv_v_ext_state data structure. > = > Co-developed-by: Vincent Chen > Signed-off-by: Vincent Chen > Signed-off-by: Greentime Hu > Suggested-by: Vineet Gupta > Suggested-by: Richard Henderson > Co-developed-by: Andy Chiu > Signed-off-by: Andy Chiu > Acked-by: Conor Dooley Acked-by: Heiko Stuebner Tested-by: Heiko Stuebner _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1271C76196 for ; Sat, 1 Apr 2023 22:20:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229529AbjDAWUr convert rfc822-to-8bit (ORCPT ); Sat, 1 Apr 2023 18:20:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjDAWUq (ORCPT ); Sat, 1 Apr 2023 18:20:46 -0400 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFFD51A963 for ; Sat, 1 Apr 2023 15:20:43 -0700 (PDT) Received: from ip4d1634d3.dynamic.kabel-deutschland.de ([77.22.52.211] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pijaL-0004qG-20; Sun, 02 Apr 2023 00:20:33 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: linux-riscv@lists.infradead.org, palmer@dabbelt.com, anup@brainfault.org, atishp@atishpatra.org, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org Cc: vineetg@rivosinc.com, greentime.hu@sifive.com, guoren@linux.alibaba.com, Vincent Chen , Andy Chiu , Paul Walmsley , Albert Ou , Conor Dooley , Richard Henderson , Guo Ren , =?ISO-8859-1?Q?Bj=F6rn_T=F6pel?= , Andrew Jones , Xianting Tian , Jisheng Zhang , Wenting Zhang , Al Viro , Andrew Bresticker , Andy Chiu Subject: Re: [PATCH -next v17 13/20] riscv: signal: Add sigcontext save/restore for vector Date: Sun, 02 Apr 2023 00:20:32 +0200 Message-ID: <2624132.Isy0gbHreE@diego> In-Reply-To: <20230327164941.20491-14-andy.chiu@sifive.com> References: <20230327164941.20491-1-andy.chiu@sifive.com> <20230327164941.20491-14-andy.chiu@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Am Montag, 27. März 2023, 18:49:33 CEST schrieb Andy Chiu: > From: Greentime Hu > > This patch facilitates the existing fp-reserved words for placement of > the first extension's context header on the user's sigframe. A context > header consists of a distinct magic word and the size, including the > header itself, of an extension on the stack. Then, the frame is followed > by the context of that extension, and then a header + context body for > another extension if exists. If there is no more extension to come, then > the frame must be ended with a null context header. A special case is > rv64gc, where the kernel support no extensions requiring to expose > additional regfile to the user. In such case the kernel would place the > null context header right after the first reserved word of > __riscv_q_ext_state when saving sigframe. And the kernel would check if > all reserved words are zeros when a signal handler returns. > > __riscv_q_ext_state---->| |<-__riscv_extra_ext_header > ~ ~ > .reserved[0]--->|0 |<- .reserved > <-------|magic |<- .hdr > | |size |_______ end of sc_fpregs > | |ext-bdy| > | ~ ~ > +)size ------->|magic |<- another context header > |size | > |ext-bdy| > ~ ~ > |magic:0|<- null context header > |size:0 | > > The vector registers will be saved in datap pointer. The datap pointer > will be allocated dynamically when the task needs in kernel space. On > the other hand, datap pointer on the sigframe will be set right after > the __riscv_v_ext_state data structure. > > Co-developed-by: Vincent Chen > Signed-off-by: Vincent Chen > Signed-off-by: Greentime Hu > Suggested-by: Vineet Gupta > Suggested-by: Richard Henderson > Co-developed-by: Andy Chiu > Signed-off-by: Andy Chiu > Acked-by: Conor Dooley Acked-by: Heiko Stuebner Tested-by: Heiko Stuebner