Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf/arm_cspmu: Add arm_cspmu_acpi_dev_get

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>
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Besar Wicaksono and committed by
Will Deacon
bc86281f f5caf26f

+34 -2
+18 -1
drivers/perf/arm_cspmu/arm_cspmu.c
··· 16 16 * The user should refer to the vendor technical documentation to get details 17 17 * about the supported events. 18 18 * 19 - * Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 19 + * Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 20 20 * 21 21 */ 22 22 ··· 1132 1132 1133 1133 return 0; 1134 1134 } 1135 + 1136 + struct acpi_device *arm_cspmu_acpi_dev_get(const struct arm_cspmu *cspmu) 1137 + { 1138 + char hid[16] = {}; 1139 + char uid[16] = {}; 1140 + const struct acpi_apmt_node *apmt_node; 1141 + 1142 + apmt_node = arm_cspmu_apmt_node(cspmu->dev); 1143 + if (!apmt_node || apmt_node->type != ACPI_APMT_NODE_TYPE_ACPI) 1144 + return NULL; 1145 + 1146 + memcpy(hid, &apmt_node->inst_primary, sizeof(apmt_node->inst_primary)); 1147 + snprintf(uid, sizeof(uid), "%u", apmt_node->inst_secondary); 1148 + 1149 + return acpi_dev_get_first_match_dev(hid, uid, -1); 1150 + } 1151 + EXPORT_SYMBOL_GPL(arm_cspmu_acpi_dev_get); 1135 1152 #else 1136 1153 static int arm_cspmu_acpi_get_cpus(struct arm_cspmu *cspmu) 1137 1154 {
+16 -1
drivers/perf/arm_cspmu/arm_cspmu.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 2 2 * 3 3 * ARM CoreSight Architecture PMU driver. 4 - * Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 4 + * Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 5 5 * 6 6 */ 7 7 8 8 #ifndef __ARM_CSPMU_H__ 9 9 #define __ARM_CSPMU_H__ 10 10 11 + #include <linux/acpi.h> 11 12 #include <linux/bitfield.h> 12 13 #include <linux/cpumask.h> 13 14 #include <linux/device.h> ··· 255 254 256 255 /* Unregister vendor backend. */ 257 256 void arm_cspmu_impl_unregister(const struct arm_cspmu_impl_match *impl_match); 257 + 258 + #if defined(CONFIG_ACPI) && defined(CONFIG_ARM64) 259 + /** 260 + * Get ACPI device associated with the PMU. 261 + * The caller is responsible for calling acpi_dev_put() on the returned device. 262 + */ 263 + struct acpi_device *arm_cspmu_acpi_dev_get(const struct arm_cspmu *cspmu); 264 + #else 265 + static inline struct acpi_device * 266 + arm_cspmu_acpi_dev_get(const struct arm_cspmu *cspmu) 267 + { 268 + return NULL; 269 + } 270 + #endif 258 271 259 272 #endif /* __ARM_CSPMU_H__ */