Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp73937lqh; Thu, 30 May 2024 14:36:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDrRKc7yaWdQZ3sr5l4mXBS7TYB8it2xPhsrQmV15j1jzomz/wp0lvTYDrFsBuHW623NYmzCcBF7QthF1D75HLcuR2mtSqgTftG8GnnA== X-Google-Smtp-Source: AGHT+IEZ/ZbEnn9sG694Ulx2Rhqb5+M4un2SyAW82ZamSmhkGxjByYjdcjHUgwlP41wo+T5yBxk3 X-Received: by 2002:a05:6a00:1994:b0:6eb:40:6bff with SMTP id d2e1a72fcca58-702477fdb1cmr59780b3a.14.1717104983058; Thu, 30 May 2024 14:36:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717104983; cv=pass; d=google.com; s=arc-20160816; b=s5TJZSRBXFo/xfL0nEWu7r9ZvxLeQz5vkEp7J81VC9So2cFtfEWEGXxB0npPZMYxYe h5tMIlYg4GjTRNlLtL0zSGdCG2iPHcnVWEQ3aBc+2JNaCeIxBGceFjfEkqOeXYbefn5M iPb9NLQ4cQaSDjVTNlP4DoTThj6c0w/tESmILlkB5sTrnWvGwVuPd8yzLKyTlNlDIuLf vd8jk7z0urj8D0eHpbDhBejMatgZr7H5J2iHBQOi95NpXQhTqhIaEb3dA7h9oSwPptgs KI0j3e41TeccxK5WTMEEbpTqqpao+F3hEwnTAkcRAsuUaQg/+X98erQGsnVtUHakxOXR wyQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:to:from:cc:in-reply-to :subject:date:dkim-signature; bh=t9TSHRpBOLH2WAAvUW98eatlSfzIkGIzBEN/BAb+rPI=; fh=YLFbkvXdXYZj9OEGfkhWFhE/J9C5Bc8O7nsJklbBQFs=; b=Ei1XB1fHP759K+8i8x45ZpooJH/E1MUASd3aGVYHEiQvAgGl8E9kWaKt2+iIaNGg9O aiqsgI6fDnJVDLmUyENhG0SBSQZa8B6fPZHYwcDK65bCN1o/hvkZZVqzg6Wg0hDtE5bE 9Ci9LALHdcVXSb8wjXm49tgftCrdxEOwHArDFeGQUt0OKv6Xun7NvoSgnelSNFBIMGbr udNcHo9/WcGPBNyy/NPQHJ1yoH1ioxnh+1NKyx7Tw/YqIliGNx0SqVBmdNlPOcT21l9W utYsFkYiiR+EA/PjVvXKIDICn1lk1pwTJ9+FFXSQU82S2sfutC8/ArcsYexGgF5YPFg5 H2fg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dabbelt-com.20230601.gappssmtp.com header.s=20230601 header.b=Cli5bx6D; arc=pass (i=1 spf=pass spfdomain=dabbelt.com dkim=pass dkdomain=dabbelt-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-195942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195942-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-70242d57046si282428b3a.322.2024.05.30.14.36.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 14:36:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20230601.gappssmtp.com header.s=20230601 header.b=Cli5bx6D; arc=pass (i=1 spf=pass spfdomain=dabbelt.com dkim=pass dkdomain=dabbelt-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-195942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195942-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E197AB23AEF for ; Thu, 30 May 2024 21:36:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C316181308; Thu, 30 May 2024 21:35:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dabbelt-com.20230601.gappssmtp.com header.i=@dabbelt-com.20230601.gappssmtp.com header.b="Cli5bx6D" Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5802A180A92 for ; Thu, 30 May 2024 21:35:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717104956; cv=none; b=bWJOC2iF4XUsl3ilCRpjFp14mvuY75Q72EQn+zZAgQ93d6pdNyprxGxQ6acboK/G/tZiB8aLCMQ0UWBLm/83cU1zBMpI0O//QS3CW0Kj4BEryM6w+XfAtK13GTLa07XrbdK7ce885EwHL/fPvOn5kygkVBd9IB+ZEV69vus0gTM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717104956; c=relaxed/simple; bh=Qgc7fuqJhkQMT7P00M8+eJ9dGTQJzcQfycxbQMKjjKw=; h=Date:Subject:In-Reply-To:CC:From:To:Message-ID:Mime-Version: Content-Type; b=rLt/hjp6QLKbMhMpuzSiIKgIro6lfv7T5z8xw+ldjx/E4LTtwDRdlU+pOcES2GYF3mj3KzhI/SCP51LJbUT9krBoIM3jceoEKWEMCkNggiCzzIAk8zjv6hFn3W6kpOsCjbOY/MN23ZfT2Y86JeJ7epjp6J6gOpP7yOQYl7rXSL0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dabbelt.com; spf=pass smtp.mailfrom=dabbelt.com; dkim=pass (2048-bit key) header.d=dabbelt-com.20230601.gappssmtp.com header.i=@dabbelt-com.20230601.gappssmtp.com header.b=Cli5bx6D; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dabbelt.com Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-6818eea9c3aso273898a12.1 for ; Thu, 30 May 2024 14:35:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20230601.gappssmtp.com; s=20230601; t=1717104953; x=1717709753; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=t9TSHRpBOLH2WAAvUW98eatlSfzIkGIzBEN/BAb+rPI=; b=Cli5bx6DRtsBkOcCImBGZUG4vLimgStnYJ6SKBDzG4wMVEHiF6Ld8+jsKUsIno/xm2 siZzCPOQAS2MP5HDzfYm4Nkfn81W1pwvtSvKnF2IuMa7ENGOpDxANkH+jmSmq2MCXjCQ k5kxoEjwzOOMMT4MDbvleLJyCRokLjRI2mf5KzdMtDX1uDh/eFmnZPhlJTfz5rsF/2fl DpjaBdLU/sMPyYWYs+kaXTLGedWD+iYmLjU/OciU8xp4dJNk+YS+BmaqhPx/9Xe+gjyZ fK1QvN6oL8yecAehtY0CJy/2mWInGg26Dwq96/Tit9LGpNJ2nLGYi+5ReFIgcKo1gbqU 5Ewg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717104953; x=1717709753; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=t9TSHRpBOLH2WAAvUW98eatlSfzIkGIzBEN/BAb+rPI=; b=Q7bTMZfhr0YUxjJZihH6lBhdUwanOnOZ6WTcGI5augSFe8YiYxbeQVLJ+iWpskjOuV llRRAiXuq1zQ1XfOHC3pj/6D9vse/jxmeAkaFBDoipwLOR6Yg21s5cRuswmF1EraZqy+ nZQYku8reFvjAoUcIGQPhEdw0Bayz8MoVCEyZM5cRZSIjIQtsFHLW+SWYGKIz9NdQSEY Ewq8nOQWAlWJ4Xrs0/7ZxVyMO5gz5PjJtlMISr/o66QqCYuIVcsWkp5vDwMgGz05PPfp QN/Bpefec9HgItl6AULhgVw/cPRtohGtNXuhrk8GWuh+C5yB+7u3Zh4Nvh7C/7/R07As EqWg== X-Forwarded-Encrypted: i=1; AJvYcCVlO+aAoZNLlcJm76O7wbWn6NhAw+nb84vnOdZo5R8QC/odA3ua7JGC1TMPcschXfe6TgYPTF6yARrwFdFfz+5BuS1qlEY/dcaHv9Xm X-Gm-Message-State: AOJu0YzdoaAVgsZYfVpMOtVnvUOtKluPCQ8EFSd+Eup8iHgfOII9Pg+a szWd3OH3p7aCoeuYY4jLy23lOYJKUo5vc7XgjKIQ03GykL152P8PXabbxTWM+as= X-Received: by 2002:a17:90a:9c13:b0:2bd:d6cc:c305 with SMTP id 98e67ed59e1d1-2c1abc4eda6mr2950107a91.49.1717104953359; Thu, 30 May 2024 14:35:53 -0700 (PDT) Received: from localhost ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c1a775ccedsm2159002a91.1.2024.05.30.14.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 14:35:51 -0700 (PDT) Date: Thu, 30 May 2024 14:35:51 -0700 (PDT) X-Google-Original-Date: Thu, 30 May 2024 14:35:49 PDT (-0700) Subject: Re: [PATCH v5 6/8] riscv: hwprobe: add zve Vector subextensions into hwprobe interface In-Reply-To: <20240510-zve-detection-v5-6-0711bdd26c12@sifive.com> CC: Paul Walmsley , aou@eecs.berkeley.edu, Conor Dooley , Heiko Stuebner , andy.chiu@sifive.com, guoren@kernel.org, Conor Dooley , robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, corbet@lwn.net, Evan Green , cleger@rivosinc.com, shuah@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, vincent.chen@sifive.com, greentime.hu@sifive.com, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org From: Palmer Dabbelt To: andy.chiu@sifive.com Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On Thu, 09 May 2024 09:26:56 PDT (-0700), andy.chiu@sifive.com wrote: > The following Vector subextensions for "embedded" platforms are added > into RISCV_HWPROBE_KEY_IMA_EXT_0: > - ZVE32X > - ZVE32F > - ZVE64X > - ZVE64F > - ZVE64D > > Extensions ending with an X indicates that the platform doesn't have a > vector FPU. > Extensions ending with F/D mean that whether single (F) or double (D) > precision vector operation is supported. > The number 32 or 64 follows from ZVE tells the maximum element length. > > Signed-off-by: Andy Chiu > Reviewed-by: Clément Léger > --- > Changelog v5: > - Rebase thus add ZVE32X after RISCV_HWPROBE_EXT_ZICOND. > Changelog v2: > - zve* extensions in hwprobe depends on whether kernel supports v, so > include them after has_vector(). Fix a typo. (Clément) > --- > Documentation/arch/riscv/hwprobe.rst | 15 +++++++++++++++ > arch/riscv/include/uapi/asm/hwprobe.h | 5 +++++ > arch/riscv/kernel/sys_hwprobe.c | 5 +++++ > 3 files changed, 25 insertions(+) > > diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst > index 204cd4433af5..fc015b452ebf 100644 > --- a/Documentation/arch/riscv/hwprobe.rst > +++ b/Documentation/arch/riscv/hwprobe.rst > @@ -192,6 +192,21 @@ The following keys are defined: > supported as defined in the RISC-V ISA manual starting from commit > d8ab5c78c207 ("Zihintpause is ratified"). > > + * :c:macro:`RISCV_HWPROBE_EXT_ZVE32X`: The Vector sub-extension Zve32x is > + supported, as defined by version 1.0 of the RISC-V Vector extension manual. > + > + * :c:macro:`RISCV_HWPROBE_EXT_ZVE32F`: The Vector sub-extension Zve32f is > + supported, as defined by version 1.0 of the RISC-V Vector extension manual. > + > + * :c:macro:`RISCV_HWPROBE_EXT_ZVE64X`: The Vector sub-extension Zve64x is > + supported, as defined by version 1.0 of the RISC-V Vector extension manual. > + > + * :c:macro:`RISCV_HWPROBE_EXT_ZVE64F`: The Vector sub-extension Zve64f is > + supported, as defined by version 1.0 of the RISC-V Vector extension manual. > + > + * :c:macro:`RISCV_HWPROBE_EXT_ZVE64D`: The Vector sub-extension Zve64d is > + supported, as defined by version 1.0 of the RISC-V Vector extension manual. > + > * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance > information about the selected set of processors. > > diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h > index 31c570cbd1c5..6593aedb9d2b 100644 > --- a/arch/riscv/include/uapi/asm/hwprobe.h > +++ b/arch/riscv/include/uapi/asm/hwprobe.h > @@ -60,6 +60,11 @@ struct riscv_hwprobe { > #define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34) > #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) > #define RISCV_HWPROBE_EXT_ZIHINTPAUSE (1ULL << 36) > +#define RISCV_HWPROBE_EXT_ZVE32X (1ULL << 37) > +#define RISCV_HWPROBE_EXT_ZVE32F (1ULL << 38) > +#define RISCV_HWPROBE_EXT_ZVE64X (1ULL << 39) > +#define RISCV_HWPROBE_EXT_ZVE64F (1ULL << 40) > +#define RISCV_HWPROBE_EXT_ZVE64D (1ULL << 41) > #define RISCV_HWPROBE_KEY_CPUPERF_0 5 > #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) > #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) > diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c > index 969ef3d59dbe..35390b4a5a17 100644 > --- a/arch/riscv/kernel/sys_hwprobe.c > +++ b/arch/riscv/kernel/sys_hwprobe.c > @@ -114,6 +114,11 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, > EXT_KEY(ZIHINTPAUSE); > > if (has_vector()) { > + EXT_KEY(ZVE32X); > + EXT_KEY(ZVE32F); > + EXT_KEY(ZVE64X); > + EXT_KEY(ZVE64F); > + EXT_KEY(ZVE64D); > EXT_KEY(ZVBB); > EXT_KEY(ZVBC); > EXT_KEY(ZVKB); Conor left a comment over here . I think the best bet is to just merge this v5 on for-next now, though -- there's a bunch of patch sets touching ISA string parsing and IIUC that sub-extension parsing stuff is a pre-existing issue, and Clement's patch set still has some outstanding feedback to address. So I think if we just go with this we're not regressing anything, we just have a bit more to clean up. Maybe it's a little uglier now that userspace can see the sub-extensions, but I'd bet wacky ISA strings will be able to confuse us for a while. I staged this so I can throw it at the tester, LMK if anyone has issues otherwise it'll show up on for-next.