From patchwork Thu Feb 11 23:46:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 12084455 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 DE696C433E0 for ; Thu, 11 Feb 2021 23:51:08 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9537F64E44 for ; Thu, 11 Feb 2021 23:51:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9537F64E44 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=g5Y1JwHP6jNCuk0QNnGgP37P+iRdFLmYE4TsAFGDcWA=; b=cPfIOdB0GeHYKTIiXuM56/twe VTFidYbUyKPFLrU74ZbfKthTpOhmpzVyyLrOLRHqySlsgLr36oZBQgOGXKI2BXOJjawIftF99TI0a 1VqUu9kUIXv4VX1V6egQJrA8tDwSsE0HZUN90/9Xbmy2Cl7gmMaZeXG00BDkgd4f8pjH4CJa8JeyH 6rzlac4saTWjMaCmHKwtrqQ2l6M3pnXq8LnjxR8w1mB91w4MscwKBnPzQr7lwKDkX3jsTzqpk3aQD lVOBakha1CcAuwfwW3CK/dm5ScsvnsBxDIBmozZmGCKFpYGG0wQKJtHahiHGiYrfCd5uMySKPzaZ8 CIrcPT54Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lALi7-0005fL-OK; Thu, 11 Feb 2021 23:49:23 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lALfc-0004OE-BL for linux-arm-kernel@lists.infradead.org; Thu, 11 Feb 2021 23:46:53 +0000 Received: by mail-pg1-x52f.google.com with SMTP id o21so5051505pgn.12 for ; Thu, 11 Feb 2021 15:46:47 -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=nWH3imbAeMw4n5RIWv9Jygevt+XepgJ5nBh82nrQrzU=; b=OsUt7nvVzjq1BmdRnvM0Ryju3WLLiLSgarJPlpzD0x4jyGi1rgG2Dth57tK5d5PltX BBXdHFgDZGzqkqeVy+teyQXKuSz+TWhYZDPUuflpgghbp8lhbB/SczBEnUUtr2le14/A t9SW0oYT9SOAnQhh5DKGyQ5/pfmxrYxHfNOfvqVaCrNHfnkFTqHE67UoFcdOA//BhyIY 7Kiwbjcmnf2XrZrviU0YRaG5l7ocRaXq18bMVaH1O+d0T1YoN3gRWbDEK3JsxHIyuBOI CD738Gw4bs+Wl05rHHJkZYYwuNjh7f8WgcWP3WT80dYw7F7lKb3uzot+dzAWgF/KIGMv dM/Q== 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=nWH3imbAeMw4n5RIWv9Jygevt+XepgJ5nBh82nrQrzU=; b=YB+/l+lq7Q1Sew35FFNxOgJu9M3lcebYZEUqVE6m117XhxeeHbUZ5Unxwa8sejwTIS PCNGs7Za1IWAoJcBp+eN2dZMGzeSDFUiroFNH/WeivMsHf/+aBWNPDrWtyX70ihDO4d9 4W4bfww3jhI9CDBDwBECWd6CSSt/XZZh/9yY4Jdf9cGqTt7eUr8O19nfAnDNbfFp4zLL D1WxYwQfSu5NyOUVEtRQIIQSOsZYo/S/kK88UxbedLhfluvV/hGyUL379ahE73WCXU7P 17nlC8jDihz/8CDmKAQFsaRBaxxRDYIcYqw4qlLiqx9aHXWcYerNjV4WCUgeaW+YZrM/ 2rMQ== X-Gm-Message-State: AOAM530lVwikfnR6wg7ACYN1GLEk1tKIuxQMXIQGM+zzItW7bZ6LscfB fZo2MMxOmp99tXIsQEWzwuYtQA== X-Google-Smtp-Source: ABdhPJwnNYdhLS3XOt7Ib9m7KFFkeV97pBzTsT0zQw7/rCXBb3/CMFfPL7ryBJyDR8iOzqBdCpHdSw== X-Received: by 2002:a62:187:0:b029:1da:e323:a96b with SMTP id 129-20020a6201870000b02901dae323a96bmr386865pfb.28.1613087206129; Thu, 11 Feb 2021 15:46:46 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 15:46:45 -0800 (PST) From: Mathieu Poirier To: ohad@wizery.com, bjorn.andersson@linaro.org, arnaud.pouliquen@st.com Subject: [PATCH v5 17/19] remoteproc: Properly deal with a start request when attached Date: Thu, 11 Feb 2021 16:46:25 -0700 Message-Id: <20210211234627.2669674-18-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210211_184648_494519_66497CC6 X-CRM114-Status: GOOD ( 14.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alexandre.torgue@st.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, mcoquelin.stm32@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch takes into account scenarios where a remote processor has been attached to when receiving a "start" command from sysfs. As with the "running" case, the command can't be carried out if the remote processor is already in operation. Signed-off-by: Mathieu Poirier Reviewed-by: Arnaud Pouliquen --- drivers/remoteproc/remoteproc_cdev.c | 3 ++- drivers/remoteproc/remoteproc_sysfs.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/remoteproc_cdev.c b/drivers/remoteproc/remoteproc_cdev.c index d06f8d4919c7..61541bc7d26c 100644 --- a/drivers/remoteproc/remoteproc_cdev.c +++ b/drivers/remoteproc/remoteproc_cdev.c @@ -32,7 +32,8 @@ static ssize_t rproc_cdev_write(struct file *filp, const char __user *buf, size_ return -EFAULT; if (!strncmp(cmd, "start", len)) { - if (rproc->state == RPROC_RUNNING) + if (rproc->state == RPROC_RUNNING || + rproc->state == RPROC_ATTACHED) return -EBUSY; ret = rproc_boot(rproc); diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c index 3696f2ccc785..7d281cfe3e03 100644 --- a/drivers/remoteproc/remoteproc_sysfs.c +++ b/drivers/remoteproc/remoteproc_sysfs.c @@ -194,7 +194,8 @@ static ssize_t state_store(struct device *dev, int ret = 0; if (sysfs_streq(buf, "start")) { - if (rproc->state == RPROC_RUNNING) + if (rproc->state == RPROC_RUNNING || + rproc->state == RPROC_ATTACHED) return -EBUSY; ret = rproc_boot(rproc);