Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp19479rdb; Wed, 21 Feb 2024 15:31:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWhmuhuNxExoyjaRxhqZNTA8Oedr3KiSNqNmuIJ1D6LlrZzrHM6HLeUDhg1oSHFjdiuUBFsHeRA0gThxbqJHBsvtjSLgmzHkK92rCinSg== X-Google-Smtp-Source: AGHT+IGlBSoP1oF66V7Cs5Gjm7QHh0aOPqZIY/5nFFZulZV580yM5c/eiJHq3ivzX6o5WfCu7Dkf X-Received: by 2002:a5b:289:0:b0:dc2:5400:e33c with SMTP id x9-20020a5b0289000000b00dc25400e33cmr835447ybl.15.1708558289398; Wed, 21 Feb 2024 15:31:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708558289; cv=pass; d=google.com; s=arc-20160816; b=nP0c9ulC74KBlb62yGJLJOM5RKxgIa8DPc7v7m6zDvkCbWI/dhxySB9iPAkQvLp1KO eO5msE3ah+7RS02r8XYv0vsIo8sSjIgyp4iubzSLYlfEgNPtKuKpahn6FQ5azhF9tqYQ ua55sk2UHe5Qs+Q8hoFQyGG1twNDZ0X3r28U0AhhkNmvx+7QKYZUmG5fzv7c3GjHQJMT sQAoYp9rDECC7ehgSOoaBgUN/O+DGlhhcLaipm8VrDBJObEtSADyr/Mcbg7nqlusj+lF dEekljGCukzyWbGBVVLeUt16LzLHtYP+tLSSwKXIdMC4X2N0pX5y3u+w+SWvpkguOTyV YvTg== 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=vosJNO3Zn4Xnibp+U/swV64D06bjeRMU8MziMRFin+Y=; fh=7bo5UXIqgTG/iosRGm5HvaMubh7ETKlNT+Z69G+WXkc=; b=JbbPqKAi3PRYXAqbxKgFDZ50x1IjHh1K1kOQEur92Nrf2EzussdA2UHZYK96+xqo5Z cFlj7Y52np2EfqOq4nwc4yuMvu69fAZuMEzzBpLO4Az7kTBJ0q3ebOzpUC/fsgBJjvHQ INEgOGjFHuTHX1h3FL9BvPMN1O0ON9UeHTryiXwiM/YcscxqKHqMdz6B1D9eBU9fg+CK X5qiaa79txanQHjgoYd/Wo29NWHFHFzrYj3Ta8lHSsk9/SUKLI8Jg1oc2dEnaQoEXkFM bgbMFW1R3UG5sGUIiFpU+TNv+4Od71dYGMmErVyYZ5iYY1kZhEu8MlYF+ZiW6z3+APyR 3lyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AtDxyuo1; 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-75658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75658-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id br43-20020a05620a462b00b007875551f13bsi12019822qkb.728.2024.02.21.15.31.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 15:31:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AtDxyuo1; 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-75658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75658-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id F292B1C2279E for ; Wed, 21 Feb 2024 23:31:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E41412DD86; Wed, 21 Feb 2024 23:31:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AtDxyuo1" 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 75E1A128824 for ; Wed, 21 Feb 2024 23:30:44 +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=1708558259; cv=none; b=XSx4vSR4v6jjEZ8EhDgXl5NMwD+adssMbZMxP8lqNVuFSIU/QwuOd/dcRjt3m1LQ0q6QMcQ34IaRELR++ev+m3yUy/pOn0b9pje1Rc6/oVEdhBF7oXf69iIwINY9/nqkArnXmYpeNJrudv9Bx5XbTMcAGGWJkT3tfj6TrulZnfk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708558259; c=relaxed/simple; bh=jUX4qJT8DPbrff7AecTpaNd/U/+p/bjh3Aq7WNnY2rU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=Nz32cTnFHkSCWYVMPw4fxU08EbFMQ0Z/h2/YIn6eFQdkQtQFGiv1BGn5+6CdGsUTfaNMJp3I38m4HqsrCNKHwrVLxTLjnO1ZP/EwhGOkWJGoK8dGuAJDuGlOHVswm1nB74JrbmeKEQ0gLRP2WASW+f0/B/TdnEX1WABJtuYqmP8= 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=AtDxyuo1; 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-60878cf0cb2so28042727b3.0 for ; Wed, 21 Feb 2024 15:30:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708558243; x=1709163043; 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=vosJNO3Zn4Xnibp+U/swV64D06bjeRMU8MziMRFin+Y=; b=AtDxyuo1yLNiljUl4l7lFhtdq1a4LD6pL8rdED9ZbyyobDdwGwLG2pRmv7ikpgc/HX T4ZowgFnTJCPzdfv0dqk1qelcW/775LRrhGjZiEyIMOg9R7gX8KtoaDZ1MIKIHqWS+vw h4wxB4eNA0aK+EOUgwVBrbo9/xY1mMWqdPo1Y5tmizVb5/wmwSqOa/J9XIGyvdGuSfZE 5FmF+L5YCHD5/JyZu4IL6+PPmXFuZMHXqLEyO9fndxYmyPhPA0K/6Jk1tlZ76D1LU/zW btJasIXE31gmgkymUAeXTK8qQXQhUVsUfImoxNKQl7UeT3L6OGb7lJ2Up0lkBRkj9BtO 1LaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708558243; x=1709163043; 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=vosJNO3Zn4Xnibp+U/swV64D06bjeRMU8MziMRFin+Y=; b=wXf7pgD/q5xNUw/u4a7aev59rVoWWuBW/iDfBQaZSJbIqMWG6n/QDgMdAV9m5tPkW/ xaWPGZ9GylewlPvHB2UQ2dwXik6ulHLbRAfwBP0T91UL6n5y41Y4n7LGml68DzJ1+ugo BTv2NFxniu6YC0KD8V2GLuATN5GPEBavYHPN3vnNjR+nFTk9Xz0hnXx6ZhBbK1IkZxBO f5TBAQV++0pHwLH0JzU2gQ841XcfH7e8yXUVMDoV2o5Yz12tibxzYwy2dNRSS2JFGo4h rEqlq8joKiCGfT+BdXefkDf2825h3IicD5RjD4gzgusGHH7ogpYbs6lLZEXmpwQi+C1V J97g== X-Forwarded-Encrypted: i=1; AJvYcCUJ2haQpzlhqulcF3skbmL75tdjqBY7N094S+6YSArRKufThMpJ3nDn68dGHTMhGSu9htLtj4us20ENk8KZ8J4L86p8tKY/93NrpTDn X-Gm-Message-State: AOJu0Yw/EfmHOg4zdClX3h5E+F7SIE++I9rBbF0SAiHCmlcfs1uhBLei XBRObOluHvpZXKLpHRM+hiKw9ldVYbA/3SyD69BtlB9qZm1WzVuMEUdepOPHHI/qfaP6ArS19EL UTSsk/Q54IkuEgQ== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:4e1e:336a:2b30:13fe]) (user=saravanak job=sendgmr) by 2002:a81:df03:0:b0:608:8f74:bbfb with SMTP id c3-20020a81df03000000b006088f74bbfbmr350946ywn.9.1708558242802; Wed, 21 Feb 2024 15:30:42 -0800 (PST) Date: Wed, 21 Feb 2024 15:30:23 -0800 In-Reply-To: <20240221233026.2915061-1-saravanak@google.com> Message-Id: <20240221233026.2915061-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: <20240221233026.2915061-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Subject: [PATCH v3 3/4] dt-bindings: Add post-init-providers property From: Saravana Kannan To: 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 , Saravana Kannan Cc: kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@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..5c97a0b5e9c1 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-supplier.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