From patchwork Fri Jan 27 00:11:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 4607 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp558648wrn; Thu, 26 Jan 2023 16:14:20 -0800 (PST) X-Google-Smtp-Source: AK7set/wHPth4+Zz0HKMUT2PUVeQVbQpyDDoxf3raO4Ii5abkuwnoc6fGXIuDHisHo4dzQCjfqqp X-Received: by 2002:a05:6a00:786:b0:592:5032:30c1 with SMTP id g6-20020a056a00078600b00592503230c1mr2340881pfu.17.1674778459695; Thu, 26 Jan 2023 16:14:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674778459; cv=none; d=google.com; s=arc-20160816; b=DNlYajcPk4OeDsZeUsHuABAwoCrUWw8xW+UtwVKs/46W3wrfrPNw5OID30kVJTa3bO PhayHEGKllkocFzZ6oFREwYTzveOQKJv3hlpPXyp8XhdY0OfJd3advwbe8ReNgsLrlrb BP2x8odghEOc7voYw0TaHOUSieSeBP92cX0wFE1on3oS67RphOnAPQHxdymkrKInTELC BIv8kICGhXZspiXnJwbceEu0m5biK21Kv7zMdCgSDL/nenKDY5UKEWfDyFTEs0G+bIv8 O3C6Z+6h6JhVasYhAGTJKLXEIpcUttqKET6eNX+KFzrGmgVbKkm6JQbWIPIlgWtY2rhg 0/0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=h6fKpqor2jTotXSn3372bFcG4CpzS45+gNVV/kwVyH8=; b=aNR8I59GcxkYEkbXp0FwiwnlzozeKkGbHPMdDc3fnGC2JOhvAA12AvC1CIFl8qr2z3 j/ufSljtXy5gQw9tMr0IfZcNURnulvQBHy9zIno0f8hp93bMi5MYK2J/VpKj84nXaelg 3Dxp1dsAOG9uqLoipvCrAWGsMTUYw/Clr9xWhONXlubZdlCsUr2y8UrcA73s6P/A7Tvs EhrzWgdt5nvYnKpD3U1znnbaXgSyFVjvl8EKbV3gGCDdEHBKEkWEiD+uKSxGa+5JqB6o knZCDHLNJQJmMyQtpdDgBpXS/m821wOVlqDUdj/IZgaNP0G2CVOAr4JNfvgJb86/mR8X MjJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=T8nzXdhv; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j184-20020a6255c1000000b0058de6e19a35si2490641pfb.279.2023.01.26.16.14.07; Thu, 26 Jan 2023 16:14:19 -0800 (PST) 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=T8nzXdhv; 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 S232356AbjA0ALt (ORCPT + 99 others); Thu, 26 Jan 2023 19:11:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231854AbjA0ALr (ORCPT ); Thu, 26 Jan 2023 19:11:47 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86EC13D for ; Thu, 26 Jan 2023 16:11:45 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id n203-20020a2572d4000000b0078f09db9888so3645495ybc.18 for ; Thu, 26 Jan 2023 16:11:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=h6fKpqor2jTotXSn3372bFcG4CpzS45+gNVV/kwVyH8=; b=T8nzXdhvva6D8ItxjLauAJb7Lyid2FP9CiV7mBEHmzqXkhpihBiea+Ioio0cAu8xfk 38uctdNEzdnoayDngTT6u5jAB3K9SyCqO69ZHzu6SQIT4G1/4H8n5lUhteIFoEcLkrd/ NC7bGETX0A7PnfR5ScrGUjnQD80Sz0m7kXCTUVUqTJKM5nBtRvjssVXvElskyh9nOA5B kSA2Howr4hDZAHM9Lbx9b8nMy3QluBCPXDiZJRb7hYpVpwWoEHcmduWXSpIpEiJh192d rm10BYlry79ywPtc9qUZQs6Ng4FGlUz3MjWb+CD/PKIna5stlSnhXFhB/d+N00jJdvc2 wtTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=h6fKpqor2jTotXSn3372bFcG4CpzS45+gNVV/kwVyH8=; b=RxQRnXjG/Tt+XZY+0YeLG6NV6PndepGXMAmvDx/KwmBPULwRdFhlUbFPQcszYETDGl iOmnbpgoHty6xYHy+lfVk5RgaKgjL58r14m6jGGtBI+0ElVVN6xfY2sf4yl30JPLBWKF 2bSZGQ35odFEtcgzTwZ43tcp4pDvFWb/RU1r5KEscqbh7uaedk3oorRpeLWQUco7KQ83 oS5wM3w762VCAJ/imNSDN8MCqa40bKjmEWA7D80/umX3uS9mP/F8ui+jCN2FE4N92oA7 anOXxvI5PgM6Qoqc9UnxaJGMz8ZcVjXIA9lAVVTf0WvwPc38ZUx/nxvrRVgnU4Pg9Y7e TqQQ== X-Gm-Message-State: AO0yUKUqXnAGZIroZsgByaBdHrkOkEJTzqwPyWdQV/Vpg0aW2wC5RpDj cVxeyAZinwUtBeaZG5Np8x5g1f4ajKoCY0c= X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:c3b4:8b1c:e3ee:3708]) (user=saravanak job=sendgmr) by 2002:a25:df86:0:b0:80b:7fa3:d33f with SMTP id w128-20020a25df86000000b0080b7fa3d33fmr1197459ybg.599.1674778304965; Thu, 26 Jan 2023 16:11:44 -0800 (PST) Date: Thu, 26 Jan 2023 16:11:27 -0800 Message-Id: <20230127001141.407071-1-saravanak@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Subject: [PATCH v2 00/11] fw_devlink improvements From: Saravana Kannan To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Sudeep Holla , Cristian Marussi , Linus Walleij , Bartosz Golaszewski , Thomas Gleixner , Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rob Herring , Frank Rowand , Geert Uytterhoeven , Magnus Damm , Len Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Saravana Kannan Cc: Tony Lindgren , Linux Kernel Functional Testing , Naresh Kamboju , Abel Vesa , Alexander Stein , Geert Uytterhoeven , John Stultz , Doug Anderson , Guenter Roeck , Dmitry Baryshkov , Maxim Kiselev , Maxim Kochetkov , Miquel Raynal , Luca Weiss , Colin Foster , Martin Kepplinger , Jean-Philippe Brucker , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-acpi@vger.kernel.org X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756132498214039817?= X-GMAIL-MSGID: =?utf-8?q?1756132498214039817?= This patch series improves fw_devlink in the following ways: 1. It no longer cares about a fwnode having a "compatible" property. It figures this our more dynamically. The only expectation is that fwnode that are converted to devices actually get probed by a driver for the dependencies to be enforced correctly. 2. Finer grained dependency tracking. fw_devlink will now create device links from the consumer to the actual resource's device (if it has one, Eg: gpio_device) instead of the parent supplier device. This improves things like async suspend/resume ordering, potentially remove the need for frameworks to create device links, more parallelized async probing, and better sync_state() tracking. 3. Handle hardware/software quirks where a child firmware node gets populated as a device before its parent firmware node AND actually supplies a non-optional resource to the parent firmware node's device. 4. Way more robust at cycle handling (see patch for the insane cases). 5. Stops depending on OF_POPULATED to figure out some corner cases. 6. Simplifies the work that needs to be done by the firmware specific code. Sorry it took a while to roll in the fixes I gave in the v1 series thread[1] into a v2 series. Since I didn't make any additional changes on top of what I already gave in the v1 thread and Dmitry is very eager to get this series going, I'm sending it out without testing locally. I already tested these patches a few months ago as part of the v1 series. So I don't expect any major issues. I'll test them again on my end in the next few days and will report here if I actually find anything wrong. Tony, Naresh, Abel, Sudeep, Geert, I got the following reviewed by's and tested by's a few months back, but it's been 5 months since I sent out v1. So I wasn't sure if it was okay to include them in the v2 commits. Let me know if you are okay with this being included in the commits and/or if you want to test this series again. Reviewed-by: Tony Lindgren Tested-by: Tony Lindgren Tested-by: Linux Kernel Functional Testing Tested-by: Naresh Kamboju Tested-by: Abel Vesa Tested-by: Sudeep Holla Tested-by: Geert Uytterhoeven Dmitry, Maxim(s), Miquel, Luca, Doug, Colin, Martin, Jean-Philippe, I've Cc-ed you because I had pointed you to v1 of this series + the patches in that thread at one point or another as a fix to some issue you were facing. It'd appreciate it if you can test this series and report any issues, or things it fixed and give Tested-bys. In addition, if you can also apply a revert of this series[2] and delete driver_deferred_probe_check_state() from your tree and see if you hit any issues and report them, that'd be great too! I'm pretty sure some of you will hit issues with that. I want to fix those next and then revert[2]. Thanks, Saravana [1] - https://lore.kernel.org/lkml/20220810060040.321697-1-saravanak@google.com/ [2] - https://lore.kernel.org/lkml/20220819221616.2107893-1-saravanak@google.com/ [3] - https://lore.kernel.org/lkml/CAGETcx-JUV1nj8wBJrTPfyvM7=Mre5j_vkVmZojeiumUGG6QZQ@mail.gmail.com/ v1 -> v2: - Fixed Patch 1 to handle a corner case discussed in [3]. - New patch 10 to handle "fsl,imx8mq-gpc" being initialized by 2 drivers. - New patch 11 to add fw_devlink support for SCMI devices. Cc: Abel Vesa Cc: Alexander Stein Cc: Tony Lindgren Cc: Sudeep Holla Cc: Geert Uytterhoeven Cc: John Stultz Cc: Doug Anderson Cc: Guenter Roeck Cc: Dmitry Baryshkov Cc: Maxim Kiselev Cc: Maxim Kochetkov Cc: Miquel Raynal Cc: Luca Weiss Cc: Colin Foster Cc: Martin Kepplinger Cc: Jean-Philippe Brucker Saravana Kannan (11): driver core: fw_devlink: Don't purge child fwnode's consumer links driver core: fw_devlink: Improve check for fwnode with no device/driver soc: renesas: Move away from using OF_POPULATED for fw_devlink gpiolib: Clear the gpio_device's fwnode initialized flag before adding driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links driver core: fw_devlink: Allow marking a fwnode link as being part of a cycle driver core: fw_devlink: Consolidate device link flag computation driver core: fw_devlink: Make cycle detection more robust of: property: Simplify of_link_to_phandle() irqchip/irq-imx-gpcv2: Mark fwnode device as not initialized firmware: arm_scmi: Set fwnode for the scmi_device drivers/base/core.c | 443 +++++++++++++++++++++----------- drivers/firmware/arm_scmi/bus.c | 2 + drivers/gpio/gpiolib.c | 6 + drivers/irqchip/irq-imx-gpcv2.c | 1 + drivers/of/property.c | 84 +----- drivers/soc/imx/gpcv2.c | 1 + drivers/soc/renesas/rcar-sysc.c | 2 +- include/linux/device.h | 1 + include/linux/fwnode.h | 12 +- 9 files changed, 332 insertions(+), 220 deletions(-) Tested-by: Colin Foster Reported-by: Linux Kernel Functional Testing