From mboxrd@z Thu Jan 1 00:00:00 1970 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 D9224C77B73 for ; Tue, 30 May 2023 09:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Subject:Cc:To:From: Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+qt3c/KE7Qylg6ZBJiC04mGQFajYncG7lLMdSHwrJ3M=; b=e5imQB5RHkrL0kuRFgsy0zU1n8 1CTWK1khBe7PrmfpB4oyTlexEeWCMKtcLep1k7R5mYArXnMo875A3TaIp2wxlJXnvuEw4XvW476Q9 UB5vR9DbgbjDJ3V8ETDd+FFgvelfJX8L4m2TLzayDZ/fneaHeQ25ZZsR2zfuJeMgpJe0520u//GHQ tC7hi3uaIUmVUfNvE07gtNWrUOsskYUEoFtX+U8YgmhrXTEcgHbGqysBst1GK/UxcP3qYdPFow1sb Wodvd2kElu9+zDQR2VhwzR9btsGq8I29SN4BwNDlu0AidVHoziSoUB1vuUNtqRn/i9oc18rRUcTFi IDLtFcaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q3vwI-00DEoO-0J; Tue, 30 May 2023 09:46:50 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q3vw9-00DEkh-1u; Tue, 30 May 2023 09:46:43 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A02CF6248C; Tue, 30 May 2023 09:46:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B3AFC433EF; Tue, 30 May 2023 09:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685440000; bh=jRdh+GkRfDWttXL/fmD+LV2d9JEAsUu+MFteor4o3v8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NWQkW7oqD1s/xQaFLgewy15nv1KOWGXsn0f6FF/858zpx8bI3nhSwnRXEShDXDMkx piTiQBqj89sTUkdaMIMcfWKRnJjeK35AreN69JjZp2umweAEJrjrWJ8M/8H4NLUBM9 +WVdgprovyGlGiPrKHjvBKi8A6MoAd3USs2SgXo8M3qo+Mk/CSaHQfquRrR+cYF8VP 33/FKZgiQHACj/TMzi3XFg7aBUN+S4EoKZZ9V4Ktn1xgYi+6rIYy+csL6WcARJXv/S Bl81LUJeWfbjgLHWweh59yJ1G0l8RdwcMEMmvruI9W6NFd3kc8QXVwJEJlOYce6iT9 8Nfj481yN1BmQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1q3vw5-001GVk-R1; Tue, 30 May 2023 10:46:37 +0100 Date: Tue, 30 May 2023 10:46:37 +0100 Message-ID: <868rd6cfsy.wl-maz@kernel.org> From: Marc Zyngier To: Geert Uytterhoeven Cc: Douglas Anderson , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Allen-KH Cheng , linux-mediatek@lists.infradead.org, Eddie Huang , Hsin-Hsiung Wang , AngeloGioacchino Del Regno , wenst@chromium.org, yidilin@chromium.org, Tinghan Shen , jwerner@chromium.org, Weiyi Lu , Ben Ho , Seiya Wang , linux-kernel@vger.kernel.org, Linux-Renesas Subject: Re: [PATCH v2 2/5] irqchip/gic-v3: Disable pseudo NMIs on Mediatek devices w/ firmware issues In-Reply-To: References: <20230515131353.v2.cover@dianders> <20230515131353.v2.2.I88dc0a0eb1d9d537de61604cd8994ecc55c0cac1@changeid> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: geert@linux-m68k.org, dianders@chromium.org, tglx@linutronix.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, allen-kh.cheng@mediatek.com, linux-mediatek@lists.infradead.org, eddie.huang@mediatek.com, hsin-hsiung.wang@mediatek.com, angelogioacchino.delregno@collabora.com, wenst@chromium.org, yidilin@chromium.org, tinghan.shen@mediatek.com, jwerner@chromium.org, weiyi.lu@mediatek.com, Ben.Ho@mediatek.com, seiya.wang@mediatek.com, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230530_024641_705514_B0C4BE15 X-CRM114-Status: GOOD ( 37.38 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Tue, 30 May 2023 09:29:02 +0100, Geert Uytterhoeven wrote: >=20 > Hi Douglas, >=20 > On Mon, May 15, 2023 at 10:16=E2=80=AFPM Douglas Anderson wrote: > > Some Chromebooks with Mediatek SoCs have a problem where the firmware > > doesn't properly save/restore certain GICR registers. Newer > > Chromebooks should fix this issue and we may be able to do firmware > > updates for old Chromebooks. At the moment, the only known issue with > > these Chromebooks is that we can't enable "pseudo NMIs" since the > > priority register can be lost. Enabling "pseudo NMIs" on Chromebooks > > with the problematic firmware causes crashes and freezes. > > > > Let's detect devices with this problem and then disable "pseudo NMIs" > > on them. We'll detect the problem by looking for the presence of the > > "mediatek,broken-save-restore-fw" property in the GIC device tree > > node. Any devices with fixed firmware will not have this property. > > > > Our detection plan works because we never bake a Chromebook's device > > tree into firmware. Instead, device trees are always bundled with the > > kernel. We'll update the device trees of all affected Chromebooks and > > then we'll never enable "pseudo NMI" on a kernel that is bundled with > > old device trees. When a firmware update is shipped that fixes this > > issue it will know to patch the device tree to remove the property. > > > > In order to make this work, the quick detection mechanism of the GICv3 > > code is extended to be able to look for properties in addition to > > looking at "compatible". > > > > Reviewed-by: Julius Werner > > Signed-off-by: Douglas Anderson > > --- > > > > Changes in v2: > > - mediatek,gicr-save-quirk =3D> mediatek,broken-save-restore-fw >=20 > Thanks for your patch, which is now commit 44bd78dd2b8897f5 > ("irqchip/gic-v3: Disable pseudo NMIs on Mediatek devices w/ > firmware issues") in v6.4-rc4. >=20 > This causes enabling an unrelated workaround on R-Car V4H: >=20 > GIC: enabling workaround for GICv3: Cavium erratum 38539 >=20 > > --- a/drivers/irqchip/irq-gic-common.c > > +++ b/drivers/irqchip/irq-gic-common.c > > @@ -16,7 +16,11 @@ void gic_enable_of_quirks(const struct device_node *= np, > > const struct gic_quirk *quirks, void *data) > > { > > for (; quirks->desc; quirks++) { > > - if (!of_device_is_compatible(np, quirks->compatible)) > > + if (quirks->compatible && > > + !of_device_is_compatible(np, quirks->compatible)) > > + continue; > > + if (quirks->property && > > + !of_property_read_bool(np, quirks->property)) > > continue; >=20 > Presumably the loop should continue if none of quirks-compatible > or quirks->property is set? Indeed, thanks for pointing that out. Can you give the following hack a go (compile tested only)? diff --git a/drivers/irqchip/irq-gic-common.c b/drivers/irqchip/irq-gic-com= mon.c index de47b51cdadb..7b591736ab58 100644 --- a/drivers/irqchip/irq-gic-common.c +++ b/drivers/irqchip/irq-gic-common.c @@ -16,6 +16,8 @@ void gic_enable_of_quirks(const struct device_node *np, const struct gic_quirk *quirks, void *data) { for (; quirks->desc; quirks++) { + if (!quirks->compatible && !quirks->property) + continue; if (quirks->compatible && !of_device_is_compatible(np, quirks->compatible)) continue; If that works for you, I'll queue it ASAP. Cheers, M. --=20 Without deviation from the norm, progress is not possible.