[PATCH 18/19] coresight: etm4x: Add support for sysreg only devices

Suzuki K Poulose suzuki.poulose at arm.com
Wed Sep 23 07:52:00 EDT 2020


Hi Mike

On 09/18/2020 04:35 PM, Mike Leach wrote:
> Hi Suzuki,
> 
> On Fri, 11 Sep 2020 at 09:41, Suzuki K Poulose <suzuki.poulose at arm.com> wrote:
>>
>> Add support for devices with system instruction access only.
>> They don't have a memory mapped interface and thus are not
>> AMBA devices.
>>
>> Cc: Mathieu Poirier <mathieu.poirier at linaro.org>
>> Cc: Mike Leach <mike.leach at linaro.org>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose at arm.com>
>> ---
>>   drivers/hwtracing/coresight/coresight-etm4x.c | 42 ++++++++++++++++++-
>>   1 file changed, 40 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
>> index 7d5f942c2108..212713ffa37e 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm4x.c
>> +++ b/drivers/hwtracing/coresight/coresight-etm4x.c
>> @@ -26,6 +26,7 @@
>>   #include <linux/seq_file.h>
>>   #include <linux/uaccess.h>
>>   #include <linux/perf_event.h>
>> +#include <linux/platform_device.h>
>>   #include <linux/pm_runtime.h>
>>   #include <linux/property.h>
>>   #include <asm/sections.h>
>> @@ -1712,6 +1713,20 @@ static int etm4_probe_amba(struct amba_device *adev, const struct amba_id *id)
>>          return ret;
>>   }
>>
>> +static int etm4_probe_platform_dev(struct platform_device *pdev)
>> +{
>> +       int ret;
>> +
>> +       pm_runtime_get_noresume(&pdev->dev);
>> +       pm_runtime_set_active(&pdev->dev);
>> +       pm_runtime_enable(&pdev->dev);
>> +
> 
> Right about here is where I would expect the sysreg access to
> TRCDEVARCH etc, to determine if this is an ETM device that can be
> supported by the driver.
> This matches approximately the similar ID table checks that the AMBA
> driver did to ensure a valid device match.

The problem is, we have to do this on the target CPU and later do another
one for feature check.

> This logically separates "is this a device we support" from "what
> features does this supported device have"

While I understand the logical argument, it doesn't buy us much. Even now we do an
additional check on the supported architecture in the etm4x_probe() anyway and reject
the unsupported CPUs there. The only change here is we move the supported architecture
check in to the etm4_init_arch_data() and stop the hard work if it is not supported.

I would prefer to keep the current method if possible, while cleaning up the detection
of the supported (old) devices as agreed in the other patch.


Cheers
Suzuki



More information about the linux-arm-kernel mailing list