linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: leo.yan@linaro.org (Leo Yan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 4/4] coresight: etb10: hook panic callback
Date: Sat,  3 Jun 2017 22:42:56 +0800	[thread overview]
Message-ID: <1496500976-18362-5-git-send-email-leo.yan@linaro.org> (raw)
In-Reply-To: <1496500976-18362-1-git-send-email-leo.yan@linaro.org>

This patch is to hook panic callback for etb10 driver; so after panic
can dump trace data from it.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etb10.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
index 979ea6e..c9ea281 100644
--- a/drivers/hwtracing/coresight/coresight-etb10.c
+++ b/drivers/hwtracing/coresight/coresight-etb10.c
@@ -473,6 +473,21 @@ static void etb_update_buffer(struct coresight_device *csdev,
 	CS_LOCK(drvdata->base);
 }
 
+static int etb_panic_cb(struct coresight_device *csdev)
+{
+	struct etb_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
+	unsigned long flags;
+
+	spin_lock_irqsave(&drvdata->spinlock, flags);
+	etb_disable_hw(drvdata);
+	etb_dump_hw(drvdata);
+	spin_unlock_irqrestore(&drvdata->spinlock, flags);
+
+	dev_err(drvdata->dev, "Dump ETB buffer 0x%x at 0x%p\n",
+		drvdata->buffer_depth, drvdata->buf);
+	return 0;
+}
+
 static const struct coresight_ops_sink etb_sink_ops = {
 	.enable		= etb_enable,
 	.disable	= etb_disable,
@@ -481,6 +496,7 @@ static const struct coresight_ops_sink etb_sink_ops = {
 	.set_buffer	= etb_set_buffer,
 	.reset_buffer	= etb_reset_buffer,
 	.update_buffer	= etb_update_buffer,
+	.panic_cb	= etb_panic_cb,
 };
 
 static const struct coresight_ops etb_cs_ops = {
-- 
2.7.4

  parent reply	other threads:[~2017-06-03 14:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-03 14:42 [PATCH v1 0/4] coresight: support panic dump functionality Leo Yan
2017-06-03 14:42 ` [PATCH v1 1/4] " Leo Yan
2017-06-08 18:13   ` Mathieu Poirier
2017-06-03 14:42 ` [PATCH v1 2/4] coresight: add and remove panic callback for sink Leo Yan
2017-06-05  9:24   ` Suzuki K Poulose
2017-06-05 10:10     ` Leo Yan
2017-06-03 14:42 ` [PATCH v1 3/4] coresight: tmc: hook panic callback for ETB/ETF Leo Yan
2017-06-03 14:42 ` Leo Yan [this message]
2017-06-05  8:57 ` [PATCH v1 0/4] coresight: support panic dump functionality Suzuki K Poulose
2017-06-05  9:27   ` Leo Yan
2017-06-08 18:16   ` Mathieu Poirier
2017-06-08 18:23 ` Mathieu Poirier

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=1496500976-18362-5-git-send-email-leo.yan@linaro.org \
    --to=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).