From patchwork Tue Dec 5 17:43:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 120723 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp6039006qgn; Tue, 5 Dec 2017 09:43:30 -0800 (PST) X-Google-Smtp-Source: AGs4zMbW26dBfl0nByfefPQjiD++94n4iSrivczqsOcobCpjJSmD4HlMLodaMWqYYkSg9WSYv1Ce X-Received: by 10.159.249.73 with SMTP id h9mr18619176pls.6.1512495810582; Tue, 05 Dec 2017 09:43:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512495810; cv=none; d=google.com; s=arc-20160816; b=zD2d+gIAdKIw/+DGBDoPsKSpQGjqrZVchhKDccHYwJhuNrWdhbWbE7xEtC53aXbsMa j/XWqXXOlJufyHH+Ik2tnbY6KGVbZNKXeMmHnTUnJYX0ucy+abaag+FTBGntFfuGFZAf Q8jvTYojr2AzzcRo4OteL1wRU9gqNGPCO9u8g0VhGTuE7w2kydh4Cu29h6f6qqQ08I79 pa5pU2wChZX9BJs52D8CKomae4gnBoiHveWNDtc/P+BXvMWdn/1uPxh6QKwMXqbnttLL cbJy8XFqBrfk4nvFDl0INtmoYDmnI8YhMic7hBO1CzwepBCP+juUiOyh40rVRxlo516p QpmA== 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=uj34FRIJeXy4yFbRKMtleZMBVGsFtYqv6/3opDfYPfc=; b=jZ9B2QJcd4m7s8+Dm4YTlzJPAaHiB35Tf4klIrHyU4csIfCBNNTviBnXYaK1oG6TM6 3BOytDOcITKtdXYt6DYijA8LJElsbZbaZSLSm76LCFLG+mM+yK0qZH7hmYUxvxvm5ZJj aqtNFLWTRLGKZdStpo3tJ+gli1ynXs2VIqBtsYd9ahZ1ZvMyPq1cN2hn7f+oHtIZDhtj Q9HvFV4k8YJMV86ffBm6Wpjj5aDa+G0wIzKKhuQyI3mBQDH5rcrcpcmntVZfyBcLdInR vqtulamUSca02hShQZIaAeeG3QxirNdmemugchwZ4aP+O1iBZoaeEBjmRJHB0rD6q/bP aHag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KiWVY5N/; 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 q29si358410pgc.795.2017.12.05.09.43.30; Tue, 05 Dec 2017 09:43:30 -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=KiWVY5N/; 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 S1752593AbdLERn3 (ORCPT + 10 others); Tue, 5 Dec 2017 12:43:29 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33590 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752630AbdLERnU (ORCPT ); Tue, 5 Dec 2017 12:43:20 -0500 Received: by mail-pg0-f65.google.com with SMTP id g7so649500pgs.0 for ; Tue, 05 Dec 2017 09:43:19 -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=ocA9DnnW4gG6VWUdTatC5bQYTHtInoTtQw8Pe32tWw8=; b=KiWVY5N/L6WT8ZGXZkSAJ7ZwmAhBPPo1ULclZqcHNc15yloch1aKLLrfSoADa3926O eeNMxCgWRK7OPAIAMxOkSjQKJ91Q7SfuN4mh1DgBZr2+5WNBHCRjwEUrVIxYzA5QZlQr fUADNXKUo4EdzE8O1mAAMXR8FZAJeQBG6ZF8E= 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=ocA9DnnW4gG6VWUdTatC5bQYTHtInoTtQw8Pe32tWw8=; b=FYlT7ElJxku2cnHFMcjvr9Qchf71wWguVfxASxoeTkhQ7/KIKtiBQeM7c3uzm7yFLc g4+tqPm+Kr7zLduZDZE8QPDvWZA21pcsf/h//pBFzh+OWIIEqEmVN57g5ET9khXfxozd g1zkYmMZbN5FdW29lAdE8RXsfwz4OdF6ka5IDJ/Clam176OE/GBxQU/BE/RzLRtm4AiI 281rJWHeCl6xz3EX2TD7sY4lgn0pDhMCBJT7pcppE6LxSL99sQ7CqHyVKUyD2/ucUShA FTf5Lm3J4grlmdbRgmh/uC+zfNmJr5V05AOUQx4tL33heY4bYVkG14RUoY9YHTYSF8ox 9f+Q== X-Gm-Message-State: AJaThX7LK7/3BJzNAnxFNlKwTVtSvBTSrdFous6n6S1Dw8m8O+oFoLoV Sjq5n/GXEfmjML51HeXzGCQqSw== X-Received: by 10.84.174.4 with SMTP id q4mr19439562plb.306.1512495798733; Tue, 05 Dec 2017 09:43:18 -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 h81sm1386514pfh.119.2017.12.05.09.43.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 09:43:17 -0800 (PST) From: Bjorn Andersson To: Andy Gross , Ohad Ben-Cohen , Bjorn Andersson Cc: Arun Kumar Neelakantam , Chris Lew , Philippe Ombredanne , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [PATCH v5 3/5] remoteproc: Pass type of shutdown to subdev remove Date: Tue, 5 Dec 2017 09:43:08 -0800 Message-Id: <20171205174310.15799-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171205174310.15799-1-bjorn.andersson@linaro.org> References: <20171205174310.15799-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. Acked-by: Chris Lew Signed-off-by: Bjorn Andersson --- Changes since v4: - Passing "graceful" in the cleanup path of probe_subdevices 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 -- 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..b2f8afee2b67 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, true); 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);