Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2731945rdh; Wed, 27 Sep 2023 10:56:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGOXKgF+wCxF2e++ECP+ffSXrpC/MSRzRiUqpSsijkF/R2FM8PATXdO9YIq9xQgHgbUDDUY X-Received: by 2002:a05:6a20:ce87:b0:15e:1486:1e08 with SMTP id if7-20020a056a20ce8700b0015e14861e08mr2625523pzb.19.1695837404625; Wed, 27 Sep 2023 10:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695837404; cv=none; d=google.com; s=arc-20160816; b=lKZviaAOiXbog9MffH7TJiGOBqmFMq8hKvTW07SienbdAygtOlbiBleNAWKDJUWhHq G2Y9/Lri+gN7WO7kINlMWv/qTtsiLsRI+ZoD8caWh3CwNsHHjFcdw5/jfQLmpgenR89Y ZdCXmuz7+53Ay4FI2s3zvXsc6d/RvtZjUAfBceE3cvhtCFj7j/sbbH8a8SLoYF5LQdtW MTu1GNoUD2K2igy33oxgAvLOc+K+s6ijEb5m098CLkWbDbsehMJvth9kaWcQLYqp6fuv Lz4q4HfwYtvYkabW0h/PTFjo6cDiLOfFKP0HdUAG4e0t9NV1/i7HzyXx6eMoD+AZXwyB hR4Q== 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=ZV6WWLW/um6fjmDxBYmHw3kQW73zJt+fvsBsocXSqds=; fh=jYo+Uph0vQgyrtsS23VKeS4UvXJ1o4RVmi8ClaqOi6U=; b=dv6s3hiSouFPy8H3k15tBAGNqFx8IpHj1/xj3+1MqUvp+Ckui4HobHO7i6ACwpiDLH nuju2saoNb0hK6TFmaV+1PjxaWgxhktuS9J8mLe+b3BYUeEhG4agrSUr4IaqiznDPhfK ptnMzcU+kqboMv1VE62QSgc2c5zsXibtCaGEIgJo01L439ky/sYBAy4ynoltxOwZTfsn BR3FlJxgIHgDWjjKpx45lDdcOYDbekE7Sdj0JetdiuPjJr+g8SK9BWPVH7eqIyzAlWqp gefN0Lic/me8kO6xG5NAUklB5noYBSxyTxj++bUQs99gZLSs2IZ5NtojKP5jTBfIvQEK mORQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=DC8d5SUK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s16-20020a17090aba1000b0026d034f6baesi7176871pjr.117.2023.09.27.10.56.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 10:56:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=DC8d5SUK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id C31A4801C1BF; Tue, 26 Sep 2023 21:48:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229852AbjI0Ese (ORCPT + 99 others); Wed, 27 Sep 2023 00:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbjI0Err (ORCPT ); Wed, 27 Sep 2023 00:47:47 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 262BCCF3 for ; Tue, 26 Sep 2023 19:13:29 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-69101022969so9042681b3a.3 for ; Tue, 26 Sep 2023 19:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1695780808; x=1696385608; darn=vger.kernel.org; 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=ZV6WWLW/um6fjmDxBYmHw3kQW73zJt+fvsBsocXSqds=; b=DC8d5SUKAatSiQdlBhnd5VF3uy902y7PBvuSVQVWE7DHAzwMT2LVJdtRVQKWIMIT2j 53Gp/cgLv3p7Wy7pJK4vGLZMV250o5YFrhnIRvhrk3IbkkDWHR3D/D2kiWdb5m8EvJrM gnrAAvM+y5lROMtXpstp4RevSM1+m2eGiY4M8r9kUUMjrsyGhLGcxTczj1eIPsLuNreu 8AnUspd8OgN9AqkNB/vK7runY7jNlC7xbXjJUOta1iQ4yFBrKlJyB8Ez6bavloQJQj7I RAqd3wPrUpioJiNsIqcOvgE6HxwfLHcI1KIwXQCc5pBJq6uUx0t7/SZerQOCGSM4rrA+ UrEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695780808; x=1696385608; 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=ZV6WWLW/um6fjmDxBYmHw3kQW73zJt+fvsBsocXSqds=; b=ID/torIGpmc3CFbpd8OZg423N/un32TXbR2rcWMMXQ60W2lp4Yai8wK245nWp8Tmxs gyLNxWs9C260v7Pf12uXkpMLG5Q/xhq+OakelNkTiUZSJhV10jrT2zexsMrlG3QE7+vg vPm0tmhQKKVgTdy0laC1h9ibepYadH3AXESBMv0NVaYc4FSUwQ0kuPHsgUMKRR8sM3C3 o7y4CjlHiy8OUooCH2O281aBXNz5X7gWSKVIPLIu4kVup9pDZFDFZ7qsAp6hL/8Rzrkr oBB4MFr01Wnuxc/QMI1yNxbuZ0Q/a9DccF6ZRozjwLFSdDzWMz8bzLfbJpPN8Xw2NqTm auJw== X-Gm-Message-State: AOJu0YwPIy1IVx6KqSkhgGttrz5QH4FBWYlG4VEGoljOvwg0xABhShkP z86LVXz6wc+vPVdfiaFpXq6P8g== X-Received: by 2002:a05:6a00:cd5:b0:68c:49e4:bd71 with SMTP id b21-20020a056a000cd500b0068c49e4bd71mr709094pfv.34.1695780808529; Tue, 26 Sep 2023 19:13:28 -0700 (PDT) Received: from ghost ([2601:647:5700:6860:6eef:9e73:7774:1855]) by smtp.gmail.com with ESMTPSA id k12-20020aa7820c000000b0068fda1db80bsm10616571pfi.75.2023.09.26.19.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 19:13:28 -0700 (PDT) Date: Tue, 26 Sep 2023 19:13:24 -0700 From: Charlie Jenkins To: Anup Patel 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 Subject: Re: [PATCH v2 2/9] RISC-V: Detect XVentanaCondOps from ISA string Message-ID: References: <20230925133859.1735879-1-apatel@ventanamicro.com> <20230925133859.1735879-3-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 26 Sep 2023 21:48:47 -0700 (PDT) On Tue, Sep 26, 2023 at 09:44:38AM +0530, Anup Patel wrote: > On Tue, Sep 26, 2023 at 9:38 AM Anup Patel wrote: > > > > On Mon, Sep 25, 2023 at 11:18 PM 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/cpufeature.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[] = { > > > > __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_XVENTANACONDOPS), > > > > }; > > > > > > > > const size_t riscv_isa_ext_count = 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. > > I was conflating hwprobe with hwcap when I was thinking about this. However, I think it might still be beneficial to split out the vendor extensions. It is possible for vendors to implement each other's extensions but I don't expect that to be the average case. Because I do not expect this to be the average case, riscv_isa_ext becomes needlessly large as it has to contain the extensions of every vendor. > > > > > > 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 - Charlie