LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Will Deacon <will.deacon@arm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Ashwin Chaugule <ashwin.chaugule@linaro.org>,
	Mark Rutland <Mark.Rutland@arm.com>,
	Neil Leeder <nleeder@codeaurora.org>,
	Ashwin Chaugule <ashwinc@codeaurora.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] ARM: perf: Add support for Scorpion PMUs
Date: Fri, 20 Feb 2015 12:16:27 -0800	[thread overview]
Message-ID: <20150220201627.GD24928@codeaurora.org> (raw)
In-Reply-To: <20150220193552.GE1767@arm.com>

On 02/20, Will Deacon wrote:
> On Fri, Feb 13, 2015 at 06:24:09PM +0000, Stephen Boyd wrote:
> 
> > +static void scorpion_evt_setup(int idx, u32 config_base)
> > +{
> > +       u32 val;
> > +       u32 mask;
> > +       u32 vval, fval;
> > +       unsigned int region;
> > +       unsigned int group;
> > +       unsigned int code;
> > +       unsigned int group_shift;
> > +       bool venum_event;
> > +
> > +       krait_decode_event(config_base, &region, &group, &code, &venum_event,
> > +                          NULL);
> > +
> > +       group_shift = group * 8;
> > +       mask = 0xff << group_shift;
> > +
> > +       /* Configure evtsel for the region and group */
> > +       if (venum_event)
> > +               val = SCORPION_VLPM_GROUP0;
> > +       else
> > +               val = scorpion_get_pmresrn_event(region);
> > +       val += group;
> > +       /* Mix in mode-exclusion bits */
> > +       val |= config_base & (ARMV7_EXCLUDE_USER | ARMV7_EXCLUDE_PL1);
> > +       armv7_pmnc_write_evtsel(idx, val);
> > +
> > +       asm volatile("mcr p15, 0, %0, c9, c15, 0" : : "r" (0));
> 
> What's this guy doing?

This is the same as Krait. It's clearing some implementation
defined register. From what I can tell it's a per-event register
(i.e. PMSELR decides which event this register write actually
affects) and we do this here to reset this register to some
defined value, zero. Otherwise the reset value of this register
is UNPREDICTABLE and that would be bad. I think we might be able
to move it to the pmu reset path, but I don't know. Ashwin?

> 
> > +static int scorpion_pmu_get_event_idx(struct pmu_hw_events *cpuc,
> > +                                  struct perf_event *event)
> > +{
> > +       int idx;
> > +       int bit = -1;
> > +       unsigned int region;
> > +       unsigned int code;
> > +       unsigned int group;
> > +       bool venum_event, scorpion_event;
> > +       struct hw_perf_event *hwc = &event->hw;
> > +
> > +       krait_decode_event(hwc->config_base, &region, &group, &code,
> > +                          &venum_event, &scorpion_event);
> > +
> > +       if (venum_event || scorpion_event) {
> > +               /* Ignore invalid events */
> > +               if (group > 3 || region > 3)
> 
> Where does the 3 come from?
> 

There are four "R"s and "G"s in the ascii art. This checks to
make sure we're within the range of possible pmresr and groups.
Krait has 3 "R"s and 4 "G"s.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2015-02-20 20:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13 18:24 [PATCH v2 0/2] Scorpion PMU support Stephen Boyd
2015-02-13 18:24 ` [PATCH v2 1/2] ARM: perf: Preparatory work for " Stephen Boyd
2015-02-20 19:30   ` Will Deacon
2015-02-20 20:37     ` Stephen Boyd
2015-02-13 18:24 ` [PATCH v2 2/2] ARM: perf: Add support for Scorpion PMUs Stephen Boyd
2015-02-20 19:35   ` Will Deacon
2015-02-20 20:16     ` Stephen Boyd [this message]
2015-02-24 17:23       ` Ashwin Chaugule
2015-02-25 16:58         ` Ashwin Chaugule
2015-02-27 19:36           ` Stephen Boyd
2015-02-27 19: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=20150220201627.GD24928@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=Mark.Rutland@arm.com \
    --cc=ashwin.chaugule@linaro.org \
    --cc=ashwinc@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nleeder@codeaurora.org \
    --cc=will.deacon@arm.com \
    --subject='Re: [PATCH v2 2/2] ARM: perf: Add support for Scorpion PMUs' \
    /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

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).