Received: by 2002:ac0:c50a:0:0:0:0:0 with SMTP id y10csp995840imi; Fri, 1 Jul 2022 00:11:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ut34nmcQt7gaK7YqfQ4ll7FO0SVVRDV6MW0U/lJr9p8x23CVIAR/ol7I/+3l31tBz5SIsC X-Received: by 2002:a62:83c4:0:b0:527:f3a6:13af with SMTP id h187-20020a6283c4000000b00527f3a613afmr12846204pfe.42.1656659462742; Fri, 01 Jul 2022 00:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656659462; cv=none; d=google.com; s=arc-20160816; b=MExYmZIbT1Rq3tk+1iPcvWc4JcDVJOhTWJLwfBgvHH1eEvSnWMtnIQvTxdZT1eE8on xgP63LfZ+6BhG8awRBoRc3xmeexLrRaFC+k+UDgG/615I4NOxtfz3/8VnM7KXCqC9CBa Ij3FdASGMoCtZjUVk7VPpLkCiN0t7WFvwA/j0G1sRhihgy9adR485QTqPxGRmpx7+9Zo RYlzCEbr13uiFHbA7E/wBdFk6pow7XUXvpIZDtUjDCw7QSeQrFiMu8eMCUeup17l/6W5 9ULRRFxVwTTRRV6DHZaNlKtnbD0Cld7sTh+BC7TeTTWKXCWE16Pz0CNeQh1NfxUeEvMd YDKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3Oxpr/H6WS/cbatfKxunj+Rm+HXq43uwJ9TOx0tf4pg=; b=DLSuozNUnMF1MQ/4MIqHuCn/UzbtiF0tKwt7c7y21mOoDWD6GfdWpanreBYg6dmqdA rNWMLzlg+FjQk2MR3Lzdf3HCBhzSm3qagmZm/0w6NN0s/+4u9woD36V5QQpb/OQZTLZJ dmEBHWu9+nEr+oJQzo1w3/mKmRmcpn9eWvJItVat3+NvDd1VF1RxcHEjFrYmgojY4MJI AEHI1e2apUs5RhA2BI2Nu7rr8cCmVf03MTfFy7COZuHW+UMsWkDaV2e6BrHl2tTnb+SA qAyCh07Ttbn7Zd5/7kTNlBE70UkMqbfK8kZj8ra47xCnvbsTtcwTBp4419UCF1MMhf/3 dedA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=G4+aGmI0; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 141-20020a630093000000b003fbc1902fe6si8942542pga.706.2022.07.01.00.10.31; Fri, 01 Jul 2022 00:11:02 -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=@google.com header.s=20210112 header.b=G4+aGmI0; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235218AbiGAHDF (ORCPT + 99 others); Fri, 1 Jul 2022 03:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235169AbiGAHDB (ORCPT ); Fri, 1 Jul 2022 03:03:01 -0400 Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18E4B677F4 for ; Fri, 1 Jul 2022 00:02:59 -0700 (PDT) Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-3176b6ed923so14527707b3.11 for ; Fri, 01 Jul 2022 00:02:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3Oxpr/H6WS/cbatfKxunj+Rm+HXq43uwJ9TOx0tf4pg=; b=G4+aGmI06EueqwK7C5Qo4w/41Yp3wU/CWyAMnimOU3r1x56NK0xwWd5NnQsEtkPJT1 j1wWR6jutsCmi+xE7hxYUqJNrQrMI+GL07X5ZYgIgqDAqQnMWhF8y5nc40xNPfhYS3jC 0nJhLPxfL1eyodYvq4oKHJFLeueGwA5XPbFVGoQA05bmNWxXq8PGbVqamZrTZs9J6qBh 1fRZx/U4bPFmJBSVu1knm/cNESUDsxYs6X7kurTJA14GFNtyIPF26073epdL9z6eSE2L X78efI4BN3icU+xkSEEQMO42kPgo3k8M7uVN2JrWdQyoK9p0Z0nOVmWHNbnRgASj9y0m xe+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3Oxpr/H6WS/cbatfKxunj+Rm+HXq43uwJ9TOx0tf4pg=; b=vhlVM8Ew5TDDfbPV7AvqYvq6QXhUYYxpxqCJ+M0SeuqbrE0+6DqERJjT8InvWqEMDb AiXuOi5liEYq9EClasL5H/+ud0Nz/TXzIT/hcj7ETo4U8IPzN4Cacg3ee5v09rgSSHLn usDwqV6b93foqfjDx+wvf/d0AorAbHmiPo4uZRX0GFtJwrv0MFVaMhE4whLmV9eD5Cxj fqcYi+47KCYWR2R6Y86Rnr6z9EZLnpiT3V1YktsVwlq/zu9/FW6zMu8mthzfy4e9pgk5 pGEv6ML9ishz/lJMJ2fQ5fY1yitpdGR0StfsmjZc1Ftd0nOfOx/rwGM5mjNndRpoFI+U 1Mtw== X-Gm-Message-State: AJIora/FiPkut/3UmnEUlxnyQ7c/Yot8Ui1BQazAH0c+0O3UCfE2nXwE 0CEIicIeDw3mWsiEfZcuuz1/MbukPp5NXf+KeJ7wgw== X-Received: by 2002:a81:4896:0:b0:317:f767:95f8 with SMTP id v144-20020a814896000000b00317f76795f8mr15214195ywa.218.1656658978077; Fri, 01 Jul 2022 00:02:58 -0700 (PDT) MIME-Version: 1.0 References: <20220601070707.3946847-1-saravanak@google.com> <4799738.LvFx2qVVIh@steina-w> <5265491.31r3eYUQgx@steina-w> In-Reply-To: <5265491.31r3eYUQgx@steina-w> From: Saravana Kannan Date: Fri, 1 Jul 2022 00:02:22 -0700 Message-ID: Subject: Re: (EXT) Re: [PATCH v2 1/9] PM: domains: Delete usage of driver_deferred_probe_check_state() To: Alexander Stein Cc: Tony Lindgren , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Pavel Machek , Joerg Roedel , Will Deacon , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Linus Walleij , Hideaki YOSHIFUJI , David Ahern , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, iommu@lists.linux-foundation.org, netdev@vger.kernel.org, linux-gpio@vger.kernel.org, Geert Uytterhoeven Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Thu, Jun 30, 2022 at 11:02 PM Alexander Stein wrote: > > Hi Saravana, > > Am Freitag, 1. Juli 2022, 02:37:14 CEST schrieb Saravana Kannan: > > On Thu, Jun 23, 2022 at 5:08 AM Alexander Stein > > > > wrote: > > > Hi, > > > > > > Am Dienstag, 21. Juni 2022, 09:28:43 CEST schrieb Tony Lindgren: > > > > Hi, > > > > > > > > * Saravana Kannan [700101 02:00]: > > > > > Now that fw_devlink=on by default and fw_devlink supports > > > > > "power-domains" property, the execution will never get to the point > > > > > where driver_deferred_probe_check_state() is called before the > > > > > supplier > > > > > has probed successfully or before deferred probe timeout has expired. > > > > > > > > > > So, delete the call and replace it with -ENODEV. > > > > > > > > Looks like this causes omaps to not boot in Linux next. With this > > > > simple-pm-bus fails to probe initially as the power-domain is not > > > > yet available. On platform_probe() genpd_get_from_provider() returns > > > > -ENOENT. > > > > > > > > Seems like other stuff is potentially broken too, any ideas on > > > > how to fix this? > > > > > > I think I'm hit by this as well, although I do not get a lockup. > > > In my case I'm using > > > arch/arm64/boot/dts/freescale/imx8mq-tqma8mq-mba8mx.dts and probing of > > > 38320000.blk-ctrl fails as the power-domain is not (yet) registed. > > > > Ok, took a look. > > > > The problem is that there are two drivers for the same device and they > > both initialize this device. > > > > gpc: gpc@303a0000 { > > compatible = "fsl,imx8mq-gpc"; > > } > > > > $ git grep -l "fsl,imx7d-gpc" -- drivers/ > > drivers/irqchip/irq-imx-gpcv2.c > > drivers/soc/imx/gpcv2.c > > > > IMHO, this is a bad/broken design. > > > > So what's happening is that fw_devlink will block the probe of > > 38320000.blk-ctrl until 303a0000.gpc is initialized. And it stops > > blocking the probe of 38320000.blk-ctrl as soon as the first driver > > initializes the device. In this case, it's the irqchip driver. > > > > I'd recommend combining these drivers into one. Something like the > > patch I'm attaching (sorry for the attachment, copy-paste is mangling > > the tabs). Can you give it a shot please? > > I tried this patch and it delayed the driver initialization (those of UART as > well BTW). Unfortunately the driver fails the same way: Thanks for testing the patch! > > [ 1.125253] imx8m-blk-ctrl 38320000.blk-ctrl: error -ENODEV: failed to > attach power domain "bus" > > More than that it even introduced some more errors: > > [ 0.008160] irq: no irq domain found for gpc@303a0000 ! So the idea behind my change was that as long as the irqchip isn't the root of the irqdomain (might be using the terms incorrectly) like the gic, you can make it a platform driver. And I was trying to hack up a patch that's the equivalent of platform_irqchip_probe() (which just ends up eventually calling the callback you use in IRQCHIP_DECLARE(). I probably made some mistake in the quick hack that I'm sure if fixable. > > [ 0.013251] Failed to map interrupt for > > /soc@0/bus@30400000/timer@306a0000 However, this timer driver also uses TIMER_OF_DECLARE() which can't handle failure to get the IRQ (because it's can't -EPROBE_DEFER). So, this means, the timer driver inturn needs to be converted to a platform driver if it's supposed to work with the IRQCHIP_DECLARE() being converted to a platform driver. But that's a can of worms not worth opening. But then I remembered this simpler workaround will work and it is pretty much a variant of the workaround that's already in the gpc's irqchip driver to allow two drivers to probe the same device (people really should stop doing that). Can you drop my previous hack patch and try this instead please? I'm 99% sure this will work. diff --git a/drivers/irqchip/irq-imx-gpcv2.c b/drivers/irqchip/irq-imx-gpcv2.c index b9c22f764b4d..8a0e82067924 100644 --- a/drivers/irqchip/irq-imx-gpcv2.c +++ b/drivers/irqchip/irq-imx-gpcv2.c @@ -283,6 +283,7 @@ static int __init imx_gpcv2_irqchip_init(struct device_node *node, * later the GPC power domain driver will not be skipped. */ of_node_clear_flag(node, OF_POPULATED); + fwnode_dev_initialized(domain->fwnode, false); return 0; } -Saravana