Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2519402lqo; Mon, 20 May 2024 08:15:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWTdb6hyRy7/cjnle9SWVfG3qbyQCw35NYvmGq/SgZjOCPq71QzVYtHu3x1AJKkujJsDOmVnBwh1Qs2cRyHLRT/+P+NI/aSRKwPs9cdqw== X-Google-Smtp-Source: AGHT+IGwv8/59NRC2qbr4PfRqcMLUTAzjDXGE0OoJzZq/xBd2kD/Ul/8fxk8/qoXr0VTy9W/oiBF X-Received: by 2002:a05:6870:a70e:b0:22e:8868:af8a with SMTP id 586e51a60fabf-24172c2b3eemr32135122fac.31.1716218102237; Mon, 20 May 2024 08:15:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716218102; cv=pass; d=google.com; s=arc-20160816; b=bRoKDWJJUZpghp07IAogQc3Zo+/SSQrWXsaKH7a6f43Z+ZZO3V/84R8NYN7omMDrAi CUQhhJt2GYYrR24RVap9+sQ5Sifj3O7M0IbLZf6O0jWWXKe3kq+JDwezhL3Oqx4Ht0Zy XZGEBQiNmJ2flSslIXtrN8fYEot4IBG+CWa+gh1+hHsQd3q69YHeDs68mxmwRIjmhx0g B/IGBMJRGy/JQfsKHOgcydv3xxrDB9CWAGezexxzXqBQQQHkk1vyeI57m3L5QyebpGE7 3QEtC7WWgN6SIk7JeQA2twr5aoAj8BM8ftdWUSoMEncBtFdDDxAd40GKXkku7tSMvuhU lrjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=8a5RomlnN7TsyUGfzH2IKfbBBCjtXMvPMQ0e+f389oQ=; fh=BsFt7ZqYAUfYqRCdUMnq3A2JO09uYkvbmU+2rNDZaD0=; b=h161AvkNSLpMkXR+3cQar5AFfhUYFkJw918zmVtReh7ciPpWn2RqHPajGU8hkfe5bu 6hrnBj7B1R6fokChcXjg/5g5oif+0k8wKRm+GXzOo9p08izBvYMJkkOcwEa5gGliPErT EtR6labpRVWPSbLcEq57rz7YhWER2b8evVcjRt6F6cXV9kfuS5jXanHmDU2KeQbNp9+e 6yXSJz2HmDX1UwmmZ7g3OgqjebaTl1K9n6OUIPlQ9ljJSrO1v/4XJIyGyKPcrhnYmdyb qa04V0N8QaO3QJ5u8pHRAtqJAq2i5eBwO7PYA4KhCUe4rLPdCezHj7CPS9FdeFlJ28hX +50A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XfQITgr5; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-183890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f29b781si35050296d6.248.2024.05.20.08.15.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 08:15:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XfQITgr5; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-183890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D88D61C2034D for ; Mon, 20 May 2024 15:15:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BE0F136E2B; Mon, 20 May 2024 15:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XfQITgr5" Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6663136E10 for ; Mon, 20 May 2024 15:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716218091; cv=none; b=rfHlpE9QY/CviUPvC3cikFcERHtRBLP/8T0nJ/ctAtu+D4XM4SpFDK7mNgtBgpqS777sN0nVo/POq914DrvaPfCXSDYRHSnFzhanu7eXvuoMWNmYsYvik+3Toq7Xyn5fXKoUf/NMkqo8abPgwf2834D/nahRLuXRMJTHynW5Ov4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716218091; c=relaxed/simple; bh=aFdkKXMgw7IZRUOUAg2Gv8HZiNrYgQERd5uStPFtaHc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=SyXPpOvUpmoojmBYhYPgKJUHQdjyMqdRn6zmMHCZJdu5yOiooaQyPs+nS6rJoI09yFl/yhxl96pc12GUDf7bMC0SNN7zWs+9hIt0Ys78v/tp+/WqTKXXKJHteHZDh+PguiwfZqvCEWoYDjK04oV5xx6H5l+loIHgEqOR1LUf8WI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=XfQITgr5; arc=none smtp.client-ip=209.85.208.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2e564cad1f6so61747311fa.1 for ; Mon, 20 May 2024 08:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716218088; x=1716822888; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8a5RomlnN7TsyUGfzH2IKfbBBCjtXMvPMQ0e+f389oQ=; b=XfQITgr5fo8pYIbVPV/dy+anzdYuYM2D2t32nXelhu2snUKK/sRjWKapKvyh6YTCcH nDlRshbm/xi7R6NWTXDyCQUKUMrcG2OePij+j+06hAWkJ9ktkekkHsxirgiUTtIIpnUz bI0B6fquwatURLlzjsTC+sJTnQGEtmlOVlq0rh+nqLcscc/d4p+/za3/uIvjApYbTDXb wM8kPsUMt6vL4JpNXH3I27xlCHSpJqKHOa20IiHUKqLdWClAybsd80QwTzQjNnNoM78d /9qNrAOF+8VXl/kgWtwQgYf/gq67X4b4CFphvjh+bnO+0tdA2CeJ/UPxaJXASebq8jXs AXcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716218088; x=1716822888; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8a5RomlnN7TsyUGfzH2IKfbBBCjtXMvPMQ0e+f389oQ=; b=KFg3jjvWFmxI0VAnHVIJ0ETemIAqo7f1zlx6Lnw6dtv3SWhuCVAVPEDVCZ/Foe+4eK XNWcai8tu16e4U2bolAeCEGWVBVv7Hr+sZStRPERYEjgXHHKNZWaJRQIg6psZg9GOruj yoXiR1fDqnNagUPOpehTqhTJwNx5nzPuPEL3/5Kofg2z9L8OfgFlVB5eMRdJfaLyW1r6 5ncxJ1QA4NszY64CYPRw5pVWrUPME3sAa1J9XiyT6FIOszgzaXsYkuZ1ZoiJZ9cZQPsk txam3d/9Kg0dtvHMjnDKDtIFMagiGnujE6GuGJahfLgalA4f//j+NfTxtFFBByszB1j4 0wFw== X-Forwarded-Encrypted: i=1; AJvYcCXHYWpAcPb7KDRUmiFL7hUTm2gl3DShLr9WbcqljCXT7RNCvXMlPudpq0Y6WPtuXShn6CyfSWmGIcnPhumPrr6AhLygK42PQaT54/hY X-Gm-Message-State: AOJu0YyTqR/ihFEq/THsNqTdPnWH1pBzietk+v6jERO9z7tXjBeE81/K PVz9yQiQT17qrFI8VkZaiB/EFEVjkCyGU8TS1GWWcYVgd4mHaoL/uRhXb04W0+LeqHisc0pP49/ Vca/9eyL3ey0qFpm/tKRuDUIZsfCpn/qrjCft4A== X-Received: by 2002:a2e:7c02:0:b0:2e0:5f2c:e0c0 with SMTP id 38308e7fff4ca-2e5204b2edfmr187637791fa.37.1716218087754; Mon, 20 May 2024 08:14:47 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240430105307.1190615-1-b-padhi@ti.com> <20240430105307.1190615-3-b-padhi@ti.com> <954f974f-8b97-4ff6-bb57-35501fa9ceb9@wanadoo.fr> In-Reply-To: <954f974f-8b97-4ff6-bb57-35501fa9ceb9@wanadoo.fr> From: Mathieu Poirier Date: Mon, 20 May 2024 09:14:36 -0600 Message-ID: Subject: Re: [PATCH v3 2/2] remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs To: Christophe JAILLET Cc: Beleswar Padhi , andersson@kernel.org, s-anna@ti.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, u-kumar1@ti.com, nm@ti.com, devarsht@ti.com, hnagalla@ti.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 18 May 2024 at 04:44, Christophe JAILLET wrote: > > Le 30/04/2024 =C3=A0 12:53, Beleswar Padhi a =C3=A9crit : > > PSC controller has a limitation that it can only power-up the second > > core when the first core is in ON state. Power-state for core0 should b= e > > equal to or higher than core1. > > > > Therefore, prevent core1 from powering up before core0 during the start > > process from sysfs. Similarly, prevent core0 from shutting down before > > core1 has been shut down from sysfs. > > > > Fixes: 6dedbd1d5443 ("remoteproc: k3-r5: Add a remoteproc driver for R5= F subsystem") > > > > Signed-off-by: Beleswar Padhi > > --- > > drivers/remoteproc/ti_k3_r5_remoteproc.c | 23 +++++++++++++++++++++-- > > 1 file changed, 21 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remotep= roc/ti_k3_r5_remoteproc.c > > index 6d6afd6beb3a..1799b4f6d11e 100644 > > --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c > > +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c > > @@ -548,7 +548,7 @@ static int k3_r5_rproc_start(struct rproc *rproc) > > struct k3_r5_rproc *kproc =3D rproc->priv; > > struct k3_r5_cluster *cluster =3D kproc->cluster; > > struct device *dev =3D kproc->dev; > > - struct k3_r5_core *core; > > + struct k3_r5_core *core0, *core; > > u32 boot_addr; > > int ret; > > > > @@ -574,6 +574,15 @@ static int k3_r5_rproc_start(struct rproc *rproc) > > goto unroll_core_run; > > } > > } else { > > + /* do not allow core 1 to start before core 0 */ > > + core0 =3D list_first_entry(&cluster->cores, struct k3_r5_= core, > > + elem); > > + if (core !=3D core0 && core0->rproc->state =3D=3D RPROC_O= FFLINE) { > > + dev_err(dev, "%s: can not start core 1 before cor= e 0\n", > > + __func__); > > + return -EPERM; > > + } > > + > > ret =3D k3_r5_core_run(core); > > if (ret) > > goto put_mbox; > > @@ -619,7 +628,8 @@ static int k3_r5_rproc_stop(struct rproc *rproc) > > { > > struct k3_r5_rproc *kproc =3D rproc->priv; > > struct k3_r5_cluster *cluster =3D kproc->cluster; > > - struct k3_r5_core *core =3D kproc->core; > > + struct device *dev =3D kproc->dev; > > + struct k3_r5_core *core1, *core =3D kproc->core; > > int ret; > > > > /* halt all applicable cores */ > > @@ -632,6 +642,15 @@ static int k3_r5_rproc_stop(struct rproc *rproc) > > } > > } > > } else { > > + /* do not allow core 0 to stop before core 1 */ > > + core1 =3D list_last_entry(&cluster->cores, struct k3_r5_c= ore, > > + elem); > > + if (core !=3D core1 && core1->rproc->state !=3D RPROC_OFF= LINE) { > > + dev_err(dev, "%s: can not stop core 0 before core= 1\n", > > + __func__); > > + return -EPERM; > > Hi, > > this patch has already reached -next, but should this "return -EPERM;" be= : > ret =3D -EPERM; > goto put_mbox; > > instead? > This has already been addressed: https://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git/commit= /?h=3Drproc-next&id=3D1dc7242f6ee0c99852cb90676d7fe201cf5de422 > CJ > > > + } > > + > > ret =3D k3_r5_core_halt(core); > > if (ret) > > goto out; >