Skip to content

Commit 119e3ee

Browse files
committed
Merge branch 'for-next/perf' into for-next/core
* for-next/perf: (33 commits) perf: arm-ni: Fix an NULL vs IS_ERR() bug perf: arm_pmuv3: Use BR_RETIRED for HW branch event if enabled MAINTAINERS: List Arm interconnect PMUs as supported perf: Add driver for Arm NI-700 interconnect PMU dt-bindings/perf: Add Arm NI-700 PMU perf/arm-cmn: Improve format attr printing perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check perf/arm-cmn: Support CMN S3 dt-bindings: perf: arm-cmn: Add CMN S3 perf/arm-cmn: Refactor DTC PMU register access perf/arm-cmn: Make cycle counts less surprising perf/arm-cmn: Improve build-time assertion perf/arm-cmn: Ensure dtm_idx is big enough perf/arm-cmn: Fix CCLA register offset perf/arm-cmn: Refactor node ID handling. Again. drivers/perf: hisi_pcie: Export supported Root Ports [bdf_min, bdf_max] drivers/perf: hisi_pcie: Fix TLP headers bandwidth counting drivers/perf: hisi_pcie: Record hardware counts correctly drivers/perf: arm_spe: Use perf_allow_kernel() for permissions perf/dwc_pcie: Add support for QCOM vendor devices ...
2 parents c2c9402 + 2e091a8 commit 119e3ee

35 files changed

+1476
-484
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
====================================
2+
Arm Network-on Chip Interconnect PMU
3+
====================================
4+
5+
NI-700 and friends implement a distinct PMU for each clock domain within the
6+
interconnect. Correspondingly, the driver exposes multiple PMU devices named
7+
arm_ni_<x>_cd_<y>, where <x> is an (arbitrary) instance identifier and <y> is
8+
the clock domain ID within that particular instance. If multiple NI instances
9+
exist within a system, the PMU devices can be correlated with the underlying
10+
hardware instance via sysfs parentage.
11+
12+
Each PMU exposes base event aliases for the interface types present in its clock
13+
domain. These require qualifying with the "eventid" and "nodeid" parameters
14+
to specify the event code to count and the interface at which to count it
15+
(per the configured hardware ID as reflected in the xxNI_NODE_INFO register).
16+
The exception is the "cycles" alias for the PMU cycle counter, which is encoded
17+
with the PMU node type and needs no further qualification.

Documentation/admin-guide/perf/dwc_pcie_pmu.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ Some of the events only exist for specific configurations.
4646
DesignWare Cores (DWC) PCIe PMU Driver
4747
=======================================
4848

49-
This driver adds PMU devices for each PCIe Root Port named based on the BDF of
49+
This driver adds PMU devices for each PCIe Root Port named based on the SBDF of
5050
the Root Port. For example,
5151

52-
30:03.0 PCI bridge: Device 1ded:8000 (rev 01)
52+
0001:30:03.0 PCI bridge: Device 1ded:8000 (rev 01)
5353

54-
the PMU device name for this Root Port is dwc_rootport_3018.
54+
the PMU device name for this Root Port is dwc_rootport_13018.
5555

5656
The DWC PCIe PMU driver registers a perf PMU driver, which provides
5757
description of available events and configuration options in sysfs, see
58-
/sys/bus/event_source/devices/dwc_rootport_{bdf}.
58+
/sys/bus/event_source/devices/dwc_rootport_{sbdf}.
5959

6060
The "format" directory describes format of the config fields of the
6161
perf_event_attr structure. The "events" directory provides configuration
@@ -66,16 +66,16 @@ The "perf list" command shall list the available events from sysfs, e.g.::
6666

6767
$# perf list | grep dwc_rootport
6868
<...>
69-
dwc_rootport_3018/Rx_PCIe_TLP_Data_Payload/ [Kernel PMU event]
69+
dwc_rootport_13018/Rx_PCIe_TLP_Data_Payload/ [Kernel PMU event]
7070
<...>
71-
dwc_rootport_3018/rx_memory_read,lane=?/ [Kernel PMU event]
71+
dwc_rootport_13018/rx_memory_read,lane=?/ [Kernel PMU event]
7272

7373
Time Based Analysis Event Usage
7474
-------------------------------
7575

7676
Example usage of counting PCIe RX TLP data payload (Units of bytes)::
7777

78-
$# perf stat -a -e dwc_rootport_3018/Rx_PCIe_TLP_Data_Payload/
78+
$# perf stat -a -e dwc_rootport_13018/Rx_PCIe_TLP_Data_Payload/
7979

8080
The average RX/TX bandwidth can be calculated using the following formula:
8181

@@ -88,7 +88,7 @@ Lane Event Usage
8888
Each lane has the same event set and to avoid generating a list of hundreds
8989
of events, the user need to specify the lane ID explicitly, e.g.::
9090

91-
$# perf stat -a -e dwc_rootport_3018/rx_memory_read,lane=4/
91+
$# perf stat -a -e dwc_rootport_13018/rx_memory_read,lane=4/
9292

9393
The driver does not support sampling, therefore "perf record" will not
9494
work. Per-task (without "-a") perf sessions are not supported.

Documentation/admin-guide/perf/hisi-pcie-pmu.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ The "identifier" sysfs file allows users to identify the version of the
2828
PMU hardware device.
2929

3030
The "bus" sysfs file allows users to get the bus number of Root Ports
31-
monitored by PMU.
31+
monitored by PMU. Furthermore users can get the Root Ports range in
32+
[bdf_min, bdf_max] from "bdf_min" and "bdf_max" sysfs attributes
33+
respectively.
3234

3335
Example usage of perf::
3436

Documentation/admin-guide/perf/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Performance monitor support
1616
starfive_starlink_pmu
1717
arm-ccn
1818
arm-cmn
19+
arm-ni
1920
xgene-pmu
2021
arm_dsu_pmu
2122
thunderx2-pmu

Documentation/devicetree/bindings/perf/arm,cmn.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ properties:
1616
- arm,cmn-600
1717
- arm,cmn-650
1818
- arm,cmn-700
19+
- arm,cmn-s3
1920
- arm,ci-700
2021

2122
reg:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/perf/arm,ni.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Arm NI (Network-on-Chip Interconnect) Performance Monitors
8+
9+
maintainers:
10+
- Robin Murphy <[email protected]>
11+
12+
properties:
13+
compatible:
14+
const: arm,ni-700
15+
16+
reg:
17+
items:
18+
- description: Complete configuration register space
19+
20+
interrupts:
21+
minItems: 1
22+
maxItems: 32
23+
description: Overflow interrupts, one per clock domain, in order of domain ID
24+
25+
required:
26+
- compatible
27+
- reg
28+
- interrupts
29+
30+
additionalProperties: false

MAINTAINERS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,17 @@ F: drivers/mtd/maps/physmap-versatile.*
17381738
F: drivers/power/reset/arm-versatile-reboot.c
17391739
F: drivers/soc/versatile/
17401740

1741+
ARM INTERCONNECT PMU DRIVERS
1742+
M: Robin Murphy <[email protected]>
1743+
S: Supported
1744+
F: Documentation/admin-guide/perf/arm-cmn.rst
1745+
F: Documentation/admin-guide/perf/arm-ni.rst
1746+
F: Documentation/devicetree/bindings/perf/arm,cmn.yaml
1747+
F: Documentation/devicetree/bindings/perf/arm,ni.yaml
1748+
F: drivers/perf/arm-cmn.c
1749+
F: drivers/perf/arm-ni.c
1750+
F: tools/perf/pmu-events/arch/arm64/arm/cmn/
1751+
17411752
ARM KOMEDA DRM-KMS DRIVER
17421753
M: Liviu Dudau <[email protected]>
17431754
S: Supported

arch/arm/include/asm/arm_pmuv3.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ static inline u32 read_pmuver(void)
127127
return (dfr0 >> 24) & 0xf;
128128
}
129129

130+
static inline bool pmuv3_has_icntr(void)
131+
{
132+
/* FEAT_PMUv3_ICNTR not accessible for 32-bit */
133+
return false;
134+
}
135+
130136
static inline void write_pmcr(u32 val)
131137
{
132138
write_sysreg(val, PMCR);
@@ -152,6 +158,13 @@ static inline u64 read_pmccntr(void)
152158
return read_sysreg(PMCCNTR);
153159
}
154160

161+
static inline void write_pmicntr(u64 val) {}
162+
163+
static inline u64 read_pmicntr(void)
164+
{
165+
return 0;
166+
}
167+
155168
static inline void write_pmcntenset(u32 val)
156169
{
157170
write_sysreg(val, PMCNTENSET);
@@ -177,6 +190,13 @@ static inline void write_pmccfiltr(u32 val)
177190
write_sysreg(val, PMCCFILTR);
178191
}
179192

193+
static inline void write_pmicfiltr(u64 val) {}
194+
195+
static inline u64 read_pmicfiltr(void)
196+
{
197+
return 0;
198+
}
199+
180200
static inline void write_pmovsclr(u32 val)
181201
{
182202
write_sysreg(val, PMOVSR);

arch/arm64/include/asm/arm_pmuv3.h

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ static inline void write_pmevtypern(int n, unsigned long val)
3333
PMEVN_SWITCH(n, WRITE_PMEVTYPERN);
3434
}
3535

36+
#define RETURN_READ_PMEVTYPERN(n) \
37+
return read_sysreg(pmevtyper##n##_el0)
38+
static inline unsigned long read_pmevtypern(int n)
39+
{
40+
PMEVN_SWITCH(n, RETURN_READ_PMEVTYPERN);
41+
return 0;
42+
}
43+
3644
static inline unsigned long read_pmmir(void)
3745
{
3846
return read_cpuid(PMMIR_EL1);
@@ -46,6 +54,14 @@ static inline u32 read_pmuver(void)
4654
ID_AA64DFR0_EL1_PMUVer_SHIFT);
4755
}
4856

57+
static inline bool pmuv3_has_icntr(void)
58+
{
59+
u64 dfr1 = read_sysreg(id_aa64dfr1_el1);
60+
61+
return !!cpuid_feature_extract_unsigned_field(dfr1,
62+
ID_AA64DFR1_EL1_PMICNTR_SHIFT);
63+
}
64+
4965
static inline void write_pmcr(u64 val)
5066
{
5167
write_sysreg(val, pmcr_el0);
@@ -71,22 +87,32 @@ static inline u64 read_pmccntr(void)
7187
return read_sysreg(pmccntr_el0);
7288
}
7389

74-
static inline void write_pmcntenset(u32 val)
90+
static inline void write_pmicntr(u64 val)
91+
{
92+
write_sysreg_s(val, SYS_PMICNTR_EL0);
93+
}
94+
95+
static inline u64 read_pmicntr(void)
96+
{
97+
return read_sysreg_s(SYS_PMICNTR_EL0);
98+
}
99+
100+
static inline void write_pmcntenset(u64 val)
75101
{
76102
write_sysreg(val, pmcntenset_el0);
77103
}
78104

79-
static inline void write_pmcntenclr(u32 val)
105+
static inline void write_pmcntenclr(u64 val)
80106
{
81107
write_sysreg(val, pmcntenclr_el0);
82108
}
83109

84-
static inline void write_pmintenset(u32 val)
110+
static inline void write_pmintenset(u64 val)
85111
{
86112
write_sysreg(val, pmintenset_el1);
87113
}
88114

89-
static inline void write_pmintenclr(u32 val)
115+
static inline void write_pmintenclr(u64 val)
90116
{
91117
write_sysreg(val, pmintenclr_el1);
92118
}
@@ -96,12 +122,27 @@ static inline void write_pmccfiltr(u64 val)
96122
write_sysreg(val, pmccfiltr_el0);
97123
}
98124

99-
static inline void write_pmovsclr(u32 val)
125+
static inline u64 read_pmccfiltr(void)
126+
{
127+
return read_sysreg(pmccfiltr_el0);
128+
}
129+
130+
static inline void write_pmicfiltr(u64 val)
131+
{
132+
write_sysreg_s(val, SYS_PMICFILTR_EL0);
133+
}
134+
135+
static inline u64 read_pmicfiltr(void)
136+
{
137+
return read_sysreg_s(SYS_PMICFILTR_EL0);
138+
}
139+
140+
static inline void write_pmovsclr(u64 val)
100141
{
101142
write_sysreg(val, pmovsclr_el0);
102143
}
103144

104-
static inline u32 read_pmovsclr(void)
145+
static inline u64 read_pmovsclr(void)
105146
{
106147
return read_sysreg(pmovsclr_el0);
107148
}

arch/arm64/include/asm/kvm_host.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,12 +1330,12 @@ void kvm_arch_vcpu_load_debug_state_flags(struct kvm_vcpu *vcpu);
13301330
void kvm_arch_vcpu_put_debug_state_flags(struct kvm_vcpu *vcpu);
13311331

13321332
#ifdef CONFIG_KVM
1333-
void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr);
1334-
void kvm_clr_pmu_events(u32 clr);
1333+
void kvm_set_pmu_events(u64 set, struct perf_event_attr *attr);
1334+
void kvm_clr_pmu_events(u64 clr);
13351335
bool kvm_set_pmuserenr(u64 val);
13361336
#else
1337-
static inline void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr) {}
1338-
static inline void kvm_clr_pmu_events(u32 clr) {}
1337+
static inline void kvm_set_pmu_events(u64 set, struct perf_event_attr *attr) {}
1338+
static inline void kvm_clr_pmu_events(u64 clr) {}
13391339
static inline bool kvm_set_pmuserenr(u64 val)
13401340
{
13411341
return false;

0 commit comments

Comments
 (0)