From patchwork Fri May 26 00:40:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarangdhar Joshi X-Patchwork-Id: 9749499 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 1BA1A60388 for ; Fri, 26 May 2017 00:40:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DAF3283D2 for ; Fri, 26 May 2017 00:40:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02708283F9; Fri, 26 May 2017 00:40: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=unavailable 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 A21EB283D2 for ; Fri, 26 May 2017 00:40: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=NZ2AJEG2ZmhPuUC4OrLGQB6uiMEDKejxIZtJW8IChlw=; b=HqQK8RrYWBhtBixam6c8QEoEJO TSyoH6SffmdSSXyNeCUmhCG2VLr8P/sQWXCa5TaIyM3ZrA+EEiamVF/OgxmmIYVoQTfg/I1Jtl4qi JWM4F7iXlyCEWCDYrvA6iuz+4cibRol1PjVkmdw2WU6tDamc07Xp0UoMV4NassrmfgQ5y2vl5/JBb zeRYigMcsUEM3K5uBDzNujdxc99EM6jtFcvy99hyiDqGAuSKVXwtFQL0a3Vay7IvEHq6+harUVadC xiTs7jtSvmZCTmCzPhD3V7I7ivkui8ZADxdHX9oCuReWvWNOabUeR5RXHeI7vp/Ha+bbKmGLYtyKn IBhYLelg==; 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 1dE3Iy-0003wP-Ch; Fri, 26 May 2017 00:40: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 1dE3Iv-0003sa-B7 for linux-arm-kernel@lists.infradead.org; Fri, 26 May 2017 00:40:34 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C39F2611CA; Fri, 26 May 2017 00:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1495759211; bh=zBF85DIaDKLJjfasdK884veV805BNiE8jkW5d4yi1Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c+FRKr1B3KVcHR+UtC2OHMZPdI7Tf0zeLQUGunWWwrXFVbHLy6pG7kr7/Ih+tvGf8 BSDE9zes5sDqnfI4Fjf37YCwNsx+ePvIlII8Q6QbWl9rhS6Q9XIBY3ZQ3WsgOs0Skf xNB2nMa1rZfrsmESdMSTUF/5e4MCsVrmAE4PbUZ4= 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 1DB92611C6; Fri, 26 May 2017 00:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1495759211; bh=zBF85DIaDKLJjfasdK884veV805BNiE8jkW5d4yi1Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c+FRKr1B3KVcHR+UtC2OHMZPdI7Tf0zeLQUGunWWwrXFVbHLy6pG7kr7/Ih+tvGf8 BSDE9zes5sDqnfI4Fjf37YCwNsx+ePvIlII8Q6QbWl9rhS6Q9XIBY3ZQ3WsgOs0Skf xNB2nMa1rZfrsmESdMSTUF/5e4MCsVrmAE4PbUZ4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1DB92611C6 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 v2 2/2] remoteproc: Modify recovery path to use rproc_{start, stop}() Date: Thu, 25 May 2017 17:40:00 -0700 Message-Id: <1495759200-5575-2-git-send-email-spjoshi@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495759200-5575-1-git-send-email-spjoshi@codeaurora.org> References: <1495759200-5575-1-git-send-email-spjoshi@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170525_174033_463932_A39D073B 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 v1: * Separate modification in recovery path * Call release_firmware() when rproc_start() fails 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 aeb7bdd..9830a1d 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1050,23 +1050,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; } /**