From patchwork Tue Nov 7 05:20:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 118104 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3561503qgn; Mon, 6 Nov 2017 21:21:01 -0800 (PST) X-Google-Smtp-Source: ABhQp+QUS3Wmb6O6ENnIjyDIuY1v/XlaxbzHaJkugag4M6sr4lLjVr3dFVyXNO8FcIVtVPqAcyjD X-Received: by 10.101.78.207 with SMTP id w15mr17916330pgq.347.1510032061243; Mon, 06 Nov 2017 21:21:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510032061; cv=none; d=google.com; s=arc-20160816; b=NtXqy/wn7ctb3B0Mg4cEnhdJ0NmXaYdfP3/OBd8gLPizk3DDbsrecJRAH0c2KnZPLq BhaSqX9KhjiJFIx7+zceANgwrzSBwpcbjcep6WVjcQbhPjDpXxPY063Ivv/SLK05h3M2 k8Dvuma2P7fNfFfh9Hp66JLe0Gvx73rNxsEvfyQNyG3NSkWywGglHlyEuSj1rPpV+Erw b61X45ErYqWXsob1QcUA+TaZZurPjbyjbIUYw6yVeImxyMIuN5pSAc74FjISMMenUPci 0l4C2WP9hsbLm05UVDdL5SHCb0q+bQy9JIHgQsoq0NEXvVye+oL9u/4vMZYnUEOLHSYi Y21Q== 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=umDn8LQ+PJc53s/tCWCSZTOvqTdQl+oXKhpEIGMTJ7k=; b=ozbIBe4Znm45NoTAhvmlYokwmJL8v/6++qmzB9qcKdZ5cWnuVQnAdw5DYE4J8invnw hEVnQRDHr+UygLLjlwCi7wMAO0AARjJ7wEpmLPEynSUoHfABrnfkzGnteysqsZXwW9rK MDK8pJPRnjbFs3DaHlZd9z8WhummpqOGbLxgJ6vCHBo0aqIdu7GMAhsVv3i40EpRqCnn ybT8CGervw57w+VFHZxQeQbo/O1l1pUa+SN5q1qHfaMiYzHbvdm2pAgh4I2AbSqHlsvw fLdDI2iQxarPXLAdj5YnsgP1x+2FE6aDP/hGqUfCTYcYJkvDPCsZQim/qG2ffZ4i/9Jk 3kCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hypU67nt; 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 u196si381475pgc.16.2017.11.06.21.21.01; Mon, 06 Nov 2017 21:21:01 -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=hypU67nt; 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 S1752760AbdKGFU6 (ORCPT + 10 others); Tue, 7 Nov 2017 00:20:58 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:44361 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752746AbdKGFUy (ORCPT ); Tue, 7 Nov 2017 00:20:54 -0500 Received: by mail-pf0-f193.google.com with SMTP id x7so9515683pfa.1 for ; Mon, 06 Nov 2017 21:20:53 -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=JhZG+qfp4riVr3+GE/ieMjDTiM32ykpistIODbSm884=; b=hypU67ntVyKlyGKft0ZNfWfwDbQhexWb9zBtIr2XV57I7M0NDEEhabbjgjm/ICqUyh lqK469oiaSakMaE1SYUxlwTnk2NCwi3B6xqRLqPnNnmyUrMknT1V00AnYk02C6oHDYmb nSUtNOciHrXl/dmfUXRb8Lc3+uJqU+IxyylLU= 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=JhZG+qfp4riVr3+GE/ieMjDTiM32ykpistIODbSm884=; b=tchNxOs9FTz8P9SwttIrF5marTMMQ29ifIUHCrTflKYXvV/hPHOT20D8U1vGXzAEvo mfOqTtEyJYYbuywNpxl5RKCwI4BkqntaCKbXWtIA3Tqh75bRHBTfimzb4ZlsYzCi+9Gj GdUdwy8PsGWkjTRKMclkKRKPw/+fNPxqCcvj2+PQVWDdQttB+zolD4zfpoVJ7dXSe5K/ doxiZrI3zY3zR73uikOm6KW5jvyS9xeblenFss924C4EkpF65wDKVdX1Zm0uvBKoWBMi UBclcyLGgI2BbZqlc4n+3BshgCF2uCQw4fEUxr5T7ThWK7jz4vRhYmThq3s39ZesnaPM DLDA== X-Gm-Message-State: AMCzsaWs0QoGH9u7iHBAG6vA1cfJviuIOaWKHnPzsjtndWBUgoBt8AOt VaMFIvmhJXt4P+EttesveALJiQ== X-Received: by 10.84.252.136 with SMTP id y8mr17059329pll.137.1510032053260; Mon, 06 Nov 2017 21:20:53 -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 g7sm847644pfj.13.2017.11.06.21.20.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 21:20:52 -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 v2 3/5] remoteproc: Pass type of shutdown to subdev remove Date: Mon, 6 Nov 2017 21:20:40 -0800 Message-Id: <20171107052042.22569-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171107052042.22569-1-bjorn.andersson@linaro.org> References: <20171107052042.22569-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 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);