Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp107484lqp; Fri, 12 Apr 2024 11:48:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8cuOwbwtKMPVr89uOHtzyIuZjjqKlGpgKXZxavBQFzuumPM+EY+YQdacem0K+TPV0ybc17uIE7Uo9dLNXGPWJT20i9jZas+mNqdC1MQ== X-Google-Smtp-Source: AGHT+IFfpA6UDi0+O4eaHzd1cLJ8Oqvq0nuv2z2BJXJdFKPQIU4I6RNwtbbWfaMEHJ5T/ToW+dFw X-Received: by 2002:a17:90b:118d:b0:2a2:579e:652f with SMTP id gk13-20020a17090b118d00b002a2579e652fmr3095035pjb.27.1712947685239; Fri, 12 Apr 2024 11:48:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712947685; cv=pass; d=google.com; s=arc-20160816; b=v6Il+025Ennof/GkJyGNAXcWaC49I1dODazlf3LrGrrgv/aW1SbGmpF33kXpnL+44H eOVC2s9OYFiuZgb69dy19a4tUl9xhi/TfSUGlaQmdZm/3z6LS/9PiHhDl5Z14Jx2ZY/+ /tPajEWzwrsRR4XU/Pk4EYInlBnfIa/aY/24nAJ4K+25KWu68MS61vsU/ZASiphGRdZ6 Zrw8VLepCUrf8lk+MXRJPHMOcqdVXPLBLhWqpGQh0TImA9h4hdUkbqvN1NLgkIIuFPtg 75N8PWE/6q1xGCvATQT+ZzZy9usCETKwy92bSjIHPaCWbP5GyzxSgVZRPcR+E24yrf67 uNSg== 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=Dj8snKJqwlk8rsaxQsm1cSUGOi+XyBWAztj42uQIhkA=; fh=XSLaAynNYlMwxjwu8OlTnvNj3rXo3qeGVEH++VtEks4=; b=i89Pkl+WuBRD35z3ljIh3gIEXPSTToH6JjmZYoT2xO7IflgKKTthYWGx1HM5icXw16 2geuYBN7BeSoVxNNN6jN3BnvMH27v177wl6gvnRQoMAk/nj54ZtJwUI4862cv/k0xFTd dkyHbrh01XHz4EGyAHBwvl5kQIjN1wBGkSxRH4eElstprA3iRgcuNkthX5CkJgtb2FmN uZdYdOcV9RsBbJWjRF5mmsjBwbz8FBlPEROYWMt0bdzD5L+lBOiIm2t1CXzpQfkPGsCX HzLqG+RXDizuo70vJdwKg0mSJt7ieGnMHtRh8zk89j9bFZ5kuu244Hj9YujUN6ZJYmfN OK9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ov4WZNsL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143227-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w3-20020a17090aaf8300b002a2755c2f65si3853368pjq.151.2024.04.12.11.48.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:48:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ov4WZNsL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143227-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143227-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E038C284B06 for ; Fri, 12 Apr 2024 18:48:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21DA414F135; Fri, 12 Apr 2024 18:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ov4WZNsL" 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 21D07502A9; Fri, 12 Apr 2024 18:47:54 +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=1712947675; cv=none; b=sog8O0786ptJKsg4W1RgFBa2/5wizhdpAIxPL20lSeq4cMN0Y9AS/R5aS0PnrKdmwPa9x+s9RWzjdEECAviNYcSdY9RKXt/oOiCy6NH4trkhMoSNHlNFtXYsGQzaB8PvR+w1F0+1oGGMgkeEtXlu1jHpmHW8tmW6hEgUHt0xNSY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712947675; c=relaxed/simple; bh=n5GAgtmQ/zrZB8bAJR7g5z1ea43EI9hfIxBwHjcASrA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GeeeOYWvcnSEupzTKXnga2O8uGWONq/toLe/+sAqCqjzZqzKWTfyKdkjH6boKss/pY9Cfea38R3ObJq3WnXpk6k7ubxUdz8Jn1zQjkM5ZK7UI8CT4IYnfWwN9i52TGuVcZFSHZjnUqjEmvLlAIgr0sgsWwU50bbOW7JgsTIXeqs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ov4WZNsL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EB36C113CC; Fri, 12 Apr 2024 18:47:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712947674; bh=n5GAgtmQ/zrZB8bAJR7g5z1ea43EI9hfIxBwHjcASrA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ov4WZNsLgMqwV02D7qCGrlgn+4CXZEGcpdO/TzMjlw0QaGJPdMXfuabow7LmE1wyp 9yp9pZjgTqZfXUHi4kYz/nrLdEXSd+7oLiFEvKSZ4fFVOUcsk7R7mbl+VJWDcrtzba ACMVbEJiDTuVNMs3+ZSLWIlmitOKl+JtGSCsjhrbj4Dwp1XNAWoLeiQYh2YRTY9oNt nj71v6w6v+74c7G4EoIopUhCrWUpLrqoMG8BVb/WNrATeww5DHbZQRZKldyCNw6wWB NCYS5X7RRSFrlH62HqZzU7NtwEteokB4/uPHBtiJru1eveA2uSmMAbd/V3S+EmomnA q3gEwWScvYpgQ== Date: Fri, 12 Apr 2024 19:47:48 +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 , 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 02/19] riscv: cpufeature: Fix thead vector hwcap removal Message-ID: <20240412-eastcoast-disparity-9c9e7d178df5@spud> References: <20240411-dev-charlie-support_thead_vector_6_9-v1-0-4af9815ec746@rivosinc.com> <20240411-dev-charlie-support_thead_vector_6_9-v1-2-4af9815ec746@rivosinc.com> <20240412-tuesday-resident-d9d07e75463c@wendy> 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="rke11NB5BctjFg+6" Content-Disposition: inline In-Reply-To: --rke11NB5BctjFg+6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 12, 2024 at 10:12:20AM -0700, Charlie Jenkins wrote: > On Fri, Apr 12, 2024 at 11:25:47AM +0100, Conor Dooley wrote: > > On Thu, Apr 11, 2024 at 09:11:08PM -0700, Charlie Jenkins wrote: > > > The riscv_cpuinfo struct that contains mvendorid and marchid is not > > > populated until all harts are booted which happens after the DT parsi= ng. > > > Use the vendorid/archid values from the DT if available or assume all > > > harts have the same values as the boot hart as a fallback. > > >=20 > > > Fixes: d82f32202e0d ("RISC-V: Ignore V from the riscv,isa DT property= on older T-Head CPUs") > >=20 > > If this is our only use case for getting the mvendorid/marchid stuff > > from dt, then I don't think we should add it. None of the devicetrees > > that the commit you're fixing here addresses will have these properties > > and if they did have them, they'd then also be new enough to hopefully > > not have "v" either - the issue is they're using whatever crap the > > vendor shipped. >=20 > Yes, the DT those shipped with will not have the property in the DT so > will fall back on the boot hart. The addition of the DT properties allow > future heterogenous systems to be able to function. I think you've kinda missed the point about what the original code was actually doing here. Really the kernel should not be doing validation of the devicetree at all, but I was trying to avoid people shooting themselves in the foot by doing something simple that would work for their (incorrect) vendor dtbs. Future heterogenous systems should be using riscv,isa-extensions, which is totally unaffected by this codepath (and setting actual values for mimpid/marchid too ideally!). > > If we're gonna get the information from DT, we already have something > > that we can look at to perform the disable as the cpu compatibles give > > us enough information to make the decision. > >=20 > > I also think that we could just cache the boot CPU's marchid/mvendorid, > > since we already have to look at it in riscv_fill_cpu_mfr_info(), avoid > > repeating these ecalls on all systems. >=20 > Yeah that is a minor optimization that can I can apply. >=20 > >=20 > > Perhaps for now we could just look at the boot CPU alone? To my > > knowledge the systems that this targets all have homogeneous > > marchid/mvendorid values of 0x0. >=20 > They have an mvendorid of 0x5b7. That was a braino, clearly I should have typed "mimpid". > This is already falling back on the boot CPU, but that is not a solution > that scales. Even though all systems currently have homogenous > marchid/mvendorid I am hesitant to assert that all systems are > homogenous without providing an option to override this. There are already is an option. Use the non-deprecated property in your new system for describing what extesions you support. We don't need to add any more properties (for now at least). > The overhead is > looking for a field in the DT which does not seem to be impactful enough > to prevent the addition of this option. >=20 > >=20 > > > Signed-off-by: Charlie Jenkins > >=20 > > > @@ -514,12 +521,23 @@ static void __init riscv_fill_hwcap_from_isa_st= ring(unsigned long *isa2hwcap) > > > pr_warn("Unable to find \"riscv,isa\" devicetree entry\n"); > > > continue; > > > } > > > + if (of_property_read_u64(node, "riscv,vendorid", &this_vendorid) = < 0) { > > > + pr_warn("Unable to find \"riscv,vendorid\" devicetree entry, usi= ng boot hart mvendorid instead\n"); > >=20 > > This should 100% not be a warning, it's not a required property in the > > binding. >=20 > Yes definitely, thank you. >=20 > - Charlie >=20 > >=20 > > Cheers, > > Conor. > >=20 > > > + this_vendorid =3D boot_vendorid; > > > + } > >=20 >=20 >=20 --rke11NB5BctjFg+6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZhmB0wAKCRB4tDGHoIJi 0r9KAPwO8kmedwyuPwdW6Gb81xo2SPmPzyE4KeaKjpG7a9zWkQEA+zkrz2aDcEPv K4koNCrLQrkE4YZhML29KEex9nHPOAg= =7PfL -----END PGP SIGNATURE----- --rke11NB5BctjFg+6--