From patchwork Fri Oct 21 18:57:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Vlaev X-Patchwork-Id: 13015262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39BA6C38A2D for ; Fri, 21 Oct 2022 18:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=d0NrcA7uXEyYGq471t44aKq2mtBjQcn+m/senXXiRQ4=; b=03YaVasSLRAHR1 C+EHnRCyFk8q/9nt9dNU4XoCGx+4xwEqym9sQavWJfk8HGwol3vuv2Dx4Uq85ACsfKrm2R5vJd698 3Mva6D2y4V6shL5lkD9Aam6/uExc7vGgZR3lE3DsE3ri+ifxu6o4Qbimp62SlGIknygok+LQQDKJP YEsKxiKMIYhw484I78LRIlOZ3JYHoNbQBfu4O6LET9mT5WVsSsU5/H2UwD4dfRWlrkISjOKv5WJnL dPCDcg5zgbDzNldqP6vYlSsI3+xdZLeOU/veK6Uor63LvVC6iat+91cAhJdwUdQTwppZC72QG1NW1 ohUhtylM8nDm/R2Pg/9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olxCv-009TiO-8R; Fri, 21 Oct 2022 18:57:25 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olxCs-009Tfj-9g for linux-arm-kernel@lists.infradead.org; Fri, 21 Oct 2022 18:57:23 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 29LIvEfA080810; Fri, 21 Oct 2022 13:57:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1666378634; bh=Epgs+uOv2ELm6Mf+YTk8ZSnbWg4aQ6L4EqMd6fPM2LY=; h=From:To:CC:Subject:Date; b=rjCPjN1FWOrvMMyBQp/pDjnXXH74zGuXgbxiQYoMt5HoXVyUFpjz2yV9Idd8RHlWm gzAJdfwkWhB39BonDloavBNK5LGtXfD9gIbMWcncJJkSVM2QONmi6bIDqCql5AUiQx TYwcP7rNzqMn9AhXnlWiXYz2H45vr1vlavE2rwKE= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 29LIvEUu122818 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 21 Oct 2022 13:57:14 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Fri, 21 Oct 2022 13:57:14 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6 via Frontend Transport; Fri, 21 Oct 2022 13:57:14 -0500 Received: from jti.ent.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 29LIv7Uw001227; Fri, 21 Oct 2022 13:57:09 -0500 From: Georgi Vlaev To: Nishanth Menon , Tero Kristo , Santosh Shilimkar , Vignesh Raghavendra , Vibhore Vardhan CC: , , Georgi Vlaev Subject: [RESEND PATCH] firmware: ti_sci: Fix polled mode during system suspend Date: Fri, 21 Oct 2022 21:57:04 +0300 Message-ID: <20221021185704.181316-1-g-vlaev@ti.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221021_115722_501365_0BD75529 X-CRM114-Status: GOOD ( 12.39 ) 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 Commit b9e8a7d950ff ("firmware: ti_sci: Switch transport to polled mode during system suspend") uses read_poll_timeout_atomic() macro in ti_sci_do_xfer() to wait for completion when the system is suspending. The break condition of the macro is set to "true" which will cause it break immediately when evaluated, likely before the TISCI xfer is completed, and always return 0. We want to poll here until "done_state == true". 1) Change the break condition of read_poll_timeout_atomic() to the bool variable "done_state". 2) The read_poll_timeout_atomic() returns 0 if the break condition is met or -ETIMEDOUT if not. Since our break condition has changed to "done_state", we also don't have to check for "!done_state" when evaluating the return value. Fixes: b9e8a7d950ff ("firmware: ti_sci: Switch transport to polled mode during system suspend") Signed-off-by: Georgi Vlaev --- drivers/firmware/ti_sci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) base-commit: 4d48f589d294ddc5e01d3b0dc7cecc55324c05ca diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index ebc32bbd9b83..6281e7153b47 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -429,15 +429,14 @@ static inline int ti_sci_do_xfer(struct ti_sci_info *info, * during noirq phase, so we must manually poll the completion. */ ret = read_poll_timeout_atomic(try_wait_for_completion, done_state, - true, 1, + done_state, 1, info->desc->max_rx_timeout_ms * 1000, false, &xfer->done); } - if (ret == -ETIMEDOUT || !done_state) { + if (ret == -ETIMEDOUT) dev_err(dev, "Mbox timedout in resp(caller: %pS)\n", (void *)_RET_IP_); - } /* * NOTE: we might prefer not to need the mailbox ticker to manage the