Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2249508ybz; Thu, 30 Apr 2020 13:39:04 -0700 (PDT) X-Google-Smtp-Source: APiQypJiu5iNFlpVe7YlXc4zUJvZpd9vQ4kzb1ViBZTUD8OtUkx4eRC5WMHutNm+hScnsZBPXpCL X-Received: by 2002:a17:906:7d1:: with SMTP id m17mr232186ejc.247.1588279144601; Thu, 30 Apr 2020 13:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588279144; cv=none; d=google.com; s=arc-20160816; b=kHKOy2aUeYwniu7lZd2hafkhovnyHhe0iT7HUJbWu7ph59Wpo2hogNFFQW7CNy6upM S631ShaL0yKz+TaqVePvX/UBtbN4uFA1pWPYL9/WArR6BYHd26ETxoJx3iu8IrR6su3Z cnhjCMsXyA7DjgMNVWxaZRiWKNvQoEbqDEhUpelfmeFDTb5BmLXqclSc2nxMp3LnEjqe wILv1TJA/EoqNh08JSidj8aHPU8MdieUGlKXawXjgKLKx/N444RXDOIMCJNp5GfNaGOV I6CoR1aSjXVFLZ8WNy+qMLUHr0QfRS8Od6y76SthRVJaUX6l2RJp2jWNWmn8IC9SQYvn ZhAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TRpun8ZJN69jp7jExSpIbQC8AtdvbGpEbLFXg6nKqKA=; b=MZ1dW7pnKxaGQwTrzPD8DZZbanvB91WFXWK31Zu8dH54jvDlC49P6KlUzCenx2XHHL gVluV5rGHwiD2xqmlN7Nz9dqTAdtnkmMml148jD5aFPyKMMmMjxB/xVc2vuMV9NiBfBa ropefMLTfaVeFix+eMGSlTyKxx7/D4A5t+24I3Z5LFiKksJGV28yRVxZ9LXld30KpHq/ tBlKejp7+MrepYbCh8XVjcao9OBDqkFYd+SLgtUzJDurK0qOnuDMrxsV2dpdHWHNA4eW aIWMud9n9vCDCyChUfX1UFwTrMTZOe/Wi0JU6ZywUPdA2ulOklDWMh925zBJCFThpG66 lGcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=abCaj1x9; 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 o4si338554edb.178.2020.04.30.13.38.40; Thu, 30 Apr 2020 13:39:04 -0700 (PDT) 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=abCaj1x9; 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 S1727044AbgD3UcJ (ORCPT + 99 others); Thu, 30 Apr 2020 16:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbgD3UcJ (ORCPT ); Thu, 30 Apr 2020 16:32:09 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23595C08E859 for ; Thu, 30 Apr 2020 13:32:09 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id c21so2746795plz.4 for ; Thu, 30 Apr 2020 13:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TRpun8ZJN69jp7jExSpIbQC8AtdvbGpEbLFXg6nKqKA=; b=abCaj1x9F40mJBqI6LU0+ztZr1PTYB4rbdxMELvUtArwQtVRG2nQPiaW+lKmwwuDmC r0eZJaQDVkXVuBEO3ODLsNGE/s7OzzoeQgodBRQekvXAXoiwCk7Rxi0v9n024EZXRi4P C+T8jKR8CKk3PZVhRx6fGcHUis3rG+/YEetmB/YzT5fvZM3oqnWfMwrow/IXExKg5Itr HGi3eduxCKubzqZqRCjuhLJ3ucIObmv+QlQVAoOkVnPMbahhjuM5nIbaSeNE+i7+rB87 wqnwDEyLNgGfaLWhMl+em5/RZ76rAgbybtAB3JV3x+5XymSEkgYodPJujkV/d/GfqJaB kSeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TRpun8ZJN69jp7jExSpIbQC8AtdvbGpEbLFXg6nKqKA=; b=o5oEPMiGfflN795C/gBgHtxGDfI/Iz1/dENYKyUqhOuA6LnrdvT3A2Xv3ZdBhOGjFu H5ut5cOmPIgnQirXzAahYA8lprG6ch1MZJUloIjgly4e2rRaleQnkVY50Hr5DviGrGLD JhscJGA0VTdt1MeZCGl484JTgQshPd0nopNCqyGYfApaj+1oABSOnS0zFcaQT4GrKYCN nPknysdX+9JGZsHYMpF4Vz0+PLbF4q/ckDttZ65bK8eZuRXWB3uGubCDJZ+z/ez8ucLF QjOxyutCTvey4MwtaREWh52eOplcHGv0bWN9Z0oU1qZjoNx/1G79xNUU9IX3PPvGstVY sQsQ== X-Gm-Message-State: AGi0PuaHDv69UPFNknVXw4yyCoiZE0ON21fM5z+6kAb7BMFBA/Qrcvae alRegbIiWJ8FxMxYfVSs3MDF8o/kCqg= X-Received: by 2002:a17:90b:46c2:: with SMTP id jx2mr659045pjb.67.1588278728464; Thu, 30 Apr 2020 13:32:08 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id t3sm542056pfq.110.2020.04.30.13.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 13:32:07 -0700 (PDT) Date: Thu, 30 Apr 2020 14:32:05 -0600 From: Mathieu Poirier To: Arnaud POULIQUEN Cc: bjorn.andersson@linaro.org, ohad@wizery.com, loic.pallardy@st.com, s-anna@ti.com, linux-remoteproc@vger.kernel.org, corbet@lwn.net, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 11/14] remoteproc: Deal with synchronisation when changing FW image Message-ID: <20200430203205.GA18004@xps15> References: <20200424200135.28825-1-mathieu.poirier@linaro.org> <20200424200135.28825-12-mathieu.poirier@linaro.org> <4ab6d7ac-905b-494e-cce7-cb8a697decb7@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ab6d7ac-905b-494e-cce7-cb8a697decb7@st.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 29, 2020 at 10:52:48AM +0200, Arnaud POULIQUEN wrote: > > > On 4/24/20 10:01 PM, Mathieu Poirier wrote: > > This patch prevents the firmware image from being displayed or changed > > when the remoteproc core is synchronising with a remote processor. This > > is needed since there is no guarantee about the nature of the firmware > > image that is loaded by the external entity. > > > > Signed-off-by: Mathieu Poirier > > --- > > drivers/remoteproc/remoteproc_sysfs.c | 24 +++++++++++++++++++++++- > > 1 file changed, 23 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c > > index 7f8536b73295..cdd322a6ecfa 100644 > > --- a/drivers/remoteproc/remoteproc_sysfs.c > > +++ b/drivers/remoteproc/remoteproc_sysfs.c > > @@ -13,9 +13,20 @@ > > static ssize_t firmware_show(struct device *dev, struct device_attribute *attr, > > char *buf) > > { > > + ssize_t ret; > > struct rproc *rproc = to_rproc(dev); > > > > - return sprintf(buf, "%s\n", rproc->firmware); > > + /* > > + * In most instances there is no guarantee about the firmware > > + * that was loaded by the external entity. As such simply don't > > + * print anything. > > + */ > > + if (rproc_needs_syncing(rproc)) > > + ret = sprintf(buf, "\n"); > > A default name is provided in sysfs if no firmware is started/synchronised on boot. > > IMO providing an empty name here could be confusing. > Perhaps a refactoring of this sysfs entry would be nice: > - Normal boot (no firmware loaded) : empty name instead of a default name That is guaranteed to break user space so we can't proceed this way. > - auto_boot: name provided by the platform driver or default name ( current implementation) > - synchronization: a predefined name such as Default, unknown, External, None,... Loic had the same comment. Usually it is best to provide sysfs output that don't need parsing, i.e 0/1 or nothing at all, but in the remoteproc subsystem we already have "state", "name" and "firmware" that need parsing. As such my next revision will have "unknown", which I think is the best way to describe the situation. > > > + else > > + ret = sprintf(buf, "%s\n", rproc->firmware); > > + > > + return ret; > > } > > > > /* Change firmware name via sysfs */ > > @@ -39,6 +50,17 @@ static ssize_t firmware_store(struct device *dev, > > goto out; > > } > > > > + /* > > + * There is no point in trying to change the firmware if loading the > > + * image of the remote processor is done by another entity. > > + */ > > + if (rproc_needs_syncing(rproc)) { > > + dev_err(dev, > > + "can't change firmware while synchronising with MCU\n"); > > I don't know if you decide to keep "MCU" or not. If not the case > you have also some other instances in your patch 9/14. MCU should be long gone. I thought I had spotted them all but was obviously wrong. > > Regards > Arnaud > > > + err = -EBUSY; > > + goto out; > > + } > > + > > len = strcspn(buf, "\n"); > > if (!len) { > > dev_err(dev, "can't provide a NULL firmware\n"); > >