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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45D01C43334 for ; Tue, 14 Jun 2022 08:25:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BD7918448A; Tue, 14 Jun 2022 10:25:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xs4all.nl 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 B6C45844A1; Tue, 14 Jun 2022 10:25:02 +0200 (CEST) Received: from sibelius.xs4all.nl (80-61-163-207.fixed.kpn.net [80.61.163.207]) (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 480C984488 for ; Tue, 14 Jun 2022 10:25:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=mark.kettenis@xs4all.nl Received: from localhost (bloch.sibelius.xs4all.nl [local]) by bloch.sibelius.xs4all.nl (OpenSMTPD) with ESMTPA id 5ed7ce2f; Tue, 14 Jun 2022 10:24:59 +0200 (CEST) Date: Tue, 14 Jun 2022 10:24:59 +0200 (CEST) From: Mark Kettenis To: Janne Grunau Cc: u-boot@lists.denx.de, kettenis@openbsd.org, trini@konsulko.com In-Reply-To: <20220614070909.8458-4-j@jannau.net> (message from Janne Grunau on Tue, 14 Jun 2022 09:09:09 +0200) Subject: Re: [PATCH v2 3/3] arm: apple: Increase RTKit timeouts References: <20220614070909.8458-1-j@jannau.net> <20220614070909.8458-4-j@jannau.net> Message-ID: 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 > From: Janne Grunau > Date: Tue, 14 Jun 2022 09:09:09 +0200 > > 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 > --- > > (no changes since v1) > > 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; > > -- > 2.35.1 > >