linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: mathieu.poirier@linaro.org, linux-kernel@vger.kernel.org,
	robert.walker@arm.com, mike.leach@arm.com,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: [PATCH 05/13] coresight: etm3: Add support for handling errors
Date: Mon,  6 Aug 2018 14:41:47 +0100	[thread overview]
Message-ID: <1533562915-21558-6-git-send-email-suzuki.poulose@arm.com> (raw)
In-Reply-To: <1533562915-21558-1-git-send-email-suzuki.poulose@arm.com>

Add support for reporting errors back from the SMP cross
function call for enabling ETM.

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

diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c
index 9ce8fba..771691c 100644
--- a/drivers/hwtracing/coresight/coresight-etm3x.c
+++ b/drivers/hwtracing/coresight/coresight-etm3x.c
@@ -355,11 +355,10 @@ static int etm_parse_event_config(struct etm_drvdata *drvdata,
 	return 0;
 }
 
-static void etm_enable_hw(void *info)
+static int etm_enable_hw(struct etm_drvdata *drvdata)
 {
 	int i;
 	u32 etmcr;
-	struct etm_drvdata *drvdata = info;
 	struct etm_config *config = &drvdata->config;
 
 	CS_UNLOCK(drvdata->base);
@@ -421,6 +420,21 @@ static void etm_enable_hw(void *info)
 	CS_LOCK(drvdata->base);
 
 	dev_dbg(drvdata->dev, "cpu: %d enable smp call done\n", drvdata->cpu);
+	return 0;
+}
+
+struct etm_enable_arg {
+	struct etm_drvdata *drvdata;
+	int rc;
+}
+
+static void etm_enable_hw_smp_call(void *info)
+{
+	struct etm_enable_arg *arg = info;
+
+	if (WARN_ON(!arg))
+		return;
+	arg->rc = etm_enable_hw(arg->drvdata);
 }
 
 static int etm_cpu_id(struct coresight_device *csdev)
@@ -475,14 +489,13 @@ static int etm_enable_perf(struct coresight_device *csdev,
 	/* Configure the tracer based on the session's specifics */
 	etm_parse_event_config(drvdata, event);
 	/* And enable it */
-	etm_enable_hw(drvdata);
-
-	return 0;
+	return etm_enable_hw(drvdata);
 }
 
 static int etm_enable_sysfs(struct coresight_device *csdev)
 {
 	struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
+	struct etm_enable_arg arg = { 0 };
 	int ret;
 
 	spin_lock(&drvdata->spinlock);
@@ -492,20 +505,21 @@ static int etm_enable_sysfs(struct coresight_device *csdev)
 	 * hw configuration will take place on the local CPU during bring up.
 	 */
 	if (cpu_online(drvdata->cpu)) {
+		arg.drvdata = drvdata;
 		ret = smp_call_function_single(drvdata->cpu,
-					       etm_enable_hw, drvdata, 1);
-		if (ret)
-			goto err;
+					       etm_enable_hw_smp_call, &arg, 1);
+		if (!ret)
+			ret = arg.rc;
+		if (!ret)
+			drvdata->sticky_enable = true;
+	} else {
+		ret = -ENODEV;
 	}
 
-	drvdata->sticky_enable = true;
 	spin_unlock(&drvdata->spinlock);
 
-	dev_dbg(drvdata->dev, "ETM tracing enabled\n");
-	return 0;
-
-err:
-	spin_unlock(&drvdata->spinlock);
+	if (!ret)
+		dev_dbg(drvdata->dev, "ETM tracing enabled\n");
 	return ret;
 }
 
-- 
2.7.4


  parent reply	other threads:[~2018-08-06 13:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 13:41 [PATCH 00/13] coresight: Implement device claim protocol Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 01/13] coresight: tmc-etr: Refactor for handling errors Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 02/13] coresight: tmc-etr: Handle errors enabling CATU Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 03/13] coresight: tmc-etb/etf: Prepare to handle errors enabling Suzuki K Poulose
2018-08-15 19:22   ` Mathieu Poirier
2018-08-16 14:47     ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 04/13] coresight: etm4x: Add support for handling errors Suzuki K Poulose
2018-08-06 13:41 ` Suzuki K Poulose [this message]
2018-08-15 19:34   ` [PATCH 05/13] coresight: etm3: " Mathieu Poirier
2018-08-16 15:45     ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 06/13] coresight: etb10: Handle errors enabling the device Suzuki K Poulose
2018-08-14 17:40   ` Mathieu Poirier
2018-08-15 19:38   ` Mathieu Poirier
2018-08-16 15:46     ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 07/13] coresight: dynamic-replicator: Handle multiple connections Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 08/13] coresight: Add support for CLAIM tag protocol Suzuki K Poulose
2018-08-14 23:20   ` Mathieu Poirier
2018-08-16 15:47     ` Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 09/13] coresight: etmx: Claim devices before use Suzuki K Poulose
2018-08-14 23:43   ` Mathieu Poirier
2018-08-06 13:41 ` [PATCH 10/13] coresight: funnel: " Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 11/13] coresight: catu: Claim device " Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 12/13] coresight: dynamic-replicator: Claim device for use Suzuki K Poulose
2018-08-06 13:41 ` [PATCH 13/13] coreisght: tmc: Claim device before use Suzuki K Poulose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1533562915-21558-6-git-send-email-suzuki.poulose@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@arm.com \
    --cc=robert.walker@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).