From: mfuzzey@parkeon.com (Martin Fuzzey)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 1/4] ARM: perf: Set suniden bit.
Date: Wed, 06 Aug 2014 15:30:51 +0200 [thread overview]
Message-ID: <53E22E0B.7080907@parkeon.com> (raw)
In-Reply-To: <20140806104947.GD25953@arm.com>
Hi Will,
thanks for the review.
On 06/08/14 12:49, Will Deacon wrote:
> + /*
> + * Bits indicating any CPU or platform specific activations that have
> + * been done so we can undo them when stopping
> + */
> + struct {
> + unsigned int secure_regs_available : 1;
> + unsigned int secure_debug_requested : 1;
> + unsigned int platform_enabled : 1;
> + } activated_flags;
> This should be a single bool secure_access; field.
The idea was to only actually modify the security settings while someone
actually uses perf rather than just anytime the driver is loaded.
But I didn't want to disable the bit when exiting perf mode if it had
already been enabled elsewhere (eg by the bootloader).
Hence the first two bits.
I'm not sure how important this really is but it seemed sensible and not
too hard.
The third one is no longer necessary if the platform code handles all
that itself as you suggest in comments on subsequent patch.
>>
>> +#define SDER_SUNIDEN (1 << 1)
>> +
>> +static inline u32 armv2pmu_read_sder(void)
>> +{
>> + u32 sder;
>> +
>> + asm volatile("mrc p15, 0, %0, c1, c1, 1" : "=r" (sder));
>> +
>> + return sder;
>> +}
>> +
>> +static inline void armv2pmu_write_sder(u32 sder)
>> +{
>> + asm volatile("mcr p15, 0, %0, c1, c1, 1" : : "r" (sder));
>> +}
> Please stick with the naming convention of the file (armv7pmu_*). You can
> also combine these functions into armv7pmu_enable_secure_access...
Argh typo, sorry
> .
>> + }
>> +
>> /* Enable all counters */
>> armv7_pmnc_write(armv7_pmnc_read() | ARMV7_PMNC_E);
>> raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
>> @@ -1394,6 +1429,15 @@ static void armv7pmu_stop(struct arm_pmu *cpu_pmu)
>> struct pmu_hw_events *events = cpu_pmu->get_hw_events();
>>
>> raw_spin_lock_irqsave(&events->pmu_lock, flags);
>> +
>> + if (cpu_pmu->activated_flags.secure_debug_requested) {
>> + u32 sder = armv2pmu_read_sder();
>> +
>> + sder &= ~SDER_SUNIDEN;
>> + armv2pmu_write_sder(sder);
>> + cpu_pmu->activated_flags.secure_debug_requested = 0;
>> + }
> Why do we need to disable this? Couldn't we just set this once during probe
> and be done with it?
Same as my remark above
Martin
next prev parent reply other threads:[~2014-08-06 13:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-05 14:48 [PATCH V2 0/4] ARM: perf: Support i.MX53 Martin Fuzzey
2014-08-05 14:48 ` [PATCH V2 1/4] ARM: perf: Set suniden bit Martin Fuzzey
2014-08-06 10:49 ` Will Deacon
2014-08-06 13:30 ` Martin Fuzzey [this message]
2014-08-07 17:33 ` Will Deacon
2016-01-06 14:55 ` [PATCH V3 1/1] " George G. Davis
2016-01-12 17:11 ` Will Deacon
2016-01-14 4:36 ` [PATCH v4 1/1] ARM: perf: Set ARMv7 SDER SUNIDEN bit George G. Davis
2016-01-14 4:36 ` George G. Davis
2016-01-15 2:50 ` Rob Herring
2016-01-15 2:50 ` Rob Herring
2016-01-15 17:46 ` Will Deacon
2016-01-15 17:46 ` Will Deacon
2014-08-05 14:48 ` [PATCH V2 2/4] ARM: perf: Associate PMU data with driver Martin Fuzzey
2014-08-06 10:50 ` Will Deacon
2014-08-06 13:03 ` Russell King - ARM Linux
2014-08-05 14:48 ` [PATCH V2 3/4] ARM: i.MX53: Add Soc specific PMU setup Martin Fuzzey
2014-08-05 14:48 ` [PATCH V2 4/4] ARM: dts: i.MX53: Add PMU DT entry Martin Fuzzey
2014-08-06 10:50 ` Will Deacon
2014-08-06 13:35 ` Martin Fuzzey
2014-08-07 5:53 ` Shawn Guo
2014-08-07 8:00 ` Martin Fuzzey
2014-08-07 8:54 ` Shawn Guo
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=53E22E0B.7080907@parkeon.com \
--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.