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: 9751253 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 174D960209 for ; Fri, 26 May 2017 23:51:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF9F228449 for ; Fri, 26 May 2017 23:51:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E211928459; Fri, 26 May 2017 23:51:40 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3AD7D28449 for ; Fri, 26 May 2017 23:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=kt44GJhDUUu4pNgGxr4uUedexOr1QuIAjO+D6bB7wvM=; b=pVAp+Mf8d+OXhufinVC4IE+I2f 78v1Zv9vY0qSlRaNRrKt/Lcsy0PK9nD7ClA8kllJqqPB6Q1/1N7TkyaxsVvCsYpX4xQlECzVUJ8oN qCxqVJt38p4iF9PI18+q9+kU6kBs2ttBXcwlp13ELY+NA4O0rSW/634C/F1mrkjbrOCWP22D+Nf1s BJ6V57iwC9AmgIZizp5zHMe9BWKZLz56tDwFlSxeRTYvytocz/2/PmcY1z2wGGSwqKVWeGqvmtUXf 8ySL9s/G88FqQncu+3xSFSINzdAmgtgxcqtFUw76Zu6gPKKSe5pmb/2DbihWK9FwVJcJGMRFNyikR FTLAzPWg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dEP16-0003SD-Uv; Fri, 26 May 2017 23:51:36 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dEP13-0003RE-BI for linux-arm-kernel@lists.infradead.org; Fri, 26 May 2017 23:51:34 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9BD26614DD; 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170526_165133_437240_53E0CEB6 X-CRM114-Status: GOOD ( 16.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Trilok Soni , linux-arm-msm@vger.kernel.org, Stephen Boyd , linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; } /**