Awesome, thank you all!

I applied both patches to my local kernel (tried both 4.9 from AOSP, and 4.11 from upstream Linux), and can't seem to get my device to fully boot. :/

Looking at `dmesg` from failed runs, it seems that etm0 is being initialized cleanly, but initializing any other etm {1..7} causes my kernel to panic. All of the panics take the form "Unhandled fault: synchronous external abort (0x96000210) at $addr," where $addr is `drvdata->base + TRCIDR0` (from etm4_init_arch_data in drivers/hwtracing/coresight/coresight-etm4x.c).

I've messed around a bit, and it seems that writes to `drvdata->base + multiple_offsets` are perfectly OK, but the moment that you try to read from it, you get a panic. Like said, this only occurs on ETMs that aren't etm0. If I just throw a `if (drvdata->cpu) return;` in before we try to read from `*drvdata->base`, the device boots happily with a single ETM.

Do you all have any tips for tracking down what's causing this? Linux isn't exactly my specialty, so my troubleshooting attempts haven't really gotten me very far. :) 

If it matters, my coresight-related configuration options are:
CONFIG_CORESIGHT=y
CONFIG_CORESIGHT_ETBV10=y
CONFIG_CORESIGHT_SOURCE_ETM4X=y
CONFIG_CORESIGHT_LINKS_AND_SINKS=y
CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
CONFIG_CORESIGHT_QCOM_REPLICATOR=y
CONFIG_CORESIGHT_SINK_TPIU=y
CONFIG_CORESIGHT_STM=y

(I just ticked whatever boxes looked even mildly relevant. ;) Cutting down on what's enabled doesn't seem to help, though...)

Thanks again,
George

On Fri, Apr 28, 2017 at 7:27 AM, Mathieu Poirier <mathieu.poirier@linaro.org> wrote:
On 27 April 2017 at 20:16, Sebastian Pop <sebpop@gmail.com> wrote:
> On Thu, Apr 27, 2017 at 4:36 PM, Mathieu Poirier
> <mathieu.poirier@linaro.org> wrote:
>> Hello Sebastian,
>>
>> On 27 April 2017 at 13:45, Sebastian Pop <sebpop@gmail.com> wrote:
>>> Hi,
>>>
>>> we started looking at how to enable collection of branch traces with
>>> coresight etm on the hikey boards that are the reference platform for
>>> the android linux-4.9 work.  Does somebody from Linaro have access
>>> to the description of where the coresight components are located for
>>> the hikey devices?  We would appreciate help on enabling linux-perf
>>> collection of traces on the hikey.
>>
>> The problem with HiKey is the APB clock...  But I had patches for that
>> not too long ago and I did get trace runs going.  I'll look for them
>> tomorrow.
>
> George just pointed out that there is this patch:
> https://patchwork.kernel.org/patch/9669003/
> "Add coresight DT nodes for hikey board."
> I will try to build the android 4.9 kernel with this patch tomorrow.

I vaguely remember reviewing that patch...

>
> Mathieu, are you speaking about another set of patches that are needed
> on top of this for the APB clock?

I've attached the patches used to get traces going on HiKey on a
4.11-rc3 kernel - simply compile boot and run.

>
> Thanks,
> Sebastian