Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2374783rdb; Tue, 10 Oct 2023 01:52:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGxz0Kk0pKooAM3AHCEF661Q3Jt1KtazCGXv3299h9N78j6UGKPmIweI/Vcfx3fdzUb+bo X-Received: by 2002:a05:6a21:3397:b0:140:253b:b658 with SMTP id yy23-20020a056a21339700b00140253bb658mr18179549pzb.57.1696927946235; Tue, 10 Oct 2023 01:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696927946; cv=none; d=google.com; s=arc-20160816; b=zrrv5jl094L17NY/knZmIX6WuyIBMuuPSXSfKC7OawDp+F9+BQI0H1yQQ13MEdRiui KPIvFLOXbdHcuRMcqWAzGFd1KsZG7GhoNQLsEHdAXJ8CwCARRGYsvC3pdbmosTiV+4Zn GLts/VtNWa1heq/JP6TuZadblEKWFS+JfQlLKgdmZspaLAcDrTlehvfxQe0VzUL9raiM aMSQ4WG0Gqev/uK8b+ozW8aLqrbFzO+Jw46fHi5iDgFmtkNGp8lduLsxepv+6FPsbHQp ZyUekvtG/uJ0bU4t5kjeop7kvQ5yOI+sqra4mq/FkXO4EfqxJl+nwOFlj7l5GZ/L09ev DuDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ixDwm5k50yKUTBz/ZVdVbdNKWPYYQMY2fgBSG+L1vt4=; fh=SH3K6UKyfwwhNf2rK3S/ruQYMJirim4T+oyTouywjH0=; b=ea2UnDjmg2z+KPC9kuhx6+fAooMyIpW6IQ0+j0BoFRtCwx53tuZTt/rWnKW3KFjGdq 7yO87/802y2jXuMxGfCj7GF7KM+S7HjrfqMFiCljFB8gi5tGXb3VOX+3yFYzJ9EXvdUj Jy+7of8OpGZLucQQ74mZH2NGp0HDKaOd+H0RGWhEOyrT3OvIbld7M/cTcE7MrkiNbIsp OwDpIlHM7x52cwXwj4VCd42SQpclsvoZfbkB634CPcPmfETwKg+mO6gLfFtlWvJTUa1a fXulWS1LOdszj1wsziMcb3xTxb8rEG9hBShV+eqgxVNv9PkJrcPmBgx8qF7HgKBDz3nd geQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o9wwu4Ur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id t17-20020a170902e85100b001c60636e426si12225692plg.432.2023.10.10.01.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 01:52:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o9wwu4Ur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D30078026C26; Tue, 10 Oct 2023 01:52:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229919AbjJJIwQ (ORCPT + 99 others); Tue, 10 Oct 2023 04:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbjJJIwP (ORCPT ); Tue, 10 Oct 2023 04:52:15 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 269A9A9 for ; Tue, 10 Oct 2023 01:52:14 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B0F4C433C8; Tue, 10 Oct 2023 08:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696927933; bh=XJynC3FVhVB5RPnfUzpYV78TXawY3XcAs4e1JfEyljQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=o9wwu4UrznOZpfdZX7oqvMRLJk0mD61f6BIJ1INfdsdsymjZ4gRjo9Kau+5y3AYwm qs2/Fa4+Gj31ZGOFprfnW5V3dOP5sgf2zwrH5YNSmKXVbK3rw3OP0Grgh5BBhLEjMQ FibLRVELC/hZ9uJwGh7FMqtQcGRqgUPOBFn1Dky0eHFf6BMlcaKQ1Zkb98qPYHnYk5 7yUtWh6ThBgm+wL2J5pRpDspCijDnRd8AjRiJ0Xl87C2plDpV5hxwHDxAlb7nC2QQk ++zDF65ChxJxHfm1/6NxL0vEnYZ6LAEpyWSh7PyluUgp8Vo0400KOYDhlXpkHEAOjr KCCwrv6n09xVQ== Message-ID: <74a4dc35-eed2-79c2-2b57-ed0857cbc96a@kernel.org> Date: Tue, 10 Oct 2023 10:52:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH v3] spmi: mtk-pmif: Serialize PMIF status check and command submission Content-Language: en-US To: =?UTF-8?B?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Stephen Boyd Cc: Chen-Yu Tsai , kernel@collabora.com, Greg Kroah-Hartman , Hsin-Hsiung Wang , James Lo , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org References: <20230724154739.493724-1-nfraprado@collabora.com> <7b407eda-702a-444a-b644-5e8dc31f3991@notapiano> From: AngeloGioacchino Del Regno In-Reply-To: <7b407eda-702a-444a-b644-5e8dc31f3991@notapiano> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 10 Oct 2023 01:52:24 -0700 (PDT) Il 19/09/23 22:12, Nícolas F. R. A. Prado ha scritto: > On Thu, Aug 10, 2023 at 06:03:53PM -0400, Nícolas F. R. A. Prado wrote: >> On Mon, Jul 24, 2023 at 11:47:33AM -0400, Nícolas F. R. A. Prado wrote: >>> Before writing the read or write command to the SPMI arbiter through the >>> PMIF interface, the current status of the channel is checked to ensure >>> it is idle. However, since the status only changes from idle when the >>> command is written, it is possible for two concurrent calls to determine >>> that the channel is idle and simultaneously send their commands. At this >>> point the PMIF interface hangs, with the status register no longer being >>> updated, and thus causing all subsequent operations to time out. >>> >>> This was observed on the mt8195-cherry-tomato-r2 machine, particularly >>> after commit 46600ab142f8 ("regulator: Set PROBE_PREFER_ASYNCHRONOUS for >>> drivers between 5.10 and 5.15") was applied, since then the two MT6315 >>> devices present on the SPMI bus would probe assynchronously and >>> sometimes (during probe or at a later point) read the bus >>> simultaneously, breaking the PMIF interface and consequently slowing >>> down the whole system. >>> >>> To fix the issue at its root cause, introduce locking around the channel >>> status check and the command write, so that both become an atomic >>> operation, preventing race conditions between two (or more) SPMI bus >>> read/write operations. A spinlock is used since this is a fast bus, as >>> indicated by the usage of the atomic variant of readl_poll, and >>> '.fast_io = true' being used in the mt6315 driver, so spinlocks are >>> already used for the regmap access. >>> >>> Fixes: b45b3ccef8c0 ("spmi: mediatek: Add support for MT6873/8192") >>> Signed-off-by: Nícolas F. R. A. Prado >> >> Hi, >> >> gentle ping on this one. MT8195 Chromebooks sometimes boot to a broken state >> without it. > > Hi Stephen, > > once again kindling reminding you of this important fix for MediaTek platforms, > solving a real issue impacting basic functionality observed on the MT8195 > Chromebook. > Hello Stephen, can you please pick this one ASAP? MT8195 is broken without. Thanks, Angelo