* [PATCH V1 0/2] Add support to preserve boot config in the DT flow @ 2024-01-09 5:06 Vidya Sagar 2024-01-09 5:06 ` [PATCH V1 1/2] dt-bindings: Add PCIe "preserve-boot-config" property Vidya Sagar 2024-01-09 5:06 ` [PATCH V1 2/2] PCI: Add support for " Vidya Sagar 0 siblings, 2 replies; 5+ messages in thread From: Vidya Sagar @ 2024-01-09 5:06 UTC (permalink / raw) To: lpieralisi, kw, robh, bhelgaas, krzysztof.kozlowski+dt, conor+dt, will, frowand.list Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel, treding, jonathanh, kthota, mmaddireddy, vidyas, sagar.tv Add support to preserve the boot configuration of the PCIe bridges per host bridge basis based on the presence of the DT flag "preserve-boot-config" in the respective host bridge node. The existing "linux,pci-probe-only" works at a system level and can't be used at a single host bridge granularity. Also, the support for preserving the boot configuration per host bridge basis is already present for the ACPI based boot flow and this patch series extends that support for the DT based boot flow. Vidya Sagar (2): dt-bindings: Add PCIe "preserve-boot-config" property PCI: Add support for "preserve-boot-config" property Documentation/devicetree/bindings/pci/pci.txt | 4 ++++ drivers/pci/controller/pci-host-common.c | 5 ++++- drivers/pci/of.c | 15 +++++++++++++++ drivers/pci/probe.c | 2 +- include/linux/of_pci.h | 6 ++++++ 5 files changed, 30 insertions(+), 2 deletions(-) -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V1 1/2] dt-bindings: Add PCIe "preserve-boot-config" property 2024-01-09 5:06 [PATCH V1 0/2] Add support to preserve boot config in the DT flow Vidya Sagar @ 2024-01-09 5:06 ` Vidya Sagar 2024-01-09 5:06 ` [PATCH V1 2/2] PCI: Add support for " Vidya Sagar 1 sibling, 0 replies; 5+ messages in thread From: Vidya Sagar @ 2024-01-09 5:06 UTC (permalink / raw) To: lpieralisi, kw, robh, bhelgaas, krzysztof.kozlowski+dt, conor+dt, will, frowand.list Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel, treding, jonathanh, kthota, mmaddireddy, vidyas, sagar.tv The existing "linux,pci-probe-only" property applies at a system level and it is not possible to selectively convey individual host bridge's requirement w.r.t preserving the boot configuration done by the platform firmware to the kernel. "preserve-boot-config" addresses that concern and can be used to preserve the boot configuration for host bridges selectivey. Signed-off-by: Vidya Sagar <vidyas@nvidia.com> --- Documentation/devicetree/bindings/pci/pci.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/pci.txt b/Documentation/devicetree/bindings/pci/pci.txt index 6a8f2874a24d..0a5ff998cbe8 100644 --- a/Documentation/devicetree/bindings/pci/pci.txt +++ b/Documentation/devicetree/bindings/pci/pci.txt @@ -32,6 +32,10 @@ driver implementation may support the following properties: root port to downstream device and host bridge drivers can do programming which depends on CLKREQ signal existence. For example, programming root port not to advertise ASPM L1 Sub-States support if there is no CLKREQ signal. +- preserve-boot-config: + If present this property specifies that this host bridge is already + configured by the platform firmware and the OS doesn't need to reconfigure + it again. PCI-PCI Bridge properties ------------------------- -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V1 2/2] PCI: Add support for "preserve-boot-config" property 2024-01-09 5:06 [PATCH V1 0/2] Add support to preserve boot config in the DT flow Vidya Sagar 2024-01-09 5:06 ` [PATCH V1 1/2] dt-bindings: Add PCIe "preserve-boot-config" property Vidya Sagar @ 2024-01-09 5:06 ` Vidya Sagar 2024-01-09 22:04 ` kernel test robot 2024-01-10 2:24 ` kernel test robot 1 sibling, 2 replies; 5+ messages in thread From: Vidya Sagar @ 2024-01-09 5:06 UTC (permalink / raw) To: lpieralisi, kw, robh, bhelgaas, krzysztof.kozlowski+dt, conor+dt, will, frowand.list Cc: linux-pci, devicetree, linux-kernel, linux-arm-kernel, treding, jonathanh, kthota, mmaddireddy, vidyas, sagar.tv 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. Signed-off-by: Vidya Sagar <vidyas@nvidia.com> --- drivers/pci/controller/pci-host-common.c | 5 ++++- drivers/pci/of.c | 15 +++++++++++++++ drivers/pci/probe.c | 2 +- include/linux/of_pci.h | 6 ++++++ 4 files changed, 26 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); + /* Parse and map our Configuration Space windows */ cfg = gen_pci_init(dev, bridge, ops); if (IS_ERR(cfg)) return PTR_ERR(cfg); /* Do not reassign resources if probe only */ - if (!pci_has_flag(PCI_PROBE_ONLY)) + if (!(pci_has_flag(PCI_PROBE_ONLY) || bridge->preserve_config)) pci_add_flags(PCI_REASSIGN_ALL_BUS); bridge->sysdata = cfg; diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 51e3dd0ea5ab..3216d4557212 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -258,6 +258,21 @@ void of_pci_check_probe_only(void) } EXPORT_SYMBOL_GPL(of_pci_check_probe_only); +/** + * of_pci_check_preserve_boot_config - Return true if the boot configuration + * needs to be preserved + * + * This function looks for a property called "preserve-boot-config" for a given + * PCIe controller's node and returns true if found. Having this property + * for a PCIe controller ensures that the kernel doesn't re-enumerate and + * reconfigure the BAR resources that are already done by the platform firmware. + */ +bool of_pci_check_preserve_boot_config(struct device_node *node) +{ + return of_property_read_bool(node, "preserve-boot-config"); +} +EXPORT_SYMBOL_GPL(of_pci_check_preserve_boot_config); + /** * devm_of_pci_get_host_bridge_resources() - Resource-managed parsing of PCI * host bridge resources from DT diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 795534589b98..79d0ac34f567 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -3085,7 +3085,7 @@ int pci_host_probe(struct pci_host_bridge *bridge) * ioport_resource trees in either pci_bus_claim_resources() * or pci_bus_assign_resources(). */ - if (pci_has_flag(PCI_PROBE_ONLY)) { + if (pci_has_flag(PCI_PROBE_ONLY) || bridge->preserve_config) { pci_bus_claim_resources(bus); } else { pci_bus_size_bridges(bus); diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h index 29658c0ee71f..a408e54128c6 100644 --- a/include/linux/of_pci.h +++ b/include/linux/of_pci.h @@ -13,6 +13,7 @@ struct device_node *of_pci_find_child_device(struct device_node *parent, unsigned int devfn); int of_pci_get_devfn(struct device_node *np); void of_pci_check_probe_only(void); +bool of_pci_check_preserve_boot_config(struct device_node *node); #else static inline struct device_node *of_pci_find_child_device(struct device_node *parent, unsigned int devfn) @@ -26,6 +27,11 @@ static inline int of_pci_get_devfn(struct device_node *np) } static inline void of_pci_check_probe_only(void) { } + +static bool of_pci_check_preserve_boot_config(struct device_node *node) +{ + return false; +} #endif #if IS_ENABLED(CONFIG_OF_IRQ) -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V1 2/2] PCI: Add support for "preserve-boot-config" property 2024-01-09 5:06 ` [PATCH V1 2/2] PCI: Add support for " Vidya Sagar @ 2024-01-09 22:04 ` kernel test robot 2024-01-10 2:24 ` kernel test robot 1 sibling, 0 replies; 5+ messages in thread From: kernel test robot @ 2024-01-09 22:04 UTC (permalink / raw) To: Vidya Sagar, lpieralisi, kw, robh, bhelgaas, krzysztof.kozlowski+dt, conor+dt, will, frowand.list Cc: oe-kbuild-all, linux-pci, devicetree, linux-kernel, linux-arm-kernel, treding, jonathanh, kthota, mmaddireddy, vidyas, sagar.tv Hi Vidya, kernel test robot noticed the following build warnings: [auto build test WARNING on pci/next] [also build test WARNING on pci/for-linus linus/master v6.7 next-20240109] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Vidya-Sagar/dt-bindings-Add-PCIe-preserve-boot-config-property/20240109-130938 base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next patch link: https://lore.kernel.org/r/20240109050648.1347255-3-vidyas%40nvidia.com patch subject: [PATCH V1 2/2] PCI: Add support for "preserve-boot-config" property config: alpha-allnoconfig (https://download.01.org/0day-ci/archive/20240110/202401100554.kaCFjM87-lkp@intel.com/config) compiler: alpha-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240110/202401100554.kaCFjM87-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202401100554.kaCFjM87-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from drivers/pci/probe.c:11: >> include/linux/of_pci.h:31:13: warning: 'of_pci_check_preserve_boot_config' defined but not used [-Wunused-function] 31 | static bool of_pci_check_preserve_boot_config(struct device_node *node) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +/of_pci_check_preserve_boot_config +31 include/linux/of_pci.h 30 > 31 static bool of_pci_check_preserve_boot_config(struct device_node *node) 32 { 33 return false; 34 } 35 #endif 36 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V1 2/2] PCI: Add support for "preserve-boot-config" property 2024-01-09 5:06 ` [PATCH V1 2/2] PCI: Add support for " Vidya Sagar 2024-01-09 22:04 ` kernel test robot @ 2024-01-10 2:24 ` kernel test robot 1 sibling, 0 replies; 5+ messages in thread From: kernel test robot @ 2024-01-10 2:24 UTC (permalink / raw) To: Vidya Sagar, lpieralisi, kw, robh, bhelgaas, krzysztof.kozlowski+dt, conor+dt, will, frowand.list Cc: oe-kbuild-all, linux-pci, devicetree, linux-kernel, linux-arm-kernel, treding, jonathanh, kthota, mmaddireddy, vidyas, sagar.tv Hi Vidya, kernel test robot noticed the following build warnings: [auto build test WARNING on pci/next] [also build test WARNING on pci/for-linus linus/master v6.7 next-20240109] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Vidya-Sagar/dt-bindings-Add-PCIe-preserve-boot-config-property/20240109-130938 base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next patch link: https://lore.kernel.org/r/20240109050648.1347255-3-vidyas%40nvidia.com patch subject: [PATCH V1 2/2] PCI: Add support for "preserve-boot-config" property config: arc-allnoconfig (https://download.01.org/0day-ci/archive/20240110/202401101015.Dch3YIjG-lkp@intel.com/config) compiler: arc-elf-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240110/202401101015.Dch3YIjG-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202401101015.Dch3YIjG-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/pci/of.c:271: warning: Function parameter or struct member 'node' not described in 'of_pci_check_preserve_boot_config' vim +271 drivers/pci/of.c 260 261 /** 262 * of_pci_check_preserve_boot_config - Return true if the boot configuration 263 * needs to be preserved 264 * 265 * This function looks for a property called "preserve-boot-config" for a given 266 * PCIe controller's node and returns true if found. Having this property 267 * for a PCIe controller ensures that the kernel doesn't re-enumerate and 268 * reconfigure the BAR resources that are already done by the platform firmware. 269 */ 270 bool of_pci_check_preserve_boot_config(struct device_node *node) > 271 { 272 return of_property_read_bool(node, "preserve-boot-config"); 273 } 274 EXPORT_SYMBOL_GPL(of_pci_check_preserve_boot_config); 275 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-10 2:25 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-01-09 5:06 [PATCH V1 0/2] Add support to preserve boot config in the DT flow Vidya Sagar 2024-01-09 5:06 ` [PATCH V1 1/2] dt-bindings: Add PCIe "preserve-boot-config" property Vidya Sagar 2024-01-09 5:06 ` [PATCH V1 2/2] PCI: Add support for " Vidya Sagar 2024-01-09 22:04 ` kernel test robot 2024-01-10 2:24 ` kernel test robot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).