Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp613322pxf; Wed, 10 Mar 2021 13:12:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwirAI7vK5F6Y/bbOVB77t6I7EzPqMVYpGJl9TSggR6YSrRWhOTBEolU6pg4f+/me4hwkfy X-Received: by 2002:a17:906:dbd0:: with SMTP id yc16mr356483ejb.71.1615410760635; Wed, 10 Mar 2021 13:12:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615410760; cv=none; d=google.com; s=arc-20160816; b=o5ShG4vV0vujSmHz4o5DUJZ/OT/AvfbB8jiLpiE0A5oSgKcMpYPAZw8/sIf/7Zcc2I 2y6SLRBNmy08dbHXaODY0+rVLqyeENkfY6IXx0smc6rMtxatCWDjcNg1+OezF5EuJsnE yYs5u5Giy1py2eR1zOvpYeJ5NuMC+CrEscaCDLFoKmQ7ebiuqxTRRRLQfmdhMWtDvhhw 5mjuYVt93zvDdJ/NK/ZE7EN7a2Y1R/6sXl1+K9l+SEqiDzN9wzMKRpi6G3WxIjF3JfjK GBpBVxBFJGxd+PvvKJeoyF9BK1rb16U7quNPA9sQAP/JuYOyFiXAVeiY9C+C+PCmZPtC uRuw== 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=aW0ol9ACADMXDBRQZ9fMX/XIlW2P2AJufeZ0r+T13gRrC/O83asw2VMPDxyMG/Iau+ Qf7F4lobVrp0jd9Ka0UZrYDn/RwdNfIg/xJGmEm1fDG+xZCU8FHyJsdS1blIP2eLiGkw 5YNWf1UUFj672U39invfyrDP6pqiLTef7zjLqr9Ko65Jzv67OEBCPhojjnfgvYe2pWag tiAkOGICfsZi5hgvbf9hNgxkVUfXFmGsh/3i1ChrramG5q4ivrvA+BCSbglBIYMv1H6F 2EoeNhYP3unZc79dcoQiC8/KRW5QmGojISz1/Vc9U5JoiO6D3G1L99icIpShbJajwHez 7p3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bp/hGieS"; 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 a13si417256edn.209.2021.03.10.13.12.17; Wed, 10 Mar 2021 13:12:40 -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="bp/hGieS"; 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 S233641AbhCJVLK (ORCPT + 99 others); Wed, 10 Mar 2021 16:11:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232222AbhCJVKu (ORCPT ); Wed, 10 Mar 2021 16:10:50 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6727C061761 for ; Wed, 10 Mar 2021 13:10:33 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id nh23-20020a17090b3657b02900c0d5e235a8so8212938pjb.0 for ; Wed, 10 Mar 2021 13:10:33 -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=bp/hGieS85PxB0+VVvXDfnDdbQX5gAUgZelPh7wvgB2u3cAXvLUXmcYR5M2WpTVhRO evI4ag4pZMg3luw1wt2VUjk2lNWcTI7LZrnwjyBoJXKmMaZyH7TB2aKAg4bgXwjr/ObD y1LWcOGwRE8Axamz99zrWyZkcNWricL/1mAsuC99NRoTprSdGV9U55UtP/IAWQwqAzZZ QkkOh9NRqOd/ZntXT93RUoT27eBNtezLbsRVYPLCK2ohT9P77xKVO3LIijuaTzGXQ0BJ 8Lb/h+2YwR/9Dnbr4tnrT3laWpSTy904VimI7lqeL+vQEigRZRKM+wdjG/TuR6zZXh40 NjQA== 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=hMqISFNJnvOCOl4B0cQ7Gytr19KPDrhSQHvNh+q/E8S6N+5hFEZoqdK0NirBt+GMmT GL0mnBP9KGK85rMz3qPHutXquaU8zjFeqZr6eOhiaqJlmEVXCzOsVYJ1D5j95AbQDY4z Vr7k1lnvySbNy4wgUO7QK2QQ+zQ9Mb9xFTK74NXbdxS4F2RTnKm0MGEFIOyqx4j/KHiK DQg0elK64fwJisPQ4OjDwVgKbmpKJESTRzxK/kU2/Nxk5397+1cyMJyhwf9WkauM6CGn QjZ3ZHQk1h2PW7F8jKVk9dFNJaRCbzLPsWdd0bavi4C9PWmdAch9GvvG/d243zvsxOqG GlCg== X-Gm-Message-State: AOAM532c2pHiWqrwCaK4if88kSmfO0M8LWbCWtpZqiGRjJ3r03C2TU1L I83sBU0PN/0d7hqY0kuQuCQEIw== X-Received: by 2002:a17:903:3093:b029:e4:7e03:d618 with SMTP id u19-20020a1709033093b02900e47e03d618mr4917120plc.54.1615410633436; Wed, 10 Mar 2021 13:10:33 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id j21sm371508pfc.114.2021.03.10.13.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 13:10:32 -0800 (PST) From: Mathieu Poirier To: ohad@wizery.com, bjorn.andersson@linaro.org 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 v7 04/17] remoteproc: Properly represent the attached state Date: Wed, 10 Mar 2021 14:10:12 -0700 Message-Id: <20210310211025.1084636-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210310211025.1084636-1-mathieu.poirier@linaro.org> References: <20210310211025.1084636-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