Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp13660791rwd; Sat, 24 Jun 2023 04:31:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ43jN+M6sVdGrt0hYY+H4F0ktuCSXHwCBGHXbcuOrKPBilt6sbQKsho23mtHtI4pPeKLNYA X-Received: by 2002:a05:6870:a8a9:b0:1a6:bd36:a24c with SMTP id eb41-20020a056870a8a900b001a6bd36a24cmr21787680oab.47.1687606285155; Sat, 24 Jun 2023 04:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687606285; cv=none; d=google.com; s=arc-20160816; b=thIrm/hU5IiawQiRtQTY8vrJQQUlS4p0uTok1U156p/9+1bJv/4Ql+bcXdFl/yDjPV rJk9XdKHK6FM1gDGnbQLZ+178NBlyzpxHk7VEgRD1xEginKJ0Qf8x46SFTaYT92bIHpw gP5hMZNR3qy+d3q2J7VaGrsP0oGNdkXcq9oMW4bd8n0cISR9ZFHgaTxFfVLuwmC+Wp6k bUEPYj+KFsS50uHTENZHuEEs1Pycv1Ofi77Eqhi1omiGSfcmHSmKUjfgI4NTsLvEY+y5 2ngg4y5GlVvLOWpRRKdijFPf1UcP4GxIfV6A/wIELjIbMUU/F7nlIDV4tqK8paQgpMlh kIDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Pnhb5E9gx1rgoSmnUX9zo1/G7QfayE+d3qTYxYfxz3k=; fh=c/HydMnydG9Jgio8WfglpZDYZ2i9oJ5JY5Zm5q1ywJs=; b=E+BB6se2/Jn1bBUMc27vC4KMo5uWPxzFW4W3DfGoTquBxTay1E7SLdfEv6/bBF5oFl CkeVrSIsUajWs4nkduthji5t18Az/y4EzGgrcT2cA3FkofjyhUwXwZdoD7HRCJMJGdsO ttFLslvfSpPc/B2D341Vf0pX7Ro9kBuNW5Y4PahKf5YYHqDs0hJUCbJYm0Yx6XZFOb+9 9ZpQZ3jvkr4HaPax1F1mMhrtKpRjZRctao1qDUDLZTWVmtYUVvzTW4jhngm70qloiOih IYgs3v7Nxug8U2PxzPy58QVbGgSfLircIqYIxSGoRRIoSYxX1EDw+AM7+k0y6We40Ry8 Ebow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=O6xneCpC; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e191-20020a6369c8000000b0054405fa924fsi1278905pgc.891.2023.06.24.04.31.04; Sat, 24 Jun 2023 04:31:25 -0700 (PDT) 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; dkim=pass header.i=@ventanamicro.com header.s=google header.b=O6xneCpC; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231379AbjFXK7s (ORCPT + 99 others); Sat, 24 Jun 2023 06:59:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbjFXK7q (ORCPT ); Sat, 24 Jun 2023 06:59:46 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77C1F1FCC for ; Sat, 24 Jun 2023 03:59:44 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-98df69cacd1so21739866b.1 for ; Sat, 24 Jun 2023 03:59:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1687604383; x=1690196383; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Pnhb5E9gx1rgoSmnUX9zo1/G7QfayE+d3qTYxYfxz3k=; b=O6xneCpCK/MO2lYg5yqQGCYU6udA+4Z/lEP/qpi0HL5arSlctbESRE35qh35JCxBVx 6gKl/+yDm2ipvTlVx4LlOz1uufewOVAzRJYUFqHEj4HgYxpk15mzSt1W0t9PwhkT5tfZ U21wQaR/0JzawOdoeFCnx/REdIz33qh+u739EMwDsxd47cs+ePxxYBeOcyNjanI/pemV CUItyCuytexALKokrF/zwRcKFbO3p8p6+VZBnvDMpF9UN5vEjmNVjB/BKXosl/jrtE0c KMZxPx1DLzeogr1D6isrhiaM2ZS2KB4Q6e+1roTaRu45QQ2O6DNJxMNZafpbKc17cnDL Zukg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687604383; x=1690196383; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Pnhb5E9gx1rgoSmnUX9zo1/G7QfayE+d3qTYxYfxz3k=; b=QCIu8TwmXLKfY6VtaL5ihjS+inNoShWqiqnaXKxgS89dX8qqr8B5OHUkxHHjBacbFx eILOfRqXyWSb2RqTnCQgTnP6CCq9vALflcNhE0T/vT/eNsoaVCBm3/PZ9WJ0Iprbh5Te v82FW7E1jWG17p9N3nsQbWXt+xjzWCMOGCD7WiOQFcK1mUxgogvsSBCDGmIFwcYGhjZQ 1yik5PkRBX/UE4XLDThOPGNla4ElZbIqSXUSGtmtbQHwiQBE1amY6PC8eCgiNcxkpGCi C6GsXwoKHeEz1z/GUMMh6A+vUc1iIDdNoBK9vYy3JWTlai45nsnVAL7eDJIJiy1QvCmg ra+g== X-Gm-Message-State: AC+VfDxfgqbT4z3XjK/v7ho8NaEvUQhAdVTf3u4KxRnehhLkvpsy2sRY OtX7s/A0UFoLqkGCses/YiWAvw== X-Received: by 2002:a17:907:9305:b0:96f:8666:5fc4 with SMTP id bu5-20020a170907930500b0096f86665fc4mr21756260ejc.50.1687604382670; Sat, 24 Jun 2023 03:59:42 -0700 (PDT) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id jz3-20020a170906bb0300b009829d2e892csm775425ejb.15.2023.06.24.03.59.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jun 2023 03:59:42 -0700 (PDT) Date: Sat, 24 Jun 2023 12:59:41 +0200 From: Andrew Jones To: Stefan O'Rear Cc: Heiko Stuebner , Conor Dooley , Palmer Dabbelt , paul.walmsley@sifive.com, linux-riscv@lists.infradead.org, samuel@sholland.org, guoren@kernel.org, christoph.muellner@vrull.eu, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] RISC-V: add T-Head vector errata handling Message-ID: <20230624-844c5c4701e8acf9bcf150aa@orel> References: <20230622231305.631331-1-heiko@sntech.de> <20230622231305.631331-4-heiko@sntech.de> <20230623-excluding-sprint-aea9cca0cb02@wendy> <1908808.taCxCBeP46@diego> <0904a831-82c5-47a0-be55-f1a59d0115c2@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0904a831-82c5-47a0-be55-f1a59d0115c2@app.fastmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Sat, Jun 24, 2023 at 01:18:26AM -0400, Stefan O'Rear wrote: > On Fri, Jun 23, 2023, at 6:40 AM, Heiko St?bner wrote: ... > >> > + > >> > +/* > >> > + * Vector 0.7.1 as used for example on T-Head Xuantie cores, uses an older > >> > + * encoding for vsetvli (ta, ma vs. d1), so provide an instruction for > >> > + * vsetvli t4, x0, e8, m8, d1 > >> > + */ > >> > +#define THEAD_VSETVLI_T4X0E8M8D1 ".long 0x00307ed7\n\t" > >> > + > >> > +/* > >> > + * While in theory, the vector-0.7.1 vsb.v and vlb.v result in the same > >> > + * encoding as the standard vse8.v and vle8.v, compilers seem to optimize > >> > + * the call resulting in a different encoding and then using a value for > >> > + * the "mop" field that is not part of vector-0.7.1 > >> > + * So encode specific variants for vstate_save and _restore. > >> > + */ > >> > +#define THEAD_VSB_V_V0T0 ".long 0x02028027\n\t" > >> > +#define THEAD_VSB_V_V8T0 ".long 0x02028427\n\t" > >> > +#define THEAD_VSB_V_V16T0 ".long 0x02028827\n\t" > >> > +#define THEAD_VSB_V_V24T0 ".long 0x02028c27\n\t" > >> > +#define THEAD_VLB_V_V0T0 ".long 0x012028007\n\t" > >> > +#define THEAD_VLB_V_V8T0 ".long 0x012028407\n\t" > >> > +#define THEAD_VLB_V_V16T0 ".long 0x012028807\n\t" > >> > +#define THEAD_VLB_V_V24T0 ".long 0x012028c07\n\t" > > .insn isn't supported by the kernel's minimum binutils version, but it _is_ > supported by the oldest version of binutils that can assemble rvv 1.0 > instructions. OP_V requires 2.39 so I use a literal 0x57 instead. > > very untested, and I leave it to your judgement whether it actually improves > readability: > > #define THEAD_VSETVLI_T4X0E8M8D1 ".insn i 0x57, 7, t4, x0, 3\n\t" > #define THEAD_VSB_V_V0T0 ".insn r STORE_FP, 0, 1, x0, t0, x0\n\t" > #define THEAD_VSB_V_V8T0 ".insn r STORE_FP, 0, 1, x8, t0, x0\n\t" > #define THEAD_VSB_V_V16T0 ".insn r STORE_FP, 0, 1, x16, t0, x0\n\t" > #define THEAD_VSB_V_V24T0 ".insn r STORE_FP, 0, 1, x24, t0, x0\n\t" > #define THEAD_VSB_V_V0T0 ".insn r LOAD_FP, 0, 9, x0, t0, x0\n\t" > #define THEAD_VSB_V_V8T0 ".insn r LOAD_FP, 0, 9, x8, t0, x0\n\t" > #define THEAD_VSB_V_V16T0 ".insn r LOAD_FP, 0, 9, x16, t0, x0\n\t" > #define THEAD_VSB_V_V24T0 ".insn r LOAD_FP, 0, 9, x24, t0, x0\n\t" > We have the INSN_R() macro in arch/riscv/include/asm/insn-def.h for stuff like this. Thanks, drew