Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4312774ybv; Mon, 10 Feb 2020 16:53:04 -0800 (PST) X-Google-Smtp-Source: APXvYqz6l0BCXognDR2eGgiTWka1YXFbztP5xnfykL0FdiOnxy+9vA3StW+JiFbGDKukM5xK04kM X-Received: by 2002:a54:4003:: with SMTP id x3mr1237151oie.0.1581382384018; Mon, 10 Feb 2020 16:53:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581382384; cv=none; d=google.com; s=arc-20160816; b=rFFlWr4RWW3R90ekL/5lJZcLlcK4e10+QLQovy0NLmdvtVs9Pg9NmasMPkVrkSMjZ7 kx5V0bEq7iXASORqVqZNpHvtLqYCkyJGmFll+zgLycpN/kgIQMz1rvI8Vp3Tq4oGzVow /2f3X0KkRH9nxywksKGGGM3yRyAeMpcS+FKi5pGHG8CwexGJLPHisv6qgOTvkfyeO4jC hhjYXt//iyiHjfhctEHz7sRLZfkqN583cYaXNHfQ9xr0/zL451uI9mAbi77hH0tPGltn dFH7HAbpHB7g1AcW2av5eGZ1ZQOPq2sEYvK5SoBP069l1HAf9H2CbDfP/GPDoqKH/tbg xecg== 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=VL9nzl13JbFlFI5aOpKHBIlRNrHP5XdfNTObBCxAwmM=; b=yOUSclolI7xWXb7/TRjpa4zjkcWW/C9APVEE/eR5MR0FsXAqUEZpLckAg9kzjmbJMs WrKiDKRCx/OS8Wu4qrTZcGDioydiyc3S0B1RIiXs5nDLmjfeTHzZlaLQ/tFGJqE+1BAc u0RX50Mbd4zNodMqcVSmBGCSFlJiKrv4bX6lkM3W618FYiuSX6gsS4cgvpm0smfo3Am+ hE/L7CkgFRwef/vc1HL/LWo9hK8hlSHjJdWcs6toF1la5qD4qFcEqQl9Y2RI4XtyMifD aqwlrX6gbHWBcbS8JmVEeb3EjDHPw093KWbevjKZRbYRFaeq3RnGYaG1vuIgUJCNdyqh C84Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JsdDKXZg; 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 s8si929942oic.7.2020.02.10.16.52.52; Mon, 10 Feb 2020 16:53:04 -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=JsdDKXZg; 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 S1727803AbgBKAwf (ORCPT + 99 others); Mon, 10 Feb 2020 19:52:35 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45259 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727732AbgBKAwT (ORCPT ); Mon, 10 Feb 2020 19:52:19 -0500 Received: by mail-pf1-f193.google.com with SMTP id 2so4546021pfg.12 for ; Mon, 10 Feb 2020 16:52:19 -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=VL9nzl13JbFlFI5aOpKHBIlRNrHP5XdfNTObBCxAwmM=; b=JsdDKXZg83El14Y+KO7R4dJ8Ux+zLngwyOQ9E8Xr/vgF278O/o+YOUlMivVMSxSyz6 KdjF1kVdkSV/s78/LaHLL8i9pcK98CVtiaftdmgQD0OW2nB1DjSfT7Q4+ehI+VgxPazv wTEUd/05phFW0T0/V2uhM8oVi+rKJkYl2UIcv1RAgHxZbjaVssmGEPiuouiQBK8Ri3xB Vu8nQLRF7GAMalbw3I4lenhvjXMvRw7IEYTy+tBGZwzjwejo9JtIMpQdpyCP/5ybLmRT MwPovBVu4PJBO6EtHFf9S5YG2yrJ+ZKqtA7lBxRBg9B6P0YHEutD2AImaJLqtiY9GBs4 2NKg== 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=VL9nzl13JbFlFI5aOpKHBIlRNrHP5XdfNTObBCxAwmM=; b=fOpiOwKMoCXTDLqmSEeFQlZTizURiYPTonLuO5BmGBUbW54BobQIdH1jEuyF1ocDLY Amn2sH2l3/EZen7XaAsoJZxz5RlTTlPG4O0ihZJeZeS/Q2EprTKN692JKlAOWwd9pLF4 /1D2hhfNQRgIHOLo72Q/giOW2tUDGgTkdDOzMGUhZQtK/mhSfu9q1vH5jce2Zg9YgoUk kgE9GG2e5asye9EsFphOKakUibleYd/tKocNXiq/P8tel4MCCHMOXZpPKys9ESwdfIS9 YNgc5XIG0beC7IT8xILlmKGSjpclYdDDEEub4XUrLGpGnXCqy+WpHmPMrdgHF17ciOn4 wA+Q== X-Gm-Message-State: APjAAAX3v+MSYRykk1gdd/7z+y+R4q9fGVz/5IBbPyFk40vMoG8wMfal dvEo9VxiAI32SJSBemzajBTxfQ== X-Received: by 2002:a63:615:: with SMTP id 21mr4301621pgg.440.1581382338561; Mon, 10 Feb 2020 16:52:18 -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 q21sm1538480pff.105.2020.02.10.16.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 16:52:18 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Ohad Ben-Cohen Cc: Andy Gross , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v3 7/8] remoteproc: qcom: q6v5: Add common panic handler Date: Mon, 10 Feb 2020 16:50:58 -0800 Message-Id: <20200211005059.1377279-8-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200211005059.1377279-1-bjorn.andersson@linaro.org> References: <20200211005059.1377279-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. For now a hard coded 200ms is returned to the remoteproc core, this value is taken from the downstream kernel. Signed-off-by: Bjorn Andersson --- Changes since v2: - Update return type and return the delay drivers/remoteproc/qcom_q6v5.c | 20 ++++++++++++++++++++ drivers/remoteproc/qcom_q6v5.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c index cb0f4a0be032..6bf660ad889c 100644 --- a/drivers/remoteproc/qcom_q6v5.c +++ b/drivers/remoteproc/qcom_q6v5.c @@ -15,6 +15,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 +164,24 @@ 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. + * + * Return: 200ms + */ +unsigned int qcom_q6v5_panic(struct qcom_q6v5 *q6v5) +{ + qcom_smem_state_update_bits(q6v5->state, + BIT(q6v5->stop_bit), BIT(q6v5->stop_bit)); + + return 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..3bef8243b33b 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); +unsigned int qcom_q6v5_panic(struct qcom_q6v5 *q6v5); #endif -- 2.24.0