From patchwork Wed Nov 15 20:10:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 119001 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4744331qgn; Wed, 15 Nov 2017 12:10:44 -0800 (PST) X-Google-Smtp-Source: AGs4zMbMiAwpGIX2YkdIurtxLO2ktlxKY5h6zflh1sg1jvqqOR9nqHvQPoK64cqAszyPsr+E3azm X-Received: by 10.84.229.5 with SMTP id b5mr17399662plk.405.1510776644371; Wed, 15 Nov 2017 12:10:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510776644; cv=none; d=google.com; s=arc-20160816; b=ppbmKzu80EdgMnnNjnXInPj2Rmb/wQjwxN9ElEVwMnxxFyulyyrpGQzv4CBSTD5dZ1 SMYL6V82ISvKl0CmPmVojMyXbz1qm18AKh5UK8LY0VQeo+QvWvo0azR9P0Y8UE/k05nm HnAoS7lE6qStlom5AhFW5UN3sm+1fx6mM81OrWOd6LZlYNGko9lbIkLFs2xXJkzIlFPY 79Q0z8HcpvspjLq1T0zyCv9u7ZM2fjY8eGEJEHpSNhvemVZaYHz6HTwQ2se+r997+a81 1PYBsr7XzqvrSm2e5yotJuUJ1lHusJldJHMUPB7o9aqm+fHCMeKtMhfUYcZvr/l+SR2p 8rgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=MUNiJ5mGQhB1mwfzKqvhy59F0ajVaS6OOoYjLlFqGGA=; b=ZazW5oWkWhEe3IfDaV+k4cRgqZ6Jory9GiZrybes74G/CNz4FPggQPCrqs6+2tldFU fR4y915I5swJ52bCDWgF4PwxF1jNTnbONCzEUBI4YrS184G0VUSQWhKWpddKX5ZeutQr p+33U55ho0jj4zIuHVU6wf5qcVL/oiGnpdtXfclwBJZMr8h2LQG/zhZrY+8DlgRC5koL 4JGUEEcCYzt/jeTUB93iMFopNbVqf1vjWjonFcskU8IHznfDF9irdeV/qNK9f+9pOX2t e4ENQbrcOEkXRQi/Lx1rXEIH4fe0VBLd2i5FFLcsnIykjx82yNmW3q5Tml50VcbATWq8 R6mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Xd3yCdQM; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 a64si7735889pfl.299.2017.11.15.12.10.44; Wed, 15 Nov 2017 12:10:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Xd3yCdQM; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933064AbdKOUKl (ORCPT + 10 others); Wed, 15 Nov 2017 15:10:41 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:55968 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932693AbdKOUKW (ORCPT ); Wed, 15 Nov 2017 15:10:22 -0500 Received: by mail-pg0-f68.google.com with SMTP id 207so15989263pgc.12 for ; Wed, 15 Nov 2017 12:10:22 -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; bh=CYVvzIXwROY26H1GS64BpjMK0fSyga2f/aW1wcOkpXc=; b=Xd3yCdQMX27Ft2qZ5gOtvp6nOqOxRpBDM+rZISz2HfJFAP8snhbjHB3MibgvYvEocc xhN5QYtPsqnutEUMvJekYLpej8RkA63TD4z7UssGfYu+XMw+ys1NUus+QbQ/yDy2f0Gt 1B8uNlKuVqSmBEB1WGT55J9c0pn0K69ErygIY= 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; bh=CYVvzIXwROY26H1GS64BpjMK0fSyga2f/aW1wcOkpXc=; b=dg1KWW0GftEuESu+tSQiU6Yfn1NCxfsM5G7yuomwQbGQMSC2AqL10H/dhuz51RhRAI /lMYVzshChaqBTRSOQvzsQskzx9aMGI/W6j5ewNivqdEpaP9BUNQvXXLcBgHukeYDNej IovYxEt6J4DPOqlQO+94T9ju/w7Mkk3C6quddqWJFljMuYxV9jHTnat9VsK21uacBUs2 7I/k4D46VbsEE/NX1ZjBcF6Ga8cQ+096rhv4WYMyhJ6pGRiQ0IcJ2UmwIe1vQTJNJAhN /Ou6EDIBe3N9Amy/N/jfUANgTcw+9RbnvEOFTDSSNOXxJT+ysyneK6H6HjkwNat5vSzS 9ZBQ== X-Gm-Message-State: AJaThX5MOub1PWqdzVHZ3K8IPtP4Nb3TSkNpn65q0Ikka/H7WuAmqre4 5JZqbR+X8KtONllnO2KvS5m1Ow== X-Received: by 10.98.155.129 with SMTP id e1mr13738976pfk.119.1510776621727; Wed, 15 Nov 2017 12:10:21 -0800 (PST) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id w20sm45959193pfi.89.2017.11.15.12.10.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 12:10:20 -0800 (PST) From: Bjorn Andersson To: Andy Gross , Ohad Ben-Cohen , Bjorn Andersson Cc: Arun Kumar Neelakantam , Chris Lew , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [PATCH v3 3/5] remoteproc: Pass type of shutdown to subdev remove Date: Wed, 15 Nov 2017 12:10:10 -0800 Message-Id: <20171115201012.25892-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171115201012.25892-1-bjorn.andersson@linaro.org> References: <20171115201012.25892-1-bjorn.andersson@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org remoteproc instances can be stopped either by invoking shutdown or by an attempt to recover from a crash. For some subdev types it's expected to clean up gracefully during a shutdown, but are unable to do so during a crash - so pass this information to the subdev remove functions. Signed-off-by: Bjorn Andersson --- Changes since v2: - None Changes since v1: - New patch drivers/remoteproc/qcom_common.c | 6 +++--- drivers/remoteproc/remoteproc_core.c | 18 +++++++++--------- include/linux/remoteproc.h | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index d487040b528b..7a862d41503e 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -60,7 +60,7 @@ static int glink_subdev_probe(struct rproc_subdev *subdev) return IS_ERR(glink->edge) ? PTR_ERR(glink->edge) : 0; } -static void glink_subdev_remove(struct rproc_subdev *subdev) +static void glink_subdev_remove(struct rproc_subdev *subdev, bool graceful) { struct qcom_rproc_glink *glink = to_glink_subdev(subdev); @@ -107,7 +107,7 @@ static int smd_subdev_probe(struct rproc_subdev *subdev) return PTR_ERR_OR_ZERO(smd->edge); } -static void smd_subdev_remove(struct rproc_subdev *subdev) +static void smd_subdev_remove(struct rproc_subdev *subdev, bool graceful) { struct qcom_rproc_subdev *smd = to_smd_subdev(subdev); @@ -176,7 +176,7 @@ static int ssr_notify_start(struct rproc_subdev *subdev) return 0; } -static void ssr_notify_stop(struct rproc_subdev *subdev) +static void ssr_notify_stop(struct rproc_subdev *subdev, bool graceful) { struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index eab14b414bf0..3146e965ca47 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -307,7 +307,7 @@ static int rproc_vdev_do_probe(struct rproc_subdev *subdev) return rproc_add_virtio_dev(rvdev, rvdev->id); } -static void rproc_vdev_do_remove(struct rproc_subdev *subdev) +static void rproc_vdev_do_remove(struct rproc_subdev *subdev, bool graceful) { struct rproc_vdev *rvdev = container_of(subdev, struct rproc_vdev, subdev); @@ -785,17 +785,17 @@ static int rproc_probe_subdevices(struct rproc *rproc) unroll_registration: list_for_each_entry_continue_reverse(subdev, &rproc->subdevs, node) - subdev->remove(subdev); + subdev->remove(subdev, false); return ret; } -static void rproc_remove_subdevices(struct rproc *rproc) +static void rproc_remove_subdevices(struct rproc *rproc, bool graceful) { struct rproc_subdev *subdev; list_for_each_entry_reverse(subdev, &rproc->subdevs, node) - subdev->remove(subdev); + subdev->remove(subdev, graceful); } /** @@ -1013,13 +1013,13 @@ static int rproc_trigger_auto_boot(struct rproc *rproc) return ret; } -static int rproc_stop(struct rproc *rproc) +static int rproc_stop(struct rproc *rproc, bool graceful) { struct device *dev = &rproc->dev; int ret; /* remove any subdevices for the remote processor */ - rproc_remove_subdevices(rproc); + rproc_remove_subdevices(rproc, graceful); /* power off the remote processor */ ret = rproc->ops->stop(rproc); @@ -1063,7 +1063,7 @@ int rproc_trigger_recovery(struct rproc *rproc) if (ret) return ret; - ret = rproc_stop(rproc); + ret = rproc_stop(rproc, false); if (ret) goto unlock_mutex; @@ -1216,7 +1216,7 @@ void rproc_shutdown(struct rproc *rproc) if (!atomic_dec_and_test(&rproc->power)) goto out; - ret = rproc_stop(rproc); + ret = rproc_stop(rproc, true); if (ret) { atomic_inc(&rproc->power); goto out; @@ -1550,7 +1550,7 @@ EXPORT_SYMBOL(rproc_del); void rproc_add_subdev(struct rproc *rproc, struct rproc_subdev *subdev, int (*probe)(struct rproc_subdev *subdev), - void (*remove)(struct rproc_subdev *subdev)) + void (*remove)(struct rproc_subdev *subdev, bool graceful)) { subdev->probe = probe; subdev->remove = remove; diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 44e630eb3d94..20a9467744ea 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -456,7 +456,7 @@ struct rproc_subdev { struct list_head node; int (*probe)(struct rproc_subdev *subdev); - void (*remove)(struct rproc_subdev *subdev); + void (*remove)(struct rproc_subdev *subdev, bool graceful); }; /* we currently support only two vrings per rvdev */ @@ -539,7 +539,7 @@ static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev) void rproc_add_subdev(struct rproc *rproc, struct rproc_subdev *subdev, int (*probe)(struct rproc_subdev *subdev), - void (*remove)(struct rproc_subdev *subdev)); + void (*remove)(struct rproc_subdev *subdev, bool graceful)); void rproc_remove_subdev(struct rproc *rproc, struct rproc_subdev *subdev);