Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp82530lql; Fri, 12 Apr 2024 04:38:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXojqPSQuoEUYJ2LpCeUmdWRSkU9q4G6+u5y/XMv+A+Vnknu/sTYFwzr+cemCp758O0nsTRCZ4CN9buAndYg92gyiV8g1q2/tHqz5ukXw== X-Google-Smtp-Source: AGHT+IGcVMiAXZV6+QmV7l/BanyYpI3tok/2PM1gj0rMuOJbrEYpZtgHoCdHTm0DwOSfGSwzFNey X-Received: by 2002:a17:906:35cc:b0:a4e:146c:ff09 with SMTP id p12-20020a17090635cc00b00a4e146cff09mr1554177ejb.7.1712921933660; Fri, 12 Apr 2024 04:38:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712921933; cv=pass; d=google.com; s=arc-20160816; b=jF/3l0lLwyZLRJqbAEVfd5u13Db5z/WrezL8eg3n6jeFOWDSpIpErdNjwRZ19mwtvz BlMyP1OK0a80IWPcCftLunvlIaouOHY1eGKYB9VBqIHp05QFT4nJDRZIAo5LDGyvvn6u BwKx+fPGOyoIyVuxks0QgkoXqYq2lTeHK7sxLk9dvmbneZWqL8WmQa0mFYtrsekjfTqi r8nSYBPLcUIQ3RvN/dGf5X40+enOKxEJKDRF8lhH2jLsIg5m98Xsht+447PaVOv6VwIC rmvANUEqQ3P0TpZlwNXC6PQn5mp92/z3tGPt4scGYkRoCsOAF6kP2QRwVFzpV2KmO4DS rdVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=4UpTQ8kTBTHee1f/pW2M4l7pKoEqtUFfuQYaNc5980k=; fh=4jyGPlIgBC+cOBl2betKVRRu896Cfe1VEzAQNc3FCOU=; b=YmMHOWqtVvmkyqgxttQb5rZ3wKHwGQFLUCAFLi+tnJF2qHxlZchl+ONMoxtL6FGY92 2xxJWUdUsCpxQTOgoewZtFVWToMfeAqauSI3VrrPAiI2l/rTPlE1Mlzz0m3WxFiwagNi ddbCy8FqQaIF0g/2aW443HztnQii8TEa/6w+YgN7vzdOP+h5YI/NjluxKyHqf133/Rjx +lrRu/6nq1FXXaDSAtDHhcgG95gx8bK9Th9UNL17LBXZ0W7kEqJQ7HZGEgdthPWFvyFY wIng2DxksyTGZzzGpjZlT865kB/EpP08gzsPp4eG5w0ctDCI1PhUMa9oAj/cWCwL/SgX 8pgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=B4ybTsXF; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-142601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qk37-20020a1709077fa500b00a5224dfa891si1436044ejc.590.2024.04.12.04.38.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 04:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=B4ybTsXF; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-142601-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 63FF11F21A4B for ; Fri, 12 Apr 2024 11:38:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B05B5674C; Fri, 12 Apr 2024 11:38:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="B4ybTsXF" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FF245674E; Fri, 12 Apr 2024 11:38:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712921909; cv=none; b=oDt+yQddqy8ypjSYxfP8MnkCzruYTYP7oKC1WoPYjrWkUI6UH/4fvvK+xXwXQ03NleLePeG6kLQwAHp8hNIo1ZHBmQetjxDCjq8+Dqkd7K9LnpVVwaTcBVIl2AZ9IrgQAI9810mtQcW+zCHchVOytUAGNT/zqgv3WTELajROwXU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712921909; c=relaxed/simple; bh=aWPWXWwePYJ7mcthXXcnh6W3EMOk6ujdepGmdYxSc0c=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HJsq8TpNdeQlIWq3QaksZlpxXCxO5vuYVnkRj1GUUTVPsAL5NGr6GtAMsk8Q8P4FAtIfXkpiyiOVOAiD/YHWd0bAWIyu+c4yI5CaYS2q6Oh/ePYJRAc53uRdUcgxTxyRMERlWvMsvGWVD7lx5mc2dCDo//8PnjFK7r0egy/guUw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=B4ybTsXF; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1712921908; x=1744457908; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=aWPWXWwePYJ7mcthXXcnh6W3EMOk6ujdepGmdYxSc0c=; b=B4ybTsXFVrSB7obR05QAb5IRs7584qdbH4++gFBdVj1o6VZ1GfDS8Irv ePwPuu8FILMnb3ZHUU+FAnj/rvxWpr6TGXCL48kFh73NFnNGXWNRErmgw DFPE+XUOoVsl9f1hajG8b9N47NMY8JVfslhQcs70iCuqzLIANti+pLrkQ BH7d6NeZCu68DKm3qih8nDAx5Y+E0IXTbRr27q5iAF7pKBnxTv91dktKU BBbZjnsR4cF6DXhPBFGlSJGM0E4lul8NbajMJIzeCTpi1BNZciYjNZFvv mX9zvcFKwFQauGWYd5XPAYDskpGoXSwQnLr2o+zCctuVpKn6Gpzvhrcq9 Q==; X-CSE-ConnectionGUID: ++lz7ARxTeyfeBIEUobjog== X-CSE-MsgGUID: KH8PpH+1RGyAV72cISUUNA== X-IronPort-AV: E=Sophos;i="6.07,196,1708412400"; d="asc'?scan'208";a="20734020" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 12 Apr 2024 04:38:27 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 12 Apr 2024 04:38:03 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Fri, 12 Apr 2024 04:37:59 -0700 Date: Fri, 12 Apr 2024 12:37:08 +0100 From: Conor Dooley To: Charlie Jenkins CC: Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Evan Green , =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= , Jonathan Corbet , Shuah Khan , , , , Palmer Dabbelt , , , , Subject: Re: [PATCH 15/19] riscv: hwcap: Add v to hwcap if xtheadvector enabled Message-ID: <20240412-thrill-amnesty-019897f21466@wendy> References: <20240411-dev-charlie-support_thead_vector_6_9-v1-0-4af9815ec746@rivosinc.com> <20240411-dev-charlie-support_thead_vector_6_9-v1-15-4af9815ec746@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ibtP5+Ck2kdPiHYk" Content-Disposition: inline In-Reply-To: <20240411-dev-charlie-support_thead_vector_6_9-v1-15-4af9815ec746@rivosinc.com> --ibtP5+Ck2kdPiHYk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 11, 2024 at 09:11:21PM -0700, Charlie Jenkins wrote: > xtheadvector is not vector 1.0 compatible, but it can leverage all of > the same save/restore routines as vector plus > riscv_v_first_use_handler(). vector 1.0 and xtheadvector are mutually > exclusive so there is no risk of overlap. I think this not okay to do - if a program checks hwcap to see if vector is supported they'll get told it is on T-Head system where only the 0.7.1 is. >=20 > Signed-off-by: Charlie Jenkins > --- > arch/riscv/kernel/cpufeature.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) >=20 > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeatur= e.c > index 41a4d2028428..59f628b1341c 100644 > --- a/arch/riscv/kernel/cpufeature.c > +++ b/arch/riscv/kernel/cpufeature.c > @@ -647,9 +647,13 @@ static void __init riscv_fill_hwcap_from_isa_string(= unsigned long *isa2hwcap) > * Many vendors with T-Head CPU cores which implement the 0.7.1 > * version of the vector specification put "v" into their DTs. > * CPU cores with the ratified spec will contain non-zero > - * marchid. > + * marchid. Only allow "v" to be set if xtheadvector is present. > */ > - if (acpi_disabled && this_vendorid =3D=3D THEAD_VENDOR_ID && > + if (__riscv_isa_vendor_extension_available(isavendorinfo->isa, > + RISCV_ISA_VENDOR_EXT_XTHEADVECTOR)) { > + this_hwcap |=3D isa2hwcap[RISCV_ISA_EXT_v]; > + set_bit(RISCV_ISA_EXT_v, isainfo->isa); > + } else if (acpi_disabled && this_vendorid =3D=3D THEAD_VENDOR_ID && > this_archid =3D=3D 0x0) { > this_hwcap &=3D ~isa2hwcap[RISCV_ISA_EXT_v]; > clear_bit(RISCV_ISA_EXT_v, isainfo->isa); > @@ -776,6 +780,15 @@ static int __init riscv_fill_hwcap_from_ext_list(uns= igned long *isa2hwcap) > =20 > of_node_put(cpu_node); > =20 > + /* > + * Enable kernel vector routines if xtheadvector is present > + */ > + if (__riscv_isa_vendor_extension_available(isavendorinfo->isa, > + RISCV_ISA_VENDOR_EXT_XTHEADVECTOR)) { > + this_hwcap |=3D isa2hwcap[RISCV_ISA_EXT_v]; > + set_bit(RISCV_ISA_EXT_v, isainfo->isa); > + } > + > /* > * All "okay" harts should have same isa. Set HWCAP based on > * common capabilities of every "okay" hart, in case they don't. >=20 > --=20 > 2.44.0 >=20 --ibtP5+Ck2kdPiHYk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZhkc5AAKCRB4tDGHoIJi 0gKCAP4v+esN57jD+BTAcXXG/qusYjMQbk1rVAldJniCgV0x0gEAibLnaoOuNXqF Pa0786aCvAvHYTWbBfJ/ykNix6NyKQI= =b/XX -----END PGP SIGNATURE----- --ibtP5+Ck2kdPiHYk--