From patchwork Fri Mar 12 16:24:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 12135259 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.0 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 454C6C433E0 for ; Fri, 12 Mar 2021 16:30:33 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 BFDF064FE2 for ; Fri, 12 Mar 2021 16:30:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFDF064FE2 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3DOR/bvveCPvpzhMTPu4C2uEPVXRKwPmdV2q56XiT7o=; b=AVuuqUaQieU9ek2KBePY49bdQ OvVTCsoI7O1Pgkc8t625mbYdyabFm7863ReRcq6zIBWmV93VZJ+1QaPqmsSaIv8lkR+cJI3NIlUUX UWoljD4HUyHiNRE4KtDTtv4TF8IJ+7L426UZ43wJwAHl3u1agkmfg4aDzC2EXPagfWL4TQW+A5yHc xJDWw7wHQsKWrbB9QohtRvJICHHmrEkoH/TSG5UjVwnVLpUt3HXaBOQGmgPPD/32lk4g0qkTeIyjn pdVwd+iYK7sxJX+FQwyVdJ6IaStgJ266AGrqksRFbcYosYcC/9q9DJnIu/TazR3EzpX9Fk5HcHfzd 6CxBAmrmg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKkei-00ByE2-HG; Fri, 12 Mar 2021 16:28:54 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKkbA-00BwjT-Qn for linux-arm-kernel@lists.infradead.org; Fri, 12 Mar 2021 16:25:16 +0000 Received: by mail-pf1-x42f.google.com with SMTP id y13so2216411pfr.0 for ; Fri, 12 Mar 2021 08:25:12 -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=gj6WF/1oKuVocPkZDr0q35lcZZqhgtjB+hq21nBtWDQ=; b=gtz428PBLEgDloxKNuUGPr92ilupj59j2EfFWY0/N6WmAnATRxpQJlW+J2ee8AQHav xfm/Xf2HxlRVeNugLHL+U4NK/rWK5UJwdN7EfSosWKr3Zt4TBkWgoN5gxNkvHYyl37ew wTLuoegWNmHdbT1yapt1sRmrpbJFDYR80XDVQgf9zEXVpRYxrykMcKshqEyybiNI1g/+ jIPrVankCXpF2yQKIzgKc3SRrrvlTrz2bdl5FITvFh/l09kH6c8OChMhbgTMBAroPgIq dRrowcFVCygaFx/jN2st9jMIN6PuKz34cElkxvTGRjMivbDKekwO6IJqP8vq2Scn2hAs yumw== 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=gj6WF/1oKuVocPkZDr0q35lcZZqhgtjB+hq21nBtWDQ=; b=Pg1mJ4DXHRNKiGqy2c46DC3NqW7xndeLZZ5idC6HnYL1M7KPFt/YXzMiqkuBwLs9/b n4tnGTYB7adHM4VEdimWqcTlrG81i11N9LnfVAVPmOxmQmhc8oNXNIY88wYfiWSRnmIp g11RciPoHMJrXtRSG9vsGMYWuKWxPELzQfxDRF6T0YUAc86zJtGpsWvePrBjG7Rq3WEJ w0RtZuQ6ydOn61QJAYbZx+Uhr++17XXX+c3mah1jRxuv7ohze3zyFEY0k3HLDA2HYUDk rp0EYoWwMKUV7iuPNMDMKrijttF/FxqQRWPA2U6wZROzHkBCPHJ/ICLLB4lCkhEZLFDm ewuQ== X-Gm-Message-State: AOAM530FxPlbF9Vz0Ndjb1Jkpt2Sqpr0sG2PG7JttGd+YBJRSGf/kVyV 8ZjIuRisJ+yJ45mNjmbm4QmnAA== X-Google-Smtp-Source: ABdhPJxGBgOg4XUMLZgE8bHRgl/Ot16rbp7CVs6Kqzly1An+KF889/k2eE5hVl0egydVPzDpTey4aQ== X-Received: by 2002:a63:135e:: with SMTP id 30mr12705562pgt.6.1615566311426; Fri, 12 Mar 2021 08:25:11 -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.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 08:25:11 -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 14/17] remoteproc: Properly deal with a start request when attached Date: Fri, 12 Mar 2021 09:24:50 -0700 Message-Id: <20210312162453.1234145-15-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210312_162514_070743_520F6E2C X-CRM114-Status: GOOD ( 12.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 case with the running state, 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 b19ea3057bde..b2cee9afb41b 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 f9694def9b54..66801e6fe5cd 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);