From patchwork Fri Dec 27 05:32:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 182475 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp2565453ild; Thu, 26 Dec 2019 21:33:03 -0800 (PST) X-Google-Smtp-Source: APXvYqy0vsJ1Vk9rnu9IAPq17li1HLSqZt79gIXwMPXCCLGIrjZPi828uvktW3Erx4YM26y/b5vT X-Received: by 2002:a9d:664a:: with SMTP id q10mr44465490otm.99.1577424783861; Thu, 26 Dec 2019 21:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577424783; cv=none; d=google.com; s=arc-20160816; b=dvHUBp+jtnpEy0lw9jDUi3KK3as3KdQGipGfQxhF2XRP4RCSemr1VHKin5pVDVYIjs 1I5fdz2cQ2mY1J415lCmBtXTLLWWbw/owv/y3ap9dM1DA9vFBrrgUodFadY5NSWwNpXg 2fQ6vb8P26j5nD0lfPrA4hdcEEQqjsvdGg1Nfr8ls8na0nNw2h9cJ2EHCn+JUTrKeV7L 2ujQMoaA9QjwFFtRy4tpHCCwzSXemmA/WpQt1EYbZogEg5UagfLwhwcLCOyXuAZ90a3Y LSNilRzOCJ+UE4RXbHXpuNzDRmvKPK6nYJodk0etGGShKeSmh1JC/u/ncW2/Kq20GLUF sfRQ== 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=wL6ZZ938iqE0J2FpN0SaFuzF05bSN2JWesT+mJR2w61wQUKT5bDg6QuNhr2FyQR92k CkxKXhaKMFimOV5rZUKGKlk1t1k2HQVEI6aUrjXKqrBXoO5zppbnhCNEC9FJjRspdRwO QMtbwWmTtKEsgnjjj7fn/vQCyQqjS+899xvmcwad8BGuYQLDrr+l530sSAXDN99ae+N2 oBLBENcnSjtyBDs230gEP/5h+pWBJhLizq6rlEBPZLaByFUZh/UKnYBx4QXlxljxXiT7 2R17ynA0ShE08bsaz4sGS18bZ8foPxx9N08Fb1vJ6UZRvrrGW/GIGpAQGADfUO69GHqG UNRw== 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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 s22si15711792oij.35.2019.12.26.21.33.03; Thu, 26 Dec 2019 21:33:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 S1727132AbfL0FdC (ORCPT + 8 others); Fri, 27 Dec 2019 00:33:02 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:34464 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727102AbfL0FdA (ORCPT ); Fri, 27 Dec 2019 00:33:00 -0500 Received: by mail-pf1-f194.google.com with SMTP id i6so7377589pfc.1 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=sYXSgfzxidnHWTyPr0VWx8yc14QY+BRVCalEt3eVoCIfkmfFqjtKDXV2gk6jTA4+DO XdavCjnpnzQ2V6uiqGU4h0WhR+h3c1w2mqq/pPlJaLBJE8JgyTNGND2cxZYxt6G8kuS6 WiWFVu1iOzURY2L1pqzqL/8j423wmN7So5yLi7NLRAwNRghDyEDhpjY3MfdD6JSVI3ct kq28+af/sO5yPSnrfE25NSUBBABGW6IcpN5lw9rrsWWacUfAq5T69ZtpIkIN+MMSSdWG 3yn+BM7E87iplUIViS3Z32XlVP/u2WKLpvbXJ0wxX5HJpI6z/8QexOUfAiz2C7pKa0i3 RA3g== X-Gm-Message-State: APjAAAX08QdCym9oWKSJgEEmnPHzpa1HhOIXtZar1Oo7QtufO8H8JsJX p7hluFIM5lCS/almshkwiC9JBg== 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 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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(+) -- 2.24.0 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