Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1933277lqa; Tue, 30 Apr 2024 03:55:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWcCo1dhwL9BpSQg39yKceZ9I0a7y+PDBxrHCwKxlIsvLmBVbysa1Lb8oTdY8Wo5XLEOJNdQQS/rWzBWlFNtcVVJn2+8f6C1izoFzpxEA== X-Google-Smtp-Source: AGHT+IGwF46s4gm3zsyEN2o9KHW4O8gChg2ynn3nDlpZXF+1/mW0UEGNtqLkcdu0284sB7WD97Lz X-Received: by 2002:a17:90a:cc7:b0:2a2:cf1d:895c with SMTP id 7-20020a17090a0cc700b002a2cf1d895cmr12184272pjt.41.1714474534869; Tue, 30 Apr 2024 03:55:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714474534; cv=pass; d=google.com; s=arc-20160816; b=qWC8/+nE7nQwmeegq5ERmLIechAkGIMBjaRJj3SyeP5n5alQ/wLYIcW7v5rFgkyBAC Ot6Gwwoy0pha1e53A9kWKXn5jc9604Uo9q4Mc0Uy9QGKbEcdH9h2SOWhPVjYBLAo9FqH utwUc5OiDyJ7mMSu4UOZbGOYkOQzarkGelTS1F4UQwdHxn5PfVwAtwBbMVI4ieV0Dd9O PXqRIziXccbey0Y4jLVVkxgEDtdtpYbv2dJMX3CP54k105DNo92EwTH1JhS8ORPBnVct HLIsTbg11gWf4u/yG5nRjKzUmILFJU+JdbZqqFult8nAyCUyR7ACgRbwY2DqwzoHbPh9 mqUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wgPLkkxkDTgxSHcoII06upNv5M+DDJ6JR1sK5fYgaeM=; fh=epinPfLfQ0hGyNd7Cj1Zem5kDPAg4Y3HQWsqHeWqiDI=; b=jaPXudncMRpPjNb5M72CUdzzHGvil/42CzPmAU57ELsCTXuLsyZ4kGYJFfSWaGWFvg l4DzXJG3RTXIsqLKorH6ZfPbKwSwQ6ziCkl8c8uWsqHoXa93Etshy0OEKmjmJMqQfCZo 0UNBgjhvPyTIP0iUCLvR7Hv+0GpNHJS/J2d7nH8MHlZQtmZ7c1Lz9VA9TFZNJvjqa0ne hMfc6fVkqnFAGusWbetzGNDZD6oGEd2CWVPxOMVKkPc6CzRFxmIN5fOxyuP9tyYJshiQ KoACX9QSn77o/oBD7LhIi7qxnsB0Ju60Yj4Nbuur5x4OeOXIFnoA/Zn5H3VDhnj/0vg/ lL0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zVhEXNeL; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-163805-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163805-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i3-20020a17090ad34300b002b1d0dc6163si3267438pjx.90.2024.04.30.03.55.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 03:55:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163805-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zVhEXNeL; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-163805-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163805-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 29DAEB20EB0 for ; Tue, 30 Apr 2024 10:54:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F21212D1E7; Tue, 30 Apr 2024 10:53:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="zVhEXNeL" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFC9F12E1CA; Tue, 30 Apr 2024 10:53:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714474402; cv=none; b=rOR72G+kKb4YOYUlSE2sXCrFkw/vD2mijC4RU+gWD3A8Ip+KueD7BKvEARULF9vFxEnBFwNIsxTk/mLpaF4ikCSOhmUuBILIAKFXAvDKy5bDeIljJ6IO+SrVZCdB7FoUYrdI1PzPxZxktPlPcwvIP95SQ15ztaS+6cAE7BJ5CLw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714474402; c=relaxed/simple; bh=SI7SkEbPILK7EIZFJ4b+5oO16k1J0ru5blwRmlgF3sM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f/yd/DlPCvCV+bSWaMcKxMQa24CwohChpM1eqc03zeTv9AR1B9q9QelYe4z617W6twA96zpJV3q3TY+kHNTmAzSNKqkIKljnEXvMfsJ5DYe2DARL5g5jDYIMqcwU1P6DJoU9Aj9jd/OL5IH6DpyVisHvMrxQMvM8pOdJb0feTVg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=zVhEXNeL; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 43UArHEu114705; Tue, 30 Apr 2024 05:53:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1714474397; bh=wgPLkkxkDTgxSHcoII06upNv5M+DDJ6JR1sK5fYgaeM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=zVhEXNeLWpjfk+DzutqzI6dkolekbr+ozSfOQ4D52E21MxJKfuNTsrpv3mGgilTdg SPj3RUHnNqN9gg8Cv9xQK4kGnCGw4oymLQhjrMBE1wMAON0J0iWqNs142TOjETLiyz fmFWtEbjdYAoBfmodu5WdGdKPpjSzvkJ17J7sfdw= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 43UArHNn033848 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Apr 2024 05:53:17 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 30 Apr 2024 05:53:17 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 30 Apr 2024 05:53:17 -0500 Received: from uda0510294.dhcp.ti.com (uda0510294.dhcp.ti.com [10.24.69.66]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 43UAr8Dr038508; Tue, 30 Apr 2024 05:53:15 -0500 From: Beleswar Padhi To: CC: , , , , , , , Subject: [PATCH v3 2/2] remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs Date: Tue, 30 Apr 2024 16:23:07 +0530 Message-ID: <20240430105307.1190615-3-b-padhi@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240430105307.1190615-1-b-padhi@ti.com> References: <20240430105307.1190615-1-b-padhi@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 be 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 R5F 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/remoteproc/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 = rproc->priv; struct k3_r5_cluster *cluster = kproc->cluster; struct device *dev = 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 = list_first_entry(&cluster->cores, struct k3_r5_core, + elem); + if (core != core0 && core0->rproc->state == RPROC_OFFLINE) { + dev_err(dev, "%s: can not start core 1 before core 0\n", + __func__); + return -EPERM; + } + ret = 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 = rproc->priv; struct k3_r5_cluster *cluster = kproc->cluster; - struct k3_r5_core *core = kproc->core; + struct device *dev = kproc->dev; + struct k3_r5_core *core1, *core = 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 = list_last_entry(&cluster->cores, struct k3_r5_core, + elem); + if (core != core1 && core1->rproc->state != RPROC_OFFLINE) { + dev_err(dev, "%s: can not stop core 0 before core 1\n", + __func__); + return -EPERM; + } + ret = k3_r5_core_halt(core); if (ret) goto out; -- 2.34.1