From patchwork Fri Mar 30 03:15:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 132582 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp2531269ljb; Thu, 29 Mar 2018 20:16:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx49VjenO7aFRBeVR1BsUvyriwvUhv3QnVTGgmS4yN4ZgdbmmwEBUfeWfU3oIK6N2KILsuO2h X-Received: by 10.99.147.82 with SMTP id w18mr7169356pgm.181.1522379818698; Thu, 29 Mar 2018 20:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522379818; cv=none; d=google.com; s=arc-20160816; b=LxfM4aGRAYSQWmvuL2WhgHt+MA+n/pVkDuAPSbbJN+Noo+WMU8uRto90gMeZdls8TY vEswkSTxrMLJiYiEycydm5/LTydJfl7QObv6deroTVsoLvu0DJDjqVsvjcTew+qHpeeY O9WoLrwfWUJXEbmQWXaJaZzaoYh+jf4BPWE7vaGa2MUnYO9/vKrxRfC2dJw0VVzGXVjL 4cR2Sajc1So4o6u8daAWdIwZEWl+jYZmCl4QQrBE9ka5nEhgfX2XM2eHCE6ipBzBTDi0 WjG67RCBkKzUTOqeNuCBQimTTxHPM3EhuBRGMwTIguNsgJdmnu0OYo091yCflqx39Sxi ce3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=HpmWK/7Q87q15GSW6+wUQSscqm4fAYVRmYYCeuwbnNw=; b=pGWvafU7KIgO11I6OfGTZtf9KOqIS1Szvj8bIhIGNYOVEndQyOmP+SABQftSpaS2r+ PbvQvphInaGskAZPKI8ovYMsOlZf2yQfPZfnqoinkSOrpLP320p9OFxT4K93mApEKC3s m1salT5LydAz0QYdjazYyC6odu0pP2fC2gwOyKKa2kqZSOe1TWAWoDlquj3ISNf7nsHH UHsnLZXiujekleMmqcojYUU5uk7k5aKLPjh4rUiaOu2pXPkRXIptqPw1aAHSch5pjPaE J9h40+Cidf07MKv2pXEGvie2qqC4RSW06ki+FY2r/767CsKqiK+LnhNnS8jrAB6jzkGZ Plrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XMsb5V8m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5-v6si7512908plh.432.2018.03.29.20.16.58; Thu, 29 Mar 2018 20:16:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XMsb5V8m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752918AbeC3DQ4 (ORCPT + 29 others); Thu, 29 Mar 2018 23:16:56 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:38934 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752770AbeC3DQG (ORCPT ); Thu, 29 Mar 2018 23:16:06 -0400 Received: by mail-wr0-f195.google.com with SMTP id c24so6978741wrc.6 for ; Thu, 29 Mar 2018 20:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HpmWK/7Q87q15GSW6+wUQSscqm4fAYVRmYYCeuwbnNw=; b=XMsb5V8mWGdb8zdXU8hFQKiaUsQtP3E05ZpNZH86+hGmcnr5r1ObPUgPmzIg+cD8jy YCKGCkdIQtxL3eYFEmBv3+ZyxTO+k6AGMFXEUylpDLO4kV/vH80sEM16IwrdKg5lVR0l ZVbRdP47268iRTcILxhJcQ3W7ir9yoJyCsegg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HpmWK/7Q87q15GSW6+wUQSscqm4fAYVRmYYCeuwbnNw=; b=R7fgQ391kWv6k2SqiY4Lstcqn+HvJL1AFD7VtyA2kNwig+ADbg5Tu6iRU3xvdXJfnO uudpoKtWADsNgnbuZ3bE4JDfWM1Z/HUIaC0esnfjnI59ZjKN5Zkvh1LiYUSzkgtUoJMX jpsjpflNyDcEqIHCxLnaJ79s7JfH9WQmSWS8rAOvdQcBeYy7rq7u1n/WGV18MBuDunoN tQp7qC5L+RSQyqp9rCkTZE4z+NQH6VDxZ/PaK7P1Tx+9le9XmOWB+98fAgkgbMgy3hCo G2LRFUTeGO/9Mevcrb3KuApVZQflyh1FU9bEc2jR7FTQh2VpSnzsefIV+Wt5tTongLi3 /bcg== X-Gm-Message-State: AElRT7HdDynt754GnDZgkxpqEzDIRPuGh5Pyp8u093RZHMsUNAPMB9vn mGy/yRocKd/a7etQwhBgavwSRQ== X-Received: by 10.223.176.253 with SMTP id j58mr8270564wra.269.1522379765011; Thu, 29 Mar 2018 20:16:05 -0700 (PDT) Received: from localhost.localdomain (li622-172.members.linode.com. [212.71.249.172]) by smtp.gmail.com with ESMTPSA id z9sm12798903wrz.4.2018.03.29.20.16.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Mar 2018 20:16:04 -0700 (PDT) From: Leo Yan To: Jonathan Corbet , Mathieu Poirier , Greg Kroah-Hartman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, Kim Phillips , Mike Leach Cc: Leo Yan Subject: [PATCH v4 4/6] coresight: tmc: Hook callback for panic kdump Date: Fri, 30 Mar 2018 11:15:22 +0800 Message-Id: <1522379724-30648-5-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522379724-30648-1-git-send-email-leo.yan@linaro.org> References: <1522379724-30648-1-git-send-email-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since Coresight panic kdump functionality has been ready, this patch is to hook panic callback function for ETB/ETF driver. The driver data structure has allocated a buffer when the session started, so simply save tracing data into this buffer when panic happens and update buffer related info for kdump. Signed-off-by: Leo Yan --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index e2513b7..d20d546 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -504,6 +504,35 @@ 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 */ + csdev->kdump_buf = drvdata->buf; + csdev->kdump_buf_sz = 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 +541,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 = {