Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp646051lqm; Wed, 1 May 2024 11:09:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSvRs9vePYD3Az7i4TTqglMI3g6bKfh7mF63GmO+ivFQzizV5w3dT8grGWGvuIv8R+DlMDEJcmJNPZe9IDXtexhJK4FGc6o7Eoz2Nj7g== X-Google-Smtp-Source: AGHT+IEpIDocMSoonZJrYBdCcLXRTSBgo3vY1Lw/XhKkQFVhazsudGLcLAGlLbMQbUd3fUG7SJq7 X-Received: by 2002:a50:a454:0:b0:572:7d77:179d with SMTP id v20-20020a50a454000000b005727d77179dmr269339edb.5.1714586998562; Wed, 01 May 2024 11:09:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714586998; cv=pass; d=google.com; s=arc-20160816; b=PyqZhXuD+ieFwlo8JKHH5c1LwoGrYs3HL9r0nHJcvHs583g1hgnh0YYx7pFQv8DNb8 B6nbDrQ/8OtzcH4WvXwBQU9XmVwIFUIYb8N9362cqxJiP0NR1Nm6PBa1xa1YQNyFRTM+ iktN9X833UzY1hWDt/UIOpABILIYfhdHz3Q573g32u5ABRs+73WM5C0WEGfFKhW2BSBQ b8sAqiBcgLR2vOmYl/qSnS7V8xO1RJKojz4gAzSuA/5caRmN2gOwJQRJiw4ZZ9FomvQh pXJe6ihv53fmR64TRmqf8Xi+5si305c7hmwJkCQ2QRU1OdcRgVmcSQO9fAqbTIHVFAbC Ecsw== 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=ytdi+3UbEgb+S0Q4zV0TKYaiinQvZBlWHKxPN0V+O4w=; fh=jvqRFXz75MXDIg5nXRCifvnCMHeaZ68KGYpdBVNfG8c=; b=kTNvZWSnO6fgale9Jcl4kXKZ+cg69z99WxQHFOoegV8bCHqoSpcjR1j5slzYbYmqq2 XAugDf4/tVrsE4CpoVSloQf33Yx5s8Er1KXX87P5nufEjXVIj9Q8lR4CaLYSRYWkmvMs SiYns3qCp64zP96KDleMOrVa1TAXnEtWKAp9PuAPpWyzhG8EDf+68ktcYTwZ6dRnbsqL mRW5+6U5r6befb5ImeeXb88Vq8cg5Srr8HCSulpB2C0zpvyf5VVFfqh+cTkOkR4XnJ2U NiM+vQksa6ISii0JrLRVRVxDf8rbE7Ohdp4GWSwBIUQf0fsaVyehTKr4ZyxJqzAS+ZtF /Ptw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BJfy5onH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165681-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165681-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h12-20020a50cdcc000000b00571c0ae2ce1si15769162edj.620.2024.05.01.11.09.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 11:09:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165681-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BJfy5onH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165681-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165681-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4F4161F21743 for ; Wed, 1 May 2024 18:09:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3C021487EC; Wed, 1 May 2024 18:09:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BJfy5onH" 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 B31A41474D9; Wed, 1 May 2024 18:09:35 +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=1714586975; cv=none; b=RpQ2tBDJO/WGuDZQ9kkTUxbzwNwVPQ/aXZ5cJXnB9rZsxD7lBT38l7u2c3MgwI18IMi9TolBozCzXQ9olYBoUs5XVIVh/rPkaaL2leyVEww1i8vR0No9oyzljQZtN+4x4gtQd36YjnW2f1uYoOHJvbbY0Fk7huC6+GgNfwd3Uw4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714586975; c=relaxed/simple; bh=GUrIh8yHkkjlZaW0ktFu8P9XlYLMGXvdBwQsqt4psgQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KiK2ODSJHbpACYOZHxL7uROKkzCngd75Ka8tQfXnC/C4bZWSYwSnPeNQ/jCD+PyP0bTLgiKBuPfv/BgjZHD1TzyTpUxBhkyzD/4arf8XAQtSGw2ypKA2J8jwscHUAGAfTHIvtNTUm22ivqmYo7rLnc0hsMHkXEPfttM68EKoRqQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BJfy5onH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CDBDC072AA; Wed, 1 May 2024 18:09:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714586975; bh=GUrIh8yHkkjlZaW0ktFu8P9XlYLMGXvdBwQsqt4psgQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BJfy5onHBA+Zu1aUXMBi8sapeke4esXCAUWp5juWXi/8n05Rz+T2GKXlpuVUu+jBZ bKxuby08Bzoblsk+ckGyQOU+0nTrIPPwTUSk34LPpqqKDlO1cAoYbdNuFXavu1AXpE 5/KA643kPVn1GLgV03XYS+pEgxXoPNxxpy6dKIL3o+jwR8LE31mDecnTA+VuS5dEAK 29Q+NccXCflx8gXcd7GXSSSn8pSxdqnAIFm9+AWOs3kd6aChniYKKNxyTm2uyPNUcV cqra5dfmJOx5ys95/whQYG8wntuyTx2c7sNMFRm9Xk1n2AWaPhyY0Y0AlCqMOcMJu1 uNT8H3oBxBYPw== Date: Wed, 1 May 2024 19:09:28 +0100 From: Conor Dooley To: Charlie Jenkins Cc: Evan Green , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Conor Dooley , =?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-moneyless-shifter-a54bbaecc4e7@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> <20240501-banner-sniff-4c5958eb15ef@spud> 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="yAv19tBoV/9fOzJc" Content-Disposition: inline In-Reply-To: <20240501-banner-sniff-4c5958eb15ef@spud> --yAv19tBoV/9fOzJc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 01, 2024 at 07:03:46PM +0100, Conor Dooley wrote: > On Wed, May 01, 2024 at 10:51:38AM -0700, Charlie Jenkins wrote: > > On Wed, May 01, 2024 at 09:44:15AM -0700, Evan Green wrote: > > > On Fri, Apr 26, 2024 at 2:29=E2=80=AFPM Charlie Jenkins wrote: > > > > + for (int i =3D 0; i < riscv_isa_vendor_ext_list_size; i++) { > > > > + const struct riscv_isa_vendor_ext_data_list *ext_li= st =3D riscv_isa_vendor_ext_list[i]; > > > > + > > > > + if (bitmap_empty(ext_list->vendor_bitmap, ext_list-= >bitmap_size)) > > > > + bitmap_copy(ext_list->vendor_bitmap, > > > > + ext_list->per_hart_vendor_bitma= p[cpu].isa, > > > > + ext_list->bitmap_size); > > >=20 > > > Could you get into trouble here if the set of vendor extensions > > > reduces to zero, and then becomes non-zero? To illustrate, consider > > > these masks: > > > cpu 0: 0x0000C000 > > > cpu 1: 0x00000003 <<< vendor_bitmap ANDs out to 0 > > > cpu 2: 0x00000010 <<< oops, we end up copying this into vendor_bitmap > > >=20 > >=20 > > Huh that's a good point. The standard extensions have that same bug too? > >=20 > > if (bitmap_empty(riscv_isa, RISCV_ISA_EXT_MAX)) > > bitmap_copy(riscv_isa, isainfo->isa, RISCV_ISA_EXT_MAX); > > else > > bitmap_and(riscv_isa, riscv_isa, isainfo->isa, RISCV_ISA_EXT_MAX); >=20 > I suppose it could in theory, but the boot hart needs ima to even get > this far. I think you'd only end up with this happening if there were > enabled harts that supported rvXXe, but I don't think we even add those > to the possible set of CPUs. I'll have to check. Ye, you don't get marked possible if you don't have ima, so I don't think this is possible to have happen. Maybe a comment here is sufficient, explaining why this cannot reduce to zeros? --yAv19tBoV/9fOzJc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZjKFWAAKCRB4tDGHoIJi 0kU9AP4s89glK6UnykI5g5cj0b710rlhFt08mdDjYgdqVE4BzwD+Pa0gATqWhdOe sO8sV3u9SVcK+K5gu/2K3mQMzB+OYQE= =r/pQ -----END PGP SIGNATURE----- --yAv19tBoV/9fOzJc--