Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp644859lqs; Tue, 5 Mar 2024 11:58:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVx5ddCspP2zGa7Dyxn1pdgOlDENCi+HCp85MkWNATrV06o9jAlRFRjudjpiQcyI14rgbpz3fhJr0UY4/Ss/V3CV4HBKojh760femUkdQ== X-Google-Smtp-Source: AGHT+IEAJu9K4kmtR7R4K9SMjnY5DJ+meLHhYaTk8nqo9yl4CTcwdVe56f55AUo8y0if3anotvUb X-Received: by 2002:a05:6402:5189:b0:567:26dd:d403 with SMTP id q9-20020a056402518900b0056726ddd403mr7048685edd.17.1709668700869; Tue, 05 Mar 2024 11:58:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709668700; cv=pass; d=google.com; s=arc-20160816; b=XD/2j9Cvjr4QQaKt4p4ONNH8TeOtnBX+eGvOm/6VvKeJ1WBaVMHN2ZoqYqIE6raoTy DEiUmN2mCD/rkIwXt/7nkRvxwVFDkA03GQSlQ5L7R7SdV8MGhg83QqrdQlhGrrjVPGfQ 5NRolAanQ+aQq7etMj+jGSknXOB6gfOH/FlqUcCaBXEs2A17MI7IIj2ns6W9ANDHm84q r+XMIEXz3bldMWgNzABL3AN3jhYOwcWhzl+DlFxFsTzdbwCHyM6IdBLfLPvo/9pCSx/H cKHRzP+fI/AxPtNj/ylnu1S/YUPDwrYBDolOLMBPXBv1G7sbyrshUKF/mtL1BNkqQ4je hjRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=Xttj3lc2VpL+YEkSF9H/v6dnerzULXMVZ7uJN0/Ctnk=; fh=+dI4+cguaU4/IaL4o5QoQQ8+q4ihPHIZSSiONlKzKVU=; b=MGOKG3Wj+aUVTAMSWpFabTyfx3IyHv3XS0qM0/urc/D6kQHzgmlwAW/5nJZFI8Zd1/ UU6lymhn7xpWoA12VPUoT1srk8SfRIjfZ0uz/X0iHvKFXMoGmFb5vYLyDDetX4EIRsgU FJzLh/NtGFOa4qDsX5igh+ZaRE+kSlWTnu5/1RvgyOpBTogC6kPsByq0CVd5KpCOkK// ReC+30TN0J2yBuSA1829A7KwWAYbO4Hgnh0vtK8AEGNOZKzvSPzOxv5WNlnflh7Lp5fY dS5PEoA0QmjL4ZXY9G3xPOynJn9oVpuKTzxRvQWaIV67VNl8C6dujYp8FtoaJ3S2NnR+ 9/jQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FNB+Nzg7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92914-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id e3-20020a50d4c3000000b005673cd2f5edsi2395828edj.284.2024.03.05.11.58.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 11:58:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92914-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FNB+Nzg7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92914-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 0DF3D1F28518 for ; Tue, 5 Mar 2024 19:57:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BABEA8563F; Tue, 5 Mar 2024 19:57:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FNB+Nzg7" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0F20288DB; Tue, 5 Mar 2024 19:57:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668645; cv=none; b=bHs7lLuMfXC2e+YHPI+4eTT0J+f3dM3INdAFsFPZNIyIGcDSp6rI9d37P4frv7fhTlXEmWfOaLJugJZb0vIdNrRrtVgKFlb+bBkh9Tzc+eOgoWUawadB/lR7bq5acSPcOmfXK/8P7SJ7puwjDk7AX1ZHbpC9pKW7qXCED6hN+fg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668645; c=relaxed/simple; bh=8wa+zOHBLIE4I/7MiJkFX8y53MtrP2Fi3EMm7bDPgZU=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=B3tofqHLvDuhOb7Y7ahuIHlt+9/n2PyPbHBCu9Ov9xXGzkvIhUbNoPJPZVKPVLj6fW/NW+Oinyrp6UrrN2Wnt/S3awLOg3uWP97g8vQ+y7OgSrTq5qd702O9bfWz+wjxGVN/8lE2eBsSDDanrsKpYPnsHe60SA3N328FUDWaLt4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FNB+Nzg7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 201E3C433C7; Tue, 5 Mar 2024 19:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709668644; bh=8wa+zOHBLIE4I/7MiJkFX8y53MtrP2Fi3EMm7bDPgZU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=FNB+Nzg7zp4BpiiNkgGtrRzsDl5CMdXmLSaHJwv9DyGQAjTS6HE6S4hJr7E8ifXmc haofwhZh4kY515Rqs3saXnWCYWquQzHK6ZRuzd39CPbrCiyQiWrIKvbXnwIRir2jna +uw0yH1V3kN71EuioZ9/ZJ6hXDgbHZ0ij83FxMIZ9/iiPATH/YQ+3s8PTHXqAmOZ7S Jz8Lzz17ZEKnZyQXbQMxoBhXGkgcHfGcmKaWpbBHZA5VNqiwbSD6Fkoy4S1LT6VLtz ThflGRpXB8mtRZFjMKg2n7d+GMuLR9nkdYePB/hdgFHTEJ623Eegcad66WxDRehASc /Gsx52YL9SOdQ== Date: Tue, 5 Mar 2024 13:57:22 -0600 From: Bjorn Helgaas To: Krishna chaitanya chundru Cc: Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, quic_vbadigan@quicinc.com, quic_ramkri@quicinc.com, quic_nitegupt@quicinc.com, quic_skananth@quicinc.com, quic_parass@quicinc.com Subject: Re: [PATCH v2] PCI: dwc: Enable runtime pm of the host bridge Message-ID: <20240305195722.GA541937@bhelgaas> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240305-runtime_pm_enable-v2-1-a849b74091d1@quicinc.com> On Tue, Mar 05, 2024 at 03:19:01PM +0530, Krishna chaitanya chundru wrote: > The Controller driver is the parent device of the PCIe host bridge, > PCI-PCI bridge and PCIe endpoint as shown below. Nit: add blank line here. > PCIe controller(Top level parent & parent of host bridge) > | > v > PCIe Host bridge(Parent of PCI-PCI bridge) > | > v > PCI-PCI bridge(Parent of endpoint driver) > | > v > PCIe endpoint driver Nit: use spaces instead of tabs to ensure this still looks good when "git log" indents this. In this case it doesn't seem to matter, > Since runtime PM is disabled for host bridge, the state of the child > devices under the host bridge is not taken into account by PM framework > for the top level parent, PCIe controller. So PM framework, allows > the controller driver to enter runtime PM irrespective of the state > of the devices under the host bridge. IIUC this says that we runtime suspend the controller even though runtime PM is disabled for the host bridge? I have a hard time parsing this; can you cite a function that does this or some relevant documentation about how this part of runtime PM works? > And this causes the topology breakage and also possible PM issues. Not sure what this refers to, since you didn't mention topology breakage earlier. And "possible PM" issues is too vague to be useful. > So enable pm runtime for the host bridge, so that controller driver > goes to suspend only when all child devices goes to runtime suspend. s/pm runtime/runtime PM/ so all the references match (unless you mean something different here) (also in subject line) > Signed-off-by: Krishna chaitanya chundru > --- > Changes in v2: > - Updated commit message as suggested by mani. > - Link to v1: https://lore.kernel.org/r/20240219-runtime_pm_enable-v1-1-d39660310504@quicinc.com > --- > drivers/pci/controller/dwc/pcie-designware-host.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > index d5fc31f8345f..57756a73df30 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > > #include "../../pci.h" > #include "pcie-designware.h" > @@ -505,6 +506,9 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) > if (pp->ops->post_init) > pp->ops->post_init(pp); > > + pm_runtime_set_active(&bridge->dev); There are currently no callers of pm_runtime_set_active() in drivers/pci/controller/. This adds it to dw_pcie_host_init(), but it doesn't seem to be a DWC-specific issue, so I assume other drivers and driver cores like cadence and mobiveil should have this, too? > + pm_runtime_enable(&bridge->dev); There are several existing calls of pci_runtime_enable(), including from several DWC drivers. Are they now redundant? In addition, [1] suggests that pm_runtime_enable() should be called *after* pm_runtime_set_active(), but these existing calls (dra7xx_pcie_probe(), ks_pcie_probe(), qcom_pcie_probe(), rcar_gen4_pcie_prepare(), tegra_pcie_config_rp()) happen *before* dw_pcie_host_init() calls pm_runtime_set_active(). [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/power/runtime_pm.rst?id=v6.7#n582 > return 0; > > err_stop_link: > > --- > base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d > change-id: 20240219-runtime_pm_enable-bdc17914bd50 > > Best regards, > -- > Krishna chaitanya chundru >