<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Getting zeros on i.MX6 PMU counters in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206912#M12010</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to "ARM Architecture Reference Manual ARMv7-A and ARMv7-R", in B3.12.21 c1, Secure Debug Enable Register (SDER), for setting SUNIDEN and SUIDEN, we need to set val=3 inspite of 0b11, as other bits are reserved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you correct me, If I am going wrong somewhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Prabhat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Jul 2013 09:43:36 GMT</pubDate>
    <dc:creator>prabhatravi</dc:creator>
    <dc:date>2013-07-05T09:43:36Z</dc:date>
    <item>
      <title>Getting zeros on i.MX6 PMU counters</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206907#M12005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running the i.MX6, and I get zeroed out PMU counters. The indication comes from ARM DS-5's Streamline, this is the message I see:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ARM Processor PMU event counters have been detected, however the event counters are reading zeroes. Event counters include those counters listed in the counter configuration options dialog under the core name but exclude the cycle counter (Clock:Cycles) as it is controlled by a dedicated counter. It is possible that the PMU configuration bit DBGEN has not been enabled, and counter values subsequently will always read as zero. To remedy, please update your firmware or Linux kernel to enable DBGEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried sampling CPU events on LTIB releases 3.0.15 and 3.0.35. Linaro version 12.05 has been also tried but the counters are still zeroed out.&lt;/P&gt;&lt;P&gt;I'm using a SabreLite board, and DS-5/gator version 5.11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one successfully read CPU events from i.MX6 using Streamline?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mickey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Dec 2012 15:04:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206907#M12005</guid>
      <dc:creator>MickeyI</dc:creator>
      <dc:date>2012-12-13T15:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Getting zeros on i.MX6 PMU counters</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206908#M12006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's been a while and I haven't found a solution for this yet.&lt;/P&gt;&lt;P&gt;Has anyone successfully read CPU counters such as L1 cache misses from an i.MX6 chip?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Apr 2013 12:54:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206908#M12006</guid>
      <dc:creator>MickeyI</dc:creator>
      <dc:date>2013-04-21T12:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Getting zeros on i.MX6 PMU counters</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206909#M12007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should set SUNIDEN and SUIDEN bit on Secure Debug Enable Register. (Cf "C12.4.1 Interaction with Security Extensions", "C12.1.7 Effects of non-invasive debug authentication on the Performance Monitors, "B4.1.131 SDER Secure Debug Enable Register, Security Extensions" of "ARM Architecture Reference Manual ARMv7-A and ARMv7-R").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To test this solution you can use &lt;A href="https://github.com/prabindh/peemuperf" rel="nofollow noopener noreferrer" title="https://github.com/prabindh/peemuperf" target="_blank"&gt;prabindh/peemuperf · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Patch peemuperf_entry.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13723499785025960" jivemacro_uid="_13723499785025960"&gt;
&lt;P&gt;--- peemuperf_entry.c.origi&amp;nbsp;&amp;nbsp;&amp;nbsp; 2013-06-27 18:00:17.136793148 +0200
+++ peemuperf_entry.c&amp;nbsp;&amp;nbsp;&amp;nbsp; 2013-06-27 18:00:52.228791934 +0200
@@ -46,6 +46,19 @@
 static void pmu_start(unsigned int event_array[],unsigned int count)
 {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int i;
+&amp;nbsp;&amp;nbsp;&amp;nbsp; {
+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u32 val = 0;
+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // SDER
+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; asm volatile("mrc p15, 0, %0, c1, c1, 1" : "=r" (val));
+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printk(KERN_ALERT "Lecture de SDER avant %u\n", val);
+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val = 0b11;
+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; asm volatile("mcr p15, 0, %0, c1, c1, 1" : : "r" (val));
+
+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; asm volatile("mrc p15, 0, %0, c1, c1, 1" : "=r" (val));
+&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printk(KERN_ALERT "Lecture de SDER apres %u\n", val);
+&amp;nbsp;&amp;nbsp;&amp;nbsp; }
+&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enable_pmu();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enable the PMU
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reset_ccnt();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Reset the CCNT (cycle counter)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reset_pmn();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Reset the configurable counters

&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Compile the module and run it, it should works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will submit a patch for linux perf_event in few days.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jun 2013 16:09:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206909#M12007</guid>
      <dc:creator>tarteauxfraises</dc:creator>
      <dc:date>2013-06-27T16:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Getting zeros on i.MX6 PMU counters</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206910#M12008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adding that code did the job! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 11:32:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206910#M12008</guid>
      <dc:creator>MickeyI</dc:creator>
      <dc:date>2013-07-03T11:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Getting zeros on i.MX6 PMU counters</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206911#M12009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For the sake of completeness, here are the steps that were taken to make an i.MX6 (SabreLite) output non-zero values on PMU events:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Edit arch/arm/mach-mx6/board-mx6q_sabrelite.c (or the relevant board initialization file)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Add a call to imx6_add_armpmu() in the mx6_sabrelite_board_init(void) function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Edit arch/arm/plat-mxc/devices/platform-imx-pmu.c&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Add tarteauxfraises' code which writes 0b11 to the SDER register to the imx_add_imx_armpmu() function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; It should look something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void __init imx_add_imx_armpmu()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u32 val = 0b11;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; asm volatile("mcr p15, 0, %0, c1, c1, 1" : : "r" (val));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; platform_device_register(&amp;amp;mx6_pmu_device);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 13:03:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206911#M12009</guid>
      <dc:creator>MickeyI</dc:creator>
      <dc:date>2013-07-03T13:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Getting zeros on i.MX6 PMU counters</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206912#M12010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to "ARM Architecture Reference Manual ARMv7-A and ARMv7-R", in B3.12.21 c1, Secure Debug Enable Register (SDER), for setting SUNIDEN and SUIDEN, we need to set val=3 inspite of 0b11, as other bits are reserved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you correct me, If I am going wrong somewhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Prabhat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jul 2013 09:43:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206912#M12010</guid>
      <dc:creator>prabhatravi</dc:creator>
      <dc:date>2013-07-05T09:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: Getting zeros on i.MX6 PMU counters</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206913#M12011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had the same issue when running PAPI 5.3.2 on i.mx6q SD with Linux kernel 3.14.52 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solved the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arch/arm/kernel/perf_event.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ void armv7_pmu_fix(void) {&lt;BR /&gt;+&amp;nbsp;&amp;nbsp; &amp;nbsp;u32 val = 0b11;&lt;BR /&gt;+&amp;nbsp;&amp;nbsp; &amp;nbsp;asm volatile("mcr p15, 0, %0, c1, c1, 1" : : "r" (val));&lt;BR /&gt;+ }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static int&lt;BR /&gt;armpmu_reserve_hardware(struct arm_pmu *armpmu)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int err;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;struct platform_device *pmu_device = armpmu-&amp;gt;plat_device;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+&amp;nbsp;&amp;nbsp; &amp;nbsp;armv7_pmu_fix();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (!pmu_device)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return -ENODEV;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I attach my test PAPI output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; PAPI_TOT_CYC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PAPI_LD_INS&amp;nbsp;&amp;nbsp;&amp;nbsp; PAPI_VEC_INS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1375564831&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 175914243&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2017 12:36:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Getting-zeros-on-i-MX6-PMU-counters/m-p/206913#M12011</guid>
      <dc:creator>michalrisa</dc:creator>
      <dc:date>2017-01-11T12:36:26Z</dc:date>
    </item>
  </channel>
</rss>

