Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2930743pxb; Sat, 6 Feb 2021 12:51:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJykb/s5xjtJiBbEJlyZeFYu6t5xqCG471xkB9i5hDtX9nVSO2ITqjAW2d2RhpVBwJKIpiqx X-Received: by 2002:a05:6402:5206:: with SMTP id s6mr9724136edd.92.1612644712235; Sat, 06 Feb 2021 12:51:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612644712; cv=none; d=google.com; s=arc-20160816; b=DDZ0om4AbWk4w5ieGaoqmERQ1gryHYtSjMGWcTX/ZeOsOl2tyoZLjJ8sE8yjZF/48c mK2iolsiz30wc0QQDMZXTVhjsQyYCrRf8G57IsLg8lP6qF6yFepzECkOIHGaJwP2NF/A DW6RggHqd/Gf/HUy9mO3FDi4RC9zNFgp33GKiSyQqSBb9x6goU41aRdLb7FiQJuF0ClU 0PlqRoARzbs4YWEtTZmxbJF6TqlfAHw+o97d1IbyqQt/eE9/BGbD4yhiciE4eTRi7C7c bVv65UTys0y/RT3epgk1glARSLRuBHR84E6VadCYMYC/uzXboWrrFKAm3qWBKaetFjMS 7qrA== 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=+hjAXsPVbgElgRdj+BZ+6MVnNMTVzcYGHrvtwU1AcCs=; b=o/yZHl04Ymeisaxaj2hnNmSr19cN6udM8i8cP/8o+bCt9u7b2w7Y3+eXslV2iOMGVu wv3z0MDJ439HWsxPouBcWILijlv0ZiOnP4vDXtP0nAlnQDXtdDa1tBNq09po4ui3JCzv BZE2LIbHVSlEMkQURGpPAtQFI8QH1u69LxCOuPEZYs467nf0iNEC2JgrYmlcGFR2lC3D jkDmoh5Vx5rBBLC/he0tHFPFMsPAZrODqM8jI6tP9eU73DThG6T227+svwPmcHqww3sy g/r2cBdRvJlAiG6KzUiKKNhFuXKcYiROYM9mzyTpgb/9ynIJF9mBteDDheafuwMTJezu BANA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PivZDf7v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si4753955edq.365.2021.02.06.12.51.28; Sat, 06 Feb 2021 12:51:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PivZDf7v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229625AbhBFUtK (ORCPT + 99 others); Sat, 6 Feb 2021 15:49:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbhBFUtG (ORCPT ); Sat, 6 Feb 2021 15:49:06 -0500 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 908D9C06178B for ; Sat, 6 Feb 2021 12:47:45 -0800 (PST) Received: by mail-yb1-xb2f.google.com with SMTP id i71so10512212ybg.7 for ; Sat, 06 Feb 2021 12:47:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+hjAXsPVbgElgRdj+BZ+6MVnNMTVzcYGHrvtwU1AcCs=; b=PivZDf7vbfBH6bSgHRaWMYMP8xN20P+lGSInQZfjmRrebl4zG19XOD81h4xHPsxfvN rrEa3VG5KM++VddLx0G0hTtcKmO3HR5nuYYQszPGx7j17MOYIXpprrMbnqMjHCQ16gnh vAAp8M7sh5ngMRXLEvCnpR0SE2eLb/b831luTAfpCMUIl/+mJcASqjF/vSQElaBpCa5G ILxRh/y64IoVeO+zKE/zafs6iW5iGJpNWNeiVO4o5xdYwVvhVcqNHRaL4XC6XStW1r/E jU8CFfUhqfItkbmKMgW8wP9A8yilwS0e3PFFDVjJn3PIqvllgunktYiSTLq9+arpDImJ yCYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+hjAXsPVbgElgRdj+BZ+6MVnNMTVzcYGHrvtwU1AcCs=; b=l0pOO0ihTM92owGbs8a+zL76hqqza1dEdMCFq9T9MHKdYnHu54YnXC0pAArg+mX+hr CchiFznANKOwEcGj0cC95xOHaAgbXMk85ZWz/lm5v612+Ov9RrM4u+aTFye6fmt+XUbA jzwb2QEvjelGxjzCtBk1j2ijafB/TmbBYALDBE3W5+oDq+m7eqCHmqXJWiQ2AqlUMIVT yeBX6LZjXuqK5UntTGiEFE+9aQjnf2oC6HkSQXrDZSgUWmPOj5C36zUe9m8mfh5BX3B3 orSFm+vj3lv7OiHUrZrgmNYhciwMIKEF1JnZYZu7uPRydzxEbKbwgiTf/pRkyRdhKZq4 LNGQ== X-Gm-Message-State: AOAM533I1T1p2EzvODLGhsgmpiPe6dKylEBfjKoTzRKy7CGF/UCG7I7w jxcHgQX07t2Op07uNbK5MTOjmHnKChF4hlXIPRDxSA== X-Received: by 2002:a25:b74c:: with SMTP id e12mr16000102ybm.20.1612644464464; Sat, 06 Feb 2021 12:47:44 -0800 (PST) MIME-Version: 1.0 References: <20210205222644.2357303-1-saravanak@google.com> In-Reply-To: From: Saravana Kannan Date: Sat, 6 Feb 2021 12:47:08 -0800 Message-ID: Subject: Re: [PATCH v4 0/8] Make fw_devlink=on more forgiving To: Geert Uytterhoeven Cc: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Len Brown , Pavel Machek , Michael Turquette , Stephen Boyd , Rob Herring , Frank Rowand , Marc Zyngier , Thomas Gleixner , "open list:DOCUMENTATION" , Linux Kernel Mailing List , Linux PM list , linux-clk , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , ACPI Devel Maling List , Marek Szyprowski , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 6, 2021 at 11:41 AM Geert Uytterhoeven wrote: > > Hi Saravana, > > On Fri, Feb 5, 2021 at 11:26 PM Saravana Kannan wrote: > > There are a lot of devices/drivers where they never have a struct device > > created for them or the driver initializes the hardware without ever > > binding to the struct device. > > > > This series is intended to avoid any boot regressions due to such > > devices/drivers when fw_devlink=on and also address the handling of > > optional suppliers. > > Thanks for your series! > > > Patch 5 sets up a generic API to handle drivers that never bind with > > their devices. > > > > Patch 6 through 8 update different frameworks to use the new API. > > > driver core: fw_devlink: Handle suppliers that don't use driver core > > irqdomain: Mark fwnodes when their irqdomain is added/removed > > PM: domains: Mark fwnodes when their powerdomain is added/removed > > clk: Mark fwnodes when their clock provider is added/removed > > I take it this is an automatic alternative for letting drivers set the > OF_POPULATED flag manually? The frameworks can still continue setting it to avoid creating dead "struct devices" that'll never be used. This new flag handles cases where the device is already created, but will never bind to a driver. So, they are meant to do slightly different things, but the end result is removing the need for individual drivers to set OF_POPULATED (and Rob hates that too). > Is this actually safe? It's not uncommon for a driver to register > multiple providers, sometimes even of different types (clock, genpd, > irq, reset[1], ...). This flag is just an indication that the fwnode has been initialized by a driver. It's okay if the flag gets set multiple times when a driver is registering with multiple frameworks. It's also okay if the flag is cleared multiple times as the driver is uninitializing the hardware (although, this is very unlikely for drivers that don't use device-driver model). When we actually try to create device links, we just check if this happened without a driver actually binding to this device. There's no "probing" race because the "status" I check goes through NO_DRIVER -> PROBING -(registering happens)-> BOUND -> UNBINDING -(deregistering happens) -> NO_DRIVER. So if the fwnode flag is getting set as part of the driver's probe function, the "status" value will never be NO_DRIVER. > Can you be sure consumer drivers do not start probing while their > dependency is still busy registering providers? The code only acts on that flag when trying to create device links from the consumer to the supplier. This is just a way to tell "hey, don't bother creating a device link, this supplier will never bind". So it just avoids blocking the consumer. Doesn't really make the consumers probe earlier than they would have. > [1] Which brings my attention to the fact that devlink does not consider > "resets" properties yet. > Yeah, we can add that and other bindings as we go. -Saravana