linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] coresight: Miscellaneous fixes
@ 2016-06-21 16:10 Suzuki K Poulose
  2016-06-21 16:10 ` [PATCH v3 1/7] coresight: Remove erroneous dma_free_coherent in tmc_probe Suzuki K Poulose
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2016-06-21 16:10 UTC (permalink / raw)
  To: mathieu.poirier; +Cc: linux-arm-kernel, linux-kernel, Suzuki K Poulose

This is a collection of cleanups and minor enhancements to the
coresight driver. Applies on v4.7-rc4

Changes since V2:
 - Removed patches already queued as fixes for 4.7
 - Addressed comments on V2.

Changes since V1:
 - Added a patch to limit the trace data
 - Added a patch to fix tmc_read_unprepare_etr (another crash)
 - Split the patch to remove erraneous dma_free_coherent.
 - Use consistent error message format for coresight_timeout cleanup.
 - Fixed checkpatch warnings on the commit description, there are
   some errors reported on the "crash output" in the commit description.
   May be the checkpatch needs to be fixed ?


Suzuki K Poulose (7):
  coresight: Remove erroneous dma_free_coherent in tmc_probe
  coresight: Consolidate error handling path for tmc_probe
  coresight: Fix csdev connections initialisation
  coresight: tmc: Limit the trace to available data
  coresight: etmv4: Fix ETMv4x peripheral ID table
  coresight: Cleanup TMC status check
  coresight: Add better messages for coresight_timeout

 drivers/hwtracing/coresight/coresight-etb10.c   |  6 +--
 drivers/hwtracing/coresight/coresight-etm4x.c   | 14 +++----
 drivers/hwtracing/coresight/coresight-tmc-etf.c |  2 +
 drivers/hwtracing/coresight/coresight-tmc-etr.c | 12 ++++--
 drivers/hwtracing/coresight/coresight-tmc.c     | 51 +++++++++++--------------
 drivers/hwtracing/coresight/coresight-tmc.h     |  4 +-
 drivers/hwtracing/coresight/coresight.c         | 24 +++++++-----
 7 files changed, 58 insertions(+), 55 deletions(-)

-- 
1.9.1

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

* [PATCH v3 1/7] coresight: Remove erroneous dma_free_coherent in tmc_probe
  2016-06-21 16:10 [PATCH v3 0/7] coresight: Miscellaneous fixes Suzuki K Poulose
@ 2016-06-21 16:10 ` Suzuki K Poulose
  2016-06-21 16:10 ` [PATCH v3 2/7] coresight: Consolidate error handling path for tmc_probe Suzuki K Poulose
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2016-06-21 16:10 UTC (permalink / raw)
  To: mathieu.poirier; +Cc: linux-arm-kernel, linux-kernel, Suzuki K Poulose

commit de5461970b3e9e194 ("coresight: tmc: allocating memory when needed")
removed the static allocation of buffer for the trace data in ETR mode in
tmc_probe. However it failed to remove the "devm_free_coherent" in
tmc_probe when the probe fails due to other reasons. This patch gets
rid of the incorrect dma_free_coherent() call.

Fixes: commit de5461970b3e9e194 ("coresight: tmc: allocating memory when needed")
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-tmc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c
index 9e02ac9..3978cbb 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.c
+++ b/drivers/hwtracing/coresight/coresight-tmc.c
@@ -388,9 +388,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
 err_misc_register:
 	coresight_unregister(drvdata->csdev);
 err_devm_kzalloc:
-	if (drvdata->config_type == TMC_CONFIG_TYPE_ETR)
-		dma_free_coherent(dev, drvdata->size,
-				drvdata->vaddr, drvdata->paddr);
 	return ret;
 }
 
-- 
1.9.1

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

* [PATCH v3 2/7] coresight: Consolidate error handling path for tmc_probe
  2016-06-21 16:10 [PATCH v3 0/7] coresight: Miscellaneous fixes Suzuki K Poulose
  2016-06-21 16:10 ` [PATCH v3 1/7] coresight: Remove erroneous dma_free_coherent in tmc_probe Suzuki K Poulose
@ 2016-06-21 16:10 ` Suzuki K Poulose
  2016-06-21 16:10 ` [PATCH v3 3/7] coresight: Fix csdev connections initialisation Suzuki K Poulose
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2016-06-21 16:10 UTC (permalink / raw)
  To: mathieu.poirier; +Cc: linux-arm-kernel, linux-kernel, Suzuki K Poulose

This patch cleans up the error handling path for tmc_probe
as a side effect of the removal of the spurious dma_free_coherent().

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-tmc.c | 36 ++++++++++++++---------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c
index 3978cbb..1b47258 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.c
+++ b/drivers/hwtracing/coresight/coresight-tmc.c
@@ -309,22 +309,31 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
 
 	if (np) {
 		pdata = of_get_coresight_platform_data(dev, np);
-		if (IS_ERR(pdata))
-			return PTR_ERR(pdata);
+		if (IS_ERR(pdata)) {
+			ret = PTR_ERR(pdata);
+			goto out;
+		}
 		adev->dev.platform_data = pdata;
 	}
 
+	ret = -ENOMEM;
 	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
 	if (!drvdata)
-		return -ENOMEM;
+		goto out;
+
+	desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
+	if (!desc)
+		goto out;
 
 	drvdata->dev = &adev->dev;
 	dev_set_drvdata(dev, drvdata);
 
 	/* Validity for the resource is already checked by the AMBA core */
 	base = devm_ioremap_resource(dev, res);
-	if (IS_ERR(base))
-		return PTR_ERR(base);
+	if (IS_ERR(base)) {
+		ret = PTR_ERR(base);
+		goto out;
+	}
 
 	drvdata->base = base;
 
@@ -347,12 +356,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
 
 	pm_runtime_put(&adev->dev);
 
-	desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
-	if (!desc) {
-		ret = -ENOMEM;
-		goto err_devm_kzalloc;
-	}
-
 	desc->pdata = pdata;
 	desc->dev = dev;
 	desc->subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER;
@@ -373,7 +376,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
 	drvdata->csdev = coresight_register(desc);
 	if (IS_ERR(drvdata->csdev)) {
 		ret = PTR_ERR(drvdata->csdev);
-		goto err_devm_kzalloc;
+		goto out;
 	}
 
 	drvdata->miscdev.name = pdata->name;
@@ -381,13 +384,8 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
 	drvdata->miscdev.fops = &tmc_fops;
 	ret = misc_register(&drvdata->miscdev);
 	if (ret)
-		goto err_misc_register;
-
-	return 0;
-
-err_misc_register:
-	coresight_unregister(drvdata->csdev);
-err_devm_kzalloc:
+		coresight_unregister(drvdata->csdev);
+out:
 	return ret;
 }
 
-- 
1.9.1

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

* [PATCH v3 3/7] coresight: Fix csdev connections initialisation
  2016-06-21 16:10 [PATCH v3 0/7] coresight: Miscellaneous fixes Suzuki K Poulose
  2016-06-21 16:10 ` [PATCH v3 1/7] coresight: Remove erroneous dma_free_coherent in tmc_probe Suzuki K Poulose
  2016-06-21 16:10 ` [PATCH v3 2/7] coresight: Consolidate error handling path for tmc_probe Suzuki K Poulose
@ 2016-06-21 16:10 ` Suzuki K Poulose
  2016-06-21 16:10 ` [PATCH v3 4/7] coresight: tmc: Limit the trace to available data Suzuki K Poulose
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2016-06-21 16:10 UTC (permalink / raw)
  To: mathieu.poirier; +Cc: linux-arm-kernel, linux-kernel, Suzuki K Poulose

This is a cleanup patch.

coresight_device->conns holds an array to point to the devices
connected to the OUT ports of a component. Sinks, e.g ETR, do not
have an OUT port (nr_outport = 0), as it streams the trace to
memory via AXI.

At coresight_register() we do :

	conns = kcalloc(csdev->nr_outport, sizeof(*conns), GFP_KERNEL);
	if (!conns) {
		ret = -ENOMEM;
		goto err_kzalloc_conns;
	}

For ETR, since the total size requested for kcalloc is zero, the return
value is, ZERO_SIZE_PTR ( != NULL). Hence, csdev->conns = ZERO_SIZE_PTR
which cannot be verified later to contain a valid pointer. The code which
accesses the csdev->conns is bounded by the csdev->nr_outport check,
hence we don't try to dereference the ZERO_SIZE_PTR. This patch cleans
up the csdev->conns initialisation to make sure we initialise it
properly(i.e, either NULL or valid conns array).

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index d08d1ab..7ba9561 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -893,7 +893,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
 	int nr_refcnts = 1;
 	atomic_t *refcnts = NULL;
 	struct coresight_device *csdev;
-	struct coresight_connection *conns;
+	struct coresight_connection *conns = NULL;
 
 	csdev = kzalloc(sizeof(*csdev), GFP_KERNEL);
 	if (!csdev) {
@@ -921,16 +921,20 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
 
 	csdev->nr_inport = desc->pdata->nr_inport;
 	csdev->nr_outport = desc->pdata->nr_outport;
-	conns = kcalloc(csdev->nr_outport, sizeof(*conns), GFP_KERNEL);
-	if (!conns) {
-		ret = -ENOMEM;
-		goto err_kzalloc_conns;
-	}
 
-	for (i = 0; i < csdev->nr_outport; i++) {
-		conns[i].outport = desc->pdata->outports[i];
-		conns[i].child_name = desc->pdata->child_names[i];
-		conns[i].child_port = desc->pdata->child_ports[i];
+	/* Initialise connections if there is at least one outport */
+	if (csdev->nr_outport) {
+		conns = kcalloc(csdev->nr_outport, sizeof(*conns), GFP_KERNEL);
+		if (!conns) {
+			ret = -ENOMEM;
+			goto err_kzalloc_conns;
+		}
+
+		for (i = 0; i < csdev->nr_outport; i++) {
+			conns[i].outport = desc->pdata->outports[i];
+			conns[i].child_name = desc->pdata->child_names[i];
+			conns[i].child_port = desc->pdata->child_ports[i];
+		}
 	}
 
 	csdev->conns = conns;
-- 
1.9.1

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

* [PATCH v3 4/7] coresight: tmc: Limit the trace to available data
  2016-06-21 16:10 [PATCH v3 0/7] coresight: Miscellaneous fixes Suzuki K Poulose
                   ` (2 preceding siblings ...)
  2016-06-21 16:10 ` [PATCH v3 3/7] coresight: Fix csdev connections initialisation Suzuki K Poulose
@ 2016-06-21 16:10 ` Suzuki K Poulose
  2016-06-21 16:10 ` [PATCH v3 5/7] coresight: etmv4: Fix ETMv4x peripheral ID table Suzuki K Poulose
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2016-06-21 16:10 UTC (permalink / raw)
  To: mathieu.poirier; +Cc: linux-arm-kernel, linux-kernel, Suzuki K Poulose

At present the ETF or ETR gives out the entire device
buffer, even if there is less or even no trace data
available. This patch limits the trace data given out to
the actual trace data collected.

Cc: mathieu.poirier@linaro.org
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-tmc-etf.c |  2 ++
 drivers/hwtracing/coresight/coresight-tmc-etr.c | 12 +++++++++---
 drivers/hwtracing/coresight/coresight-tmc.c     |  6 +++---
 drivers/hwtracing/coresight/coresight-tmc.h     |  4 +++-
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
index 466af86..e68289b 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
@@ -48,6 +48,7 @@ static void tmc_etb_dump_hw(struct tmc_drvdata *drvdata)
 	int i;
 
 	bufp = drvdata->buf;
+	drvdata->len = 0;
 	while (1) {
 		for (i = 0; i < drvdata->memwidth; i++) {
 			read_data = readl_relaxed(drvdata->base + TMC_RRD);
@@ -55,6 +56,7 @@ static void tmc_etb_dump_hw(struct tmc_drvdata *drvdata)
 				return;
 			memcpy(bufp, &read_data, 4);
 			bufp += 4;
+			drvdata->len += 4;
 		}
 	}
 }
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
index 688be9e..03f36cb 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
@@ -64,11 +64,17 @@ static void tmc_etr_dump_hw(struct tmc_drvdata *drvdata)
 	rwp = readl_relaxed(drvdata->base + TMC_RWP);
 	val = readl_relaxed(drvdata->base + TMC_STS);
 
-	/* How much memory do we still have */
-	if (val & BIT(0))
+	/*
+	 * Adjust the buffer to point to the beginning of the trace data
+	 * and update the available trace data.
+	 */
+	if (val & BIT(0)) {
 		drvdata->buf = drvdata->vaddr + rwp - drvdata->paddr;
-	else
+		drvdata->len = drvdata->size;
+	} else {
 		drvdata->buf = drvdata->vaddr;
+		drvdata->len = rwp - drvdata->paddr;
+	}
 }
 
 static void tmc_etr_disable_hw(struct tmc_drvdata *drvdata)
diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c
index 1b47258..b3275bb 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.c
+++ b/drivers/hwtracing/coresight/coresight-tmc.c
@@ -140,8 +140,8 @@ static ssize_t tmc_read(struct file *file, char __user *data, size_t len,
 						   struct tmc_drvdata, miscdev);
 	char *bufp = drvdata->buf + *ppos;
 
-	if (*ppos + len > drvdata->size)
-		len = drvdata->size - *ppos;
+	if (*ppos + len > drvdata->len)
+		len = drvdata->len - *ppos;
 
 	if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) {
 		if (bufp == (char *)(drvdata->vaddr + drvdata->size))
@@ -160,7 +160,7 @@ static ssize_t tmc_read(struct file *file, char __user *data, size_t len,
 	*ppos += len;
 
 	dev_dbg(drvdata->dev, "%s: %zu bytes copied, %d bytes left\n",
-		__func__, len, (int)(drvdata->size - *ppos));
+		__func__, len, (int)(drvdata->len - *ppos));
 	return len;
 }
 
diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h
index 5c5fe2a..44b3ae3 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.h
+++ b/drivers/hwtracing/coresight/coresight-tmc.h
@@ -98,7 +98,8 @@ enum tmc_mem_intf_width {
  * @buf:	area of memory where trace data get sent.
  * @paddr:	DMA start location in RAM.
  * @vaddr:	virtual representation of @paddr.
- * @size:	@buf size.
+ * @size:	trace buffer size.
+ * @len:	size of the available trace.
  * @mode:	how this TMC is being used.
  * @config_type: TMC variant, must be of type @tmc_config_type.
  * @memwidth:	width of the memory interface databus, in bytes.
@@ -115,6 +116,7 @@ struct tmc_drvdata {
 	dma_addr_t		paddr;
 	void __iomem		*vaddr;
 	u32			size;
+	u32			len;
 	local_t			mode;
 	enum tmc_config_type	config_type;
 	enum tmc_mem_intf_width	memwidth;
-- 
1.9.1

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

* [PATCH v3 5/7] coresight: etmv4: Fix ETMv4x peripheral ID table
  2016-06-21 16:10 [PATCH v3 0/7] coresight: Miscellaneous fixes Suzuki K Poulose
                   ` (3 preceding siblings ...)
  2016-06-21 16:10 ` [PATCH v3 4/7] coresight: tmc: Limit the trace to available data Suzuki K Poulose
@ 2016-06-21 16:10 ` Suzuki K Poulose
  2016-06-21 16:10 ` [PATCH v3 6/7] coresight: Cleanup TMC status check Suzuki K Poulose
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2016-06-21 16:10 UTC (permalink / raw)
  To: mathieu.poirier; +Cc: linux-arm-kernel, linux-kernel, Suzuki K Poulose

This patch cleans up the peripheral id table for different ETMv4
implementations.

As per Cortex-A53 TRM, the ETM has following id values:

Peripheral ID0	0x5D	0xFE0
Peripheral ID1	0xB9	0xFE4
Peripheral ID2	0x4B	0xFE8
Peripheral ID3	0x00	0xFEC

where, PID2: has the following format:

[7:4]   Revision
[3]     JEDEC   0b1     res1. Indicates a JEP106 identity code is used
[2:0]   DES_1   0b011   ARM Limited. This is bits[6:4] of JEP106 ID code

The existing table entry checks only the bits [1:0], which is not
sufficient enough. Fix it to match bits [3:0], just like the other
entries do. While at it, correct the comment for A57 and the A53 entry.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-etm4x.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
index 462f0dc..88947f3 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x.c
@@ -815,12 +815,12 @@ err_arch_supported:
 }
 
 static struct amba_id etm4_ids[] = {
-	{       /* ETM 4.0 - Qualcomm */
-		.id	= 0x0003b95d,
-		.mask	= 0x0003ffff,
+	{       /* ETM 4.0 - Cortex-A53  */
+		.id	= 0x000bb95d,
+		.mask	= 0x000fffff,
 		.data	= "ETM 4.0",
 	},
-	{       /* ETM 4.0 - Juno board */
+	{       /* ETM 4.0 - Cortex-A57 */
 		.id	= 0x000bb95e,
 		.mask	= 0x000fffff,
 		.data	= "ETM 4.0",
-- 
1.9.1

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

* [PATCH v3 6/7] coresight: Cleanup TMC status check
  2016-06-21 16:10 [PATCH v3 0/7] coresight: Miscellaneous fixes Suzuki K Poulose
                   ` (4 preceding siblings ...)
  2016-06-21 16:10 ` [PATCH v3 5/7] coresight: etmv4: Fix ETMv4x peripheral ID table Suzuki K Poulose
@ 2016-06-21 16:10 ` Suzuki K Poulose
  2016-06-21 16:10 ` [PATCH v3 7/7] coresight: Add better messages for coresight_timeout Suzuki K Poulose
  2016-06-21 17:38 ` [PATCH v3 0/7] coresight: Miscellaneous fixes Mathieu Poirier
  7 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2016-06-21 16:10 UTC (permalink / raw)
  To: mathieu.poirier; +Cc: linux-arm-kernel, linux-kernel, Suzuki K Poulose

Use the defined symbol rather than hardcoding the value to
check whether the TMC buffer is full.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-tmc-etr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
index 03f36cb..6d7de03 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
@@ -68,7 +68,7 @@ static void tmc_etr_dump_hw(struct tmc_drvdata *drvdata)
 	 * Adjust the buffer to point to the beginning of the trace data
 	 * and update the available trace data.
 	 */
-	if (val & BIT(0)) {
+	if (val & TMC_STS_FULL) {
 		drvdata->buf = drvdata->vaddr + rwp - drvdata->paddr;
 		drvdata->len = drvdata->size;
 	} else {
-- 
1.9.1

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

* [PATCH v3 7/7] coresight: Add better messages for coresight_timeout
  2016-06-21 16:10 [PATCH v3 0/7] coresight: Miscellaneous fixes Suzuki K Poulose
                   ` (5 preceding siblings ...)
  2016-06-21 16:10 ` [PATCH v3 6/7] coresight: Cleanup TMC status check Suzuki K Poulose
@ 2016-06-21 16:10 ` Suzuki K Poulose
  2016-06-21 17:38 ` [PATCH v3 0/7] coresight: Miscellaneous fixes Mathieu Poirier
  7 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2016-06-21 16:10 UTC (permalink / raw)
  To: mathieu.poirier; +Cc: linux-arm-kernel, linux-kernel, Suzuki K Poulose

When we encounter a timeout waiting for a status change via
coresight_timeout, the caller always print the offset which
was tried. This is pretty much useless as it doesn't specify
the bit position we wait for. Also, one needs to lookup the
TRM to figure out, what was wrong. This patch changes all
such error messages to print something more meaningful.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-etb10.c | 6 ++----
 drivers/hwtracing/coresight/coresight-etm4x.c | 6 ++----
 drivers/hwtracing/coresight/coresight-tmc.c   | 6 ++----
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
index 4d20b0b..3b483e3 100644
--- a/drivers/hwtracing/coresight/coresight-etb10.c
+++ b/drivers/hwtracing/coresight/coresight-etb10.c
@@ -184,8 +184,7 @@ static void etb_disable_hw(struct etb_drvdata *drvdata)
 
 	if (coresight_timeout(drvdata->base, ETB_FFCR, ETB_FFCR_BIT, 0)) {
 		dev_err(drvdata->dev,
-			"timeout observed when probing at offset %#x\n",
-			ETB_FFCR);
+		"timeout while waiting for completion of Manual Flush\n");
 	}
 
 	/* disable trace capture */
@@ -193,8 +192,7 @@ static void etb_disable_hw(struct etb_drvdata *drvdata)
 
 	if (coresight_timeout(drvdata->base, ETB_FFSR, ETB_FFSR_BIT, 1)) {
 		dev_err(drvdata->dev,
-			"timeout observed when probing at offset %#x\n",
-			ETB_FFCR);
+			"timeout while waiting for Formatter to Stop\n");
 	}
 
 	CS_LOCK(drvdata->base);
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
index 88947f3..c8b44c6 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x.c
@@ -111,8 +111,7 @@ static void etm4_enable_hw(void *info)
 	/* wait for TRCSTATR.IDLE to go up */
 	if (coresight_timeout(drvdata->base, TRCSTATR, TRCSTATR_IDLE_BIT, 1))
 		dev_err(drvdata->dev,
-			"timeout observed when probing at offset %#x\n",
-			TRCSTATR);
+			"timeout while waiting for Idle Trace Status\n");
 
 	writel_relaxed(config->pe_sel, drvdata->base + TRCPROCSELR);
 	writel_relaxed(config->cfg, drvdata->base + TRCCONFIGR);
@@ -184,8 +183,7 @@ static void etm4_enable_hw(void *info)
 	/* wait for TRCSTATR.IDLE to go back down to '0' */
 	if (coresight_timeout(drvdata->base, TRCSTATR, TRCSTATR_IDLE_BIT, 0))
 		dev_err(drvdata->dev,
-			"timeout observed when probing at offset %#x\n",
-			TRCSTATR);
+			"timeout while waiting for Idle Trace Status\n");
 
 	CS_LOCK(drvdata->base);
 
diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c
index b3275bb..84052c7 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.c
+++ b/drivers/hwtracing/coresight/coresight-tmc.c
@@ -38,8 +38,7 @@ void tmc_wait_for_tmcready(struct tmc_drvdata *drvdata)
 	if (coresight_timeout(drvdata->base,
 			      TMC_STS, TMC_STS_TMCREADY_BIT, 1)) {
 		dev_err(drvdata->dev,
-			"timeout observed when probing at offset %#x\n",
-			TMC_STS);
+			"timeout while waiting for TMC to be Ready\n");
 	}
 }
 
@@ -56,8 +55,7 @@ void tmc_flush_and_stop(struct tmc_drvdata *drvdata)
 	if (coresight_timeout(drvdata->base,
 			      TMC_FFCR, TMC_FFCR_FLUSHMAN_BIT, 0)) {
 		dev_err(drvdata->dev,
-			"timeout observed when probing at offset %#x\n",
-			TMC_FFCR);
+		"timeout while waiting for completion of Manual Flush\n");
 	}
 
 	tmc_wait_for_tmcready(drvdata);
-- 
1.9.1

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

* Re: [PATCH v3 0/7] coresight: Miscellaneous fixes
  2016-06-21 16:10 [PATCH v3 0/7] coresight: Miscellaneous fixes Suzuki K Poulose
                   ` (6 preceding siblings ...)
  2016-06-21 16:10 ` [PATCH v3 7/7] coresight: Add better messages for coresight_timeout Suzuki K Poulose
@ 2016-06-21 17:38 ` Mathieu Poirier
  7 siblings, 0 replies; 9+ messages in thread
From: Mathieu Poirier @ 2016-06-21 17:38 UTC (permalink / raw)
  To: Suzuki K Poulose; +Cc: linux-arm-kernel, linux-kernel

On 21 June 2016 at 10:10, Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
> This is a collection of cleanups and minor enhancements to the
> coresight driver. Applies on v4.7-rc4
>
> Changes since V2:
>  - Removed patches already queued as fixes for 4.7
>  - Addressed comments on V2.
>
> Changes since V1:
>  - Added a patch to limit the trace data
>  - Added a patch to fix tmc_read_unprepare_etr (another crash)
>  - Split the patch to remove erraneous dma_free_coherent.
>  - Use consistent error message format for coresight_timeout cleanup.
>  - Fixed checkpatch warnings on the commit description, there are
>    some errors reported on the "crash output" in the commit description.
>    May be the checkpatch needs to be fixed ?
>
>
> Suzuki K Poulose (7):
>   coresight: Remove erroneous dma_free_coherent in tmc_probe
>   coresight: Consolidate error handling path for tmc_probe
>   coresight: Fix csdev connections initialisation
>   coresight: tmc: Limit the trace to available data
>   coresight: etmv4: Fix ETMv4x peripheral ID table
>   coresight: Cleanup TMC status check
>   coresight: Add better messages for coresight_timeout
>
>  drivers/hwtracing/coresight/coresight-etb10.c   |  6 +--
>  drivers/hwtracing/coresight/coresight-etm4x.c   | 14 +++----
>  drivers/hwtracing/coresight/coresight-tmc-etf.c |  2 +
>  drivers/hwtracing/coresight/coresight-tmc-etr.c | 12 ++++--
>  drivers/hwtracing/coresight/coresight-tmc.c     | 51 +++++++++++--------------
>  drivers/hwtracing/coresight/coresight-tmc.h     |  4 +-
>  drivers/hwtracing/coresight/coresight.c         | 24 +++++++-----
>  7 files changed, 58 insertions(+), 55 deletions(-)
>
> --
> 1.9.1
>

I have applied the whole set.

Thanks,
Mathieu

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

end of thread, other threads:[~2016-06-21 17:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-21 16:10 [PATCH v3 0/7] coresight: Miscellaneous fixes Suzuki K Poulose
2016-06-21 16:10 ` [PATCH v3 1/7] coresight: Remove erroneous dma_free_coherent in tmc_probe Suzuki K Poulose
2016-06-21 16:10 ` [PATCH v3 2/7] coresight: Consolidate error handling path for tmc_probe Suzuki K Poulose
2016-06-21 16:10 ` [PATCH v3 3/7] coresight: Fix csdev connections initialisation Suzuki K Poulose
2016-06-21 16:10 ` [PATCH v3 4/7] coresight: tmc: Limit the trace to available data Suzuki K Poulose
2016-06-21 16:10 ` [PATCH v3 5/7] coresight: etmv4: Fix ETMv4x peripheral ID table Suzuki K Poulose
2016-06-21 16:10 ` [PATCH v3 6/7] coresight: Cleanup TMC status check Suzuki K Poulose
2016-06-21 16:10 ` [PATCH v3 7/7] coresight: Add better messages for coresight_timeout Suzuki K Poulose
2016-06-21 17:38 ` [PATCH v3 0/7] coresight: Miscellaneous fixes Mathieu Poirier

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 NNTP newsgroup(s).