From: mfuzzey@parkeon.com (Martin Fuzzey)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] ARM: perf: Add platform specific start/stop callbacks.
Date: Tue, 29 Jul 2014 14:33:01 +0200 [thread overview]
Message-ID: <20140729123301.13347.39881.stgit@localhost> (raw)
In-Reply-To: <20140729123256.13347.79778.stgit@localhost>
Some platforms (such as i.MX53) require SOC specific registers
to be manipulated to make the PMU work.
Add callback hooks to support this.
Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
---
arch/arm/include/asm/pmu.h | 9 +++++++++
arch/arm/kernel/perf_event.c | 13 ++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h
index 0bd181f..0f361c9 100644
--- a/arch/arm/include/asm/pmu.h
+++ b/arch/arm/include/asm/pmu.h
@@ -15,6 +15,8 @@
#include <linux/interrupt.h>
#include <linux/perf_event.h>
+struct arm_pmu;
+
/*
* struct arm_pmu_platdata - ARM PMU platform data
*
@@ -32,12 +34,18 @@
* succession this handler will only be called following the
* final call to pm_runtime_put() that actually disables the
* hardware.
+ * @start: an optional handler which will be called before starting
+ * the PMU to do any platform specific setup
+ * @stop: an optional handler which be called after stopping the PMU
+ * to do any platform specific teardown
*/
struct arm_pmu_platdata {
irqreturn_t (*handle_irq)(int irq, void *dev,
irq_handler_t pmu_handler);
int (*runtime_resume)(struct device *dev);
int (*runtime_suspend)(struct device *dev);
+ void (*start)(struct arm_pmu *arm_pmu);
+ void (*stop)(struct arm_pmu *arm_pmu);
};
#ifdef CONFIG_HW_PERF_EVENTS
@@ -67,6 +75,7 @@ struct pmu_hw_events {
*/
unsigned int activated_flags;
#define ARM_PMU_ACTIVATED_SECURE_DEBUG (1 << 0)
+ #define ARM_PMU_ACTIVATED_PLATFORM (1 << 1)
};
struct arm_pmu {
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 4238bcb..d0d9a25 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -469,16 +469,27 @@ static void armpmu_enable(struct pmu *pmu)
{
struct arm_pmu *armpmu = to_arm_pmu(pmu);
struct pmu_hw_events *hw_events = armpmu->get_hw_events();
+ struct arm_pmu_platdata *plat =
+ dev_get_platdata(&armpmu->plat_device->dev);
+
int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events);
- if (enabled)
+ if (enabled) {
+ if (plat && plat->start)
+ plat->start(armpmu);
armpmu->start(armpmu);
+ }
}
static void armpmu_disable(struct pmu *pmu)
{
struct arm_pmu *armpmu = to_arm_pmu(pmu);
+ struct arm_pmu_platdata *plat =
+ dev_get_platdata(&armpmu->plat_device->dev);
+
armpmu->stop(armpmu);
+ if (plat && plat->stop)
+ plat->stop(armpmu);
}
#ifdef CONFIG_PM_RUNTIME
next prev parent reply other threads:[~2014-07-29 12:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 12:32 [PATCH 0/4] ARM: perf: Support i.MX53 Martin Fuzzey
2014-07-29 12:32 ` [PATCH 1/4] ARM: perf: Set suniden bit Martin Fuzzey
2014-07-29 12:33 ` Martin Fuzzey [this message]
2014-07-29 12:33 ` [PATCH 3/4] ARM: i.MX53: Add Soc specific PMU setup Martin Fuzzey
2014-07-29 12:33 ` [PATCH 4/4] ARM: dts: i.MX53: Add PMU DT entry Martin Fuzzey
2014-07-29 12:52 ` [PATCH 0/4] ARM: perf: Support i.MX53 Will Deacon
2014-07-29 16:40 ` Martin Fuzzey
2014-07-30 10:46 ` Will Deacon
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=20140729123301.13347.39881.stgit@localhost \
--to=mfuzzey@parkeon.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.