Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1725825rdh; Tue, 26 Sep 2023 01:18:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFIGwGVcT1UtgqELLubS6UUax56DjX14w5DhPoWcDjYprckf4Z27+yd+kXTmxE8LER3/qzW X-Received: by 2002:a05:6a21:66c9:b0:160:7679:90 with SMTP id ze9-20020a056a2166c900b0016076790090mr3043072pzb.56.1695716335096; Tue, 26 Sep 2023 01:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695716335; cv=none; d=google.com; s=arc-20160816; b=QZsAIiDMVFtHoivrlbMD5Mt7kISP9an8eaT2t74ZEeIq52qEZooCFEGC0QaaADIq+X PXTKGXXg9Q1GYL2d65Jy7Yh7B1w7qtiXiugaVQsVTAtm+Oy/Eu7Z3C08E0ZWohndUira nBeYg1PM8xzqvPSQ/wVdMJJoSeSc+P2YsnKVeCUq5pupYHaoVtZeSN1epM33EXMyJ3Xo XwfLFAZ5Eb8YjXJoz93Td1OB62AwlaW9O4OdMYQP789mrgpzi240n44GyvWH3kjMys3c +WLKOtK/gZCJmLniXsdb7sL56Ld2WEbh+flzz46kml8YzANDBe/14yFgAbMSizRMl6v0 RW+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=D0Uz9m0Lpyj2Up3M7ljAj872e7YEcYxbkjr4aA3fxoM=; fh=nPeDHqMrohMt0Jwxg7o98xWuAUVMkGo8XhDtOsWDiYE=; b=LheYPkDAIu9upSYNv57GHEV11QfF9inpYDMErLsYAN9ktL45yRQ6+PDXFZsYllFxGb 6YdQ6apWGo3JNqhsbkYrJrkN/59zJtlW8nP5CLcqqMnVLtV5Pnl4j9viPDmYNrGWpaIW gJRg7glxUSfWaJo/nj+Im+qsqKw8guNjr3LKqd414MkUtFuzXzzqB12LeS26EmErIq/8 nNZVl0hR2zMJwD4+EiCB7x0q0+/o+V2t+nKpKoOT0O5NbMOy2YeDq6sgJgFCJxPEpyMt +/CJOXza7XU9KLaWWW0MSaVQtLcjGseqzIsC/y0u1STR/ImxDc6sdWoldoD/37alc6eR 6Znw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=BIA5itrF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id br4-20020a056a00440400b0068e2f6feab4si11638048pfb.374.2023.09.26.01.18.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 01:18:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=BIA5itrF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4E9B4822A48B; Mon, 25 Sep 2023 21:14:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233201AbjIZEO6 (ORCPT + 99 others); Tue, 26 Sep 2023 00:14:58 -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 S229472AbjIZEO4 (ORCPT ); Tue, 26 Sep 2023 00:14:56 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D347E6 for ; Mon, 25 Sep 2023 21:14:50 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so5647277a12.1 for ; Mon, 25 Sep 2023 21:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1695701690; x=1696306490; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=D0Uz9m0Lpyj2Up3M7ljAj872e7YEcYxbkjr4aA3fxoM=; b=BIA5itrFYbRSfcwBtv6qT97Aph65YufArhdmkwRx98crNms3XpdOn4VlcnQ9vMxVE3 f1NlRmv8u3zDOn0J/amHvwmiNQFK9OxpzV+WNg6spVsUXTeoUQ2nkXWg/pR1Tw94Jg4h CZHBBySlEsHnuai08b8HsQFGS+j8KLnECC4l6DoJ/2RLnNYzjpCT5N5vukhHO4x/XLjW L/XGI9xdY5AUo3NeKr2gh2FcGjJIhMbb/jb0yCYog1xYuAX0ZOBgcocozO/8eT183NKj TLYHSf6IAkgFRbrhozKuFaaGG5iAR3KEmBuhlZwNwdPpuCVpity/ZOMIY5gFKu83KY2y mWcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695701690; x=1696306490; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D0Uz9m0Lpyj2Up3M7ljAj872e7YEcYxbkjr4aA3fxoM=; b=Dov7wow/Uf2d7nngh2xVIpVw6xdlCKQDtOxsV1hfDhpkoUHOjXz04WPVqqXwBFjFq/ wNTUWPZdkshQKDvprALOQ1hx6Yj7NL5ZeNscASym2OrDgjXKRWP6js5FsXm/rlMKwGoK u/0M+f+PsjQf+fT677iqFeCnQWXY9TRW9uQ9/r5slWlb6Kv5H6rLklxEscLI9f1zHnmH zeZ9IeKO3BF805V+4cRFZV9D3Zv2M55Ocmalho417ck5ipdqQegfhlChH4fynnR/dUDt tn+IYE5ib/uF+5LyLSWAZpJYt58pT9mgeyBW5jZ5hFjBsEsPyJj2Ya/SzFZChumU9gCW 8nvw== X-Gm-Message-State: AOJu0Yxj/xiafscyj7zjH6ObB/AQxGeF1YaGYmQYgLsU4RQJMhiAeG4B imfBBH1Oa4cXUf8OVIcToO0zLD6U0FbLty1G3UOItA== X-Received: by 2002:a05:6a20:a11e:b0:153:5832:b31b with SMTP id q30-20020a056a20a11e00b001535832b31bmr9309947pzk.53.1695701689540; Mon, 25 Sep 2023 21:14:49 -0700 (PDT) MIME-Version: 1.0 References: <20230925133859.1735879-1-apatel@ventanamicro.com> <20230925133859.1735879-3-apatel@ventanamicro.com> In-Reply-To: From: Anup Patel Date: Tue, 26 Sep 2023 09:44:38 +0530 Message-ID: Subject: Re: [PATCH v2 2/9] RISC-V: Detect XVentanaCondOps from ISA string To: Charlie Jenkins Cc: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Shuah Khan , Andrew Jones , Mayuresh Chitale , devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 21:14:58 -0700 (PDT) On Tue, Sep 26, 2023 at 9:38=E2=80=AFAM Anup Patel wrote: > > On Mon, Sep 25, 2023 at 11:18=E2=80=AFPM Charlie Jenkins wrote: > > > > On Mon, Sep 25, 2023 at 07:08:52PM +0530, Anup Patel wrote: > > > The Veyron-V1 CPU supports custom conditional arithmetic and > > > conditional-select/move operations referred to as XVentanaCondOps > > > extension. In fact, QEMU RISC-V also has support for emulating > > > XVentanaCondOps extension. > > > > > > Let us detect XVentanaCondOps extension from ISA string available > > > through DT or ACPI. > > > > > > Signed-off-by: Anup Patel > > > Reviewed-by: Andrew Jones > > > --- > > > arch/riscv/include/asm/hwcap.h | 1 + > > > arch/riscv/kernel/cpufeature.c | 1 + > > > 2 files changed, 2 insertions(+) > > > > > > diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/= hwcap.h > > > index 0f520f7d058a..b7efe9e2fa89 100644 > > > --- a/arch/riscv/include/asm/hwcap.h > > > +++ b/arch/riscv/include/asm/hwcap.h > > > @@ -59,6 +59,7 @@ > > > #define RISCV_ISA_EXT_ZIFENCEI 41 > > > #define RISCV_ISA_EXT_ZIHPM 42 > > > #define RISCV_ISA_EXT_SMSTATEEN 43 > > > +#define RISCV_ISA_EXT_XVENTANACONDOPS 44 > > > > > > #define RISCV_ISA_EXT_MAX 64 > > > > > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufe= ature.c > > > index 3755a8c2a9de..3a31d34fe709 100644 > > > --- a/arch/riscv/kernel/cpufeature.c > > > +++ b/arch/riscv/kernel/cpufeature.c > > > @@ -182,6 +182,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = =3D { > > > __RISCV_ISA_EXT_DATA(svinval, RISCV_ISA_EXT_SVINVAL), > > > __RISCV_ISA_EXT_DATA(svnapot, RISCV_ISA_EXT_SVNAPOT), > > > __RISCV_ISA_EXT_DATA(svpbmt, RISCV_ISA_EXT_SVPBMT), > > > + __RISCV_ISA_EXT_DATA(xventanacondops, RISCV_ISA_EXT_XVENTANACON= DOPS), > > > }; > > > > > > const size_t riscv_isa_ext_count =3D ARRAY_SIZE(riscv_isa_ext); > > > -- > > > 2.34.1 > > > > > > > > > _______________________________________________ > > > linux-riscv mailing list > > > linux-riscv@lists.infradead.org > > > http://lists.infradead.org/mailman/listinfo/linux-riscv > > > > I worry about storing vendor extensions in this file. Because vendor > > extensions are not standardized, they can only be expected to have the > > desired behavior on hardware with the appropriate vendor id. A couple > > Assuming that a vendor extension is only available on hardware with > appropriate vendor id is not correct because: > 1) vendor A can allow vendor B to implement a custom extension > defined by vendor B Typo correction: "vendor A can allow vendor B to implement a custom extension defined by vendor A" > 2) vendor A and vendor B can jointly develop a RISC-V CPU where > both vendors integrate their custom extensions. > > It is best to identify a vendor extension independently with a > "X" string to keep it simple > and scalable. > > Along these lines, each T-Head custom extension should have a > "XThead" name associated with it. > > > months ago I sent a patch to address this by handling vector extensions > > independently for each vendor [1]. I dropped the patch because it > > relied upon Heiko's T-Head vector extension support that he stopped > > working on. However, I can revive this patch so you can build off of it= . > > At least, the conditional operations don't need a hwprobe interface > because an application is either compiled with or without conditional > operations. In other words, effective use of conditional operation is > only possible if compiler generates these instructions based on > code patterns. > > > > > This scheme has the added benefit that vendors do not have to worry > > about conficting extensions, and the kernel does not have to act as a > > key registry for vendors. > > How can vendor extensions conflict if they all follow the > "X" naming scheme ? > > > > > What are your thoughts? > > > > - Charlie > > > > [1] https://lore.kernel.org/lkml/20230705-thead_vendor_extensions-v1-2-= ad6915349c4d@rivosinc.com/ > > > > Regards, > Anup Regards, Anup