Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp886326ybz; Wed, 29 Apr 2020 11:07:15 -0700 (PDT) X-Google-Smtp-Source: APiQypI/ywkTbvcda4Nb10Kjl8imNdTuYjbSTz4JrLawlLrH3pjdPwZ06/FwN9IN6MOg0CPvhlEX X-Received: by 2002:a17:906:57d7:: with SMTP id u23mr3533594ejr.354.1588183635761; Wed, 29 Apr 2020 11:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588183635; cv=none; d=google.com; s=arc-20160816; b=OG3oBnnQ7eRIJcTiyoSGRsn78c09viLIBIfL5kvcKwef3N4p6+Fru8DlzH+cB7DSeP HxhP4ItX8M2uo7Li+2xQ2pnfrz52XmgPwLaUuOy0LDH1F5BkMpfprEWF+WqlLdEnJMaW Lix0QdZq/4SkhyhrESV3iDhg/Gj3hAQXCuohoQ+vMUU5GO5Mkp9Ee+gLVokrhZ3SmDlL C0KLvbsTVrjgl3FMsJ5wdfGe75tW4Gyl76PA1B57rHD81AArwWifkrbVSYJXAfYtslZq sqcMjaw1Yg9mQYdo/jfeslkslGDS/gm+JGwHKpBnE873kVeRmJN0x7SJuLkjS/paY4XG D1cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=2FALkhGpM2HPL37dTrh6ykdf3xZBris2h6ZDdsxWFkQ=; b=t1ui7YDGSsz46xzech/CG/CdjtfsOoF7nnaZTVi++H/ls8T8AwZ5xothJIyMkIGOVi 3Xl9Tn16Gq25Te+cdeD3Nk3uw+mQA5ACn2/+pt6u8KT9wKK4ESDVmYpjte2kNMydhqWI NkgRJv1D/C4KxuQIiucgDJQsorehcd2/sRt76Q8oXRd4XYmc1H7hKyzazj03uDYzCv2O cUtppnVldsfp2VVm/ePTSpqM9ngoVf2FhmfI6DoXQf7spe+WbIJpBjCmHSbeRrMXxPHo 2+Tw8mT5lbGFkrwmVH6XYp0HQMLaTENss/rx7fNK7nOS2Xta+GdDhda/mAmu8FHeiZJc 5c4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="LI/1BzJk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si4313764ejj.231.2020.04.29.11.06.42; Wed, 29 Apr 2020 11:07:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="LI/1BzJk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbgD2SE7 (ORCPT + 99 others); Wed, 29 Apr 2020 14:04:59 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:51417 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbgD2SE7 (ORCPT ); Wed, 29 Apr 2020 14:04:59 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588183498; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=2FALkhGpM2HPL37dTrh6ykdf3xZBris2h6ZDdsxWFkQ=; b=LI/1BzJkAhcixKNoNimspbwF3iUEoQi1xo2CvUwgUhqhJNAFULUxtGnEhIgYmLD8XPYtWS58 mGsgwNHkPNFahezNF5RvSJhhix6/F4Nv77OoEssK5nibeOr9+59gpUCQsh9DrxrdJ0ATcpBH yTCIWtjuhavk/E0/1c65iwn4oUs= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ea9c1c2.7f19aea4b148-smtp-out-n02; Wed, 29 Apr 2020 18:04:50 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id D73E1C433BA; Wed, 29 Apr 2020 18:04:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from rishabhb-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: rishabhb) by smtp.codeaurora.org (Postfix) with ESMTPSA id CBC25C433CB; Wed, 29 Apr 2020 18:04:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CBC25C433CB Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=rishabhb@codeaurora.org From: Rishabh Bhatnagar To: linux-remoteproc@vger.kernel.org, bjorn.andersson@linaro.org Cc: ohad@wizery.com, linux-kernel@vger.kernel.org, tsoni@codeaurora.org, psodagud@codeaurora.org, sidgup@codeaurora.org, Rishabh Bhatnagar Subject: [PATCH] remoteproc: core: Prevent system suspend during remoteproc recovery Date: Wed, 29 Apr 2020 11:04:42 -0700 Message-Id: <1588183482-21146-1-git-send-email-rishabhb@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The system might go into suspend during recovery of any remoteproc. This will interrupt the recovery process in between increasing the recovery time. Make the platform device as wakeup capable and use pm_stay_wake/pm_relax APIs to avoid system from going into suspend during recovery. Signed-off-by: Siddharth Gupta Signed-off-by: Rishabh Bhatnagar Acked-by: Mathieu Poirier --- drivers/remoteproc/qcom_q6v5_pas.c | 2 ++ drivers/remoteproc/remoteproc_core.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index edf9d0e..e608578 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -398,6 +398,8 @@ static int adsp_probe(struct platform_device *pdev) adsp->has_aggre2_clk = desc->has_aggre2_clk; platform_set_drvdata(pdev, adsp); + device_wakeup_enable(adsp->dev); + ret = adsp_alloc_memory_region(adsp); if (ret) goto free_rproc; diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 097f33e..6a1cb98 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1712,6 +1712,8 @@ static void rproc_crash_handler_work(struct work_struct *work) if (!rproc->recovery_disabled) rproc_trigger_recovery(rproc); + + pm_relax(rproc->dev.parent); } /** @@ -2208,6 +2210,9 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type) return; } + /* Prevent suspend while the remoteproc is being recovered */ + pm_stay_awake(rproc->dev.parent); + dev_err(&rproc->dev, "crash detected in %s: type %s\n", rproc->name, rproc_crash_to_string(type)); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project