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: 6933 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp856019wrr; Fri, 21 Oct 2022 12:00:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40uS58lZ5j8eYiZOP6dXAU+mqH2d7zoHo+YBCxJSag6uPMNcnEJCoL6fvCtc6be0FdIcRE X-Received: by 2002:a17:902:ba8f:b0:17f:9b1b:6634 with SMTP id k15-20020a170902ba8f00b0017f9b1b6634mr20759307pls.171.1666378815566; Fri, 21 Oct 2022 12:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666378815; cv=none; d=google.com; s=arc-20160816; b=sAq9eTBtpCeLIBc/thIL2wTv1MXYyVtWWvtata1dDAA2K65JEz6R2myGKlHLA+j4JQ GrYc6jnDdsiRIs9Pa4OOsr22HLndo8K9EeYP5/QkhLKUmD4lqrNTp8w/v1va+TxWZYF7 bzjs+LkYJu92rdc3x8BUmK97xK9Ubdw/jL/pjyMYaKLTvxkgOVLVr6qIYgYnphVzdK8Q wFApS5q39BLRQdRVTo3fNMU8mDru65YoYsAQ78OSN1RQ4WYJYGqO53fkTpml5NPPQ5zd ZrLMEvLfRbyJjNK1TZC/wg7gER5S3z7bAsjh4hAM/D4Wz2yrqgjd8cqcmGhwJ59VeqBc ofng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Epgs+uOv2ELm6Mf+YTk8ZSnbWg4aQ6L4EqMd6fPM2LY=; b=PAEWvummPUBp/cA8a8KOH4eOcQO4Tzx4PpzT6T5G3QD2b5/1og6KPj9VVjaaB6xe3f fDTt4KNlR/3/NWX7vlOEqONk6TzUi7C9vbOvRF51+C3EcgBRsMiqukTQkwxELXgxqs/A U8aZUmXPrlSYeKPCP/6vhHbT8w1bJzUPLt3in3LMTfEvz4bJ4pbLMJGWdXCU1V3XxVEs Ob5bA06WlaVGTEcSdp6aV2U8ZbnE1Z3WofI3R/dVAh2cELBPU7o94Yb5rSqgIhmyf4qw S/iT7vHxOzF3DMneZCyWe5OGXUlkYrZAoHUaYet+4p5NesntWpYPExjKGYglIwJOQ3tT GOSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=rjCPjN1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a170902d49100b001784b572d3csi2255408plg.525.2022.10.21.12.00.02; Fri, 21 Oct 2022 12:00:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=rjCPjN1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbiJUS5j (ORCPT + 99 others); Fri, 21 Oct 2022 14:57:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiJUS5d (ORCPT ); Fri, 21 Oct 2022 14:57:33 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BE1E28F261 for ; Fri, 21 Oct 2022 11:57:24 -0700 (PDT) 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-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747324833332183618?= X-GMAIL-MSGID: =?utf-8?q?1747324833332183618?= 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