Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1147911rdb; Fri, 19 Jan 2024 09:31:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKgFQkTmA4p919VBLT4+1WWJWerJeCNLt3GWzz8EjcnJJEaZmzWmDcivw3jqiKXZQi/TjP X-Received: by 2002:a5d:8d06:0:b0:7bf:74dd:6fcd with SMTP id p6-20020a5d8d06000000b007bf74dd6fcdmr37926ioj.22.1705685510802; Fri, 19 Jan 2024 09:31:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705685510; cv=pass; d=google.com; s=arc-20160816; b=DKFkfajQeSVK/tBaVuTUvpLbR4tFbp8iAa/WEGWzwGjuDQkgpmENTErv8YnFgdudHW cUL9plOorm971dUwodF5M3owtvEyUlhqWzcX42LnAadQvlgwmDfD6Yb+8vt26++BUxb1 FNBECNtnA5beo3oR/Dj8ySfQCieppbZg6wG0ItSCiV6e73WKD/TGyILO2qgUa1V1ymrD XuEE+v5hL3a/pc0EcwFdzF3fe98kz98lD6C8TWzagdlyzkRPRVW1QmvqT+Jc+p2Ok6ZX x1aDIfbIU6MiZrOoFl1lzJpf9mkLH/uqqJTLZ628NpvCXc/3IOB87o25CbWZeOtLW0ce wfUQ== 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=U6r83wVkYmKREJU9bijvWLJNYMktd2uwksryZEGPV5A=; fh=SVXWrUu+BAfd4m/jvxHYLugc3jD8EkNCy1f6CMRtOVo=; b=V8sYhz5OYPun8ZIH3Z8F1TMXDkHAF+bHtK/GaF2mL5G4mpYb5hhf70YmRbO04JahiP D1xIeDDtz+cbZobCOg8f5RF4LutkUV6+b4YYY3Z7oYM2J6zGyTSDeHoOswDt21vKX2Ap 7UhrGafhQTybVrvmOmJyIUDKqI9fSQ+mSF64QCf6QjkjmaJAl1O2b33Gqw4WllUtE1ko 6XSqsDROTJj8XtmpqJXWficUIhakOsrlUpMkhz50GsINqn4cmqHb0IY0q9WqTfMpkMEj goWye9lRtowLuXlZ6Rq8tOYiB3dadpFh3YP8acaGYkGlPZORmGw6KiNzeXkUC9yZTL4a KOLg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d3eVaqJV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-31427-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31427-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 n5-20020a634005000000b005cdfaccba35si3742759pga.665.2024.01.19.09.31.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 09:31:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31427-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=d3eVaqJV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-31427-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31427-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 3E3CA28830F for ; Fri, 19 Jan 2024 17:31:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E79C556445; Fri, 19 Jan 2024 17:31:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d3eVaqJV" 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 1A93E55C05; Fri, 19 Jan 2024 17:31:39 +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=1705685500; cv=none; b=u7NZkcTE3BrpOhGH92e7EMtdkW0TTBDqehWpwKvrdzrNMOCBbB7aU8oF2MmN7w64LCfDYNnhUJZtiWMJitIDM+UX83MClA+JgKMGHpLz4ak2yDldhY/yf3br0WUIa4CJMdP/H9Kk6qVRvcXkwjkdq1W+k+KrGnqyNVle04n/Clw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705685500; c=relaxed/simple; bh=bx3dBEafVwA3lVJVceH0Td6l7zSsuteDOXP4YqQuYQQ=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=iQEERUECthgDV8UCBEucyUFsDBFu2J5lIFktbBfo1qYn/Av9KusCpcjtJ/w/N00OY2Ekmc2oQWfx5dBioi2oQLFjWngGvW7Zpto/BNkaQ3qUK2JXPMT8sLKrnH40nDmplUjCChXvEp6p8CFFkBSF2d3rBHxsKHeQucCsnyL1qC0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d3eVaqJV; arc=none smtp.client-ip=10.30.226.201 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> 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: <5e8f6c52-6149-42c0-affb-d8b072a77956@nvidia.com> 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