* [PATCH 0/2] CCI PMU update
@ 2014-02-19 12:17 Punit Agrawal
2014-02-19 12:17 ` [PATCH 1/2] drivers: cci: Extend support to CCI revisions > r1p2 Punit Agrawal
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Punit Agrawal @ 2014-02-19 12:17 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
Here are a short couple of patches to update the CCI PMU perf backend
to better support IP updates.
The first patch simplifies version checking to assume that event
numbering doesn't change for > r1p0 (it changed between r0 and r1).
This change should help reduce code churn when IP version is bumped up
without any changes to event numbering.
The second patch exports the PMU version to userspace (via the PMU
name) to allow tooling to deal with event numbering differences.
I'd appreciate any feedback on the changes.
The patches are based on top of 3.14-rc3 and can hopefully make it for
3.15.
Thanks,
Punit
Punit Agrawal (2):
drivers: cci: Extend support to CCI revisions > r1p2
drivers: cci: Export CCI PMU revision
drivers/bus/arm-cci.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] drivers: cci: Extend support to CCI revisions > r1p2
2014-02-19 12:17 [PATCH 0/2] CCI PMU update Punit Agrawal
@ 2014-02-19 12:17 ` Punit Agrawal
2014-02-19 12:17 ` [PATCH 2/2] drivers: cci: Export CCI PMU revision Punit Agrawal
2014-02-24 18:28 ` [PATCH 0/2] CCI PMU update Will Deacon
2 siblings, 0 replies; 6+ messages in thread
From: Punit Agrawal @ 2014-02-19 12:17 UTC (permalink / raw)
To: linux-arm-kernel
The driver queries the CCI IP revision to distinguish between r0 and r1
scheme for event numbers and currently supports upto version r1p2. To
minimise code churn every time there's a new version of the IP, assume
that event numbering doesn't change for revisions > r1p0 (which is
the case).
The driver will still need an update for future revisions that change
the event numbers.
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
---
drivers/bus/arm-cci.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index 962fd35..da485ae 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -88,8 +88,7 @@ static unsigned long cci_ctrl_phys;
#define CCI_REV_R0 0
#define CCI_REV_R1 1
-#define CCI_REV_R0_P4 4
-#define CCI_REV_R1_P2 6
+#define CCI_REV_R1_PX 5
#define CCI_PMU_EVT_SEL 0x000
#define CCI_PMU_CNTR 0x004
@@ -193,21 +192,16 @@ static int probe_cci_revision(void)
rev = readl_relaxed(cci_ctrl_base + CCI_PID2) & CCI_PID2_REV_MASK;
rev >>= CCI_PID2_REV_SHIFT;
- if (rev <= CCI_REV_R0_P4)
+ if (rev < CCI_REV_R1_PX)
return CCI_REV_R0;
- else if (rev <= CCI_REV_R1_P2)
+ else
return CCI_REV_R1;
-
- return -ENOENT;
}
static struct pmu_port_event_ranges *port_range_by_rev(void)
{
int rev = probe_cci_revision();
- if (rev < 0)
- return NULL;
-
return &port_event_range[rev];
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] drivers: cci: Export CCI PMU revision
2014-02-19 12:17 [PATCH 0/2] CCI PMU update Punit Agrawal
2014-02-19 12:17 ` [PATCH 1/2] drivers: cci: Extend support to CCI revisions > r1p2 Punit Agrawal
@ 2014-02-19 12:17 ` Punit Agrawal
2014-02-24 18:28 ` [PATCH 0/2] CCI PMU update Will Deacon
2 siblings, 0 replies; 6+ messages in thread
From: Punit Agrawal @ 2014-02-19 12:17 UTC (permalink / raw)
To: linux-arm-kernel
The event numbering changed between revision r0 and r1 of the CCI
PMU. Expose this to userspace to allow tooling to handle the
differences in event numbers.
Suggested-by: Drew Richardson <Drew.Richardson@arm.com>
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
---
drivers/bus/arm-cci.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index da485ae..5a86da9 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -31,7 +31,6 @@
#define DRIVER_NAME "CCI-400"
#define DRIVER_NAME_PMU DRIVER_NAME " PMU"
-#define PMU_NAME "CCI_400"
#define CCI_PORT_CTRL 0x0
#define CCI_CTRL_STATUS 0xc
@@ -162,6 +161,15 @@ static struct pmu_port_event_ranges port_event_range[] = {
},
};
+/*
+ * Export different PMU names for the different revisions so userspace knows
+ * because the event ids are different
+ */
+static char *const pmu_names[] = {
+ [CCI_REV_R0] = "CCI_400",
+ [CCI_REV_R1] = "CCI_400_r1",
+};
+
struct cci_pmu_drv_data {
void __iomem *base;
struct arm_pmu *cci_pmu;
@@ -520,7 +528,7 @@ static void pmu_write_counter(struct perf_event *event, u32 value)
static int cci_pmu_init(struct arm_pmu *cci_pmu, struct platform_device *pdev)
{
*cci_pmu = (struct arm_pmu){
- .name = PMU_NAME,
+ .name = pmu_names[probe_cci_revision()],
.max_period = (1LLU << 32) - 1,
.get_hw_events = pmu_get_hw_events,
.get_event_idx = pmu_get_event_idx,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 0/2] CCI PMU update
2014-02-19 12:17 [PATCH 0/2] CCI PMU update Punit Agrawal
2014-02-19 12:17 ` [PATCH 1/2] drivers: cci: Extend support to CCI revisions > r1p2 Punit Agrawal
2014-02-19 12:17 ` [PATCH 2/2] drivers: cci: Export CCI PMU revision Punit Agrawal
@ 2014-02-24 18:28 ` Will Deacon
2014-02-25 18:39 ` Arnd Bergmann
2 siblings, 1 reply; 6+ messages in thread
From: Will Deacon @ 2014-02-24 18:28 UTC (permalink / raw)
To: linux-arm-kernel
[adding Olof and arm at kernel.org]
On Wed, Feb 19, 2014 at 12:17:01PM +0000, Punit Agrawal wrote:
> Here are a short couple of patches to update the CCI PMU perf backend
> to better support IP updates.
>
> The first patch simplifies version checking to assume that event
> numbering doesn't change for > r1p0 (it changed between r0 and r1).
> This change should help reduce code churn when IP version is bumped up
> without any changes to event numbering.
>
> The second patch exports the PMU version to userspace (via the PMU
> name) to allow tooling to deal with event numbering differences.
>
> I'd appreciate any feedback on the changes.
>
> The patches are based on top of 3.14-rc3 and can hopefully make it for
> 3.15.
Since these patches [1] are small and trivial, would the arm-soc folk be
happy picking them directly? I can put together a branch and pull request if
necessary, but it seems a bit OTT for this.
Will
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-February/234041.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/2] CCI PMU update
2014-02-24 18:28 ` [PATCH 0/2] CCI PMU update Will Deacon
@ 2014-02-25 18:39 ` Arnd Bergmann
2014-02-25 18:39 ` Will Deacon
0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2014-02-25 18:39 UTC (permalink / raw)
To: linux-arm-kernel
On Monday 24 February 2014, Will Deacon wrote:
> Since these patches [1] are small and trivial, would the arm-soc folk be
> happy picking them directly? I can put together a branch and pull request if
> necessary, but it seems a bit OTT for this.
>
Applied into next/drivers now
Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/2] CCI PMU update
2014-02-25 18:39 ` Arnd Bergmann
@ 2014-02-25 18:39 ` Will Deacon
0 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2014-02-25 18:39 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 25, 2014 at 06:39:11PM +0000, Arnd Bergmann wrote:
> On Monday 24 February 2014, Will Deacon wrote:
> > Since these patches [1] are small and trivial, would the arm-soc folk be
> > happy picking them directly? I can put together a branch and pull request if
> > necessary, but it seems a bit OTT for this.
> >
>
> Applied into next/drivers now
Thanks, Arnd.
Will
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-02-25 18:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-19 12:17 [PATCH 0/2] CCI PMU update Punit Agrawal
2014-02-19 12:17 ` [PATCH 1/2] drivers: cci: Extend support to CCI revisions > r1p2 Punit Agrawal
2014-02-19 12:17 ` [PATCH 2/2] drivers: cci: Export CCI PMU revision Punit Agrawal
2014-02-24 18:28 ` [PATCH 0/2] CCI PMU update Will Deacon
2014-02-25 18:39 ` Arnd Bergmann
2014-02-25 18:39 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).