Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Ayupov <aaupov@fb.com>
To: James Clark <james.clark@linaro.org>, Leo Yan <leo.yan@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Daniel Pereira <danielmaraboo@gmail.com>,
	<coresight@lists.linaro.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-perf-users@vger.kernel.org>, <linux-doc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH v5 0/7] coresight: Pulse an ETM external output for a PMU event
Date: Fri, 20 Nov 2026 07:21:13 -0800	[thread overview]
Message-ID: <cover.1795182850.git.aaupov@fb.com> (raw)

Add an ETMv4 configuration, pmu_pulse, that drives trace unit external
output 1 on every traced cycle, so a PMU event counting it (TRCEXTOUT1)
can end a fixed-length ETM window, for example with aux-action=pause.
The feature only loads on an ETE whose PMU counts its external outputs.

Output 1 is fixed by the configuration; the perf command selects the
matching TRCEXTOUT1 consumer separately. Output 0 is avoided because it
is the trace trigger, and a detected trigger stops TRBE capture. Each
window includes the counted trace cycles plus pause interrupt latency.

Patch 1 is Leo's fix for TRCIDR0.NUMEVENT decoding, which patch 6 relies
on for the number of external outputs. An ARM PMU maintainer Ack is
requested on patch 5 so the series can be taken through the CoreSight
tree.

Changes in v5:
- Compare the class and capability fields with FIELD_GET() (Suzuki). The
  class check stays an intersection: built-in features name a single
  class, while ETMv4 devices register with both SRC_ALL and SRC_ETM4.
- Move both ARMV8_PMUV3_MAX_COMMON_EVENTS and
  ARMV8_PMUV3_EXT_COMMON_EVENT_BASE to linux/perf/arm_pmuv3.h and include
  it from linux/perf/arm_pmu.h (Suzuki, James). Add Will and Mark for an
  Ack on that patch.
- Rename the capability to CS_CFG_MATCH_CAP_ETE_TRCEXTOUT, as it only
  applies to ETE (Suzuki).
- Drop caps.trcextout and pass the probe-time result to
  etm4_cscfg_register() instead (Suzuki). The check reads PMCEID on the
  trace unit's CPU, so it stays in etm4_init_arch_data(), which runs
  there, while etm4_cscfg_register() may run on any CPU.
- Add James's Reviewed-by to all but patch 2, and Leo's Tested-by to all.
- Link to v4: https://lore.kernel.org/r/cover.1792989860.git.aaupov@fb.com

Changes in v4:
- Fix the arm64 build: v3 defined pmuv3_event_implemented() in
  linux/perf/arm_pmuv3.h after including asm/arm_pmuv3.h, which broke
  files that include asm/arm_pmuv3.h directly, such as
  arch/arm64/kernel/cpufeature.c. Move it to the arm64 asm/arm_pmuv3.h,
  after the helpers it uses.
  Breakage reported by kernel test robot.
- Link to v3: https://lore.kernel.org/r/cover.1792907332.git.aaupov@fb.com

Changes in v3:
- Rebase onto coresight next, which moves the capability fields into
  drvdata->caps (Leo).
- Carry Leo's "coresight: etm4x: Fix event count decoding" (Leo).
- Add Leo's Reviewed-by to "Fail to enable a configuration not loaded on
  the device".
- Define CS_CFG_MATCH_CLASS_MASK and CS_CFG_MATCH_CAP_MASK with
  GENMASK_U32() and split the match check into early returns (Leo). The
  class check stays an intersection, as ETMv4 devices register with
  SRC_ALL | SRC_ETM4 while the built-in features only set SRC_ETM4.
- Remove the unused CS_CFG_MATCH_INST_ANY in a separate patch (Leo).
- Replace the per-output CS_CFG_MATCH_CAP_PMU_EXTOUT(n) bits with a single
  CS_CFG_MATCH_CAP_TRCEXTOUT, set on ETE only (Leo, James).
- Check the PMU events through a new pmuv3_event_implemented() helper
  instead of open-coding PMCEID0_EL0 in etm4x (James).
- Use PMU-agnostic event names in the documentation example (Daniel).
- Add Daniel's Reviewed-by to "Add pmu_pulse/extout_pulse".
- Link to v2: https://lore.kernel.org/r/20261012230527.750567-1-aaupov@fb.com

Amir Ayupov (6):
  coresight: syscfg: Fail to enable a configuration not loaded on the
    device
  coresight: syscfg: Match feature capabilities separately from device
    class
  coresight: syscfg: Remove unused CS_CFG_MATCH_INST_ANY
  perf: arm_pmuv3: Add pmuv3_event_implemented()
  coresight: etm4x: Report whether the PMU counts the external outputs
  coresight: Add pmu_pulse/extout_pulse

Leo Yan (1):
  coresight: etm4x: Fix event count decoding

 .../trace/coresight/coresight-config.rst      |  5 +
 .../trace/coresight/coresight-perf.rst        | 15 +++
 arch/arm64/include/asm/arm_pmuv3.h            | 20 ++++
 drivers/hwtracing/coresight/Makefile          |  1 +
 .../coresight/coresight-cfg-pmu-pulse.c       | 55 +++++++++++
 .../coresight/coresight-cfg-preload.c         |  2 +
 .../coresight/coresight-cfg-preload.h         |  2 +
 .../hwtracing/coresight/coresight-config.h    | 11 ++-
 .../hwtracing/coresight/coresight-etm4x-cfg.c |  7 +-
 .../hwtracing/coresight/coresight-etm4x-cfg.h |  2 +-
 .../coresight/coresight-etm4x-core.c          | 42 ++++++++-
 .../coresight/coresight-etm4x-sysfs.c         | 29 +++---
 .../coresight/coresight-syscfg-configfs.c     |  3 +
 .../hwtracing/coresight/coresight-syscfg.c    | 93 ++++++++++++-------
 include/linux/perf/arm_pmu.h                  |  3 +-
 include/linux/perf/arm_pmuv3.h                |  8 ++
 16 files changed, 239 insertions(+), 59 deletions(-)
 create mode 100644 drivers/hwtracing/coresight/coresight-cfg-pmu-pulse.c


base-commit: 343cfcbb3ecfdb80aa576a428cfa3b65ad783842
-- 
2.52.1



             reply	other threads:[~2026-11-20 15:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 15:21 Amir Ayupov [this message]
2026-11-20 15:21 ` [PATCH v5 1/7] coresight: etm4x: Fix event count decoding Amir Ayupov
2026-11-20 15:21 ` [PATCH v5 2/7] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-11-20 15:21 ` [PATCH v5 3/7] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-11-20 15:21 ` [PATCH v5 4/7] coresight: syscfg: Remove unused CS_CFG_MATCH_INST_ANY Amir Ayupov
2026-11-20 15:21 ` [PATCH v5 5/7] perf: arm_pmuv3: Add pmuv3_event_implemented() Amir Ayupov
2026-11-20 15:21 ` [PATCH v5 6/7] coresight: etm4x: Report whether the PMU counts the external outputs Amir Ayupov
2026-11-20 15:21 ` [PATCH v5 7/7] coresight: Add pmu_pulse/extout_pulse Amir Ayupov

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=cover.1795182850.git.aaupov@fb.com \
    --to=aaupov@fb.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=coresight@lists.linaro.org \
    --cc=danielmaraboo@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=james.clark@linaro.org \
    --cc=leo.yan@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@arm.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=suzuki.poulose@arm.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