Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1044137pxb; Wed, 6 Oct 2021 22:45:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJya5cSGoHg8EATr/ttodwVp0rdyDhbXnSxOBiKoyjVkeJbtbHbKB5IsMJMEKZK+Mrrpg6vl X-Received: by 2002:a17:902:d203:b0:13e:d053:1aa8 with SMTP id t3-20020a170902d20300b0013ed0531aa8mr2077356ply.40.1633585500527; Wed, 06 Oct 2021 22:45:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633585500; cv=none; d=google.com; s=arc-20160816; b=OVUSKIN+2XrAeTzArCnR+Lq+Jeu4/m3TgjaPm5LrTxbyyrZKd+OGdBqf27ktI2QYI7 MiGMkxM7LrH8PCKNszVlOvr8HLdhiuau2Yl/teXWFWLj9Dpdlu+HYwT3tGR/phcPy3A1 9Tm4hZ87eXe3vCq0SYtUilC7WIpccEvlaODShv19OFU6ItM27LBp++I/NO5nQPLWPOlK XNs8TYRH6GgxVHxzB02zGWKFmg8flJBaa/1v49NJ1ziXrfWFnVrDjNA/zQpG3VIBNjLc lKC7wgayOB8hoaktwYxz8mSB15NapuaZVKZOHyy/hCT8sWB1KoX4bcXmdqtUbtVLRSoy X41w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=81rqk/38UzMoI2J007fl4lzEpbnCXy74F2vWUQta7hI=; b=CySGXEyIihFMWrV18lCbbCqkHsA5ipczNB6Q6zpLZE4lZ7fSdKCTVn8sftaDY1WUUw Q5dvcbhOA4IYT/L6GJNhJYscsWwH0E62+klJVVOeH4hs3Dvw9+JZ/oHFGbmT1vRFiMVo pD7YDTQQhkDqqxnlcTFXghtdXuZaNRDrIToRLh3jvNDcWjOjxayH6VQlmdQ1xyhxUluA vI4A5XIefsvj8ss4mqbyIXalDxw9RL3WGXL7woGou7EdjpNzbxx6tVWoFQAE7xnujYAe PySc5jS2YAXlVf8BBk8GNF06xTlLXChfzu/NKksrrqmn+djLLIre8yM9SP/WpqVJIoUW bV0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GSqoevST; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si13534502plg.270.2021.10.06.22.44.45; Wed, 06 Oct 2021 22:45:00 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=GSqoevST; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231797AbhJGFjg (ORCPT + 99 others); Thu, 7 Oct 2021 01:39:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:40992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbhJGFjf (ORCPT ); Thu, 7 Oct 2021 01:39:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E4291610CC; Thu, 7 Oct 2021 05:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633585062; bh=P7X92rJwASjEGPDFPTaAzuaKBzZU/P0vLoiJYBnZfng=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GSqoevSTi16VX6+LHcBCTSMvE38UB+InitX3dePN2CnjYbwbS5urG+fBNRCT7CdFm c35hM25I6TutA9t7Tt8fxYtK3OSYLZmEGSOcUHuEKp6es96RzJgBDEf6cJwHzClWgu uYhm6/bjLYXgeXP5XbjLd3PgiYRafPcYK1RvGXG8= Date: Thu, 7 Oct 2021 07:37:40 +0200 From: Greg Kroah-Hartman To: Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: Re: [PATCH v2 02/34] component: Introduce the aggregate bus_type Message-ID: References: <20211006193819.2654854-1-swboyd@chromium.org> <20211006193819.2654854-3-swboyd@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211006193819.2654854-3-swboyd@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 06, 2021 at 12:37:47PM -0700, Stephen Boyd wrote: > The component driver only provides 'bind' and 'unbind' callbacks to tell > the host driver that it is time to assemble the aggregate driver now > that all the components have probed. The component driver model doesn't > attempt to resolve runtime PM or suspend/resume ordering, and explicitly > mentions this in the code. This lack of support leads to some pretty > gnarly usages of the 'prepare' and 'complete' power management hooks in > drivers that host the aggregate device, and it fully breaks down when > faced with ordering shutdown between the various components, the > aggregate driver, and the host driver that registers the whole thing. > > In a concrete example, the MSM display driver at drivers/gpu/drm/msm is > using 'prepare' and 'complete' to call the drm helpers > drm_mode_config_helper_suspend() and drm_mode_config_helper_resume() > respectively, so that it can move the aggregate driver suspend/resume > callbacks to be before and after the components that make up the drm > device call any suspend/resume hooks they have. This only works as long > as the component devices don't do anything in their own 'prepare' and > 'complete' callbacks. If they did, then the ordering would be incorrect > and we would be doing something in the component drivers before the > aggregate driver could do anything. Yuck! > > Similarly, when trying to add shutdown support to the MSM driver we run > across a problem where we're trying to shutdown the drm device via > drm_atomic_helper_shutdown(), but some of the devices in the encoder > chain have already been shutdown. This time, the component devices > aren't the problem (although they could be if they did anything in their > shutdown callbacks), but there's a DSI to eDP bridge in the encoder > chain that has already been shutdown before the driver hosting the > aggregate device runs shutdown. The ordering of driver probe is like > this: > > 1. msm_pdev_probe() (host driver) > 2. DSI bridge > 3. aggregate bind > > When it comes to shutdown we have this order: > > 1. DSI bridge > 2. msm_pdev_shutdown() (host driver) > > and so the bridge is already off, but we want to communicate to it to > turn things off on the display during msm_pdev_shutdown(). Double yuck! > Unfortunately, this time we can't split shutdown into multiple phases > and swap msm_pdev_shutdown() with the DSI bridge. > > Let's make the component driver into an actual device driver that has > probe/remove/shutdown functions. The driver will only be bound to the > aggregate device once all component drivers have called component_add() > to indicate they're ready to assemble the aggregate driver. This allows > us to attach shutdown logic (and in the future runtime PM logic) to the > aggregate driver so that it runs the hooks in the correct order. Why are you creating a new bus type and not using the auxiliary bus instead? You have seen Documentation/driver-api/auxiliary_bus.rst, right? thanks, greg k-h