Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp110420rdb; Wed, 21 Feb 2024 19:47:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWBvEPwmrEK0bkjJLIJFfLR6vYCa/YfRDn6rIMezBp7hqJcMVHcqE1hShn5WB+at/PhhgX697iq2aiYM0Un9+TwbLaV37yDo9rwLUm1xw== X-Google-Smtp-Source: AGHT+IHSiGHRRsbUjz+SqAKjEor3dWTvbd2C9LlcswdMDdt7vqbkvUlpZqEcO4KXjWPWzxk8iWUj X-Received: by 2002:a17:906:1cc1:b0:a3f:54a1:565c with SMTP id i1-20020a1709061cc100b00a3f54a1565cmr1022875ejh.27.1708573653677; Wed, 21 Feb 2024 19:47:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708573653; cv=pass; d=google.com; s=arc-20160816; b=kIy5vt0eOPjUqCVKxa5Ua/6lqgmFvbO0ldb7T/RNEYjjJDx+FFZGwkH11lI2Z4Hcdu lmd4MaRPQJsApsHefV7sChZTgw8PsNTQRdktq8vdq8YngdzuW3y3X0l56YMbJLVll7mi YT7XIvkDkL7hcdNGDAPwUh67JHV+6QpPRT27hUrmqFezqWQIbREjBtyBj9Aq7Dps+y3Q h3Lk1oLKajOx9/Hj7q2e8eprOGNqgWiKH7l33zjG8CvVP68aOpqJ5xVzv0gcm77eFOnO Trskdzvm5m99jr63Vsh27Xo7n6pIFVJTVapvDW7WV4i05SYCi+qWs0G9kCQl5RIXFUm2 blow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=wH33w5aG2BffksVtrB54fX5fBHp+P/Q2DjXoHgc9nyE=; fh=/14qnK6Avln9/TQlMrdxc68LfOedtAVTUVRvRF1AxGA=; b=MYBHqSAKZs4lfabz7sHbH0jGO2uIlaUBVe6OJEA+2vDXAEN1i70YDBItsaa+ia2BoP PtBTXiIdAj/s3xmG7Dmmo6gG99fUxnohf7PIBSRmxxZ45mU/K+qgTGI/k1QlmW8CQzcV 29ZASnyq254+OcEXdERLHE0BYoZ9aCJ5EpCZcIFYTNa9HPwRkhk9kWKL0OxK/C0r5PRG KF6/kquDpwhyJ3+NXyg9WwviLuOedDgrwRYPyaQxkTLU38HIERKzysMENpYO34sOgNgm PBg22MwXkgrhrjgN0732RTI6AoDO5FdnFI4NOLpAgpEHk2GcCVVpdZzw70dgD/HMbOcR I6fA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=eKdfwIsH; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qa36-20020a17090786a400b00a3f102e97b9si1912959ejc.157.2024.02.21.19.47.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:47:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=eKdfwIsH; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75871-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 564B71F21B8D for ; Thu, 22 Feb 2024 03:47:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88A4317755; Thu, 22 Feb 2024 03:46:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="eKdfwIsH" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9169B1B599 for ; Thu, 22 Feb 2024 03:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708573602; cv=none; b=EQ1hMcqPnIG1b97n+WoDXpVqIvCb8/F6mlmE3oCP0SJTX1UtL2gwgUacGYWZf5jwAX4y7TzpiYHKw8frbk4q8M0goND4D8/jVnHyXgKoHtuk8S/Dvw20QZ9EVhL02Ug8CMxgge1JdK4jRTV8mwGUjDUNop4FeyG08GT+Sj9ufZo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708573602; c=relaxed/simple; bh=cp0XJ1vg7N+tq7T/hQqrmLoRlQ0Tu1sLQF3XCorNNhs=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=Eme08yPV1iPSrdNEbpTM0Tl0T9JMs8NuPi+gaBG4B+aXAlbTafNrmqImpfAVoclaJyXrj+8+RoltAeuHdA0wk7eFp6xwSgClhq6dWZn6GB/5pNaW7C5T8wHp49ErRwDu4vda8Ev+Pkm+JDmuh427GKu+Bm98vWlItMUG/OaBVRk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=eKdfwIsH; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-602dae507caso122707567b3.0 for ; Wed, 21 Feb 2024 19:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708573598; x=1709178398; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=wH33w5aG2BffksVtrB54fX5fBHp+P/Q2DjXoHgc9nyE=; b=eKdfwIsH5w8eFcUFGOrDNG/nCGjXPZf/pnkbbo2V+M9kBdTsxftXqvex1bZH3QyPej vf5qtS1JqXIFAxAKDryQ3FdMVe6Mp+0bq/8FakzEjuZ6Ayub6tPlOUjT267kX4ZXMWe1 OVgbXZVa9Koexehbjaw2ii3FHjPNqATNH3DqUJwaQ7ORk+WovRD8rb/d+jknFyyxFFwA nWq3UA2LLLkKlzygJIKHDrR0Vj5AdeuXqgQvGe7tJ6P0tkyO0ECvctCa/9cKqJQpvFbM 2dAbDJMzfQWssNIDHl5xALh9sYW4wMQ0iiw5i9lvYtzMDQGjc7nG8a5ZB2zfrmHCbW4P mo8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708573598; x=1709178398; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wH33w5aG2BffksVtrB54fX5fBHp+P/Q2DjXoHgc9nyE=; b=H622Cml7eW0Wl3kdOmp9FoFgqjMX6U9hjc5jR7pqPvJpGxqO/HdvboOUsKXXZoesA3 SKu//8hfRzwGSLQYYSfFXVe4kqgAeREzbjmXXHZLtLh14y3wP4lV5jwpXZSGXH/QIslK 4FWOpGYP68xZhFHHOQ1diqdWK0GWVD6pji2jkMLY0dgObtJ1T5rWGgw83h2sFSNAP0YD uSrm0jo0UmU2DTDj3ZzbxQHJdclAH9TBasUdPXxQ8fdDFKFVc5S9JCrTCKZDaRXPN2es Kiau4ZWMFX0TS3+T1yLiSf23i6tViyXnpni3JuGiTKa38L7EGwpJcU/Pv6WCsJd+uK/U l6Fg== X-Forwarded-Encrypted: i=1; AJvYcCWnSdDqzyeenTvvc2WCwNpJmDOxuwKWRDEabsH3s15n/G/hxOH8J2IH0c8LnP1FuFiwVq6cgbz4Ag2UIvaqxKWgPbSx1guVrBLqrC0r X-Gm-Message-State: AOJu0Yz9PQeSZ2PFiGfkWVJtEeA5ZL75Q9Ps6hSCMjqY3OalowQL9jEU NVG0Y8HQJxmBKBJU5UPrNKp9KzkU1uFq9mLIz/uJUXar9E5ESrTBfO80pii8p7aDrF5kCRCnNne dO/firH12995lqw== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:451c:c6c5:1fb1:a2a1]) (user=saravanak job=sendgmr) by 2002:a25:ef09:0:b0:dc6:53c3:bcbd with SMTP id g9-20020a25ef09000000b00dc653c3bcbdmr325368ybd.7.1708573598675; Wed, 21 Feb 2024 19:46:38 -0800 (PST) Date: Wed, 21 Feb 2024 19:46:21 -0800 In-Reply-To: <20240222034624.2970024-1-saravanak@google.com> Message-Id: <20240222034624.2970024-4-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240222034624.2970024-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Subject: [PATCH v4 3/4] dt-bindings: Add post-init-providers property From: Saravana Kannan To: Saravana Kannan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , "Rafael J. Wysocki" , Ard Biesheuvel , Frank Rowand , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Len Brown Cc: kernel-team@android.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-efi@vger.kernel.org, linux-acpi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" The post-init-providers property can be used to break a dependency cycle by marking some provider(s) as a post device initialization provider(s). This allows an OS to do a better job at ordering initialization and suspend/resume of the devices in a dependency cycle. Signed-off-by: Saravana Kannan --- .../bindings/post-init-providers.yaml | 105 ++++++++++++++++++ MAINTAINERS | 13 ++- 2 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/post-init-providers.yaml diff --git a/Documentation/devicetree/bindings/post-init-providers.yaml b/Documentation/devicetree/bindings/post-init-providers.yaml new file mode 100644 index 000000000000..92eb9a027443 --- /dev/null +++ b/Documentation/devicetree/bindings/post-init-providers.yaml @@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (c) 2020, Google LLC. All rights reserved. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/post-init-providers.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Post device initialization providers + +maintainers: + - Saravana Kannan + +description: | + This property is used to indicate that the device(s) pointed to by the + property are not needed for the initialization of the device that lists this + property. This property does not make a device (that's previously not a + provider) into a provider. It simply downgrades an existing provider to a + post device initialization provider. + + A device can list its providers in devicetree using one or more of the + standard devicetree bindings. By default, it is assumed that the provider + device can be initialized before the consumer device is initialized. + + However, that assumption cannot be made when there are cyclic dependencies + between devices. Since each device is a provider (directly or indirectly) of + the others in the cycle, there is no guaranteed safe order for initializing + the devices in a cycle. We can try to initialize them in an arbitrary order + and eventually successfully initialize all of them, but that doesn't always + work well. + + For example, say, + * The device tree has the following cyclic dependency X -> Y -> Z -> X (where + -> denotes "depends on"). + * But X is not needed to fully initialize Z (X might be needed only when a + specific functionality is requested post initialization). + + If all the other -> are mandatory initialization dependencies, then trying to + initialize the devices in a loop (or arbitrarily) will always eventually end + up with the devices being initialized in the order Z, Y and X. + + However, if Y is an optional provider for X (where X provides limited + functionality when Y is not initialized and providing its services), then + trying to initialize the devices in a loop (or arbitrarily) could end up with + the devices being initialized in the following order: + + * Z, Y and X - All devices provide full functionality + * Z, X and Y - X provides partial functionality + * X, Z and Y - X provides partial functionality + + However, we always want to initialize the devices in the order Z, Y and X + since that provides the full functionality without interruptions. + + One alternate option that might be suggested is to have the driver for X + notice that Y became available at a later point and adjust the functionality + it provides. However, other userspace applications could have started using X + with the limited functionality before Y was available and it might not be + possible to transparently transition X or the users of X to full + functionality while X is in use. + + Similarly, when it comes to suspend (resume) ordering, it's unclear which + device in a dependency cycle needs to be suspended/resumed first and trying + arbitrary orders can result in system crashes or instability. + + Explicitly calling out which link in a cycle needs to be broken when + determining the order, simplifies things a lot, improves efficiency, makes + the behavior more deterministic and maximizes the functionality that can be + provided without interruption. + + This property is used to provide this additional information between devices + in a cycle by telling which provider(s) is not needed for initializing the + device that lists this property. + + In the example above, Z would list X as a post-init-providers and the + initialization dependency would become X -> Y -> Z -/-> X. So the best order + to initialize them becomes clear: Z, Y and then X. + +select: true + +properties: + post-init-providers: + # One or more providers can be marked as post initialization provider + description: + List of phandles to providers that are not needed for initializing or + resuming this device. + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + maxItems: 1 + +additionalProperties: true + +examples: + - | + gcc: clock-controller@1000 { + compatible = "vendor,soc4-gcc", "vendor,soc1-gcc"; + reg = <0x1000 0x80>; + clocks = <&dispcc 0x1>; + #clock-cells = <1>; + post-init-providers = <&dispcc>; + }; + dispcc: clock-controller@2000 { + compatible = "vendor,soc4-dispcc", "vendor,soc1-dispcc"; + reg = <0x2000 0x80>; + clocks = <&gcc 0xdd>; + #clock-cells = <1>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 9ed4d3868539..feec740239c9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6060,12 +6060,6 @@ S: Maintained F: drivers/base/devcoredump.c F: include/linux/devcoredump.h -DEVICE DEPENDENCY HELPER SCRIPT -M: Saravana Kannan -L: linux-kernel@vger.kernel.org -S: Maintained -F: scripts/dev-needs.sh - DEVICE DIRECT ACCESS (DAX) M: Dan Williams M: Vishal Verma @@ -8300,6 +8294,13 @@ F: include/linux/firewire.h F: include/uapi/linux/firewire*.h F: tools/firewire/ +FIRMWARE DEVICE LINK (fw_devlink) +M: Saravana Kannan +L: linux-kernel@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/post-init-providers.yaml +F: scripts/dev-needs.sh + FIRMWARE FRAMEWORK FOR ARMV8-A M: Sudeep Holla L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -- 2.44.0.rc0.258.g7320e95886-goog