Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1072606pxu; Wed, 2 Dec 2020 10:17:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCfequFOkTxVx9AVT3puiQBlyMziw+KTia02IciRI7+q4/nUEM+/UCg4IE4dvNiWIndnXc X-Received: by 2002:a17:906:3d69:: with SMTP id r9mr1037279ejf.43.1606933056782; Wed, 02 Dec 2020 10:17:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606933056; cv=none; d=google.com; s=arc-20160816; b=cJ3dEYeynl9BZvWDX+iwmPSeIgT0zz+34B15+QHaYLG9lU16suUKAlMfQAuQJBaacc 6Hw449FpFw8aZuA6LjB6wCgDRuOaNzovymgLBFjvjzcFqiUx8QOL+YsuslUfFR5gCn8e S0ZxbpJIrE7dGtxAJdELsCuCKJeqSCgcruRo94IL8cqA7skbaaOaN8sCmdBT9+WglbD0 2hvdwwGf62oMJ/4FyuXX10I23eQVRHuDfMOEv7DzQmffitz0QZbQm9GC/dUjgKQN/leU fxNiN2gU0rEG455hU5imnNmADEpLWn+mOIZKGHZBj+oTUeTLy/HqWdeDJcuUPnOMFvAZ GcmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=IHMm0cjK3eOhtNxeby0JUJ/xysp13KMNTZpGx5FB/i4=; b=Wqnvnnf9z+gpkxzZeqADy4k/sL604/EK2z3MshvvPTWLQ5OvJw4wkGeblVuqVNGmiS oAXLDf+3KZjsp01LUykLYl9nD9bEXE4TZsH4j1bmla4rKhlMHCvYay6O/+VBoP39bTN5 2hFG5ueRGkUWY/SJq610Fi7v29KmeK4IMShqOVo5r0hRJHgPSXDUFvNUAfEynGWZyay6 Vkm9hmsfF1GGnZk/9Pmi7r7tBmzJ7hCREKINftTi7eQzUkebXPCqisTCq9kR2WD0mcz4 fL5l2s29THKUNthRnmvp0QnMgEdLc308WgOT3fTcCmO3t2chqIsC8IkCUxQvdzXbWaL2 QuAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=MOIjqtIo; 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=REJECT sp=REJECT dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s6si440685ejb.276.2020.12.02.10.17.12; Wed, 02 Dec 2020 10:17:36 -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=@st.com header.s=STMicroelectronics header.b=MOIjqtIo; 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=REJECT sp=REJECT dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389384AbgLBSPe (ORCPT + 99 others); Wed, 2 Dec 2020 13:15:34 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:6168 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727193AbgLBSPd (ORCPT ); Wed, 2 Dec 2020 13:15:33 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 0B2I6wh6029053; Wed, 2 Dec 2020 19:14:47 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=STMicroelectronics; bh=IHMm0cjK3eOhtNxeby0JUJ/xysp13KMNTZpGx5FB/i4=; b=MOIjqtIojG1qXzPtXeep1E4QAsRYcVURS4/JTKn8wpEb7izKb8yvgq3HGGEK3bToJkrJ DLPy0u8noBFuBIp37ZY9omsCnC/hZdTUAl3EIeHbXKkZ8hInsGqtXA//atdDlPWw3nNh s9YhlVaFhqxsKg66/FM20cFfJEYpJWNk+w6dGtxvrG6+SmltXL3tLVGjjzJNEDHExw81 DnURP9LoQzP44OCvfqdqFa2Fb5CPheSO8L57CbuFvGdkJuuc8pGDNa5Sfded7hjzWU1C zTkRXB6LcNXiy+WzFc7i+vBdPLBGW+g/7WZOIuQpl4IlOKyDi73amJoZColMkS4VwAYj uQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 355w3cd384-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Dec 2020 19:14:47 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4B34110002A; Wed, 2 Dec 2020 19:14:47 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3CFD0225F18; Wed, 2 Dec 2020 19:14:47 +0100 (CET) Received: from lmecxl0889.lme.st.com (10.75.127.49) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 2 Dec 2020 19:14:46 +0100 Subject: Re: [PATCH v3 13/15] remoteproc: Properly deal with a start request when attached To: Mathieu Poirier , "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" References: <20201126210642.897302-1-mathieu.poirier@linaro.org> <20201126210642.897302-14-mathieu.poirier@linaro.org> From: Arnaud POULIQUEN Message-ID: <24a902d1-f2e5-2318-16bc-202955fcfe28@st.com> Date: Wed, 2 Dec 2020 19:14:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201126210642.897302-14-mathieu.poirier@linaro.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-12-02_10:2020-11-30,2020-12-02 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/26/20 10:06 PM, Mathieu Poirier wrote: > 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 Thanks, Arnaud > --- > 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); >