Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4790752rwd; Tue, 30 May 2023 09:55:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4m3DEriommaCZR/uG9D38n+I/ZirpZ2XyySAC6vzYEguo/8s84DHYskqTHerMKWfJTz/WK X-Received: by 2002:a17:90a:7e14:b0:256:5abf:105c with SMTP id i20-20020a17090a7e1400b002565abf105cmr3195685pjl.46.1685465744660; Tue, 30 May 2023 09:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685465744; cv=none; d=google.com; s=arc-20160816; b=M9pzA/RQOXar3ZNyQIcCrFQ+v5tavDgib0/+Zg6mHOjWfNXUiVSCdw5lj0gVNkzDeB /isfdxSpE7qejw9CW6QgXmwlpajVOUFojsjTCOFE9KnwI9s31lfOW1KRToqZgroOajX6 3rayv2a6dKZIQ1BpPTT6+EUY/jo0VU8zlGSmhpnBgNc9/uOE4OVtxK+Bcbo/g5KOmUSC /JUkwIRxCONA6L+Se4/KcOkBhRWUc1s577Wjd0fshdw4rdFIWKuFqoVu6uWHA53weMsg riI1DrmIq/KCMd7cX0Ab1+Waf2h1/5s7Qf8G3m9B/Co8Ig4QLyd4EkQMi1iA1fb5f1cr 3ELg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=XmljBxLjijPPRFlX5mO8wqHeqzDYN0rcYWjJkP07F34=; b=bi5aFuFe2Fz73gCXBFXyg9vdK80RX3ClrA8kHZv6I3a0mo62YZxV+ZaxUc2FG0CqGr 9RlPk/5myWnSmOTl0VqyPIKaqEenSfb7rKNqKk5n+7TvCM0PXVGcxyFNDgvX52Z0dKEH ITMfKHF3FjPedKwVz9dOO5Cx1mfiqTjXIGxtTACHTgW/Bb9ChqBzdlqylz6Pckz9vDH0 xf3FTx7m43NAHam6gY48aS8SueOeS+rpgjR5Eotj5QMGZ6pY9Y9t04Q/H0kQFkgGuR2q ORCj52tV+wdPvy01hERz7VcLS1DTEMYbDvdcc56nwVSWk6MWP3Og2kcvPXxBfZKBW6g9 ZgiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NHoWLT+l; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a17090a991200b0024686879af0si1973136pjp.169.2023.05.30.09.55.32; Tue, 30 May 2023 09:55:44 -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=@chromium.org header.s=google header.b=NHoWLT+l; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232386AbjE3QhU (ORCPT + 99 others); Tue, 30 May 2023 12:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbjE3QhS (ORCPT ); Tue, 30 May 2023 12:37:18 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E288F7 for ; Tue, 30 May 2023 09:37:09 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-53f70f7c2d2so1917490a12.3 for ; Tue, 30 May 2023 09:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685464628; x=1688056628; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XmljBxLjijPPRFlX5mO8wqHeqzDYN0rcYWjJkP07F34=; b=NHoWLT+l8y30+8KojH2SRMRDTxMrZHFJhQn7S2Toq69wa/LlbcKJE6IhF2ZMzx9SDp dK9LoPCsEM6VZi2zqniJvlVdyDnFnoUi5FzAsKrgPhp4oVMgr9B2V7uimLUyp8bx9Xzz UXGqP/4NcFjcZfA9O19RdWqqr+zm469inPAUA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685464628; x=1688056628; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XmljBxLjijPPRFlX5mO8wqHeqzDYN0rcYWjJkP07F34=; b=V1TjoZbsUJDUpLgLu6NErbVOLWrNKJInwnf5YOknOCHNbN9CNlVMXkHvnVcbQGPTsX UKWAEAVqxeWgGO3vI1ZXLaeDpOd+0z0C98qdD8Dz+U65d7prVLZvhxpZCOQzkRy9OdPP u87GlB1pQ1czBVD3ZCFqctotohyhUfvsBVQWS5th9Qiwegqi9/EWP9oiq5SC1OA1xdrG bUNv18oRzbcQmkR8W81XpCYo/TVxJCB32NU+1BeA5Y9l8KeuzzP2C1v/VfbueOGwibjM SsR3/FMgmRPKp/jDN6342AsY9i77Yqb9qqWTwd/o1C1mhHyQTSFUMS83EKALVvwMyiNk 2ZBQ== X-Gm-Message-State: AC+VfDzBliYwwCO76jM5Clr1s5LKVELjInKa3V7Cwqs7T4SMQjBNZspk 1Frm6XDR0ASWNmSdwUzSag3yX+3jIkWR5nmUr2w= X-Received: by 2002:a17:903:41c1:b0:1b0:6541:91c2 with SMTP id u1-20020a17090341c100b001b0654191c2mr2490419ple.63.1685464628127; Tue, 30 May 2023 09:37:08 -0700 (PDT) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com. [209.85.214.170]) by smtp.gmail.com with ESMTPSA id i14-20020a17090332ce00b001ab0083c6c9sm5193444plr.261.2023.05.30.09.37.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 May 2023 09:37:07 -0700 (PDT) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1b025aaeddbso339485ad.1 for ; Tue, 30 May 2023 09:37:07 -0700 (PDT) X-Received: by 2002:a05:6e02:1d1e:b0:33b:4a8c:2147 with SMTP id i30-20020a056e021d1e00b0033b4a8c2147mr183809ila.8.1685464606562; Tue, 30 May 2023 09:36:46 -0700 (PDT) MIME-Version: 1.0 References: <20230515131353.v2.cover@dianders> <20230515131353.v2.2.I88dc0a0eb1d9d537de61604cd8994ecc55c0cac1@changeid> <868rd6cfsy.wl-maz@kernel.org> In-Reply-To: <868rd6cfsy.wl-maz@kernel.org> From: Doug Anderson Date: Tue, 30 May 2023 09:36:34 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/5] irqchip/gic-v3: Disable pseudo NMIs on Mediatek devices w/ firmware issues To: Marc Zyngier Cc: Geert Uytterhoeven , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 Hi, On Tue, May 30, 2023 at 2:46=E2=80=AFAM Marc Zyngier wrote= : > > On Tue, 30 May 2023 09:29:02 +0100, > Geert Uytterhoeven wrote: > > > > Hi Douglas, > > > > 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 GICv= 3 > > > 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 > > > > 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. > > > > This causes enabling an unrelated workaround on R-Car V4H: > > > > GIC: enabling workaround for GICv3: Cavium erratum 38539 > > > > > --- 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; > > > > 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-c= ommon.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; Sorry for missing this and thanks for the fix. Looks like this is already committed, but in case it matters: Reviewed-by: Douglas Anderson