Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp397163lqm; Wed, 1 May 2024 04:19:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXOubmHevrBNplfgwJfjCck8swSHJ/BDmcov1y3/wo52WUR9YczHfJSXAI62va97rKdI+F2Wx8QVJQRszIVxIXoGAYFI9y/ICmVa4roWQ== X-Google-Smtp-Source: AGHT+IHsmgdH0Y46st6OZb672GdNfSWPYAUS/7NlPgXfLCtbHzcOloqGOYjT91AquQYJk25/wvCM X-Received: by 2002:ac8:5850:0:b0:439:b523:46e4 with SMTP id h16-20020ac85850000000b00439b52346e4mr3936623qth.32.1714562391400; Wed, 01 May 2024 04:19:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714562391; cv=pass; d=google.com; s=arc-20160816; b=C5m8MSnm/gyS6NddtFpCJ9M/kiPnBFWD1cs5UcizE/BPhDltj+/GIE2N16hZIowq84 YcamAcO3HEAfqlDGC4QaiUujfybp/HDuxA/M7/++B3mRuGxw89xrepvcv9woJ3VdSI4b 3ZrOR/zZ40deGANPnLFzOfBcLge6JLMnBDRXH1yimzaNDpgFbhXu7koSTmAa7WnX5foM 8sEtLDv2rzqfIA7Y3uS+LcLJQN0Y/E7Nm+MMVaJsMbB6PoyPQGlCfBtsvY8kXPvZ5WR6 zeyyreYGMJFVnlr/j23DLjkUCaukJ0A/j/gjcby99+16umnII/hqU6fskTDwyt86p893 EXgw== 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=ydBSn2GJx/5xIAXuNI9N0XzBw1KAS6J4bTiBRV8/bYc=; fh=mBwwpQbay9vhzTgPULjjDn+LkmwbaBeNVRczdYQ/Av4=; b=SlIcGujQO0Dq3A+DGWPglj+OAGFlLpCvJWVTEPXsoMwba9RO7AkMzY9VZ6QgbtC94N HCnxoCK/EKXhCtzula0gj9+RrvjuQrkTwV4B3HRKbQlUKAcew9gcRK9WJnccaPGAWcEA 2Ice5K6gAjV9HwR0LH91IL+pGsF1lMeZeQP8bLSwmE98R41phQgohz83Kx5XHCzBxAn+ tIsuTST8P1XaxpHEiENY8KjO2TXC4IWDLimA9+z9o2hMQtyuZv9btgBTle74tP4H5x7I V94nwQAJTV0xQcz/ut0SzCW4mGdueoiFgvMAjKqXYUjFnF2QZeq9I608EW2Itat1996c Njcw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r1GBh8g1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165179-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165179-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n18-20020a05622a11d200b0043af96bafadsi6015017qtk.262.2024.05.01.04.19.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 04:19:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165179-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r1GBh8g1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165179-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165179-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 250741C21936 for ; Wed, 1 May 2024 11:19:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD89C60BBE; Wed, 1 May 2024 11:19:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r1GBh8g1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DC22956B63; Wed, 1 May 2024 11:19:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714562382; cv=none; b=t7CUtKKlXNBhNYmkLSlDkg61GlD5YorA2/b+6mP3rnPpnCPatbgu2BZbIWkG+NybqMOzC9VrE3z6tCUnNWm8IClBDZnjGkPqrDIJKxq3avx7z0HltR8Wn+ErDMdwQqqSjtTpJ/i2mrtOX+rYvmmdusFXilQtC5+Dx87a5Z32ZFQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714562382; c=relaxed/simple; bh=NdA764WJcGvt8lXly8jeVIEutQMXNgk81JN1Ta7vWVY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DTobHv7krHL4IgXAorK98I/fq4rOC7gkVISaSelsjLXvoCt9TEX8jqlpvppeAqQD+e5xtX4mIYTRXOV8qB1yDq7eCjCyBFxa8Ed0RBAQkYCuvS3qTLTDw/rBP4l5qfsKPuF02XefkTpaids+yIKCgWgtDgRdkQwyYwW2DecfoHI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r1GBh8g1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7021C113CC; Wed, 1 May 2024 11:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714562381; bh=NdA764WJcGvt8lXly8jeVIEutQMXNgk81JN1Ta7vWVY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r1GBh8g178zlWYlSPyVe2IH0YcLY8mAJwRU9UH6hXxlYt1gtua7k+rREM54kTau8v Y7H5zBcJuIl+SZda1BS1vSVtZAvg3vHs7pYF6qdrJGk5t2JULK+jPJSDUbfF/lFJnH mMet8WFbpQw6okf2wyuvVSnse3Sy2Je/ak+0cQNHc1F2ZLmFtcIkEnjQMc3awKM1RT oo9KexsvtcE8/ZSxRErW4WHCu/GL31Ut8GKqV/Ce4A1OlM4v/AttF/xsFREivm2Y6/ d2oip2TN9cSMH8U+W9EJskrejkG8sx4vcgkggrLIEBTr5l8AiJx7BN4XblhE8sNr8g yR40X/LPEX0Ig== Date: Wed, 1 May 2024 12:19:34 +0100 From: Conor Dooley To: Charlie Jenkins Cc: Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Conor Dooley , Evan Green , =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= , Jonathan Corbet , Shuah Khan , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Palmer Dabbelt , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v4 05/16] riscv: Extend cpufeature.c to detect vendor extensions Message-ID: <20240501-pelican-throwaway-da84be7dac30@spud> References: <20240426-dev-charlie-support_thead_vector_6_9-v4-0-b692f3c516ec@rivosinc.com> <20240426-dev-charlie-support_thead_vector_6_9-v4-5-b692f3c516ec@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="p3ofyY8PZFrt+4od" Content-Disposition: inline In-Reply-To: <20240426-dev-charlie-support_thead_vector_6_9-v4-5-b692f3c516ec@rivosinc.com> --p3ofyY8PZFrt+4od Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 26, 2024 at 02:29:19PM -0700, Charlie Jenkins wrote: > @@ -353,6 +336,10 @@ static void __init riscv_parse_isa_string(unsigned l= ong *this_hwcap, struct risc > bool ext_long =3D false, ext_err =3D false; > =20 > switch (*ext) { > + case 'x': > + case 'X': > + pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,i= sa-extensions instead."); > + continue; Yeah, so this is not right - you need to find the end of the extension before containing - for example if I had a system with rv64imafdcxconorkwe, you get something like: [ 0.000000] CPU with hartid=3D0 is not available [ 0.000000] Falling back to deprecated "riscv,isa" [ 0.000000] Vendor extensions are ignored in riscv,isa. Use riscv,isa-ex= tensions instead. [ 0.000000] riscv: base ISA extensions acdefikmnorw [ 0.000000] riscv: ELF capabilities acdfim kwe are all pretty safe letters, but suppose one was a v.. I think you can just yoink the code from the s/z case: diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 20bc9ba6b7a2..4daedba7961f 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -338,8 +338,19 @@ static void __init riscv_parse_isa_string(unsigned lon= g *this_hwcap, struct risc switch (*ext) { case 'x': case 'X': - pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa= -extensions instead."); - continue; + if (acpi_disabled) + pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,is= a-extensions instead."); + /* + * To skip an extension, we find its end. + * As multi-letter extensions must be split from other multi-letter + * extensions with an "_", the end of a multi-letter extension will + * either be the null character or the "_" at the start of the next + * multi-letter extension. + */ + for (; *isa && *isa !=3D '_'; ++isa) + ; + ext_err =3D true; + break; case 's': /* * Workaround for invalid single-letter 's' & 'u' (QEMU). You'll note that I made the dt property error dt only, this function gets called for ACPI too. I think the skip is pretty safe there though at the moment, we've not established any meanings yet for vendor stuff on ACPI. I think breaking is probably better than using continue - we get the _ skip from outside the switch statement out of that. And ye, I am lazy so I kept it as a for loop. Cheers, Conor. --p3ofyY8PZFrt+4od Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZjIlRgAKCRB4tDGHoIJi 0ugAAPoDPa6ArkzDoKOdltjV690jUcxJanZcOTddmqK/7OVlEQEAxQBqLmw0FIrU vufC89X3QQxXx0ONQsmNnf3NeXJ//QU= =Ec6E -----END PGP SIGNATURE----- --p3ofyY8PZFrt+4od--