Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp174944lqc; Thu, 7 Mar 2024 13:55:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXsumHv8rdvUcrMA2EAv+MwxHn/P30Ua6pq7+0UN0Xa3UgkFHCPEdGVOY1UaSng/S1BzpHWfAzc1dBdFNJUVbcaGPg3hPLLN2RqZPxVBA== X-Google-Smtp-Source: AGHT+IGoAXIInzRnSUd27UqowYNLEMg2gKCTTeYezGUmFniC9RpRH5wBk/U5TJHedBT4qLOZXOmt X-Received: by 2002:a17:90a:8046:b0:29a:7efc:4720 with SMTP id e6-20020a17090a804600b0029a7efc4720mr16711901pjw.31.1709848515766; Thu, 07 Mar 2024 13:55:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709848515; cv=pass; d=google.com; s=arc-20160816; b=SZsTjqeTFEsnKLKZZBTE3puu7muUL824dpQOVFYzOWaFnDGHTvltjOvBdxLq3gLdpu c29Gw4ceAib+jaC41Fy4UDcAlOjHe1Pk0JVS9bjjfSo5KbLFS0/SfoTtbc2xAc+yOWE5 7gT9NcDHBbV+/5ANOIoXiV4ApOslrIboM62R8oMV+DEtjDIDI1NhT3Tk054iYvUcmp+7 CfTBkML9n5xEP5XwhFzIf18YvZ3lGpwCdyuHv9hZka3jac8CpjIyf+ARZx53I8XcdrCR 1PSxnic3oxLPP9uOxKJRMrp5htKnmtXgyUM5kmlo+Jdrefuvh7JRQ1zrIH0pdGHo9Alw N7GA== 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=8zv397cO3QG0j96R05kTtcixPCy44dTu/pr6LUYsbYc=; fh=Tr6WW2ATshAlQ5276g5a6br8l8IhfKlkPhDiiYGB4Jw=; b=iMsFjvtQ5eqD7wzcW5Ltyg/bwa+Xyum6ueAOzr60e3XZ+J93r5mjIYzxh1h3Fvvjpg is904eNUJ7+hlgR6zVKeN5yzzRbEA/tsu0xDvqK/gG+ZzP9EvIKnDtx4Ftf75ArqAVF9 GRExYfJ83U5AlqcR4X/aHb1jdBLu5wcTLyo03+jwsf7vsPrnHws7XCa7v34o8LJxT1Tk /y7qjgbyI5VIMN1ZjIIfoSxXzhIglQhEfcMSIg6i10TU4X+CuZSmyKCIc3yeMRHva7ls oKtNDPImyVLQhfUD1CdqqkmwLHsGsQQ+0Q/bUE8hEYEIODmfkj12gYkCCc/cLrzbZFuc JlQw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CJ3YI9xs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-96292-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96292-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c62-20020a17090a494400b0029a6f31b103si2374821pjh.153.2024.03.07.13.55.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 13:55:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96292-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CJ3YI9xs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-96292-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96292-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7523E2818B6 for ; Thu, 7 Mar 2024 21:55:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3895713BAD1; Thu, 7 Mar 2024 21:55:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CJ3YI9xs" 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 542B964A9F; Thu, 7 Mar 2024 21:55:07 +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=1709848508; cv=none; b=K1Uciov/SIjBSGrDFZV8qltrGm4vOWKtPyTdRTAIUY1ODlbs1axcMxadUIzrfxHBouYf/pRvRDS87NLvPcZCSrXTC9GusoRzltSjNH9jCpxUjS4h8PrsFxXUmX1ipiAzW4IA14diXC/De6VQuiv7/i97xoUU+Kew6CXgBZGKXkQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709848508; c=relaxed/simple; bh=ji+6eu2vEsL5PFLwf1Vo/c6h9m23l5VmdsuQsf6toAs=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=rwShnFvpOjGJlmI5pE/sFhPlWXvONCILfGWZEokvTPQQY9aLzakwuPz/S8KVoiIneSXmUc+OVQqozmluGPJ+j12cb7pWAI4nQENUol25v8HiLRMbRgefJPAtu1mD5X44445VepabiiJLlitEb5+2/kGV2+W1L6buPkV90QP1z5g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CJ3YI9xs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 701E2C433F1; Thu, 7 Mar 2024 21:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709848507; bh=ji+6eu2vEsL5PFLwf1Vo/c6h9m23l5VmdsuQsf6toAs=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=CJ3YI9xsKU7sTU3zQlSn2oj63JCFdICFfCu4TNCQHVuKukq+p+SsaPM3xC8i6r3nM d+sCJm4NP3zGhuAXGeEg+3BBIB/RQqM/UcJ2A6/8eoWZC5iimleTgrVa9blhArQHk8 sX2GbmmE5VaPuNWo3Og88x/1+gSuTNWBzWgFTSCM1gbQ6i9xiZvmV3HauUD4hXsKIi n1RK3Mqxfa5X5My8YvH4CfYqhxm68kNA3KW8mHZRs/Vn/KDu2n6YqQZ8o/7sTQfjp7 TDnsFI88QUrosv8esEw5Pe00YBCaNi7RpRv4JYlS1rnUH/VjmgnwRVmBhusuwld0Ii 0W2RJys2Yiq+A== Date: Thu, 7 Mar 2024 15:55:05 -0600 From: Bjorn Helgaas To: Krishna Chaitanya Chundru , "Rafael J. Wysocki" 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: <20240307215505.GA632869@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: [+to Rafael, sorry, another runtime PM question, beginning of thread: https://lore.kernel.org/r/20240305-runtime_pm_enable-v2-1-a849b74091d1@quicinc.com] On Thu, Mar 07, 2024 at 07:28:54AM +0530, Krishna Chaitanya Chundru wrote: > On 3/6/2024 1:27 AM, Bjorn Helgaas wrote: > > 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. > > > > > > 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 > > > > > > 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? > > > Generally controller should go to runtime suspend when endpoint client > drivers and pci-pci host bridge drivers goes to runtime suspend as the > controller driver is the parent, but we are observing controller driver > goes to runtime suspend even when client drivers and PCI-PCI bridge are > in active state. It surprises me that a device could be suspended while children are active. A PCI-PCI bridge must be in D0 for any devices below it to be active. The controller is a platform device, not a PCI device, but I am similarly surprised that we would suspend it when children are active, which makes me think we didn't set the hierarchy up correctly. It doesn't seem like we should need to enable runtime PM for a parent to keep it from being suspended when children are active. > > > --- 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); > > > + pm_runtime_enable(&bridge->dev); > > > + > > > return 0; > > > > > > err_stop_link: Bjorn