Skip to content

Commit ed2cfb2

Browse files
Suzuki K Poulosegregkh
authored andcommitted
dts: bindings: Restrict coresight tmc-etr scatter-gather mode
We are about to add the support for ETR builtin scatter-gather mode for dealing with large amount of trace buffers. However, on some of the platforms, using the ETR SG mode can lock up the system due to the way the ETR is connected to the memory subsystem. In SG mode, the ETR performs READ from the scatter-gather table to fetch the next page and regular WRITE of trace data. If the READ operation doesn't complete(due to the memory subsystem issues, which we have seen on a couple of platforms) the trace WRITE cannot proceed leading to issues. So, we by default do not use the SG mode, unless it is known to be safe on the platform. We define a DT property for the TMC node to specify whether we have a proper SG mode. Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: John Horley <john.horley@arm.com> Cc: Robert Walker <robert.walker@arm.com> Cc: devicetree@vger.kernel.org Cc: frowand.list@gmail.com Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6f755e8 commit ed2cfb2

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎Documentation/devicetree/bindings/arm/coresight.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ its hardware characteristcs.
8686
* arm,buffer-size: size of contiguous buffer space for TMC ETR
8787
(embedded trace router)
8888

89+
* arm,scatter-gather: boolean. Indicates that the TMC-ETR can safely
90+
use the SG mode on this system.
8991

9092
Example:
9193

‎drivers/hwtracing/coresight/coresight-tmc.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/err.h>
1313
#include <linux/fs.h>
1414
#include <linux/miscdevice.h>
15+
#include <linux/property.h>
1516
#include <linux/uaccess.h>
1617
#include <linux/slab.h>
1718
#include <linux/dma-mapping.h>
@@ -296,6 +297,12 @@ const struct attribute_group *coresight_tmc_groups[] = {
296297
NULL,
297298
};
298299

300+
static inline bool tmc_etr_can_use_sg(struct tmc_drvdata *drvdata)
301+
{
302+
return fwnode_property_present(drvdata->dev->fwnode,
303+
"arm,scatter-gather");
304+
}
305+
299306
/* Detect and initialise the capabilities of a TMC ETR */
300307
static int tmc_etr_setup_caps(struct tmc_drvdata *drvdata,
301308
u32 devid, void *dev_caps)
@@ -305,7 +312,7 @@ static int tmc_etr_setup_caps(struct tmc_drvdata *drvdata,
305312
/* Set the unadvertised capabilities */
306313
tmc_etr_init_caps(drvdata, (u32)(unsigned long)dev_caps);
307314

308-
if (!(devid & TMC_DEVID_NOSCAT))
315+
if (!(devid & TMC_DEVID_NOSCAT) && tmc_etr_can_use_sg(drvdata))
309316
tmc_etr_set_cap(drvdata, TMC_ETR_SG);
310317

311318
/* Check if the AXI address width is available */

0 commit comments

Comments
 (0)