perf: ARM CoreSight PMU support
v6 cover perf: ARM CoreSight PMU support
Add driver support for ARM CoreSight PMU device and event attributes for NVIDIA implementation. The code is based on ARM Coresight PMU architecture and ACPI ARM Performance Monitoring Unit table (APMT) specification below:
* ARM Coresight PMU:
https://developer.arm.com/documentation/ihi0091/latest
* APMT: https://developer.arm.com/documentation/den0117/latest
The patchset applies on top of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
master next-20220524
For APMT support, please see patchset: https://lkml.org/lkml/2022/4/19/1395
Changes from v5:
* Default get_event/format_attrs callback now returns copy of default array.
Thanks to [email protected] for the review comments.
v5: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Changes from v4:
* Fix code formatting
* Add timeout to read register function with high-low-high sequence
* Add NO_INTERRUPT capability on PMU that does not have IRQ
* Fix the name of NVIDIA PMUs
* Drop filter attribute for NVLink-C2C PMUs
* Added Reviewed/Acked-by from Suzuki
Thanks to [email protected] and [email protected] for the review comments.
v4: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Changes from v3:
* Driver is now probing "arm-cs-arch-pmu" device.
* The driver files, directory, functions are renamed with "arm_cspmu" prefix.
* Use Kconfig ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU.
* Add kernel doc for NVIDIA Uncore PMU.
* Use GENMASK and FIELD_GET macros everywhere.
Thanks to [email protected] and [email protected] for the review comments.
v3: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Changes from v2:
* Driver is now probing "arm-system-pmu" device.
* Change default PMU naming to "arm_<APMT node type>_pmu".
* Add implementor ops to generate custom name.
Thanks to [email protected] for the review comments.
v2: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Changes from v1:
* Remove CPU arch dependency.
* Remove 32-bit read/write helper function and just use read/writel.
* Add .is_visible into event attribute to filter out cycle counter event.
* Update pmiidr matching.
* Remove read-modify-write on PMCR since the driver only writes to PMCR.E.
* Assign default cycle event outside the 32-bit PMEVTYPER range.
* Rework the active event and used counter tracking.
Thanks to [email protected] for the review comments.
v1: https://lore.kernel.org/linux-arm-kernel/[email protected]/
Besar Wicaksono (2):
perf: arm_cspmu: Add support for ARM CoreSight PMU driver
perf: arm_cspmu: Add support for NVIDIA SCF and MCF attribute
Documentation/admin-guide/perf/index.rst | 1 + Documentation/admin-guide/perf/nvidia-pmu.rst | 299 ++++ arch/arm64/configs/defconfig | 1 + drivers/perf/Kconfig | 2 + drivers/perf/Makefile | 1 + drivers/perf/arm_cspmu/Kconfig | 13 + drivers/perf/arm_cspmu/Makefile | 7 + drivers/perf/arm_cspmu/arm_cspmu.c | 1301 +++++++++++++++++ drivers/perf/arm_cspmu/arm_cspmu.h | 151 ++ drivers/perf/arm_cspmu/nvidia_cspmu.c | 398 +++++ drivers/perf/arm_cspmu/nvidia_cspmu.h | 17 + 11 files changed, 2191 insertions(+) create mode 100644 Documentation/admin-guide/perf/nvidia-pmu.rst create mode 100644 drivers/perf/arm_cspmu/Kconfig create mode 100644 drivers/perf/arm_cspmu/Makefile create mode 100644 drivers/perf/arm_cspmu/arm_cspmu.c create mode 100644 drivers/perf/arm_cspmu/arm_cspmu.h create mode 100644 drivers/perf/arm_cspmu/nvidia_cspmu.c create mode 100644 drivers/perf/arm_cspmu/nvidia_cspmu.h
base-commit: 09ce5091ff971cdbfd67ad84dc561ea27f10d67a
Signature · 1 line
2.17.1
PATCH v6 1/2 perf: arm_cspmu: Add support for ARM CoreSight PMU driver
Add support for ARM CoreSight PMU driver framework and interfaces. The driver provides generic implementation to operate uncore PMU based on ARM CoreSight PMU architecture. The driver also provides interface to get vendor/implementation specific information, for example event attributes and formating.
The specification used in this implementation can be found below:
* ACPI Arm Performance Monitoring Unit table:
https://developer.arm.com/documentation/den0117/latest
* ARM Coresight PMU architecture:
https://developer.arm.com/documentation/ihi0091/latest
--- arch/arm64/configs/defconfig | 1 + drivers/perf/Kconfig | 2 + drivers/perf/Makefile | 1 + drivers/perf/arm_cspmu/Kconfig | 13 + drivers/perf/arm_cspmu/Makefile | 6 + drivers/perf/arm_cspmu/arm_cspmu.c | 1292 ++++++++++++++++++++++++++++ drivers/perf/arm_cspmu/arm_cspmu.h | 151 ++++ 7 files changed, 1466 insertions(+) create mode 100644 drivers/perf/arm_cspmu/Kconfig create mode 100644 drivers/perf/arm_cspmu/Makefile create mode 100644 drivers/perf/arm_cspmu/arm_cspmu.c create mode 100644 drivers/perf/arm_cspmu/arm_cspmu.h
arch/arm64/configs/defconfig +1 -0
@@ -1212,6 +1212,7 @@ CONFIG_PHY_UNIPHIER_USB3=y CONFIG_PHY_TEGRA_XUSB=y CONFIG_PHY_AM654_SERDES=m CONFIG_PHY_J721E_WIZ=m +CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU=y CONFIG_ARM_SMMU_V3_PMU=m CONFIG_FSL_IMX8_DDR_PMU=m CONFIG_QCOM_L2_PMU=y
drivers/perf/Kconfig +2 -0
@@ -192,4 +192,6 @@ config MARVELL_CN10K_DDR_PMU Enable perf support for Marvell DDR Performance monitoring event on CN10K platform. +source "drivers/perf/arm_cspmu/Kconfig" + endmenu
drivers/perf/Makefile +1 -0
@@ -20,3 +20,4 @@ obj-$(CONFIG_ARM_DMC620_PMU) += arm_dmc620_pmu.o obj-$(CONFIG_MARVELL_CN10K_TAD_PMU) += marvell_cn10k_tad_pmu.o obj-$(CONFIG_MARVELL_CN10K_DDR_PMU) += marvell_cn10k_ddr_pmu.o obj-$(CONFIG_APPLE_M1_CPU_PMU) += apple_m1_cpu_pmu.o +obj-$(CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += arm_cspmu/
drivers/perf/arm_cspmu/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. + +config ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU + tristate "ARM Coresight Architecture PMU" + depends on ACPI + depends on ACPI_APMT || COMPILE_TEST + help + Provides support for performance monitoring unit (PMU) devices + based on ARM CoreSight PMU architecture. Note that this PMU + architecture does not have relationship with the ARM CoreSight + Self-Hosted Tracing.
drivers/perf/arm_cspmu/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. +# +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += \ + arm_cspmu.o
drivers/perf/arm_cspmu/arm_cspmu.c new file +1292 -0
1,292 lines not on this page · raw message
drivers/perf/arm_cspmu/arm_cspmu.h new file +151 -0
151 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 2/2 perf: arm_cspmu: Add support for NVIDIA SCF and MCF attribute
In reply to Besar WicaksonoAdd support for NVIDIA System Cache Fabric (SCF) and Memory Control Fabric (MCF) PMU attributes for CoreSight PMU implementation in NVIDIA devices.
--- Documentation/admin-guide/perf/index.rst | 1 + Documentation/admin-guide/perf/nvidia-pmu.rst | 299 +++++++++++++ drivers/perf/arm_cspmu/Makefile | 3 +- drivers/perf/arm_cspmu/arm_cspmu.c | 9 + drivers/perf/arm_cspmu/nvidia_cspmu.c | 398 ++++++++++++++++++ drivers/perf/arm_cspmu/nvidia_cspmu.h | 17 + 6 files changed, 726 insertions(+), 1 deletion(-) create mode 100644 Documentation/admin-guide/perf/nvidia-pmu.rst create mode 100644 drivers/perf/arm_cspmu/nvidia_cspmu.c create mode 100644 drivers/perf/arm_cspmu/nvidia_cspmu.h
Documentation/admin-guide/perf/index.rst +1 -0
@@ -17,3 +17,4 @@ Performance monitor support xgene-pmu arm_dsu_pmu thunderx2-pmu + nvidia-pmu
Documentation/admin-guide/perf/nvidia-pmu.rst new file +299 -0
299 lines not on this page · raw message
drivers/perf/arm_cspmu/Makefile +2 -1
@@ -3,4 +3,5 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += \ - arm_cspmu.o + arm_cspmu.o \ + nvidia_cspmu.o
drivers/perf/arm_cspmu/arm_cspmu.c +9 -0
@@ -31,6 +31,7 @@#include <acpi/processor.h> #include "arm_cspmu.h" +#include "nvidia_cspmu.h" #define PMUNAME "arm_cspmu"#define DRVNAME "arm-cs-arch-pmu"
@@ -116,6 +117,9 @@*/ #define HILOHI_MAX_POLL 1000 +/* JEDEC-assigned JEP106 identification code */ +#define ARM_CSPMU_IMPL_ID_NVIDIA 0x36B +static unsigned long arm_cspmu_cpuhp_state;/*
@@ -382,6 +386,11 @@ struct impl_match { };static const struct impl_match impl_match[] = { + { + .pmiidr =ARM_CSPMU_IMPL_ID_NVIDIA , + .mask =ARM_CSPMU_PMIIDR_IMPLEMENTER , + .impl_init_ops = nv_cspmu_init_ops + }, {} };
drivers/perf/arm_cspmu/nvidia_cspmu.c new file +398 -0
398 lines not on this page · raw message
drivers/perf/arm_cspmu/nvidia_cspmu.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. +* +*/ + +/* Support for NVIDIA specific attributes. */ + +#ifndef __NVIDIA_CSPMU_H__ +#define __NVIDIA_CSPMU_H__ + +#include "arm_cspmu.h" + +/* Allocate NVIDIA descriptor. */ +int nv_cspmu_init_ops (struct arm_cspmu *cspmu); + +#endif /* __NVIDIA_CSPMU_H__ */
Signature · 1 line
2.17.1
Will Deacon
maintainerQuoted 11 lines · Besar Wicaksono
Add driver support for ARM CoreSight PMU device and event attributes for NVIDIA implementation. The code is based on ARM Coresight PMU architecture and ACPI ARM Performance Monitoring Unit table (APMT) specification below:
* ARM Coresight PMU:
https://developer.arm.com/documentation/ihi0091/latest
* APMT: https://developer.arm.com/documentation/den0117/latestThe patchset applies on top of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
master next-20220524
Quoted 6 lines
For APMT support, please see patchset: https://lkml.org/lkml/2022/4/19/1395
Changes from v5:
* Default get_event/format_attrs callback now returns copy of default array.
Thanks to [email protected] for the review comments.
v5: https://lore.kernel.org/linux-arm-kernel/[email protected]/
These patches no longer apply. Please can you rebase onto -rc4 and drop the defconfig change from the first patch?
Thanks,
Will
Hi Will,
Quoted 36 lines
-----Original Message-----
From: Will Deacon <[email protected]>
Sent: Monday, November 7, 2022 9:53 AM
To: Besar Wicaksono <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; Thierry Reding <[email protected]>; Jonathan Hunter <[email protected]>; Vikram Sethi <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v6 0/2] perf: ARM CoreSight PMU supportExternal email: Use caution opening links or attachments
Quoted 1 line · Besar Wicaksono
Add driver support for ARM CoreSight PMU device and event attributes for
NVIDIA
Quoted 1 line
implementation. The code is based on ARM Coresight PMU architecture
and ACPI ARM
Quoted 10 lines
Performance Monitoring Unit table (APMT) specification below:
* ARM Coresight PMU:
https://developer.arm.com/documentation/ihi0091/latest
* APMT: https://developer.arm.com/documentation/den0117/latestThe patchset applies on top of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
master next-20220524For APMT support, please see patchset:
https://lkml.org/lkml/2022/4/19/1395
Quoted 3 lines
Changes from v5:
* Default get_event/format_attrs callback now returns copy of default
Quoted 7 lines
array.
Quoted 2 lines
Thanks to [email protected] for the review comments.
v5: https://lore.kernel.org/linux-arm-kernel/20220928201830.45637-1-These patches no longer apply. Please can you rebase onto -rc4 and drop the defconfig change from the first patch?
Why does the defconfig change need to be dropped ? And sure, I will rebase to 6.1 rc4.
Thanks,
Besar
Quoted 4 lines
Thanks,
Will
Will Deacon
maintainerQuoted 39 lines · Besar Wicaksono
Hi Will,
Quoted 37 lines
-----Original Message-----
From: Will Deacon <[email protected]>
Sent: Monday, November 7, 2022 9:53 AM
To: Besar Wicaksono <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; Thierry Reding <[email protected]>; Jonathan Hunter <[email protected]>; Vikram Sethi <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v6 0/2] perf: ARM CoreSight PMU supportExternal email: Use caution opening links or attachments
Quoted 1 line · Besar Wicaksono
Add driver support for ARM CoreSight PMU device and event attributes for
NVIDIA
Quoted 1 line
implementation. The code is based on ARM Coresight PMU architecture
and ACPI ARM
Quoted 10 lines
Performance Monitoring Unit table (APMT) specification below:
* ARM Coresight PMU:
https://developer.arm.com/documentation/ihi0091/latest
* APMT: https://developer.arm.com/documentation/den0117/latestThe patchset applies on top of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
master next-20220524For APMT support, please see patchset:
https://lkml.org/lkml/2022/4/19/1395
Quoted 3 lines
Changes from v5:
* Default get_event/format_attrs callback now returns copy of defaultarray.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Thanks to [email protected] for the review comments.
v5: https://lore.kernel.org/linux-arm-kernel/20220928201830.45637-1-These patches no longer apply. Please can you rebase onto -rc4 and drop the defconfig change from the first patch?
Why does the defconfig change need to be dropped ?
Oh, just because that file is a big source of conflicts so I'd prefer to keep defconfig changes separate from patches which add new functionality.
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Will,
Quoted 63 lines
-----Original Message-----
From: Will Deacon <[email protected]>
Sent: Monday, November 7, 2022 12:01 PM
To: Besar Wicaksono <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; Thierry Reding <[email protected]>; Jonathan Hunter <[email protected]>; Vikram Sethi <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v6 0/2] perf: ARM CoreSight PMU supportExternal email: Use caution opening links or attachments
Quoted 12 lines · Besar Wicaksono
Hi Will,
Quoted 10 lines
-----Original Message-----
From: Will Deacon <[email protected]>
Sent: Monday, November 7, 2022 9:53 AM
To: Besar Wicaksono <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; Thierry Reding <[email protected]>; Jonathan Hunter <[email protected]>;Vikram
Quoted 9 lines
Quoted 9 lines
Sethi <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v6 0/2] perf: ARM CoreSight PMU supportExternal email: Use caution opening links or attachments
Quoted 1 line · Besar Wicaksono
Add driver support for ARM CoreSight PMU device and event attributes
for
Quoted 22 lines
Quoted 22 lines
NVIDIA
Quoted 1 line
implementation. The code is based on ARM Coresight PMU architecture
and ACPI ARM
Quoted 10 lines
Performance Monitoring Unit table (APMT) specification below:
* ARM Coresight PMU:
https://developer.arm.com/documentation/ihi0091/latest
* APMT: https://developer.arm.com/documentation/den0117/latestThe patchset applies on top of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
master next-20220524For APMT support, please see patchset:
https://lkml.org/lkml/2022/4/19/1395
Quoted 3 lines
Changes from v5:
* Default get_event/format_attrs callback now returns copy of defaultarray.
Quoted 2 lines
Thanks to [email protected] for the review comments.
v5: https://lore.kernel.org/linux-arm-kernel/20220928201830.45637-1-
Quoted 9 lines
Quoted 1 line
Quoted 1 line
These patches no longer apply. Please can you rebase onto -rc4 and drop
the
Quoted 3 lines
Quoted 1 line
defconfig change from the first patch?
Why does the defconfig change need to be dropped ?
Oh, just because that file is a big source of conflicts so I'd prefer to keep defconfig changes separate from patches which add new functionality.
Sorry for the delay. I have sent v7 patchset with the rebase to 6.1-rc4.
Could you please try again ?
Regards,
Besar
Quoted 1 line
Will