[V5,5/6] coresight: platform: acpi: Ignore the absence of graph

Message ID 20230529062511.52016-6-anshuman.khandual@arm.com
State New
Headers
Series coresight: etm4x: Migrate ACPI AMBA devices to platform driver |

Commit Message

Anshuman Khandual May 29, 2023, 6:25 a.m. UTC
  From: Suzuki K Poulose <suzuki.poulose@arm.com>

Some components may not have graph connections for describing
the trace path. e.g., ETE, where it could directly use the per
CPU TRBE. Ignore the absence of graph connections

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 drivers/hwtracing/coresight/coresight-platform.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Mike Leach June 7, 2023, 8:58 a.m. UTC | #1
HI Ansuman,

On Mon, 29 May 2023 at 07:26, Anshuman Khandual
<anshuman.khandual@arm.com> wrote:
>
> From: Suzuki K Poulose <suzuki.poulose@arm.com>
>
> Some components may not have graph connections for describing
> the trace path. e.g., ETE, where it could directly use the per
> CPU TRBE. Ignore the absence of graph connections
>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-platform.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
> index 475899714104..c4b4fbde8550 100644
> --- a/drivers/hwtracing/coresight/coresight-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-platform.c
> @@ -692,8 +692,12 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev,
>
>         pdata->nr_inport = pdata->nr_outport = 0;
>         graph = acpi_get_coresight_graph(adev);
> +       /*
> +        * There are no graph connections, which is fine for some components.
> +        * e.g., ETE
> +        */
>         if (!graph)
> -               return -ENOENT;
> +               return 0;
>

Should we not determine if it is valid for a particular component not
to have a graph connection?
Prior to this patch an incorrectly configured ETMv4 - which must have
a graph would return an error, after this it will fail silently

Mike

>         nlinks = graph->package.elements[2].integer.value;
>         if (!nlinks)
> --
> 2.25.1
>
  
Suzuki K Poulose June 7, 2023, 9:04 a.m. UTC | #2
On 07/06/2023 09:58, Mike Leach wrote:
> HI Ansuman,
> 
> On Mon, 29 May 2023 at 07:26, Anshuman Khandual
> <anshuman.khandual@arm.com> wrote:
>>
>> From: Suzuki K Poulose <suzuki.poulose@arm.com>
>>
>> Some components may not have graph connections for describing
>> the trace path. e.g., ETE, where it could directly use the per
>> CPU TRBE. Ignore the absence of graph connections
>>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>>   drivers/hwtracing/coresight/coresight-platform.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
>> index 475899714104..c4b4fbde8550 100644
>> --- a/drivers/hwtracing/coresight/coresight-platform.c
>> +++ b/drivers/hwtracing/coresight/coresight-platform.c
>> @@ -692,8 +692,12 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev,
>>
>>          pdata->nr_inport = pdata->nr_outport = 0;
>>          graph = acpi_get_coresight_graph(adev);
>> +       /*
>> +        * There are no graph connections, which is fine for some components.
>> +        * e.g., ETE
>> +        */
>>          if (!graph)
>> -               return -ENOENT;
>> +               return 0;
>>
> 
> Should we not determine if it is valid for a particular component not
> to have a graph connection?
> Prior to this patch an incorrectly configured ETMv4 - which must have
> a graph would return an error, after this it will fail silently

I think it doesn't call for a failure. The ETM could still
be probed but is not usable. We provide enough information via the
sysfs, i.e., connection links, which should be sufficient for the
user to detect this case. Also, this change is inline with what
we do for ETMv4 with DT.

Suzuki
  

Patch

diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 475899714104..c4b4fbde8550 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -692,8 +692,12 @@  static int acpi_coresight_parse_graph(struct acpi_device *adev,
 
 	pdata->nr_inport = pdata->nr_outport = 0;
 	graph = acpi_get_coresight_graph(adev);
+	/*
+	 * There are no graph connections, which is fine for some components.
+	 * e.g., ETE
+	 */
 	if (!graph)
-		return -ENOENT;
+		return 0;
 
 	nlinks = graph->package.elements[2].integer.value;
 	if (!nlinks)