From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 16A6BC47DD3 for ; Fri, 19 Jan 2024 17:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=irL1dboKdw9XocLO8Ko80WUOagi+2ihYIrupv9eGPSQ=; b=b+hU4KTp1mAYHh H+QSEfcMBg5Bw5YOcr71W06NFQnEC82jAHCIo8TUCZMrVe0orS0fqhUAmB0y2OCoCKfVg0M5aiAjn +e5n3zCtnoIcORgya4PzG8jdomXD+kgKyWxxQJwV76QFT6KOwcM1eOU3MGmNKPj5K7MIEWh8CAXq1 N4xxYdRT4uBQSQDa7VQr50CL2ZrQaMb7x9673ZWxKFejrNQChTEOqi0P/Sbj1/J62y3IZQV5rw7JX yhJfIfmpvZDYWbnJV2HqDZ62Rv2ISSzTrnmyeJKq7FZxX09LXDW0k5XWgNoUg/czCxSq73Oeeqg2Y hKqe7ursooDvQbtcvl+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQsiV-006HU6-1j; Fri, 19 Jan 2024 17:31:43 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQsiS-006HTn-2s for linux-arm-kernel@lists.infradead.org; Fri, 19 Jan 2024 17:31:42 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CAA3661A6C; Fri, 19 Jan 2024 17:31:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3592AC433F1; Fri, 19 Jan 2024 17:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705685499; bh=bx3dBEafVwA3lVJVceH0Td6l7zSsuteDOXP4YqQuYQQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=d3eVaqJVId8F9SFx2HE7+VtBKBkeoTgOSnCfGcnutVGB8Amu2/NnAr53RHpdJW2cI HsrCHES1ME2ZiCgLk6EGJZ08QqQamaNwM/dbaSfc1oas1ONNVAI1XEH7Pp3sMe+nQ6 k4w/PAWIWW0rY38M5L0JQwavF9MGjRS/YOEUv5ktyVRdMAslB6F1gZ3sH0a0qDJ8b3 4K29qSzZG6hn5jyt1VLBc2obJvJVFWAQOwauaeBIZ7MUe7eRZKL0jExT4NydchuIVx SdTIokkHWVIE0KAg0DXmhikeel9INExRR1RqCK0mijGX2qrUNINUVGexcvi5zp43iP w2pZNvgaL6SZw== Date: Fri, 19 Jan 2024 11:31:37 -0600 From: Bjorn Helgaas To: Vidya Sagar Cc: robh@kernel.org, lpieralisi@kernel.org, kw@linux.com, bhelgaas@google.com, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, will@kernel.org, frowand.list@gmail.com, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, treding@nvidia.com, jonathanh@nvidia.com, kthota@nvidia.com, mmaddireddy@nvidia.com, sagar.tv@gmail.com, kernel test robot Subject: Re: [PATCH V2 2/2] PCI: Add support for "preserve-boot-config" property Message-ID: <20240119173137.GA180921@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5e8f6c52-6149-42c0-affb-d8b072a77956@nvidia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240119_093141_038028_B18D3EB0 X-CRM114-Status: GOOD ( 30.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jan 15, 2024 at 08:02:56PM +0530, Vidya Sagar wrote: > On 1/12/2024 10:28 PM, Bjorn Helgaas wrote: > > On Wed, Jan 10, 2024 at 08:37:25AM +0530, Vidya Sagar wrote: > > > Add support for "preserve-boot-config" property that can be used to > > > selectively (i.e. per host bridge) instruct the kernel to preserve the > > > boot time configuration done by the platform firmware. > > > > > > Reported-by: kernel test robot > > > Signed-off-by: Vidya Sagar > > > --- > > > V2: > > > * Addressed issues reported by kernel test robot > > > > > > drivers/pci/controller/pci-host-common.c | 5 ++++- > > > drivers/pci/of.c | 18 ++++++++++++++++++ > > > drivers/pci/probe.c | 2 +- > > > include/linux/of_pci.h | 6 ++++++ > > > 4 files changed, 29 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c > > > index 6be3266cd7b5..d3475dc9ec44 100644 > > > --- a/drivers/pci/controller/pci-host-common.c > > > +++ b/drivers/pci/controller/pci-host-common.c > > > @@ -68,13 +68,16 @@ int pci_host_common_probe(struct platform_device *pdev) > > > > > > of_pci_check_probe_only(); > > > > > > + bridge->preserve_config = > > > + of_pci_check_preserve_boot_config(dev->of_node); > > > > Thanks for leveraging the existing "preserve_config" support for the > > ACPI _DSM. Is pci_host_common_probe() the best place for this? I > > think there are many DT platform drivers that do not use > > pci_host_common_probe(), so I wonder if there's a more generic place > > to put this. > > My understanding is that pci_host_common_probe() is mainly used in > systems where the firmware would have taken care of all the platform > specific initialization and giving the ECAM and 'ranges' info through DT > for the Linux kernel to go ahead and perform the enumeration. This is > similar to ACPI way of handing over the system from firmware to the OS. > > If PCIe controllers are getting initialized in the kernel itself, then > pci_host_probe() is called directly from the respective host controller > drivers which is the case with all the DesignWare based implementations > including Tegra194 and Tegra234. In those systems, since the controllers > themselves have come up and gotten initialized in the kernel, resource > assignment has to happen anyway. acpi_pci_root_create() sets "preserve_config" based on the DSM_PCI_PRESERVE_BOOT_CONFIG _DSM for all ACPI host bridges. Similarly, I think we should set "preserve_config" based on the DT "preserve-boot-config" property for *all* DT-based host bridges, regardless of where the controller init happens. acpi_pci_root_create pci_create_root_bus pci_alloc_host_bridge pci_register_host_bridge acpi_evaluate_dsm_typed(DSM_PCI_PRESERVE_BOOT_CONFIG) <-- pci_scan_child_bus pci_host_common_probe + of_pci_check_preserve_boot_config <-- proposed pci_host_probe pci_scan_root_bus_bridge pci_register_host_bridge pci_set_bus_of_node pci_scan_child_bus Maybe we should do both in pci_register_host_bridge()? E.g., make a function that sets "preserve_config" based on either the ACPI _DSM or the DT property, whichever is appropriate, and call it from pci_register_host_bridge()? Bjorn _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel