Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4264024rwd; Tue, 30 May 2023 02:56:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6uaBhCUvqNYMxDi0y33n4ktbQrWyxetwC4PPEJ2uxGUL6WquFDfLVOc2ztxNle3SID+Huq X-Received: by 2002:a17:902:db0f:b0:1ac:750e:33ef with SMTP id m15-20020a170902db0f00b001ac750e33efmr2209231plx.3.1685440579500; Tue, 30 May 2023 02:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685440579; cv=none; d=google.com; s=arc-20160816; b=uiF0umQLHJhhUP1r/4u0x3G+0+DOKpL3LBoLRt2TlHmjppRpZvysqmXQ2l2fszW/I8 C89u8AJKy76Z3ZoKaFoi/igLM9CJt2TghA331loIyQZ82/i7YPm+sw6ReQjezVztLdyj ytLr72hwRQgtGKTLFcdrhuLp51cDgplNfsyr67pV3c4DODdiYaEOQuLzp1ciADjgeXoj xuwYHaZQgz+qxWQ36oXVbNiGnBJzjzc9BRMroSUUTKFSPyu+lYwADW0drNvBgyenIXwn i0Q/zqcCqot2KaXBUgUvrHIcpSLb5tKsb+pa1YDrr8c4SJkWizXke+u6IssL8e1d8zqK NIMg== 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 :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=+qt3c/KE7Qylg6ZBJiC04mGQFajYncG7lLMdSHwrJ3M=; b=vZhEkRLeOl8O7f2oO6Vyp5onOW8Gx/tiGTmMSdAdx+xpiMiTGzEb+4HlIjC0Yuqum9 vlvH1jaeD5pyc0A7MkzwTF1tS3+C4c7/BJDVy2EcNOIJ+K0sa0uQdi3JTkqcKQNHbTrD GmPwOjbvPd+zenWNWRopjfCCILOJK+X3s2e5ZADM3x4+F1PaAQlmYUNw1MccneqdVS0y aNpfbofxWhDhS9kDZDr1rZaCa2IIwdQIi3peFwe6TffNoSnvUGORXdsBXjdxpgV9M4cE QxIzlxBuRafzXV9IuPhU7k4bkTcYRDmwOiCjn4THp3MNq66pIyGabt9tIM9ic/8BmUPl 6ydA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NWQkW7oq; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x1-20020a170902820100b001ac482e25a0si10807431pln.374.2023.05.30.02.56.04; Tue, 30 May 2023 02:56:19 -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=@kernel.org header.s=k20201202 header.b=NWQkW7oq; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229608AbjE3Jqu (ORCPT + 99 others); Tue, 30 May 2023 05:46:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229739AbjE3Jqm (ORCPT ); Tue, 30 May 2023 05:46:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B8BBA3; Tue, 30 May 2023 02:46:41 -0700 (PDT) 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 A3619625E7; 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-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,T_SCC_BODY_TEXT_LINE 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 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.