From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 5/5] arm64/perf: Extend event mask for ARMv8.1
Date: Mon, 15 Feb 2016 20:04:04 +0000 [thread overview]
Message-ID: <20160215200404.GX6298@arm.com> (raw)
In-Reply-To: <fa91eaedf581e6a7053899f25b1b08458dbd4b8e.1454516082.git.jglauber@cavium.com>
On Wed, Feb 03, 2016 at 06:12:00PM +0100, Jan Glauber wrote:
> ARMv8.1 increases the PMU event number space. Detect the
> presence of this PMUv3 type and extend the event mask.
>
> The event mask is moved to struct arm_pmu so different event masks
> can exist, depending on the PMU type.
>
> Signed-off-by: Jan Glauber <jglauber@cavium.com>
> ---
> arch/arm/kernel/perf_event_v6.c | 6 ++++--
> arch/arm/kernel/perf_event_v7.c | 29 +++++++++++++++++++----------
> arch/arm/kernel/perf_event_xscale.c | 4 +++-
> arch/arm64/kernel/perf_event.c | 33 +++++++++++++++++++--------------
> drivers/perf/arm_pmu.c | 5 +++--
> include/linux/perf/arm_pmu.h | 4 ++--
> 6 files changed, 50 insertions(+), 31 deletions(-)
[...]
> static void armv8_pmu_init(struct arm_pmu *cpu_pmu)
> {
> + u64 id;
> +
> cpu_pmu->handle_irq = armv8pmu_handle_irq,
> cpu_pmu->enable = armv8pmu_enable_event,
> cpu_pmu->disable = armv8pmu_disable_event,
> @@ -842,6 +840,13 @@ static void armv8_pmu_init(struct arm_pmu *cpu_pmu)
> cpu_pmu->reset = armv8pmu_reset,
> cpu_pmu->max_period = (1LLU << 32) - 1,
> cpu_pmu->set_event_filter = armv8pmu_set_event_filter;
> +
> + /* detect ARMv8.1 PMUv3 with extended event mask */
> + id = read_cpuid(ID_AA64DFR0_EL1);
> + if (((id >> 8) & 0xf) == 4)
We have helpers for this stuff (cpuid_feature_extract_field)...
> + cpu_pmu->event_mask = 0xffff; /* ARMv8.1 extended events */
> + else
> + cpu_pmu->event_mask = ARMV8_EVTYPE_EVENT;
... although can't we just update ARMV8_EVTYPE_EVENT to be 0xffff now?
AFAICT, that just eats into bits that used to be RES0, so we shouldn't
see any problems. That should make your patch *much* simpler!
Will
WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Jan Glauber <jglauber@cavium.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 5/5] arm64/perf: Extend event mask for ARMv8.1
Date: Mon, 15 Feb 2016 20:04:04 +0000 [thread overview]
Message-ID: <20160215200404.GX6298@arm.com> (raw)
In-Reply-To: <fa91eaedf581e6a7053899f25b1b08458dbd4b8e.1454516082.git.jglauber@cavium.com>
On Wed, Feb 03, 2016 at 06:12:00PM +0100, Jan Glauber wrote:
> ARMv8.1 increases the PMU event number space. Detect the
> presence of this PMUv3 type and extend the event mask.
>
> The event mask is moved to struct arm_pmu so different event masks
> can exist, depending on the PMU type.
>
> Signed-off-by: Jan Glauber <jglauber@cavium.com>
> ---
> arch/arm/kernel/perf_event_v6.c | 6 ++++--
> arch/arm/kernel/perf_event_v7.c | 29 +++++++++++++++++++----------
> arch/arm/kernel/perf_event_xscale.c | 4 +++-
> arch/arm64/kernel/perf_event.c | 33 +++++++++++++++++++--------------
> drivers/perf/arm_pmu.c | 5 +++--
> include/linux/perf/arm_pmu.h | 4 ++--
> 6 files changed, 50 insertions(+), 31 deletions(-)
[...]
> static void armv8_pmu_init(struct arm_pmu *cpu_pmu)
> {
> + u64 id;
> +
> cpu_pmu->handle_irq = armv8pmu_handle_irq,
> cpu_pmu->enable = armv8pmu_enable_event,
> cpu_pmu->disable = armv8pmu_disable_event,
> @@ -842,6 +840,13 @@ static void armv8_pmu_init(struct arm_pmu *cpu_pmu)
> cpu_pmu->reset = armv8pmu_reset,
> cpu_pmu->max_period = (1LLU << 32) - 1,
> cpu_pmu->set_event_filter = armv8pmu_set_event_filter;
> +
> + /* detect ARMv8.1 PMUv3 with extended event mask */
> + id = read_cpuid(ID_AA64DFR0_EL1);
> + if (((id >> 8) & 0xf) == 4)
We have helpers for this stuff (cpuid_feature_extract_field)...
> + cpu_pmu->event_mask = 0xffff; /* ARMv8.1 extended events */
> + else
> + cpu_pmu->event_mask = ARMV8_EVTYPE_EVENT;
... although can't we just update ARMV8_EVTYPE_EVENT to be 0xffff now?
AFAICT, that just eats into bits that used to be RES0, so we shouldn't
see any problems. That should make your patch *much* simpler!
Will
next prev parent reply other threads:[~2016-02-15 20:04 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 17:11 [PATCH v3 0/5] Cavium ThunderX PMU support Jan Glauber
2016-02-03 17:11 ` Jan Glauber
2016-02-03 17:11 ` [PATCH v3 1/5] arm64/perf: Rename Cortex A57 events Jan Glauber
2016-02-03 17:11 ` Jan Glauber
2016-02-15 19:40 ` Will Deacon
2016-02-15 19:40 ` Will Deacon
2016-02-15 20:06 ` Will Deacon
2016-02-15 20:06 ` Will Deacon
2016-02-18 9:13 ` Jan Glauber
2016-02-18 9:13 ` Jan Glauber
2016-02-18 11:24 ` Will Deacon
2016-02-18 11:24 ` Will Deacon
2016-02-18 13:45 ` Jan Glauber
2016-02-18 13:45 ` Jan Glauber
2016-02-03 17:11 ` [PATCH v3 2/5] arm64/perf: Add Cavium ThunderX PMU support Jan Glauber
2016-02-03 17:11 ` Jan Glauber
2016-02-03 17:11 ` [PATCH v3 3/5] arm64: dts: Add Cavium ThunderX specific PMU Jan Glauber
2016-02-03 17:11 ` Jan Glauber
2016-02-03 17:11 ` [PATCH v3 4/5] arm64/perf: Enable PMCR long cycle counter bit Jan Glauber
2016-02-03 17:11 ` Jan Glauber
2016-02-15 19:55 ` Will Deacon
2016-02-15 19:55 ` Will Deacon
2016-02-16 8:04 ` Jan Glauber
2016-02-16 8:04 ` Jan Glauber
2016-02-03 17:12 ` [PATCH v3 5/5] arm64/perf: Extend event mask for ARMv8.1 Jan Glauber
2016-02-03 17:12 ` Jan Glauber
2016-02-15 20:04 ` Will Deacon [this message]
2016-02-15 20:04 ` Will Deacon
2016-02-16 8:00 ` Jan Glauber
2016-02-16 8:00 ` Jan Glauber
2016-02-16 15:12 ` Will Deacon
2016-02-16 15:12 ` Will Deacon
2016-02-17 10:47 ` Jan Glauber
2016-02-17 10:47 ` Jan Glauber
2016-02-11 13:28 ` [PATCH v3 0/5] Cavium ThunderX PMU support Jan Glauber
2016-02-11 13:28 ` Jan Glauber
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=20160215200404.GX6298@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.