From: Besar Wicaksono <bwicaksono@nvidia.com>
To: <will@kernel.org>, <suzuki.poulose@arm.com>,
<robin.murphy@arm.com>, <ilkka@os.amperecomputing.com>,
<jonathan.cameron@huawei.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
<mark.rutland@arm.com>, <treding@nvidia.com>,
<jonathanh@nvidia.com>, <vsethi@nvidia.com>, <rwiley@nvidia.com>,
<sdonthineni@nvidia.com>, <skelley@nvidia.com>,
<mochs@nvidia.com>, <nirmoyd@nvidia.com>, <bhelgaas@google.com>,
<wangyushan12@huawei.com>, <shiju.jose@huawei.com>,
<linux-pci@vger.kernel.org>,
Besar Wicaksono <bwicaksono@nvidia.com>
Subject: [PATCH v3 3/8] perf/arm_cspmu: Add arm_cspmu_acpi_dev_get
Date: Tue, 24 Mar 2026 01:29:47 +0000 [thread overview]
Message-ID: <20260324012952.1923296-4-bwicaksono@nvidia.com> (raw)
In-Reply-To: <20260324012952.1923296-1-bwicaksono@nvidia.com>
Add interface to get ACPI device associated with the
PMU. This ACPI device may contain additional properties
not covered by the standard properties.
Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
---
drivers/perf/arm_cspmu/arm_cspmu.c | 19 ++++++++++++++++++-
drivers/perf/arm_cspmu/arm_cspmu.h | 17 ++++++++++++++++-
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
index 34430b68f602..49e8a1f38131 100644
--- a/drivers/perf/arm_cspmu/arm_cspmu.c
+++ b/drivers/perf/arm_cspmu/arm_cspmu.c
@@ -16,7 +16,7 @@
* The user should refer to the vendor technical documentation to get details
* about the supported events.
*
- * Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
*/
@@ -1132,6 +1132,23 @@ static int arm_cspmu_acpi_get_cpus(struct arm_cspmu *cspmu)
return 0;
}
+
+struct acpi_device *arm_cspmu_acpi_dev_get(const struct arm_cspmu *cspmu)
+{
+ char hid[16] = {};
+ char uid[16] = {};
+ const struct acpi_apmt_node *apmt_node;
+
+ apmt_node = arm_cspmu_apmt_node(cspmu->dev);
+ if (!apmt_node || apmt_node->type != ACPI_APMT_NODE_TYPE_ACPI)
+ return NULL;
+
+ memcpy(hid, &apmt_node->inst_primary, sizeof(apmt_node->inst_primary));
+ snprintf(uid, sizeof(uid), "%u", apmt_node->inst_secondary);
+
+ return acpi_dev_get_first_match_dev(hid, uid, -1);
+}
+EXPORT_SYMBOL_GPL(arm_cspmu_acpi_dev_get);
#else
static int arm_cspmu_acpi_get_cpus(struct arm_cspmu *cspmu)
{
diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h b/drivers/perf/arm_cspmu/arm_cspmu.h
index cd65a58dbd88..3fc5c8d77266 100644
--- a/drivers/perf/arm_cspmu/arm_cspmu.h
+++ b/drivers/perf/arm_cspmu/arm_cspmu.h
@@ -1,13 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0
*
* ARM CoreSight Architecture PMU driver.
- * Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
*/
#ifndef __ARM_CSPMU_H__
#define __ARM_CSPMU_H__
+#include <linux/acpi.h>
#include <linux/bitfield.h>
#include <linux/cpumask.h>
#include <linux/device.h>
@@ -255,4 +256,18 @@ int arm_cspmu_impl_register(const struct arm_cspmu_impl_match *impl_match);
/* Unregister vendor backend. */
void arm_cspmu_impl_unregister(const struct arm_cspmu_impl_match *impl_match);
+#if defined(CONFIG_ACPI) && defined(CONFIG_ARM64)
+/**
+ * Get ACPI device associated with the PMU.
+ * The caller is responsible for calling acpi_dev_put() on the returned device.
+ */
+struct acpi_device *arm_cspmu_acpi_dev_get(const struct arm_cspmu *cspmu);
+#else
+static inline struct acpi_device *
+arm_cspmu_acpi_dev_get(const struct arm_cspmu *cspmu)
+{
+ return NULL;
+}
+#endif
+
#endif /* __ARM_CSPMU_H__ */
--
2.43.0
next prev parent reply other threads:[~2026-03-24 1:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 1:29 [PATCH v3 0/8] perf: add NVIDIA Tegra410 Uncore PMU support Besar Wicaksono
2026-03-24 1:29 ` [PATCH v3 1/8] perf/arm_cspmu: nvidia: Rename doc to Tegra241 Besar Wicaksono
2026-03-24 1:29 ` [PATCH v3 2/8] perf/arm_cspmu: nvidia: Add Tegra410 UCF PMU Besar Wicaksono
2026-03-24 1:29 ` Besar Wicaksono [this message]
2026-03-24 1:29 ` [PATCH v3 4/8] perf/arm_cspmu: nvidia: Add Tegra410 PCIE PMU Besar Wicaksono
2026-03-24 1:29 ` [PATCH v3 5/8] perf/arm_cspmu: nvidia: Add Tegra410 PCIE-TGT PMU Besar Wicaksono
2026-03-24 1:29 ` [PATCH v3 6/8] perf: add NVIDIA Tegra410 CPU Memory Latency PMU Besar Wicaksono
2026-03-24 1:29 ` [PATCH v3 7/8] perf: add NVIDIA Tegra410 C2C PMU Besar Wicaksono
2026-03-24 1:29 ` [PATCH v3 8/8] arm64: defconfig: Enable NVIDIA TEGRA410 PMU Besar Wicaksono
2026-03-24 15:08 ` [PATCH v3 0/8] perf: add NVIDIA Tegra410 Uncore PMU support Will Deacon
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=20260324012952.1923296-4-bwicaksono@nvidia.com \
--to=bwicaksono@nvidia.com \
--cc=bhelgaas@google.com \
--cc=ilkka@os.amperecomputing.com \
--cc=jonathan.cameron@huawei.com \
--cc=jonathanh@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mochs@nvidia.com \
--cc=nirmoyd@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=rwiley@nvidia.com \
--cc=sdonthineni@nvidia.com \
--cc=shiju.jose@huawei.com \
--cc=skelley@nvidia.com \
--cc=suzuki.poulose@arm.com \
--cc=treding@nvidia.com \
--cc=vsethi@nvidia.com \
--cc=wangyushan12@huawei.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