From: Ilkka Koskinen <ilkka@os.amperecomputing.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Jonathan Corbet <corbet@lwn.net>,
linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf: ampere: Add support for Ampere SoC PMUs
Date: Sun, 30 Apr 2023 22:43:28 -0700 (PDT) [thread overview]
Message-ID: <5d29aa57-7c92-3dce-ecc0-a7b2c8453c80@os.amperecomputing.com> (raw)
In-Reply-To: <7d7cafea-37b2-a050-7247-6c0234cb4f4c@arm.com>
Hi Robin,
On Fri, 28 Apr 2023, Robin Murphy wrote:
> On 2023-04-27 22:53, Ilkka Koskinen wrote:
>> Add support for Ampere SoC PMUs. This driver supports MCU PMU
>> available in the AmpereOne SoC.
>>
>> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
>> ---
>> .../admin-guide/perf/ampere-soc-pmu.rst | 36 +
>> Documentation/admin-guide/perf/index.rst | 1 +
>> drivers/perf/Kconfig | 10 +
>> drivers/perf/Makefile | 1 +
>> drivers/perf/ampere_soc_pmu.c | 724 ++++++++++++++++++
>> 5 files changed, 772 insertions(+)
>> create mode 100644 Documentation/admin-guide/perf/ampere-soc-pmu.rst
>> create mode 100644 drivers/perf/ampere_soc_pmu.c
>>
>> diff --git a/Documentation/admin-guide/perf/ampere-soc-pmu.rst
>> b/Documentation/admin-guide/perf/ampere-soc-pmu.rst
>> new file mode 100644
>> index 000000000000..5161fbd1c548
>> --- /dev/null
>> +++ b/Documentation/admin-guide/perf/ampere-soc-pmu.rst
>> @@ -0,0 +1,36 @@
>> +.. SPDX-License-Identifier: GPL-2.0
>> +
>> +============================================
>> +Ampere SoC Performance Monitoring Unit (PMU)
>> +============================================
>> +
>> +Ampere SoC PMU is a generic PMU IP. At the first phase it's used for
>> counting
>> +MCU events on AmpereOne.
>> +
>> +MCU PMU events
>> +--------------
>> +
>> +The PMU driver registers a PMU device for every supported PMU instance on
>> each
>> +SoC. See /sys/devices/AMPC0100:<nn>/.
>> +
>> +The PMU driver supports setting filters for "rank", "bank", and
>> "threshold". The
>> +filter settings are device specific and shared between all the relevant
>> events.
>> +The default value for all the filters is zero. The filters can be modified
>> by
>> +setting them with the last event of the particular device. All the
>> previous
>> +settings are overwritten.
>
> Yeah, that doesn't really work... what is the "last event" relative to? Order
> of arguments to arbitrary tools? Order of perf_event_open syscalls? Order in
> which events are actually scheduled on the PMU? (which users can't even
> control - think event rotation)
>
> To be practical I think you'll have to handle this the same way as
> arm_smmuv3_pmu's global filtering, and only allow events with matching filter
> configs to be scheduled together.
Thanks for pointing out that to me! I thought my implementation had an
issue with the shared filters but when I tried to look, if any of
the supported PMUs was using them the same way, I somehow missed
arm_smmuv3_pmu. I fix the driver.
>
> [...]
>> +#define SOC_PMEVCNTR0_LO 0x000
>> +#define SOC_PMEVCNTR0_HI 0x004
>> +#define SOC_PMCCNTR_LO 0x0F8
>> +#define SOC_PMCCNTR_HI 0x0FC
>> +
>> +#define SOC_PMEVTYPER0 0x400
>> +
>> +#define SOC_PMELCSR 0xA10
>> +
>> +#define SOC_PMCNTENSET 0xC00
>> +#define SOC_PMCNTENCLR 0xC20
>> +#define SOC_PMINTENSET 0xC40
>> +#define SOC_PMINTENCLR 0xC60
>> +#define SOC_PMOVSCLR 0xC80
>> +#define SOC_PMOVSSET 0xCC0
>> +
>> +#define SOC_PMAUXR0 0xD80
>> +#define SOC_PMAUXR1 0xD84
>> +#define SOC_PMAUXR2 0xD88
>> +#define SOC_PMAUXR3 0xD8C
>> +
>> +#define SOC_PMCFGR 0xE00
>> +#define SOC_PMCR 0xE04
>> +#define PMU_PMCR_E BIT(0)
>> +#define PMU_PMCR_P BIT(1)
>> +
>> +#define SOC_PMAUTHSTATUS 0xFB8
>> +#define SOC_PMDEVARCH 0xFBC
>> +#define SOC_PMDEVTYPE 0xFCC
>> +#define SOC_PMPIDR4 0xFD0
>> +#define SOC_PMPIDR0 0xFE0
>> +#define SOC_PMPIDR1 0xFE4
>> +#define SOC_PMPIDR2 0xFE8
>> +#define SOC_PMPIDR3 0xFEC
>> +#define SOC_PMCIDR0 0xFF0
>> +#define SOC_PMCIDR1 0xFF4
>> +#define SOC_PMCIDR2 0xFF8
>> +#define SOC_PMCIDR3 0xFFC
>
> This register map quite clearly follows the Arm CoreSight PMU architecture.
> Nice to see it being used, but would you mind having a go at hooking up your
> imp-def bits to the existing arm_cspmu driver?
I didn't think about that. I'll take a look at the coresight pmu driver
and see how I could do it properly.
Thanks, Ilkka
prev parent reply other threads:[~2023-05-01 5:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 21:53 Ilkka Koskinen
2023-04-28 0:24 ` Robin Murphy
2023-05-01 5:43 ` Ilkka Koskinen [this message]
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=5d29aa57-7c92-3dce-ecc0-a7b2c8453c80@os.amperecomputing.com \
--to=ilkka@os.amperecomputing.com \
--cc=corbet@lwn.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robin.murphy@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
all inboxes | Powered by JetHome®