From patchwork Thu Nov 26 21:06:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 333055 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp1633931ilb; Thu, 26 Nov 2020 13:08:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxTq1oBSakzBO8ybicGaS5hR6degqFn1TVjCGMS7Hw3dKMuuQmMA7m3PXiP7BVNz9c063J X-Received: by 2002:a17:906:468d:: with SMTP id a13mr4448234ejr.253.1606424897690; Thu, 26 Nov 2020 13:08:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606424897; cv=none; d=google.com; s=arc-20160816; b=Wt2VdkJysO7rqDPChtleXke63MUMEdVwclumIxDj5pOz4BNJ2tDbUia9FPLnbQP6Z2 1HWdh/oHDszShR3R+549+hQoIhTp+YmzXFEC8n9kDEVbTMG2bzCMi2S0K4Tssz3cdKcK UBUIrdVc1kceKpDOY7BPchf2IjD204DQ2sEWJCiQVE45eiuJQZJWytE6zJAWqpN++ULM QR5Nqi2bzCiRlwx/YRgYu60pVgLvS9fTHzAAQi+LzdOWmR+3wGqdaVCrKGxsHvk/EnzG rXxcurhFg605XO3GxQXbieAjgyVU3G8dyPNxA3NfhgXSNYYwM8rO3FPmD1F+UuP+CFgi 3lnA== 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=6EKfnma+mEUF1GkkphP1W+oWnMIfOL5ijPUv2Gueq0k=; b=g6B8lJ9HybDUf+xODHRdVDbItwyuQKWHWLIjgwMBy7j7sGUa1BPBvzY2NEaRnNzXvN jHjIcz0QuMG6V7BRlIT1H1WbX17h4ryoE+CkxLp7cjHUMZ0GT5skZRKWmczeQMO38Nd1 ZaoRQsnQxLiSbkoYFy62C+0ybhFEqV3FU1E/VakQ5rbytQtwrJ+a3ziyIOL3J27pmxOR uCRK7c0NgDW0TKixSAR462Vkmm4+8VWpt9sx1ulwg65kT5Wmpmin6cDcwBdWAZ6eHfGK l3N7wPAMMc+1beGFAdfF6YDaHC0LvGztvukJUi/e0WSjZGEaBqBMlaZTTaEojAerDds8 KhnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YTsABqRp; 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 k11si3567033ejg.330.2020.11.26.13.08.17; Thu, 26 Nov 2020 13:08:17 -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=YTsABqRp; 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 S1733136AbgKZVGt (ORCPT + 6 others); Thu, 26 Nov 2020 16:06:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390945AbgKZVGt (ORCPT ); Thu, 26 Nov 2020 16:06:49 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46010C0617A7 for ; Thu, 26 Nov 2020 13:06:49 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id u2so1652275pls.10 for ; Thu, 26 Nov 2020 13:06:49 -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=6EKfnma+mEUF1GkkphP1W+oWnMIfOL5ijPUv2Gueq0k=; b=YTsABqRpBrUv2wTyqkbRbGotHKiTQSVNuZBn8ukO/QiQQn8xGaBmh0QOMY2qkJMbQr 0vm9xEg/eLR2ZhfX4gyM81acRWTDiD87VSkos2fuLG2Zv6gips0iOCbTBbJkBKOscKNl lqMB/FoC5kLVhyabqytksx9DD3JHscoxAss/n3sHtVeKo+qdPXebpvZxlQdBbw6Q1ELe VdPB0/kfEY/8YPnyQzvRzsDPHglvWEdRG04zrjdPXr1NUd4PG0so2IDZ9ef8lAYjWAgP 5VsuDPu59bkBTXXbc06j5vQGfpl4QmCWEL985TbtwjZWvnFDj/C8MePmfqIBgpsgQMNN rZeA== 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=6EKfnma+mEUF1GkkphP1W+oWnMIfOL5ijPUv2Gueq0k=; b=WMuQN7sNXCL9/oySTfcm2WVs6O4g5ObwqQ+e12J1u0Eto7AdH3f2K9vIpKm9qDGKj4 T9GJRXjjnXuIcVuFrUH/pvc+e3YBlnftIOSvnTOMugZsAAjBX8xSPXcHJLlPPbh0S0qf bqBxom9ppYxARr4ZpKQ7l0D9xbT8EEyKnK1tptUI+o9wXvvntFRYoxjz/YSiaiAgc/SF 9NbubVMCZPQpRKW+mMuuLNA+TTFy15L9XFKJaA7yXfN3TdTV99Ga2+jdENwK99DSpmq2 txVTsOx0J8ZbGayN3DOPfKV0iNAIVaqeNbRpMU0PNu7nHcMdeBBu5QE2tc05loJCeUc8 Lh6Q== X-Gm-Message-State: AOAM5326ojY5OWx5dzDPg60GXtxcMPECw/XaXXj+e+UXZrh6ZuaFH+r8 9HsUb9LI3U4HN++ysFuk4CGygg== X-Received: by 2002:a17:902:9b85:b029:da:1684:cc82 with SMTP id y5-20020a1709029b85b02900da1684cc82mr4195605plp.41.1606424808820; Thu, 26 Nov 2020 13:06:48 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id c203sm5612676pfc.10.2020.11.26.13.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 13:06:48 -0800 (PST) From: Mathieu Poirier To: ohad@wizery.com, bjorn.andersson@linaro.org, robh+dt@kernel.org Cc: linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, arnaud.pouliquen@st.com Subject: [PATCH v3 05/15] remoteproc: Properly represent the attached state Date: Thu, 26 Nov 2020 14:06:32 -0700 Message-Id: <20201126210642.897302-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201126210642.897302-1-mathieu.poirier@linaro.org> References: <20201126210642.897302-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 a2b9cd541315..300785a18f03 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 71d531c64dfd..9be112b5c09d 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -510,7 +510,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 @@ -547,7 +546,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;