On Mon, Apr 08, 2024 at 11:57:58AM -0700, Mayank Rana wrote: > Hi Mani > > On 4/5/2024 9:17 PM, Manivannan Sadhasivam wrote: > > On Fri, Apr 05, 2024 at 10:41:15AM -0700, Mayank Rana wrote: > > > Hi Mani > > > > > > On 4/4/2024 10:30 PM, Manivannan Sadhasivam wrote: > > > > On Thu, Apr 04, 2024 at 12:11:24PM -0700, Mayank Rana wrote: > > > > > On some of Qualcomm platform, firmware configures PCIe controller into > > > > > ECAM mode allowing static memory allocation for configuration space of > > > > > supported bus range. Firmware also takes care of bringing up PCIe PHY > > > > > and performing required operation to bring PCIe link into D0. Firmware > > > > > also manages system resources (e.g. clocks/regulators/resets/ bus voting). > > > > > Hence add Qualcomm PCIe ECAM root complex driver which enumerates PCIe > > > > > root complex and connected PCIe devices. Firmware won't be enumerating > > > > > or powering up PCIe root complex until this driver invokes power domain > > > > > based notification to bring PCIe link into D0/D3cold mode. > > > > > > > > > > > > > Is this an in-house PCIe IP of Qualcomm or the same DWC IP that is used in other > > > > SoCs? > > > > > > > > - Mani > > > Driver is validated on SA8775p-ride platform using PCIe DWC IP for > > > now.Although this driver doesn't need to know used PCIe controller and PHY > > > IP as well programming sequence as that would be taken care by firmware. > > > > > > > Ok, so it is the same IP but firmware is controlling the resources now. This > > information should be present in the commit message. > > > > Btw, there is an existing generic ECAM host controller driver: > > drivers/pci/controller/pci-host-generic.c > > > > This driver is already being used by several vendors as well. So we should try > > to extend it for Qcom usecase also. I would take it a bit further and say if you need your own driver, then just use the default QCom driver. Perhaps extend it to support ECAM. Better yet, copy your firmware setup and always configure the QCom h/w to use ECAM. If you want to extend the generic driver, that's fine, but we don't need a 3rd. > I did review pci-host-generic.c driver for usage. although there are more > functionalityneeded for use case purpose as below: > 1. MSI functionality Pretty sure the generic driver already supports that. > 2. Suspend/Resume Others might want that to work as well. > 3. Wakeup Functionality (not part of current change, but would be added > later) Others might want that to work as well. > 4. Here this driver provides way to virtualized PCIe controller. So VMs only > talk to a generic ECAM whereas HW is only directed accessed by service VM. That's the existing driver. If if doesn't work for a VM, fix the VM. > 5. Adding more Auto based safety use cases related implementation Now that's just hand waving. > Hence keeping pci-host-generic.c as generic driver where above functionality > may not be needed. Duplicating things to avoid touching existing drivers is not how kernel development works. Rob