Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

coresight: tmc: Enable SG capability on ACPI based SoC-400 TMC ETR devices

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>
Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20240404072934.940760-1-anshuman.khandual@arm.com

authored by

Anshuman Khandual and committed by
Suzuki K Poulose
8877ef45 2d7e8a64

+27 -1
+27 -1
drivers/hwtracing/coresight/coresight-tmc-core.c
··· 4 4 * Description: CoreSight Trace Memory Controller driver 5 5 */ 6 6 7 + #include <linux/acpi.h> 7 8 #include <linux/kernel.h> 8 9 #include <linux/init.h> 9 10 #include <linux/types.h> ··· 363 362 364 363 static inline bool tmc_etr_can_use_sg(struct device *dev) 365 364 { 366 - return fwnode_property_present(dev->fwnode, "arm,scatter-gather"); 365 + int ret; 366 + u8 val_u8; 367 + 368 + /* 369 + * Presence of the property 'arm,scatter-gather' is checked 370 + * on the platform for the feature support, rather than its 371 + * value. 372 + */ 373 + if (is_of_node(dev->fwnode)) { 374 + return fwnode_property_present(dev->fwnode, "arm,scatter-gather"); 375 + } else if (is_acpi_device_node(dev->fwnode)) { 376 + /* 377 + * TMC_DEVID_NOSCAT test in tmc_etr_setup_caps(), has already ensured 378 + * this property is only checked for Coresight SoC 400 TMC configured 379 + * as ETR. 380 + */ 381 + ret = fwnode_property_read_u8(dev->fwnode, "arm-armhc97c-sg-enable", &val_u8); 382 + if (!ret) 383 + return !!val_u8; 384 + 385 + if (fwnode_property_present(dev->fwnode, "arm,scatter-gather")) { 386 + pr_warn_once("Deprecated ACPI property - arm,scatter-gather\n"); 387 + return true; 388 + } 389 + } 390 + return false; 367 391 } 368 392 369 393 static inline bool tmc_etr_has_non_secure_access(struct tmc_drvdata *drvdata)