LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] coresight: tmc: Enable SG capability on ACPI based SoC-400 TMC ETR devices
@ 2024-04-04  7:29 Anshuman Khandual
  2024-04-04 10:53 ` James Clark
  2024-05-01 12:46 ` Suzuki K Poulose
  0 siblings, 2 replies; 3+ messages in thread
From: Anshuman Khandual @ 2024-04-04  7:29 UTC (permalink / raw
  To: linux-arm-kernel, suzuki.poulose
  Cc: sudeep.holla, Anshuman Khandual, Mike Leach, James Clark,
	Alexander Shishkin, coresight, linux-kernel

This detects and enables the scatter gather capability (SG) on ACPI based
Soc-400 TMC ETR devices via a new property called 'arm-armhc97c-sg-enable'.
The updated ACPI spec can be found below, which contains this new property.

https://developer.arm.com/documentation/den0067/latest/

This preserves current handling for the property 'arm,scatter-gather' both
on ACPI and DT based platforms i.e the presence of the property is checked
instead of the value.

Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: James Clark <james.clark@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: coresight@lists.linaro.org 
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 .../hwtracing/coresight/coresight-tmc-core.c  | 28 ++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c
index 72005b0c633e..2b277499b59a 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-core.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-core.c
@@ -4,6 +4,7 @@
  * Description: CoreSight Trace Memory Controller driver
  */
 
+#include <linux/acpi.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/types.h>
@@ -360,7 +361,32 @@ static const struct attribute_group *coresight_etr_groups[] = {
 
 static inline bool tmc_etr_can_use_sg(struct device *dev)
 {
-	return fwnode_property_present(dev->fwnode, "arm,scatter-gather");
+	int ret;
+	u8 val_u8;
+
+	/*
+	 * Presence of the property 'arm,scatter-gather' is checked
+	 * on the platform for the feature support, rather than its
+	 * value.
+	 */
+	if (is_of_node(dev->fwnode)) {
+		return fwnode_property_present(dev->fwnode, "arm,scatter-gather");
+	} else if (is_acpi_device_node(dev->fwnode)) {
+		/*
+		 * TMC_DEVID_NOSCAT test in tmc_etr_setup_caps(), has already ensured
+		 * this property is only checked for Coresight SoC 400 TMC configured
+		 * as ETR.
+		 */
+		ret = fwnode_property_read_u8(dev->fwnode, "arm-armhc97c-sg-enable", &val_u8);
+		if (!ret)
+			return !!val_u8;
+
+		if (fwnode_property_present(dev->fwnode, "arm,scatter-gather")) {
+			pr_warn_once("Deprecated ACPI property - arm,scatter-gather\n");
+			return true;
+		}
+	}
+	return false;
 }
 
 static inline bool tmc_etr_has_non_secure_access(struct tmc_drvdata *drvdata)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] coresight: tmc: Enable SG capability on ACPI based SoC-400 TMC ETR devices
  2024-04-04  7:29 [PATCH] coresight: tmc: Enable SG capability on ACPI based SoC-400 TMC ETR devices Anshuman Khandual
@ 2024-04-04 10:53 ` James Clark
  2024-05-01 12:46 ` Suzuki K Poulose
  1 sibling, 0 replies; 3+ messages in thread
From: James Clark @ 2024-04-04 10:53 UTC (permalink / raw
  To: Anshuman Khandual, linux-arm-kernel, suzuki.poulose
  Cc: sudeep.holla, Mike Leach, Alexander Shishkin, coresight,
	linux-kernel



On 04/04/2024 08:29, Anshuman Khandual wrote:
> This detects and enables the scatter gather capability (SG) on ACPI based
> Soc-400 TMC ETR devices via a new property called 'arm-armhc97c-sg-enable'.
> The updated ACPI spec can be found below, which contains this new property.
> 
> https://developer.arm.com/documentation/den0067/latest/
> 
> This preserves current handling for the property 'arm,scatter-gather' both
> on ACPI and DT based platforms i.e the presence of the property is checked
> instead of the value.
> 
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: James Clark <james.clark@arm.com>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: coresight@lists.linaro.org 
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  .../hwtracing/coresight/coresight-tmc-core.c  | 28 ++++++++++++++++++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c
> index 72005b0c633e..2b277499b59a 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc-core.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c
> @@ -4,6 +4,7 @@
>   * Description: CoreSight Trace Memory Controller driver
>   */
>  
> +#include <linux/acpi.h>
>  #include <linux/kernel.h>
>  #include <linux/init.h>
>  #include <linux/types.h>
> @@ -360,7 +361,32 @@ static const struct attribute_group *coresight_etr_groups[] = {
>  
>  static inline bool tmc_etr_can_use_sg(struct device *dev)
>  {
> -	return fwnode_property_present(dev->fwnode, "arm,scatter-gather");
> +	int ret;
> +	u8 val_u8;
> +
> +	/*
> +	 * Presence of the property 'arm,scatter-gather' is checked
> +	 * on the platform for the feature support, rather than its
> +	 * value.
> +	 */
> +	if (is_of_node(dev->fwnode)) {
> +		return fwnode_property_present(dev->fwnode, "arm,scatter-gather");
> +	} else if (is_acpi_device_node(dev->fwnode)) {
> +		/*
> +		 * TMC_DEVID_NOSCAT test in tmc_etr_setup_caps(), has already ensured
> +		 * this property is only checked for Coresight SoC 400 TMC configured
> +		 * as ETR.
> +		 */
> +		ret = fwnode_property_read_u8(dev->fwnode, "arm-armhc97c-sg-enable", &val_u8);
> +		if (!ret)
> +			return !!val_u8;
> +
> +		if (fwnode_property_present(dev->fwnode, "arm,scatter-gather")) {
> +			pr_warn_once("Deprecated ACPI property - arm,scatter-gather\n");
> +			return true;
> +		}
> +	}
> +	return false;
>  }
>  
>  static inline bool tmc_etr_has_non_secure_access(struct tmc_drvdata *drvdata)


Reviewed-by: James Clark <james.clark@arm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] coresight: tmc: Enable SG capability on ACPI based SoC-400 TMC ETR devices
  2024-04-04  7:29 [PATCH] coresight: tmc: Enable SG capability on ACPI based SoC-400 TMC ETR devices Anshuman Khandual
  2024-04-04 10:53 ` James Clark
@ 2024-05-01 12:46 ` Suzuki K Poulose
  1 sibling, 0 replies; 3+ messages in thread
From: Suzuki K Poulose @ 2024-05-01 12:46 UTC (permalink / raw
  To: linux-arm-kernel, Anshuman Khandual
  Cc: Suzuki K Poulose, Alexander Shishkin, James Clark, coresight,
	linux-kernel, sudeep.holla, Mike Leach

On Thu, 4 Apr 2024 12:59:34 +0530, Anshuman Khandual wrote:
> This detects and enables the scatter gather capability (SG) on ACPI based
> Soc-400 TMC ETR devices via a new property called 'arm-armhc97c-sg-enable'.
> The updated ACPI spec can be found below, which contains this new property.
> 
> https://developer.arm.com/documentation/den0067/latest/
> 
> This preserves current handling for the property 'arm,scatter-gather' both
> on ACPI and DT based platforms i.e the presence of the property is checked
> instead of the value.
> 
> [...]

Applied, thanks!

[1/1] coresight: tmc: Enable SG capability on ACPI based SoC-400 TMC ETR devices
      https://git.kernel.org/coresight/c/8877ef45ef9ec281849870d88039f8dc84cde774

Best regards,
-- 
Suzuki K Poulose <suzuki.poulose@arm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-01 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-04  7:29 [PATCH] coresight: tmc: Enable SG capability on ACPI based SoC-400 TMC ETR devices Anshuman Khandual
2024-04-04 10:53 ` James Clark
2024-05-01 12:46 ` Suzuki K Poulose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).