Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp157160pxb; Tue, 23 Feb 2021 21:33:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSg0o2AWkNFiFSlhTRR9M9RRMMm1bVsc/NeCYQPn+hILACFzlVxTFTZbXttetgeh6GEghQ X-Received: by 2002:a17:906:19c9:: with SMTP id h9mr4311420ejd.288.1614144795779; Tue, 23 Feb 2021 21:33:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614144795; cv=none; d=google.com; s=arc-20160816; b=AXCIfdxkEGkN8JhwPEJePXvTXZ4JiOWy8oPyx9eUBtMo2jbfN2mDWwBzFaAb7Zy7of aVtuxLcVd5ZeDH8EMb0QEqZftodow4EygU7E3fgMuCSJ9fPEn3WZbRTcciiccno+Flk4 WggAj2MXEVBVV8trOCb0url3uwLDWsuQIgjWd4x/5DIRuQ5QnMqfGP/gIZPOj43SgR++ pGHmrnO+DI1UvgC6jyaA02YK5RjDCKB4030Ha/L8y7KDMbN1BfkLhjKxNbv3cHNZrV3n WTdHC/R2A2muMBVXwBV6QZJRmU11c9E/Y9Dhe3lDja2NiK1W1EqbD+dz4AQlpkGYJ3RZ TiMA== 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=EmIttTOsgDNM++s8zt1RjF9fKLTZIPRgfTRmynUwSgM=; b=R8P7SV3L3sJ/xX9qu5yJzYt3IuFa8iYFlssErwoXaFL195nS4bIn2rxfWgxdWYrHPq Dk5ze6tITfbgmOJZP4fQLRrzkOjz5nO+ldfqRVR9L7S+g8wMdeBlRORWMyBjxcvhzXui OmhQ56sEYBPCeQHisIU69iz5uMaJoTU4FKjxgJea5wv0MA6AwV+HpzB2LYUh7Je02/uQ clHC+cWpF5xLPqi1U/R4qHF9Ke6KQfGR3tQjr1VoBDXQ4oFrvi3IwSk5u+a6z2e1eOsp JqlMPfnvMb7eYLKJEe3uW38UjxR3UaiJQ3+UOUKKw/ExP4Gikno52B1dR/7n+fak3SgX tueg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mcwM58WW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id g19si664677ejz.742.2021.02.23.21.32.52; Tue, 23 Feb 2021 21:33:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=mcwM58WW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S234483AbhBWXzM (ORCPT + 99 others); Tue, 23 Feb 2021 18:55:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233420AbhBWXim (ORCPT ); Tue, 23 Feb 2021 18:38:42 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EF9DC0617A7 for ; Tue, 23 Feb 2021 15:35:21 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id ba1so22833plb.1 for ; Tue, 23 Feb 2021 15:35:21 -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=EmIttTOsgDNM++s8zt1RjF9fKLTZIPRgfTRmynUwSgM=; b=mcwM58WWsUXUvIsh2FdJ4BES+IgpYxO9AhUPJ1gWIw1zLuH2xRbnJpycVWoQY4dTme qd23XOhFVBK0Zm6R5OB2q8jjG7/BJOFGyDGUlj0bBDMrxogj2MLSKaDvvZ1GYJoXMo0c bF+o0kIrw0ndsMOdNGwjYVFJGe+Gro2hwWGIMWc6WYuUFHK4Bl5u40JATi5ho20E6NgM 9y43IF7s5l7K5wvZ0rwgVnDq25TJVK0SIx7iaLQB6bf4xBJTzwi2Mt0O4ot30d7hccm+ aX3YxzcOp7V67egVVkk8mRCOiVQXT+sdCpAUDhl0H6Gd1anKXA30nc7vmSLU0NDefPM6 xhMg== 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=EmIttTOsgDNM++s8zt1RjF9fKLTZIPRgfTRmynUwSgM=; b=rCKsZdz5sJusR7swBPN+rWzJHwFDniTPv6/rVBSO5rFzMB1zW0sfBPUHXcaL98Dysh kcnr/lUtOOLFDOC0quLFbk1VIvI8FE8pwHZ+xaXHDc2fJRdkw6ZqGVXQFxhPjhieKTfL VaW0fm3m4BuTCFHGtjruaLI/8QCFlDwImYxkA4MV2bLVoiUdEgsa6keEUHsqUwNsvXM2 bPPF+TtXV/8eIHpwIxy2Uk/CtTJt59MpT7aAyL814QNIYTQ2kBKVEaftPyH3IJ2ppTcd MP/ke305uVaCTafj0twbd3IoTOQS8SwhvW4dsDwN/NCTwfOfkEo8GlVFWPTzr4NNYOjS v2zQ== X-Gm-Message-State: AOAM530AlrZeZ88HS+WeuKgyHsYNb/LpVJB9wroVWVw/SF0DRPKWpDg2 qc21dy6KyPy+aslUDK4JPn0GsA== X-Received: by 2002:a17:902:7c90:b029:e4:340b:37e7 with SMTP id y16-20020a1709027c90b02900e4340b37e7mr475922pll.2.1614123321091; Tue, 23 Feb 2021 15:35:21 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id c24sm311999pfd.11.2021.02.23.15.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 15:35:20 -0800 (PST) From: Mathieu Poirier To: ohad@wizery.com, bjorn.andersson@linaro.org, arnaud.pouliquen@st.com Cc: mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 04/16] remoteproc: Properly represent the attached state Date: Tue, 23 Feb 2021 16:35:03 -0700 Message-Id: <20210223233515.3468677-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210223233515.3468677-1-mathieu.poirier@linaro.org> References: <20210223233515.3468677-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 7b66e1e96e4a..8c7e9f1d50d7 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; @@ -2077,16 +2069,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; -- 2.25.1