From patchwork Fri May 26 23:51:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarangdhar Joshi X-Patchwork-Id: 9751273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A6D460393 for ; Sat, 27 May 2017 01:11:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AB3A284DB for ; Sat, 27 May 2017 01:11:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3659C2847D; Sat, 27 May 2017 01:11:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDB15284F2 for ; Sat, 27 May 2017 01:10:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752865AbdE0BKV (ORCPT ); Fri, 26 May 2017 21:10:21 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:56476 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1948860AbdEZXvP (ORCPT ); Fri, 26 May 2017 19:51:15 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id AD9326146B; Fri, 26 May 2017 23:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1495842674; bh=ZbeYJETqe4Z+I/hzk6iBxd23SZ+Dx0Rlmgj2ObFiF3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uiz6P2V23XSCATa4/vQGqIr6fYr7g7UioEkFb+djOD79TCIrSetrwfojgqCeWWciR +fHJtFRZf5wPtYfeM0BFxVD/pBds9Qz2O7CF0NY03nIrvWqT1ORRdbI3d3zV+855qb KZ6hpb9mCsgnKMc/Sl9eslBtV3La89GwRqj0lZ84= Received: from spjoshi-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: spjoshi@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B928061481; Fri, 26 May 2017 23:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1495842674; bh=ZbeYJETqe4Z+I/hzk6iBxd23SZ+Dx0Rlmgj2ObFiF3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uiz6P2V23XSCATa4/vQGqIr6fYr7g7UioEkFb+djOD79TCIrSetrwfojgqCeWWciR +fHJtFRZf5wPtYfeM0BFxVD/pBds9Qz2O7CF0NY03nIrvWqT1ORRdbI3d3zV+855qb KZ6hpb9mCsgnKMc/Sl9eslBtV3La89GwRqj0lZ84= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B928061481 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=spjoshi@codeaurora.org From: Sarangdhar Joshi To: Ohad Ben-Cohen , Bjorn Andersson , Loic Pallardy Cc: Sarangdhar Joshi , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Stephen Boyd , Trilok Soni Subject: [PATCH v3 2/2] remoteproc: Modify recovery path to use rproc_{start, stop}() Date: Fri, 26 May 2017 16:51:01 -0700 Message-Id: <1495842661-8926-2-git-send-email-spjoshi@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495842661-8926-1-git-send-email-spjoshi@codeaurora.org> References: <1495842661-8926-1-git-send-email-spjoshi@codeaurora.org> Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace rproc_shutdown() by rproc_stop() and rproc_boot() by rproc_start() in the recovery path, in order to avoid remoteproc resources re-allocation overhead and to assist with extracting the coredumps after stopping the remote processor. Signed-off-by: Sarangdhar Joshi --- Changes from v2: * Rebase on top of v4.12-rc1 drivers/remoteproc/remoteproc_core.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index c8cb54b..369ba0f 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1051,23 +1051,40 @@ static int rproc_stop(struct rproc *rproc) */ int rproc_trigger_recovery(struct rproc *rproc) { - dev_err(&rproc->dev, "recovering %s\n", rproc->name); + const struct firmware *firmware_p; + struct device *dev = &rproc->dev; + int ret; + + dev_err(dev, "recovering %s\n", rproc->name); init_completion(&rproc->crash_comp); - /* shut down the remote */ - /* TODO: make sure this works with rproc->power > 1 */ - rproc_shutdown(rproc); + ret = mutex_lock_interruptible(&rproc->lock); + if (ret) + return ret; + + ret = rproc_stop(rproc); + if (ret) + goto unlock_mutex; /* wait until there is no more rproc users */ wait_for_completion(&rproc->crash_comp); - /* - * boot the remote processor up again - */ - rproc_boot(rproc); + /* load firmware */ + ret = request_firmware(&firmware_p, rproc->firmware, dev); + if (ret < 0) { + dev_err(dev, "request_firmware failed: %d\n", ret); + goto unlock_mutex; + } - return 0; + /* boot the remote processor up again */ + ret = rproc_start(rproc, firmware_p); + + release_firmware(firmware_p); + +unlock_mutex: + mutex_unlock(&rproc->lock); + return ret; } /**