From patchwork Fri Mar 12 16:24:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 12135199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F617C4332B for ; Fri, 12 Mar 2021 16:26:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B11364F80 for ; Fri, 12 Mar 2021 16:26:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231346AbhCLQZd (ORCPT ); Fri, 12 Mar 2021 11:25:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232623AbhCLQZA (ORCPT ); Fri, 12 Mar 2021 11:25:00 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29A6DC061762 for ; Fri, 12 Mar 2021 08:25:00 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id a22-20020a17090aa516b02900c1215e9b33so10967604pjq.5 for ; Fri, 12 Mar 2021 08:25:00 -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=bCHKr0/GSeFFSxm8Q4Nwz8kF8pe3oKPrzq/jVKb2PSnmVfo+sAl1PzrKRkSdZ8LMT0 GF+I7XJa+Ui+EG+02L631CsvB+VbdRTXD1Uoxg5OMvP2oDDElK7xUZi7v43MjutF7rhz 4TLz3TPulv8R10hGSYB4nDswd1dLCCl9+8d5TQyA6nE7N4Lm+9hL/N2AJI7w8618goxY 5SrjZqWdA+PG0KdaZ3bM6uukXKrEewTRQMkrGFM5Ql7eBdas5UGg/gdcwFhN+ONnsHS/ AXtilX1TdXRzHwsgaxg9kyaIAjz8kE22D9jLbk4iP1knKvwMZvjYP6g7UFp4Jb0ra+to GRxw== 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=gDYnlSTasV5v8cuabyVpipaWs76ok+66YxuFvtw2XU/zP9GIo+9L+pkuZvofCh8axD 4cMxixc8305zxoYdx3Uij0rULN9vn+x/3Ml/F/SqaMdTZJiewDg0uWZxQDMemnUUOyKs 3+WPaMoMdWEyIFtydcvWHNZy9EUq74/nU6EiIO3Dtq5eNk8ObZC9RIIFNTgeC+0PEOjs xKZx0eTpAcuBP1PyL6CS/Y0wS88hMNb1wWWICag7fmVxkVFNYJ4tvBkBKA08OsRGwfDa 0B4Yi+GXrrGkbSOgDkFNScZ8/LW+iNNRS46U+hqZJhk82hfJfga4Oi3ZVAEaY7mpwFkl L8jA== X-Gm-Message-State: AOAM531HnGfln4QhMU5Rt7t3H2L9jnRiuPPT/IUUT5gr+Ofy/i9zEoO7 j44F7bWkBxHM4NkBa7IkVPcJ8A== X-Google-Smtp-Source: ABdhPJxXJe5hKTDd4WF93xA2jimdLPApISq00YSPw79YUIexUQRALtvGUMqeh8UWjTrWHXuHQImaJg== X-Received: by 2002:a17:90b:100e:: with SMTP id gm14mr14916331pjb.217.1615566299668; Fri, 12 Mar 2021 08:24:59 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id e8sm5899599pgb.35.2021.03.12.08.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 08:24:59 -0800 (PST) From: Mathieu Poirier To: bjorn.andersson@linaro.org, ohad@wizery.com Cc: arnaud.pouliquen@st.com, 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 v8 04/17] remoteproc: Properly represent the attached state Date: Fri, 12 Mar 2021 09:24:40 -0700 Message-Id: <20210312162453.1234145-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210312162453.1234145-1-mathieu.poirier@linaro.org> References: <20210312162453.1234145-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@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;