Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp43427lqa; Fri, 26 Apr 2024 13:46:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXAb7iOoFlnr+jAdpCzH3k2gO7KNFj2WuE/NhdOH51h6DLkMxkMnXvpV/itT7WHeLxXmjZZbI8LK0dgzykljCPo/leU6XtA82OxwgIMbA== X-Google-Smtp-Source: AGHT+IFevHRnARoBxTek4MIfMJzm7zVQCe8zLbt7Ib4zntKIFfBAqlKPumy5zqq/Xysc394S0ZFk X-Received: by 2002:a05:6214:29cb:b0:6a0:af07:1141 with SMTP id gh11-20020a05621429cb00b006a0af071141mr2969721qvb.65.1714164410979; Fri, 26 Apr 2024 13:46:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714164410; cv=pass; d=google.com; s=arc-20160816; b=VCOgyYAg9AbeGgTchUywCtI8PNeBEUQM96/KYmt3IsJM0WxOLYOjGda30jnO/w5wTu q78O56FGa8LWhIPOo0oVFCBr9CYpsaozhfS1+Rkq59/8ZlL/Q7udwuF1lQ3rlXJNYDk6 uD6gwK5Df0PtKVaHtqsftV+2QpQIyCswOG0reHVG+T48t0KR4hX+TUQTGtERCRlnIdOc ILl1C8Z8OSQlH3l9NAFnkYTEwtaLyVuHcCRTuGgV4CdY5238gZT1Nhu1zC1GBkXD7WMv o9bWGMMSgUDSClz/xduOUBHNEZ3lq87tePVnEb6AohGbRy8i5fUi7G+l6y67+Uem8rUY WvsA== 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=kmaIr1UUAdjHNhiQXQ00UZ4FvYDgsudCqwTuZAl2rL0=; fh=mBwwpQbay9vhzTgPULjjDn+LkmwbaBeNVRczdYQ/Av4=; b=uFobRt8x7ro3SiCAPglYm3Be3Wlqh5B0O5HuQuZFEYjZqhsM8daEQ4o8a6DJYqyeDr xki40g72E+02RggN8PPdFnF7R7+h+eXZBoH2f0/rtoOLCP9AF5w+R/dEqLpnPFX5YFRK f6Se4UMwaRWt0Ba7svVGVg9hcJn2OUTwIM6k4kHCaDr1JuXQz1SawQ7uWeD7O0X/1/KQ v/0HX3uYtk0nVa6cKv1zaQbg8olfBY2XOGeENcbDZIwSQZ1+4suiEUhK1kso/zpa6Vwa uY8FGnyBOiI1qOstg6P8sZDg9WEL2ky2iiP9SdCEbg1EsK5kmWBehUHWV4FgpfGZQWOB 6/eQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AAQAPudp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-160677-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160677-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. [147.75.199.223]) by mx.google.com with ESMTPS id 7-20020a05621420c700b006a09037ab16si9398733qve.23.2024.04.26.13.46.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 13:46:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160677-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AAQAPudp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-160677-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160677-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 A0C3A1C2269B for ; Fri, 26 Apr 2024 20:46:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 968592C6B7; Fri, 26 Apr 2024 20:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AAQAPudp" 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 9B81528383; Fri, 26 Apr 2024 20:46: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=1714164401; cv=none; b=SG/tGON0r/OyxEuU5D4rKHvZ4vm4MTcyDdOaZR3lvAZdj91Kdw1oxf6SJx/hc3hQJXGl9iWGg4bASAnGJnU7iU4f0pg2Wo3moXnRyS/5NOL9SvFJCnJgvp++6In/y11axwIGQ57cZGcX4VNHoRUUJUJkhyh1NKuTmI+2B82Vy8A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714164401; c=relaxed/simple; bh=FpnES2VzAJAeOqxKGH0lg2Bnjqd4mkcolNpkPfg+scg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hCF8ESKeB/gIWEEnmh0UclMoMdBh6681mISdM6DO7Tfwk8ViO5b4yKJNx6mje4fJLAgFXh6V/z+kgKubb6n+Lv9y8Oj+yRTBXsDOdOJtgF9JuWusrkyzMJ42Wqr3dDBTLTpeEqf7unMvWb88mVeePkJ63KIUxBm8pRKdd39tU8I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AAQAPudp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A42C9C113CD; Fri, 26 Apr 2024 20:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714164401; bh=FpnES2VzAJAeOqxKGH0lg2Bnjqd4mkcolNpkPfg+scg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AAQAPudpDakoNEU3GRdPIGAx3jXltg8+z70mavPQj+osxfFlcbSQCoNioaYDQzixc UDe2Z3W6FQcgSevbm0wq9plVxSDN0Ziw/AfmIBAlejymaPcRmUHZ4sbQ36E07THTjP 9CcBpyoL0MS6Yu2YApMucm7KK2u1Mq449EIoACUlckAtCW/0c6LpA7rUor6NfNjN+h vkQZlmuW+2ONsIX/3CwbmTtcCtqQ6qG6d5GAzWPh//WH8JO7diTvQet5GXnAIhxJXX Keb8E/cK36zmHrIXTfnsmQl5729B6N9NNL6Qyt3yl6p3Z5behPJbj5VccYHKx+/1Ht O9uOf/+wJKbfw== Date: Fri, 26 Apr 2024 21:46: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 v3 09/17] riscv: drivers: Convert xandespmu to use the vendor extension framework Message-ID: <20240426-wackiness-fringe-d296412b0c06@spud> References: <20240420-dev-charlie-support_thead_vector_6_9-v3-0-67cff4271d1d@rivosinc.com> <20240420-dev-charlie-support_thead_vector_6_9-v3-9-67cff4271d1d@rivosinc.com> <20240426-venue-maximum-f78ac451b146@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="obfZp8CibtUO+FNM" Content-Disposition: inline In-Reply-To: --obfZp8CibtUO+FNM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 26, 2024 at 01:34:19PM -0700, Charlie Jenkins wrote: > On Fri, Apr 26, 2024 at 05:25:20PM +0100, Conor Dooley wrote: > > On Sat, Apr 20, 2024 at 06:04:41PM -0700, Charlie Jenkins wrote: > > > Migrate xandespmu out of riscv_isa_ext and into a new Andes-specific > > > vendor namespace. > > > diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sb= i.c > > > index 8cbe6e5f9c39..84760ce61e03 100644 > > > --- a/drivers/perf/riscv_pmu_sbi.c > > > +++ b/drivers/perf/riscv_pmu_sbi.c > > > @@ -24,6 +24,8 @@ > > > #include > > > #include > > > #include > > > +#include > > > +#include > > > =20 > > > #define ALT_SBI_PMU_OVERFLOW(__ovl) \ > > > asm volatile(ALTERNATIVE_2( \ > > > @@ -32,7 +34,7 @@ asm volatile(ALTERNATIVE_2( \ > > > THEAD_VENDOR_ID, ERRATA_THEAD_PMU, \ > > > CONFIG_ERRATA_THEAD_PMU, \ > > > "csrr %0, " __stringify(ANDES_CSR_SCOUNTEROF), \ > > > - 0, RISCV_ISA_EXT_XANDESPMU, \ > > > + ANDES_VENDOR_ID, RISCV_ISA_VENDOR_EXT_XANDESPMU, \ > > > CONFIG_ANDES_CUSTOM_PMU) \ > > > : "=3Dr" (__ovl) : \ > > > : "memory") > > > @@ -41,7 +43,7 @@ asm volatile(ALTERNATIVE_2( \ > > > asm volatile(ALTERNATIVE( \ > > > "csrc " __stringify(CSR_IP) ", %0\n\t", \ > > > "csrc " __stringify(ANDES_CSR_SLIP) ", %0\n\t", \ > > > - 0, RISCV_ISA_EXT_XANDESPMU, \ > > > + ANDES_VENDOR_ID, RISCV_ISA_VENDOR_EXT_XANDESPMU, \ > > > CONFIG_ANDES_CUSTOM_PMU) \ > > > : : "r"(__irq_mask) \ > > > : "memory") > > > @@ -837,7 +839,7 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *p= mu, struct platform_device *pde > > > riscv_cached_mimpid(0) =3D=3D 0) { > > > riscv_pmu_irq_num =3D THEAD_C9XX_RV_IRQ_PMU; > > > riscv_pmu_use_irq =3D true; > > > - } else if (riscv_isa_extension_available(NULL, XANDESPMU) && > > > + } else if (riscv_isa_vendor_extension_available(-1, XANDESPMU) && > >=20 > > What's the rationale for this not using riscv_has_extension_unlikely()? > > Happens once in probe so don't bother? I forget if we discussed it when > > the code was added, but it would save us from the NULL/-1 syntax, > > neither of which I think is a good interface. >=20 > Doesn't look like something that was ever commented on in the series, > but I may have missed it. I can change this to use the alternatives. Yeha, not really a question for you but thinking aloud and wondering if someone would remind me. I really don't like riscv_isa_extension_available() because it doesn't respect config options etc, but ultimately I think the series that Clement is currently working on for Zc* is could be the saviour there, as the callbacks his most recent version has I think could make it much easier to hook in and turn off extensions. Should be helpful for the sort of confusing shit that Eric was complaining about last week on Andy's vector series. >=20 > This also wasn't supposed to be -1, it's supposed to be the id of the > vendor. >=20 > >=20 > > Also, I'd prob drop the "drivers" from $subject. > >=20 > > I'll come back and look at the rest of this Monday, it's a sunny Friday > > here and I've still got my devicetree patch queue to clear.. > >=20 >=20 > - Charlie >=20 > > Cheers, > > Conor. > >=20 > > > IS_ENABLED(CONFIG_ANDES_CUSTOM_PMU)) { > > > riscv_pmu_irq_num =3D ANDES_SLI_CAUSE_BASE + ANDES_RV_IRQ_PMOVI; > > > riscv_pmu_use_irq =3D true; > > >=20 > > > --=20 > > > 2.44.0 > > >=20 >=20 >=20 --obfZp8CibtUO+FNM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZiwSqgAKCRB4tDGHoIJi 0gNhAQDrHkAfioAOiId8a0oZe9Tp2bWKu1pfHE//przLWplaKAEApP4lOWJpBqcf vxWNFoKpgkDlzQEmtSnjR0ttsqkgAwI= =M/W8 -----END PGP SIGNATURE----- --obfZp8CibtUO+FNM--