Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2591905rwb; Fri, 20 Jan 2023 05:06:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXubOOoBQl5TH5WH0MpnRltBMTNEn6W+jJBhtzIw4uuYpqNnOW10wxOk7r9F7DV9P2GvgKXg X-Received: by 2002:a17:906:4a85:b0:84d:2f09:661 with SMTP id x5-20020a1709064a8500b0084d2f090661mr14708652eju.1.1674219972679; Fri, 20 Jan 2023 05:06:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674219972; cv=none; d=google.com; s=arc-20160816; b=CJYcUEiMZfWXyyZxYKTQlZnRh3mj6p5Fnb7XVqK59ug9r6SSyySpQiCfDicabocPPy ZO0pKUleaHFs3CBD1tpIx3z+Lpwd8rA0QR9w+eZSXemUBgUQtOMBdZpbdfldpVjunQ3v GU6tof+ahQDhQyf7skvkQKbKr8CFz1SL6doq0DlIUGTkiDmDSvqGY6Jei+21ofiIA4kD D2yN6oD2rvH5hizwjkGT9dg7CYxuUgt+MNocsBR5Prbk3E9ccRQbmV5QdGMySOCHpfhR YLZkDdC6pxtwhrQXn4D6Klb9oq+eZ9qKSgNBkWn/zsl1/zNEqgr6s9AQcZVGIhoi4KvS D2Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hgz0YycZqXjsTFr84HbNrYAi57hU0rXTBmXUSg8kZ3k=; b=rQlPdLUv/knz6KPwMJCPKjqepBm077LLPQ5YMR7TuuwXJT8ZnCVOpfrZG6UsTxSflO VgxJm5b11HsXa1ITvo2nTypR1aDQ/kPiW1+h+QjDP52SC2RQo0shyrv/4hvsR9sJukUx /65bsOCYOIoXAlfbJ9/9XA4UWJAQO3z7tOBF+CaPxapYoKtj1+gY0cQHzrvkUrmZSiC0 Pnsmav+ljp21zE5OvHga0DA+B1PvxGVQ5HrVc4OgVNakuJivaSGes+1TdQkzxVp3QIsT VJnhWaZ/RZEJIjolpkqsqkFXXCWMRtkKxsj/NbT6R1GvAzzU5ym/y0NkYgvJ5/xeANQn W2lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj5-20020a0564022b8500b004607378ae65si33414930edb.160.2023.01.20.05.05.58; Fri, 20 Jan 2023 05:06:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbjATMVq (ORCPT + 49 others); Fri, 20 Jan 2023 07:21:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjATMVp (ORCPT ); Fri, 20 Jan 2023 07:21:45 -0500 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AF3B8B303; Fri, 20 Jan 2023 04:21:42 -0800 (PST) Received: from ip5b412258.dynamic.kabel-deutschland.de ([91.65.34.88] 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 1pIqNP-0003oi-Vu; Fri, 20 Jan 2023 13:20:12 +0100 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: linux-riscv@lists.infradead.org Cc: Guo Ren , Vincent Chen , Han-Kuan Chen , Greentime Hu , Palmer Dabbelt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Eric Biederman , Kees Cook , Anup Patel , Atish Patra , Oleg Nesterov , Heinrich Schuchardt , Guo Ren , Chris Stillson , Mayuresh Chitale , Paolo Bonzini , Alexandre Ghiti , Qinglin Pan , Arnd Bergmann , Jisheng Zhang , Dao Lu , "Peter Zijlstra (Intel)" , Sunil V L , Ruinland Tsai , Li Zhengyu , Alexander Graf , Ard Biesheuvel , Tsukasa OI , Yury Norov , Nicolas Saenz Julienne , Mark Rutland , Frederic Weisbecker , Changbin Du , Vitaly Wool , Myrtle Shah , Catalin Marinas , Will Deacon , Mark Brown , Alexey Dobriyan , Huacai Chen , Janosch Frank , Christian Brauner , Peter Collingbourne , Eugene Syromiatnikov , Colin Cross , Andrew Morton , Barret Rhoden , Suren Baghdasaryan , Davidlohr Bueso , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Chris Stillson Subject: Re: [PATCH v12 06/17] riscv: Reset vector register Date: Fri, 20 Jan 2023 13:20:09 +0100 Message-ID: <2331455.NG923GbCHz@diego> In-Reply-To: <20220921214439.1491510-6-stillson@rivosinc.com> References: <20220921214439.1491510-1-stillson@rivosinc.com> <20220921214439.1491510-6-stillson@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Mittwoch, 21. September 2022, 23:43:48 CET schrieb Chris Stillson: > @@ -431,6 +431,29 @@ ENTRY(reset_regs) > csrw fcsr, 0 > /* note that the caller must clear SR_FS */ > #endif /* CONFIG_FPU */ > + > +#ifdef CONFIG_VECTOR > + csrr t0, CSR_MISA > + li t1, COMPAT_HWCAP_ISA_V > + and t0, t0, t1 > + beqz t0, .Lreset_regs_done > + > + /* > + * Clear vector registers and reset vcsr > + * VLMAX has a defined value, VLEN is a constant, > + * and this form of vsetvli is defined to set vl to VLMAX. > + */ > + li t1, SR_VS > + csrs CSR_STATUS, t1 > + csrs CSR_VCSR, x0 > + vsetvli t1, x0, e8, m8, ta, ma > + vmv.v.i v0, 0 > + vmv.v.i v8, 0 > + vmv.v.i v16, 0 > + vmv.v.i v24, 0 > + /* note that the caller must clear SR_VS */ > +#endif /* CONFIG_VECTOR */ > + > .Lreset_regs_done: Not sure how much they go together, but the #ifdef CONFIG_FPU block above your new VECTOR block also jumps to the same .Lreset_regs_done, so with the patch as is the vector-reset block is never reached in the !FPU case. So maybe making them independent of each other might prevent issues down the roead.