mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ilkka Koskinen <ilkka@os.amperecomputing.com>
To: Besar Wicaksono <bwicaksono@nvidia.com>
Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	 suzuki.poulose@arm.com, robin.murphy@arm.com,
	ilkka@os.amperecomputing.com,  mark.rutland@arm.com,
	treding@nvidia.com, jonathanh@nvidia.com,  vsethi@nvidia.com,
	rwiley@nvidia.com, sdonthineni@nvidia.com
Subject: Re: [PATCH 4/5] perf/arm_cspmu: nvidia: Add revision id matching
Date: Tue, 19 Aug 2025 14:28:24 -0700 (PDT)	[thread overview]
Message-ID: <9fe744b5-94fd-4ad8-8485-c3761b211edf@os.amperecomputing.com> (raw)
In-Reply-To: <20250812233411.1694012-5-bwicaksono@nvidia.com>



On Tue, 12 Aug 2025, Besar Wicaksono wrote:

> Distinguish NVIDIA devices by revision and variant bits
> in PMIIDR register in addition to product id.
>
> Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>

Looks good to me

Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>

> ---
> drivers/perf/arm_cspmu/nvidia_cspmu.c | 18 ++++++++----------
> 1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/perf/arm_cspmu/nvidia_cspmu.c b/drivers/perf/arm_cspmu/nvidia_cspmu.c
> index b6cec351a142..ac91dc46501d 100644
> --- a/drivers/perf/arm_cspmu/nvidia_cspmu.c
> +++ b/drivers/perf/arm_cspmu/nvidia_cspmu.c
> @@ -23,7 +23,7 @@
>
> #define NV_GENERIC_FILTER_ID_MASK    GENMASK_ULL(31, 0)
>
> -#define NV_PRODID_MASK               GENMASK(31, 0)
> +#define NV_PRODID_MASK	(PMIIDR_PRODUCTID | PMIIDR_VARIANT | PMIIDR_REVISION)
>
> #define NV_FORMAT_NAME_GENERIC	0
>
> @@ -220,7 +220,7 @@ struct nv_cspmu_match {
>
> static const struct nv_cspmu_match nv_cspmu_match[] = {
> 	{
> -	  .prodid = 0x103,
> +	  .prodid = 0x10300000,
> 	  .prodid_mask = NV_PRODID_MASK,
> 	  .filter_mask = NV_PCIE_FILTER_ID_MASK,
> 	  .filter_default_val = NV_PCIE_FILTER_ID_MASK,
> @@ -230,7 +230,7 @@ static const struct nv_cspmu_match nv_cspmu_match[] = {
> 	  .format_attr = pcie_pmu_format_attrs
> 	},
> 	{
> -	  .prodid = 0x104,
> +	  .prodid = 0x10400000,
> 	  .prodid_mask = NV_PRODID_MASK,
> 	  .filter_mask = NV_NVL_C2C_FILTER_ID_MASK,
> 	  .filter_default_val = NV_NVL_C2C_FILTER_ID_MASK,
> @@ -240,7 +240,7 @@ static const struct nv_cspmu_match nv_cspmu_match[] = {
> 	  .format_attr = nvlink_c2c_pmu_format_attrs
> 	},
> 	{
> -	  .prodid = 0x105,
> +	  .prodid = 0x10500000,
> 	  .prodid_mask = NV_PRODID_MASK,
> 	  .filter_mask = NV_NVL_C2C_FILTER_ID_MASK,
> 	  .filter_default_val = NV_NVL_C2C_FILTER_ID_MASK,
> @@ -250,7 +250,7 @@ static const struct nv_cspmu_match nv_cspmu_match[] = {
> 	  .format_attr = nvlink_c2c_pmu_format_attrs
> 	},
> 	{
> -	  .prodid = 0x106,
> +	  .prodid = 0x10600000,
> 	  .prodid_mask = NV_PRODID_MASK,
> 	  .filter_mask = NV_CNVL_FILTER_ID_MASK,
> 	  .filter_default_val = NV_CNVL_FILTER_ID_MASK,
> @@ -260,7 +260,7 @@ static const struct nv_cspmu_match nv_cspmu_match[] = {
> 	  .format_attr = cnvlink_pmu_format_attrs
> 	},
> 	{
> -	  .prodid = 0x2CF,
> +	  .prodid = 0x2CF00000,
> 	  .prodid_mask = NV_PRODID_MASK,
> 	  .filter_mask = 0x0,
> 	  .filter_default_val = 0x0,
> @@ -312,7 +312,6 @@ static char *nv_cspmu_format_name(const struct arm_cspmu *cspmu,
>
> static int nv_cspmu_init_ops(struct arm_cspmu *cspmu)
> {
> -	u32 prodid;
> 	struct nv_cspmu_ctx *ctx;
> 	struct device *dev = cspmu->dev;
> 	struct arm_cspmu_impl_ops *impl_ops = &cspmu->impl.ops;
> @@ -322,13 +321,12 @@ static int nv_cspmu_init_ops(struct arm_cspmu *cspmu)
> 	if (!ctx)
> 		return -ENOMEM;
>
> -	prodid = FIELD_GET(PMIIDR_PRODUCTID, cspmu->impl.pmiidr);
> -
> 	/* Find matching PMU. */
> 	for (; match->prodid; match++) {
> 		const u32 prodid_mask = match->prodid_mask;
>
> -		if ((match->prodid & prodid_mask) == (prodid & prodid_mask))
> +		if ((match->prodid & prodid_mask) ==
> +		    (cspmu->impl.pmiidr & prodid_mask))
> 			break;
> 	}
>
> -- 
> 2.47.0
>
>

  reply	other threads:[~2025-08-19 21:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12 23:34 [PATCH 0/5] perf/arm_cspmu: Preparatory patches for NVIDIA T410 PMU Besar Wicaksono
2025-08-12 23:34 ` [PATCH 1/5] perf/arm_cspmu: Export arm_cspmu_apmt_node Besar Wicaksono
2025-08-19 20:16   ` Ilkka Koskinen
2025-08-20 19:07     ` Besar Wicaksono
2025-08-21 16:04       ` Robin Murphy
2025-08-22  1:28         ` Besar Wicaksono
2025-08-12 23:34 ` [PATCH 2/5] perf/arm_cspmu: Add callback to reset filter config Besar Wicaksono
2025-08-12 23:34 ` [PATCH 3/5] perf/arm_cspmu: Add pmpidr support Besar Wicaksono
2025-08-19 21:26   ` Ilkka Koskinen
2025-08-12 23:34 ` [PATCH 4/5] perf/arm_cspmu: nvidia: Add revision id matching Besar Wicaksono
2025-08-19 21:28   ` Ilkka Koskinen [this message]
2025-08-12 23:34 ` [PATCH 5/5] perf/arm_cspmu: nvidia: Add pmevfiltr2 support Besar Wicaksono

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9fe744b5-94fd-4ad8-8485-c3761b211edf@os.amperecomputing.com \
    --to=ilkka@os.amperecomputing.com \
    --cc=bwicaksono@nvidia.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=rwiley@nvidia.com \
    --cc=sdonthineni@nvidia.com \
    --cc=suzuki.poulose@arm.com \
    --cc=treding@nvidia.com \
    --cc=vsethi@nvidia.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®