Re: [PATCH V2 2/2] PCI: Add support for "preserve-boot-config" property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <lkp@xxxxxxxxx>
> > > Signed-off-by: Vidya Sagar <vidyas@xxxxxxxxxx>
> > > ---
> > > V2:
> > > * Addressed issues reported by kernel test robot <lkp@xxxxxxxxx>
> > > 
> > >   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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux