From: leo.yan@linaro.org (Leo Yan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/4] coresight: tmc: Hook panic dump callback for ETB/ETF
Date: Tue, 21 Nov 2017 11:08:43 +0800 [thread overview]
Message-ID: <1511233724-11867-4-git-send-email-leo.yan@linaro.org> (raw)
In-Reply-To: <1511233724-11867-1-git-send-email-leo.yan@linaro.org>
The panic dump functionality has been ready, this patch is to hook
panic callback function for ETB/ETF. Since the driver data structure
has allocated buffer when the session started, so simply save ETB/ETF
trace data into the buffer when panic happens and update related info
into dump node.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
drivers/hwtracing/coresight/coresight-tmc-etf.c | 29 +++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
index e2513b7..1337c02 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
@@ -504,6 +504,34 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev,
CS_LOCK(drvdata->base);
}
+static void tmc_panic_cb(void *data)
+{
+ struct coresight_device *csdev = (struct coresight_device *)data;
+ struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
+ unsigned long flags;
+
+ if (WARN_ON_ONCE(drvdata->config_type != TMC_CONFIG_TYPE_ETB &&
+ drvdata->config_type != TMC_CONFIG_TYPE_ETF))
+ return;
+
+ if (drvdata->mode == CS_MODE_DISABLED)
+ return;
+
+ spin_lock_irqsave(&drvdata->spinlock, flags);
+
+ CS_UNLOCK(drvdata->base);
+
+ tmc_flush_and_stop(drvdata);
+ tmc_etb_dump_hw(drvdata);
+
+ CS_LOCK(drvdata->base);
+
+ /* Update buffer info for panic dump */
+ coresight_dump_update(csdev, drvdata->buf, drvdata->len);
+
+ spin_unlock_irqrestore(&drvdata->spinlock, flags);
+}
+
static const struct coresight_ops_sink tmc_etf_sink_ops = {
.enable = tmc_enable_etf_sink,
.disable = tmc_disable_etf_sink,
@@ -512,6 +540,7 @@ static const struct coresight_ops_sink tmc_etf_sink_ops = {
.set_buffer = tmc_set_etf_buffer,
.reset_buffer = tmc_reset_etf_buffer,
.update_buffer = tmc_update_etf_buffer,
+ .panic_cb = tmc_panic_cb,
};
static const struct coresight_ops_link tmc_etf_link_ops = {
--
2.7.4
next prev parent reply other threads:[~2017-11-21 3:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 3:08 [PATCH v2 0/4] coresight: support panic dump functionality Leo Yan
2017-11-21 3:08 ` [PATCH v2 1/4] coresight: Support " Leo Yan
2017-11-22 18:58 ` Mathieu Poirier
2017-11-24 1:54 ` Leo Yan
2017-11-24 16:29 ` Mathieu Poirier
2017-11-27 1:57 ` Leo Yan
2017-11-28 17:13 ` Mathieu Poirier
2017-11-21 3:08 ` [PATCH v2 2/4] coresight: Add and delete dump node for registration/unregistration Leo Yan
2017-11-21 3:08 ` Leo Yan [this message]
2017-11-21 3:08 ` [PATCH v2 4/4] coresight: etm4x: Hook panic dump callback for etmv4 Leo Yan
2017-11-22 19:09 ` Mathieu Poirier
2017-11-23 17:03 ` Mathieu Poirier
2017-11-24 4:06 ` Leo Yan
2017-11-24 16:46 ` 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=1511233724-11867-4-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).