Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp10585600ybl; Thu, 26 Dec 2019 21:35:24 -0800 (PST) X-Google-Smtp-Source: APXvYqz8bBKVgB/mjJzGLnWpQWcLa26+qncfJmaPBLh/hoCP/Dgjv0fluDz2LimN6MtlsTpc6EfY X-Received: by 2002:a05:6830:22e3:: with SMTP id t3mr52012550otc.193.1577424924137; Thu, 26 Dec 2019 21:35:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577424924; cv=none; d=google.com; s=arc-20160816; b=gbm4wOCg5B6hk5rv+CxkKbXHEQe13fDKU0vUbRTkYLsYnO2SrwyAn1J6UKaXVaomr4 Ta78/HOKeQJI1n9l654Wc3TildP8Y9Gpaa8Pd3Q0qmj9vSEZNzWE7qOlg44i57224gtb W94feGk+K09WV3BlzQz/b2vl0UEfvAdgtA5zC7E4BCRvsI1lj1ApZ1XmT0gIRDu310fQ T0N2y179oYIzqz0OMk0UVvxmzqP16xrqfSDkOqQhr2riWqQ2X67QfUS9b8mxpSd8HH4+ rZlbwlejqi3EgwC0FCw/UaodjgocIR15K3jYpBwwZJjRIsNMDgTZLC31sqh0p62Ozz6C esAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CeCsCjetYaq9WLaLyz0l/vASvwsTn/rJXzj0Xq2S4N0=; b=TXWIDkunQMFy9lnSm0UorrZF3USLjNIVs/P8XHd7P2YkHxiIvSiDlvbZFE3/60URtC A8YB/HJ7R6O3r4Z8+YTMJU/HvVRQF+SJtA5fDg6zi/gWyIa9TwBx6IG3GPFxYiUAqvim HbvPmFnM5zdHR/Pg5mYHk/q1xmKJFK2OViiBLNFppDkfwPmY8Zwq31amfWuLBAmPTTMK 0L/XGLUkxQjVgyebLR/dAde0mVaLah+tVGdAmxGA8ZwF2Fyeyz//70hi3M/opj2h2ucG X+KUOYyKsz6D4iwLCzteox8FwCaSvLDFDWZvJ+y4VKTNwqH4pF42JFipAyissPcV717Y 1wFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nLUHfY3E; 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 g10si17096788otn.12.2019.12.26.21.34.47; Thu, 26 Dec 2019 21:35:24 -0800 (PST) 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=nLUHfY3E; 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 S1727074AbfL0FdD (ORCPT + 99 others); Fri, 27 Dec 2019 00:33:03 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:42999 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727083AbfL0FdA (ORCPT ); Fri, 27 Dec 2019 00:33:00 -0500 Received: by mail-pg1-f194.google.com with SMTP id s64so13906873pgb.9 for ; Thu, 26 Dec 2019 21:33:00 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=CeCsCjetYaq9WLaLyz0l/vASvwsTn/rJXzj0Xq2S4N0=; b=nLUHfY3E5pMaN/KibvmuXbNaq42aQuxH65u3ZO17PcOn2YXEXNxWwRZ1Uwshnr2S+A lVYJhmM9SL4UeG2a1yWFvttGr1Wo/xmIAbIq9BLzf6o6geguJVWtrYcCgOC4gSvhQpHi lf6+PG0dZwBXVEwwPMZAuVTtW9W4YxRzxMV/4x5w1NklBDocWivYi6fgJHI4brndU4xN MMPqLAFb5AwBy+Jk9GUrwJ9qzXxszrZlwXCmLp7l/OP8g0O36xOlipenlvdtD6k2JdK8 w2z42alR2lXpGiTRg4hUQl3IAkxVa0wtJWqfuNGJsWeCJElbo7fX2MvECQw3E+b2U2nW O47w== 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:mime-version:content-transfer-encoding; bh=CeCsCjetYaq9WLaLyz0l/vASvwsTn/rJXzj0Xq2S4N0=; b=eKNsCqFzwWx1avjNS3osIN6yyx+0k7cUjA/B8AZNpcMTbg7iRwUBaL+lKk2pIITWEJ QoKi8BwmzlMFgIdiXgv8Ib6XmuAjaieXKOtpbTV+FRAoanQId2ugSTx3PYOI2RN1Velc 3IkjuxO/d3CxzC79ZkC80gGNrFp4COQb2zFtBguR3R8NExRSfr9b54zAf3ysVzeQabr4 X8wgb1vUTX/bGwUQXybYt0foCAGgrZm2UkmBHwXzaSHHl7M4MAxg29QYnY8q019Dhp8B LNj1Zibmg2/h5NK/QllZvbqSO7x8XiKwKweUdr3KC7kqxdiMVLyW+P+0zq1xJUxECnq4 emWQ== X-Gm-Message-State: APjAAAW6klTbDXpUqBhXIwu7kkK3qzjKOk3eJb5qJ5yCjtvJiff1xN4l FnDghbX/EBQEfv+mYZ6tOa+BZQ== X-Received: by 2002:a63:1210:: with SMTP id h16mr51989473pgl.171.1577424779986; Thu, 26 Dec 2019 21:32:59 -0800 (PST) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id c22sm16789196pfo.50.2019.12.26.21.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2019 21:32:59 -0800 (PST) From: Bjorn Andersson To: Rob Herring , Mark Rutland , Ohad Ben-Cohen Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v2 7/8] remoteproc: qcom: q6v5: Add common panic handler Date: Thu, 26 Dec 2019 21:32:14 -0800 Message-Id: <20191227053215.423811-8-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191227053215.423811-1-bjorn.andersson@linaro.org> References: <20191227053215.423811-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a common panic handler that invokes a stop request and sleep enough to let the remoteproc flush it's caches etc in order to aid post mortem debugging. Signed-off-by: Bjorn Andersson --- Changes since v1: - None drivers/remoteproc/qcom_q6v5.c | 19 +++++++++++++++++++ drivers/remoteproc/qcom_q6v5.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c index cb0f4a0be032..17167c980e02 100644 --- a/drivers/remoteproc/qcom_q6v5.c +++ b/drivers/remoteproc/qcom_q6v5.c @@ -6,6 +6,7 @@ * Copyright (C) 2014 Sony Mobile Communications AB * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. */ +#include #include #include #include @@ -15,6 +16,8 @@ #include #include "qcom_q6v5.h" +#define Q6V5_PANIC_DELAY_MS 200 + /** * qcom_q6v5_prepare() - reinitialize the qcom_q6v5 context before start * @q6v5: reference to qcom_q6v5 context to be reinitialized @@ -162,6 +165,22 @@ int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5) } EXPORT_SYMBOL_GPL(qcom_q6v5_request_stop); +/** + * qcom_q6v5_panic() - panic handler to invoke a stop on the remote + * @q6v5: reference to qcom_q6v5 context + * + * Set the stop bit and sleep in order to allow the remote processor to flush + * its caches etc for post mortem debugging. + */ +void qcom_q6v5_panic(struct qcom_q6v5 *q6v5) +{ + qcom_smem_state_update_bits(q6v5->state, + BIT(q6v5->stop_bit), BIT(q6v5->stop_bit)); + + mdelay(Q6V5_PANIC_DELAY_MS); +} +EXPORT_SYMBOL_GPL(qcom_q6v5_panic); + /** * qcom_q6v5_init() - initializer of the q6v5 common struct * @q6v5: handle to be initialized diff --git a/drivers/remoteproc/qcom_q6v5.h b/drivers/remoteproc/qcom_q6v5.h index 7ac92c1e0f49..c37e6fd063e4 100644 --- a/drivers/remoteproc/qcom_q6v5.h +++ b/drivers/remoteproc/qcom_q6v5.h @@ -42,5 +42,6 @@ int qcom_q6v5_prepare(struct qcom_q6v5 *q6v5); int qcom_q6v5_unprepare(struct qcom_q6v5 *q6v5); int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5); int qcom_q6v5_wait_for_start(struct qcom_q6v5 *q6v5, int timeout); +void qcom_q6v5_panic(struct qcom_q6v5 *q6v5); #endif -- 2.24.0