From patchwork Thu Feb 11 23:46:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 381063 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp2495662jah; Thu, 11 Feb 2021 15:49:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCSn3c86bUB+qsvXWQECgSV2WtDE3ykg/6f2VVCm1bSm5pMIGFaEMFjRDafp2IvO6iUELR X-Received: by 2002:a05:6402:c7:: with SMTP id i7mr617327edu.328.1613087377037; Thu, 11 Feb 2021 15:49:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613087377; cv=none; d=google.com; s=arc-20160816; b=gC9AAD2UImzGEhoRw2N2cbbkQI9+cHYu4gG5Yo01DAiD2su2KUNQGcMeH3OJe1vblP 6sQC9ZevO/A6lNoKivMu3uDlzptqh4LPpuKrqvW5yoccEn7XFhmSH8pTDfO4pCIxB4OU Rw+VWx7xEMsvX6rjPBfRKCWm8+C74UDGUTOZFSLyRR3i6trmSkwg7FQ8kY4wbHpZUfVN AFHk1df/6Mr+E+6hNo3ODyAh9CQZ4oMkifBcfDw/YW0lL7LlIm2N8clw+QmQaqdBg5j1 yVrWDIwhYtaQ4Jd4iSflCj27EDwKtncSiWRKlchHIOaJUndwNiZQH4KSUZdLe8jrSqt2 AOwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0Iy9CzlHfitoEfgTXPac8pcqQPI0KYVgBprjbFY0v+o=; b=PMOdVxmELInKxhtABfKN/7XaKr1yvCXEB9pO4/hcyiSc+hNbo70FHgQjhV+qpOVrvm vu9NMkCZppJnnCO0vDqO3KkajOBRUT6ObD/tn0Pd2b8yZfygCxa25yHBWfmnp+A/1VB0 v3K9DaL/7GG4ZAWEzcUODL4d5S2YD30w/xqDduSD6RiQsCnn9UCFMqJULl98s/notuLL xbsUSoaB7XXzNYqB76YkFxkGyDfbaeLMuhYRbU4ZfP+pNGMdlame1ml0LrhaZTuHHIqj 8UIL7Kfg/pSfemR7UpCTg6UpgwBg8SybOBSES+NTeS2P8pJtpS3iEsuQu+gBQs2ZKFj9 RAzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f2fKdG75; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id ot7si4969638ejb.88.2021.02.11.15.49.36; Thu, 11 Feb 2021 15:49:37 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f2fKdG75; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S230019AbhBKXtL (ORCPT + 6 others); Thu, 11 Feb 2021 18:49:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230228AbhBKXr5 (ORCPT ); Thu, 11 Feb 2021 18:47:57 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F437C0611C2 for ; Thu, 11 Feb 2021 15:46:35 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id w18so4716252pfu.9 for ; Thu, 11 Feb 2021 15:46:35 -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 :mime-version:content-transfer-encoding; bh=0Iy9CzlHfitoEfgTXPac8pcqQPI0KYVgBprjbFY0v+o=; b=f2fKdG75VecpW4vnKLQDkn2QIEdUZf51EfSvwdt7+SHwY5Wez/fyZq05XcUZNkdW4D T5+6xG58xVGkgkeb93Zfz4v0BWqyQOZQqe4TRatXqtNqzO2/WVmzZMIHsP6flILM2WMt w8IiQVx56w20ido3l49l0fMlw4ygABhhabUarmLrNNCeN4PcnWoa2GMvGZ3EX77fnYwx r3wrUFa8450sZ0/Z22YojRqWHzRnS4d0fGbiQ+HKvIJl/n6IlFEl/nsZBbzL5dsFS1pP +18I6/LqXFMHUtnXcysIT+zFPPfsTfzBP3ohUfx6QxfkfTM6wm8kJ/2A9krd0RArNU7a LtMA== 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:mime-version:content-transfer-encoding; bh=0Iy9CzlHfitoEfgTXPac8pcqQPI0KYVgBprjbFY0v+o=; b=AZL70D3+Tm/CelLpicBs/JJf8EmNLochiKPar9ld1dq9jWsWeKvsFUaU9KeAiPB0Bm yu2hj7n9B5LrW2565/XSVrZzZYiS80THfofWm7P0J5K+82w+U/sesWOCxOE6gpK3AjID Dl0H1ZBBiX9o8dGpyLEb6qB/j4b1VqFFiewRi3sEEHTWm2n45H7hJws/SgHbrYgw5clO xtBB6a715oBXUULw9XN2d0YCo7uPy72kb4z34C45JyooZutx1n98+ZkwqObbapbjgLEH AvxMr6FK8hqIW//Z0gebi+MdxB7zBmTGtI7/VitgVKsDZRIdCV1EqyK9vpidMio8q4Pk OvUw== X-Gm-Message-State: AOAM532WWZdwOuIFiACcmYHAAob022OaHbz0atKmKzZ+0XmlzDFUQBJD GCHEgJk+ZSyU/2ZSiyzlbfgIpA== X-Received: by 2002:a62:644f:0:b029:1d3:b559:fe7a with SMTP id y76-20020a62644f0000b02901d3b559fe7amr342270pfb.21.1613087194736; Thu, 11 Feb 2021 15:46:34 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id iq6sm5932740pjb.6.2021.02.11.15.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 15:46:34 -0800 (PST) From: Mathieu Poirier To: ohad@wizery.com, bjorn.andersson@linaro.org, arnaud.pouliquen@st.com Cc: robh+dt@kernel.org, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 06/19] remoteproc: Properly represent the attached state Date: Thu, 11 Feb 2021 16:46:14 -0700 Message-Id: <20210211234627.2669674-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210211234627.2669674-1-mathieu.poirier@linaro.org> References: <20210211234627.2669674-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org There is a need to know when a remote processor has been attached to rather than booted by the remoteproc core. In order to avoid manipulating two variables, i.e rproc::autonomous and rproc::state, get rid of the former and simply use the newly introduced RPROC_ATTACHED state. Signed-off-by: Mathieu Poirier Reviewed-by: Peng Fan Reviewed-by: Arnaud Pouliquen --- drivers/remoteproc/remoteproc_core.c | 20 +------------------- drivers/remoteproc/remoteproc_sysfs.c | 5 +---- include/linux/remoteproc.h | 2 -- 3 files changed, 2 insertions(+), 25 deletions(-) -- 2.25.1 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 8afc7e1bd28a..e6606d10a4c8 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1444,7 +1444,7 @@ static int __rproc_attach(struct rproc *rproc) goto stop_rproc; } - rproc->state = RPROC_RUNNING; + rproc->state = RPROC_ATTACHED; dev_info(dev, "remote processor %s is now attached\n", rproc->name); @@ -1659,14 +1659,6 @@ static int rproc_stop(struct rproc *rproc, bool crashed) rproc->state = RPROC_OFFLINE; - /* - * The remote processor has been stopped and is now offline, which means - * that the next time it is brought back online the remoteproc core will - * be responsible to load its firmware. As such it is no longer - * autonomous. - */ - rproc->autonomous = false; - dev_info(dev, "stopped remote processor %s\n", rproc->name); return 0; @@ -2080,16 +2072,6 @@ int rproc_add(struct rproc *rproc) if (ret < 0) return ret; - /* - * Remind ourselves the remote processor has been attached to rather - * than booted by the remoteproc core. This is important because the - * RPROC_DETACHED state will be lost as soon as the remote processor - * has been attached to. Used in firmware_show() and reset in - * rproc_stop(). - */ - if (rproc->state == RPROC_DETACHED) - rproc->autonomous = true; - /* if rproc is marked always-on, request it to boot */ if (rproc->auto_boot) { ret = rproc_trigger_auto_boot(rproc); diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c index 4b4aab0d4c4b..f9694def9b54 100644 --- a/drivers/remoteproc/remoteproc_sysfs.c +++ b/drivers/remoteproc/remoteproc_sysfs.c @@ -138,11 +138,8 @@ static ssize_t firmware_show(struct device *dev, struct device_attribute *attr, * If the remote processor has been started by an external * entity we have no idea of what image it is running. As such * simply display a generic string rather then rproc->firmware. - * - * Here we rely on the autonomous flag because a remote processor - * may have been attached to and currently in a running state. */ - if (rproc->autonomous) + if (rproc->state == RPROC_ATTACHED) firmware = "unknown"; return sprintf(buf, "%s\n", firmware); diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index b0a57ff73849..6b0a0ed30a03 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -512,7 +512,6 @@ struct rproc_dump_segment { * @table_sz: size of @cached_table * @has_iommu: flag to indicate if remote processor is behind an MMU * @auto_boot: flag to indicate if remote processor should be auto-started - * @autonomous: true if an external entity has booted the remote processor * @dump_segments: list of segments in the firmware * @nb_vdev: number of vdev currently handled by rproc * @char_dev: character device of the rproc @@ -549,7 +548,6 @@ struct rproc { size_t table_sz; bool has_iommu; bool auto_boot; - bool autonomous; struct list_head dump_segments; int nb_vdev; u8 elf_class;