From patchwork Sun Jun 12 16:00:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Grunau X-Patchwork-Id: 1642564 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LLfZP3MRSz9s75 for ; Mon, 13 Jun 2022 02:01:17 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 41F9C84433; Sun, 12 Jun 2022 18:00:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jannau.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 80B9D84424; Sun, 12 Jun 2022 18:00:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from soltyk.jannau.net (soltyk.jannau.net [144.76.91.90]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F3BF38441D for ; Sun, 12 Jun 2022 18:00:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jannau.net Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=j@jannau.net Received: from coburn.home.jannau.net (p579ad988.dip0.t-ipconnect.de [87.154.217.136]) by soltyk.jannau.net (Postfix) with ESMTPSA id 9675B26EC7C; Sun, 12 Jun 2022 18:00:31 +0200 (CEST) From: Janne Grunau To: u-boot@lists.denx.de Cc: Mark Kettenis , Tom Rini Subject: [PATCH 3/3] arm: apple: Increase RTKit timeouts Date: Sun, 12 Jun 2022 18:00:29 +0200 Message-Id: <20220612160029.20712-4-j@jannau.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220612160029.20712-1-j@jannau.net> References: <20220612160029.20712-1-j@jannau.net> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Timeouts are not expected to happen and are handled as fatal errors. Increase all timeouts to 1 second as defensive measure to avoid relying on the timing behaviour of certain firmware versions or configurations. Signed-off-by: Janne Grunau Reviewed-by: Mark Kettenis Tested-by: Mark Kettenis --- arch/arm/mach-apple/rtkit.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-apple/rtkit.c b/arch/arm/mach-apple/rtkit.c index da7771844230..a550b553b663 100644 --- a/arch/arm/mach-apple/rtkit.c +++ b/arch/arm/mach-apple/rtkit.c @@ -52,6 +52,8 @@ #define APPLE_RTKIT_BUFFER_REQUEST_SIZE GENMASK(51, 44) #define APPLE_RTKIT_BUFFER_REQUEST_IOVA GENMASK(41, 0) +#define TIMEOUT_1SEC_US 1000000 + struct apple_rtkit { struct mbox_chan *chan; void *cookie; @@ -168,7 +170,7 @@ int apple_rtkit_boot(struct apple_rtkit *rtk) return ret; /* Wait for protocol version negotiation message. */ - ret = mbox_recv(rtk->chan, &msg, 10000); + ret = mbox_recv(rtk->chan, &msg, TIMEOUT_1SEC_US); if (ret < 0) return ret; @@ -210,7 +212,7 @@ int apple_rtkit_boot(struct apple_rtkit *rtk) wait_epmap: /* Wait for endpoint map message. */ - ret = mbox_recv(rtk->chan, &msg, 10000); + ret = mbox_recv(rtk->chan, &msg, TIMEOUT_1SEC_US); if (ret < 0) return ret; @@ -275,7 +277,7 @@ wait_epmap: pwrstate = APPLE_RTKIT_PWR_STATE_SLEEP; while (pwrstate != APPLE_RTKIT_PWR_STATE_ON) { - ret = mbox_recv(rtk->chan, &msg, 100000); + ret = mbox_recv(rtk->chan, &msg, TIMEOUT_1SEC_US); if (ret < 0) return ret; @@ -330,7 +332,7 @@ int apple_rtkit_shutdown(struct apple_rtkit *rtk, int pwrstate) if (ret < 0) return ret; - ret = mbox_recv(rtk->chan, &msg, 100000); + ret = mbox_recv(rtk->chan, &msg, TIMEOUT_1SEC_US); if (ret < 0) return ret;