From patchwork Thu Nov 30 01:16:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 120059 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp73780qgn; Wed, 29 Nov 2017 17:17:34 -0800 (PST) X-Google-Smtp-Source: AGs4zMbSAFjUPlyemya8AKCGuXc0Npfbo1LtrMXGs7QD4J+3vjpHeZ/1kX7wo6VReV/gmLC98tpX X-Received: by 10.99.4.11 with SMTP id 11mr773403pge.123.1512004654460; Wed, 29 Nov 2017 17:17:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512004654; cv=none; d=google.com; s=arc-20160816; b=aw+OOO3Pv+f7BWGQ8Ccymx9PFaHxs4qaCrUrGnlqBMGP9oGX8mwdV9OHVzz3ulanSU /2dVfgRUVhXUZxIGgV+xqRHcq2JhVSAEjnz8ycE/sqjXvR6rJzg79PQcx1VJoMSnmkAT rIMa0bhzpronwO0hKrLmmUn7tNxsvVd1n1OG5FiDybRAaC4GN5kAiAEr9t+2Jj/mLqyf RhNRZY3qoTBj5TDeS7gg2SftF7hmYnMmt7pSBA+pfL2cbSXTUC4g4osFTz10fEEMdZpJ 6hJxIUd86EqrQLSw+KC8WijIcDSFDW2TcncMmM/Jpivyhky4C4npQKpvZEMIUoU1NaGB 22jQ== 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=FmiEji65XJf3OGsNIl0+tvKpcC2dE3/KYwxTsJf1QUI=; b=i+NKiZUj8iHf2c6Y6hOGEX53f1SUk4uaiml1UD7uZ1CZBvEKzLO+vB382KDySiLQaQ xanTj+QiVPAlJHyUC/hvfjVadcK8FHIdrWUwoki0sPiOdzGsNjwEQlyTBx+KmTkh0E0n QCsckZtI1el6PdsZxZy/TqngYFKR1Hp6f7hwi6lH0Lev7SD19NN+SzAy/QDynF47zkKB stk8VDd7K+WKca5JHcHCV4LhOqtQtZzv73NjOja7/kTV/gAq3dPKwuMNa9FIei78FEEW 0RBmAhNIEebCjlr2mnHyCH9mHXNtvR0PvdJK6R6Oj/H7lHpn32UUWaApgcKZ4+hJmbvg NrHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jCOHY7Os; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (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 m1si2164580plb.521.2017.11.29.17.17.34; Wed, 29 Nov 2017 17:17:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jCOHY7Os; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753267AbdK3BRA (ORCPT + 26 others); Wed, 29 Nov 2017 20:17:00 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:44324 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753060AbdK3BQw (ORCPT ); Wed, 29 Nov 2017 20:16:52 -0500 Received: by mail-pl0-f66.google.com with SMTP id x22so3195487pln.11 for ; Wed, 29 Nov 2017 17:16:52 -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=FmiEji65XJf3OGsNIl0+tvKpcC2dE3/KYwxTsJf1QUI=; b=jCOHY7OsMCMTaWozIFxvMLeoek217oYIqRbJNXqOF1+lQizLbU23qYA7H2vorLWedK PQmnW/GTx0dw31zEztoeViPq8xj7i7ZkvLXMHc/8g7aVZZjLdxwYvCZuloi0Pd9AIrh5 HYA3Y9dukAIvzcT623Fw2O1I/UD1tVF9OMEAA= 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=FmiEji65XJf3OGsNIl0+tvKpcC2dE3/KYwxTsJf1QUI=; b=UnDppwXOeg7WiaitpZJo230MGo7aqsJdgZMNCJ1F5+SuAlsGCi+bdBTnzS/yew0+mP VAl8x+s1p1Dtvil0ZZd7WJVoHlRBhcMZNen2h/f3IvjV5iR02+nSCHm7HkMVRBKNp7uI QE3mjKQNG6d2SfAA9YJhmWjCrKHeB6wGfTCtwLz2HMCyn7VDIyqKyn0TrG0N53e74wt8 PxTvsyah66npf0YaIAafP7uC9wXbN43+wz4LN1lE6fOoHEqgVmu+JJ9vj2pxbHFL5fsR 7e8eChf8iCz7VvrA7Ji9C8LRwjqKlmNJyKh/UjarAm4eraFKQ+4m/iK8+V3Hoj+19W5x YIAA== X-Gm-Message-State: AJaThX4XT8leQDkYEl6SM0ZRxEGDY94LuZyW6eJ/K0tw7b3bgc+XlBa/ oGHo5nIutL63HhkLN8Dg0FLqiw== X-Received: by 10.159.198.70 with SMTP id y6mr806778plt.334.1512004612197; Wed, 29 Nov 2017 17:16:52 -0800 (PST) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id c24sm5401015pfl.2.2017.11.29.17.16.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Nov 2017 17:16:51 -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 v4 3/5] remoteproc: Pass type of shutdown to subdev remove Date: Wed, 29 Nov 2017 17:16:42 -0800 Message-Id: <20171130011644.9421-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171130011644.9421-1-bjorn.andersson@linaro.org> References: <20171130011644.9421-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 v3: - None 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 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);