mbox series

[V2,0/7] Add power domain and MSI functionality with PCIe host generic ECAM driver

Message ID 1721067215-5832-1-git-send-email-quic_mrana@quicinc.com (mailing list archive)
Headers show
Series Add power domain and MSI functionality with PCIe host generic ECAM driver | expand

Message

Mayank Rana July 15, 2024, 6:13 p.m. UTC
Based on previously received feedback, this patch series adds functionalities
with existing PCIe host generic ECAM driver (pci-host-generic.c) to get PCIe
host root complex functionality on Qualcomm SA8775P auto platform.

Previously sent RFC patchset to have separate Qualcomm PCIe ECAM platform driver:
https://lore.kernel.org/all/d10199df-5fb3-407b-b404-a0a4d067341f@quicinc.com/T/                                                                                                      

1. Interface to allow requesting firmware to manage system resources and performing
PCIe Link up (devicetree binding in terms of power domain and runtime PM APIs is used in driver)
2. Performing D3 cold with system suspend and D0 with system resume (usage of GenPD
framework based power domain controls these operations)
3. SA8775P is using Synopsys Designware PCIe controller which supports MSI controller.
This MSI functionality is used with PCIe host generic driver after splitting existing MSI
functionality from pcie-designware-host.c file into pcie-designware-msi.c file.

Below architecture is used on Qualcomm SA8775P auto platform to get ECAM compliant PCIe
controller based functionality. Here firmware VM based PCIe driver takes care of resource
management and performing PCIe link related handling (D0 and D3cold). Linux VM based PCIe
host generic driver uses power domain to request firmware VM to perform these operations
using SCMI interface.
----------------


                                   ┌────────────────────────┐                                               
                                   │                        │                                               
  ┌──────────────────────┐         │     SHARED MEMORY      │            ┌──────────────────────────┐       
  │     Firmware VM      │         │                        │            │         Linux VM         │       
  │ ┌─────────┐          │         │                        │            │    ┌────────────────┐    │       
  │ │ Drivers │ ┌──────┐ │         │                        │            │    │   PCIE host    │    │       
  │ │ PCIE PHY◄─┤      │ │         │   ┌────────────────┐   │            │    │  generic driver│    │       
  │ │         │ │ SCMI │ │         │   │                │   │            │    │                │    │       
  │ │PCIE CTL │ │      │ ├─────────┼───►    PCIE        ◄───┼─────┐      │    └──┬──────────▲──┘    │       
  │ │         ├─►Server│ │         │   │    SHMEM       │   │     │      │       │          │       │       
  │ │Clk, Vreg│ │      │ │         │   │                │   │     │      │    ┌──▼──────────┴──┐    │       
  │ │GPIO,GDSC│ └─▲──┬─┘ │         │   └────────────────┘   │     └──────┼────┤PCIE SCMI Inst  │    │       
  │ └─────────┘   │  │   │         │                        │            │    └──▲──────────┬──┘    │       
  │               │  │   │         │                        │            │       │          │       │       
  └───────────────┼──┼───┘         │                        │            └───────┼──────────┼───────┘       
                  │  │             │                        │                    │          │               
                  │  │             └────────────────────────┘                    │          │               
                  │  │                                                           │          │               
                  │  │                                                           │          │               
                  │  │                                                           │          │               
                  │  │                                                           │IRQ       │HVC            
              IRQ │  │HVC                                                        │          │               
                  │  │                                                           │          │               
                  │  │                                                           │          │               
                  │  │                                                           │          │               
┌─────────────────┴──▼───────────────────────────────────────────────────────────┴──────────▼──────────────┐
│                                                                                                          │
│                                                                                                          │
│                                      HYPERVISOR                                                          │
│                                                                                                          │
│                                                                                                          │
│                                                                                                          │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
                                                                                                            
  ┌─────────────┐    ┌─────────────┐  ┌──────────┐   ┌───────────┐   ┌─────────────┐  ┌────────────┐        
  │             │    │             │  │          │   │           │   │  PCIE       │  │   PCIE     │        
  │   CLOCK     │    │   REGULATOR │  │   GPIO   │   │   GDSC    │   │  PHY        │  │ controller │        
  └─────────────┘    └─────────────┘  └──────────┘   └───────────┘   └─────────────┘  └────────────┘        
                                                                                                            
----------
Changes in V2:
- Drop new PCIe Qcom ECAM driver, and use existing PCIe designware based MSI functionality
- Add power domain based functionality within existing ECAM driver

Tested:
- Validated NVME functionality with PCIe0 and PCIe1 on SA8775P-RIDE platform

Mayank Rana (7):
  PCI: dwc: Move MSI related code to separate file
  PCI: dwc: Add msi_ops to allow DBI based MSI register access
  PCI: dwc: Add pcie-designware-msi driver kconfig option
  dt-bindings: PCI: host-generic-pci: Add power-domains binding
  PCI: host-generic: Add power domain based handling for PCIe controller
  dt-bindings: PCI: host-generic-pci: Add snps,dw-pcie-ecam-msi binding
  PCI: host-generic: Add dwc MSI based MSI functionality

 .../devicetree/bindings/pci/host-generic-pci.yaml  |  64 +++
 drivers/pci/controller/dwc/Kconfig                 |   8 +
 drivers/pci/controller/dwc/Makefile                |   1 +
 drivers/pci/controller/dwc/pci-keystone.c          |  12 +-
 drivers/pci/controller/dwc/pcie-designware-host.c  | 438 ++-------------------
 drivers/pci/controller/dwc/pcie-designware-msi.c   | 413 +++++++++++++++++++
 drivers/pci/controller/dwc/pcie-designware-msi.h   |  63 +++
 drivers/pci/controller/dwc/pcie-designware.c       |   1 +
 drivers/pci/controller/dwc/pcie-designware.h       |  26 +-
 drivers/pci/controller/dwc/pcie-rcar-gen4.c        |   1 +
 drivers/pci/controller/dwc/pcie-tegra194.c         |   5 +-
 drivers/pci/controller/pci-host-generic.c          | 127 +++++-
 12 files changed, 723 insertions(+), 436 deletions(-)
 create mode 100644 drivers/pci/controller/dwc/pcie-designware-msi.c
 create mode 100644 drivers/pci/controller/dwc/pcie-designware-msi.h

Comments

Dmitry Baryshkov July 24, 2024, 2:13 a.m. UTC | #1
On Mon, Jul 15, 2024 at 11:13:28AM GMT, Mayank Rana wrote:
> Based on previously received feedback, this patch series adds functionalities
> with existing PCIe host generic ECAM driver (pci-host-generic.c) to get PCIe
> host root complex functionality on Qualcomm SA8775P auto platform.
> 
> Previously sent RFC patchset to have separate Qualcomm PCIe ECAM platform driver:
> https://lore.kernel.org/all/d10199df-5fb3-407b-b404-a0a4d067341f@quicinc.com/T/                                                                                                      
> 
> 1. Interface to allow requesting firmware to manage system resources and performing
> PCIe Link up (devicetree binding in terms of power domain and runtime PM APIs is used in driver)
> 2. Performing D3 cold with system suspend and D0 with system resume (usage of GenPD
> framework based power domain controls these operations)
> 3. SA8775P is using Synopsys Designware PCIe controller which supports MSI controller.
> This MSI functionality is used with PCIe host generic driver after splitting existing MSI
> functionality from pcie-designware-host.c file into pcie-designware-msi.c file.

Please excuse me my ignorance if this is described somewhere. Why are
you using DWC-specific MSI handling instead of using GIC ITS?

> Below architecture is used on Qualcomm SA8775P auto platform to get ECAM compliant PCIe
> controller based functionality. Here firmware VM based PCIe driver takes care of resource
> management and performing PCIe link related handling (D0 and D3cold). Linux VM based PCIe
> host generic driver uses power domain to request firmware VM to perform these operations
> using SCMI interface.
Mayank Rana July 24, 2024, 3:58 a.m. UTC | #2
On 7/23/2024 7:13 PM, Dmitry Baryshkov wrote:
> On Mon, Jul 15, 2024 at 11:13:28AM GMT, Mayank Rana wrote:
>> Based on previously received feedback, this patch series adds functionalities
>> with existing PCIe host generic ECAM driver (pci-host-generic.c) to get PCIe
>> host root complex functionality on Qualcomm SA8775P auto platform.
>>
>> Previously sent RFC patchset to have separate Qualcomm PCIe ECAM platform driver:
>> https://lore.kernel.org/all/d10199df-5fb3-407b-b404-a0a4d067341f@quicinc.com/T/
>>
>> 1. Interface to allow requesting firmware to manage system resources and performing
>> PCIe Link up (devicetree binding in terms of power domain and runtime PM APIs is used in driver)
>> 2. Performing D3 cold with system suspend and D0 with system resume (usage of GenPD
>> framework based power domain controls these operations)
>> 3. SA8775P is using Synopsys Designware PCIe controller which supports MSI controller.
>> This MSI functionality is used with PCIe host generic driver after splitting existing MSI
>> functionality from pcie-designware-host.c file into pcie-designware-msi.c file.
> 
> Please excuse me my ignorance if this is described somewhere. Why are
> you using DWC-specific MSI handling instead of using GIC ITS?
Due to usage of GIC v3 on SA8775p with Gunyah hypervisor, we have 
limitation of not supporting GIC ITS
functionality. We considered other approach as usage of free SPIs (not 
available, limitation in terms of mismatch between number of SPIs 
available with physical GIC vs hypervisor) and extended SPIs (not 
supported with GIC hardware). Hence we just left with DWC-specific MSI 
controller here for MSI functionality.
>> Below architecture is used on Qualcomm SA8775P auto platform to get ECAM compliant PCIe
>> controller based functionality. Here firmware VM based PCIe driver takes care of resource
>> management and performing PCIe link related handling (D0 and D3cold). Linux VM based PCIe
>> host generic driver uses power domain to request firmware VM to perform these operations
>> using SCMI interface.
> 
Regards,
Mayank
Dmitry Baryshkov July 24, 2024, 7:12 a.m. UTC | #3
On Wed, 24 Jul 2024 at 06:58, Mayank Rana <quic_mrana@quicinc.com> wrote:
>
>
>
> On 7/23/2024 7:13 PM, Dmitry Baryshkov wrote:
> > On Mon, Jul 15, 2024 at 11:13:28AM GMT, Mayank Rana wrote:
> >> Based on previously received feedback, this patch series adds functionalities
> >> with existing PCIe host generic ECAM driver (pci-host-generic.c) to get PCIe
> >> host root complex functionality on Qualcomm SA8775P auto platform.
> >>
> >> Previously sent RFC patchset to have separate Qualcomm PCIe ECAM platform driver:
> >> https://lore.kernel.org/all/d10199df-5fb3-407b-b404-a0a4d067341f@quicinc.com/T/
> >>
> >> 1. Interface to allow requesting firmware to manage system resources and performing
> >> PCIe Link up (devicetree binding in terms of power domain and runtime PM APIs is used in driver)
> >> 2. Performing D3 cold with system suspend and D0 with system resume (usage of GenPD
> >> framework based power domain controls these operations)
> >> 3. SA8775P is using Synopsys Designware PCIe controller which supports MSI controller.
> >> This MSI functionality is used with PCIe host generic driver after splitting existing MSI
> >> functionality from pcie-designware-host.c file into pcie-designware-msi.c file.
> >
> > Please excuse me my ignorance if this is described somewhere. Why are
> > you using DWC-specific MSI handling instead of using GIC ITS?
> Due to usage of GIC v3 on SA8775p with Gunyah hypervisor, we have
> limitation of not supporting GIC ITS
> functionality. We considered other approach as usage of free SPIs (not
> available, limitation in terms of mismatch between number of SPIs
> available with physical GIC vs hypervisor) and extended SPIs (not
> supported with GIC hardware). Hence we just left with DWC-specific MSI
> controller here for MSI functionality.

... or extend Gunyah to support GIC ITS. I'd say it is a significant
deficiency if one can not use GIC ITS on Gunyah platforms.

> >> Below architecture is used on Qualcomm SA8775P auto platform to get ECAM compliant PCIe
> >> controller based functionality. Here firmware VM based PCIe driver takes care of resource
> >> management and performing PCIe link related handling (D0 and D3cold). Linux VM based PCIe
> >> host generic driver uses power domain to request firmware VM to perform these operations
> >> using SCMI interface.
> >
> Regards,
> Mayank
Manivannan Sadhasivam July 24, 2024, 1:31 p.m. UTC | #4
On Wed, Jul 24, 2024 at 10:12:17AM +0300, Dmitry Baryshkov wrote:
> On Wed, 24 Jul 2024 at 06:58, Mayank Rana <quic_mrana@quicinc.com> wrote:
> >
> >
> >
> > On 7/23/2024 7:13 PM, Dmitry Baryshkov wrote:
> > > On Mon, Jul 15, 2024 at 11:13:28AM GMT, Mayank Rana wrote:
> > >> Based on previously received feedback, this patch series adds functionalities
> > >> with existing PCIe host generic ECAM driver (pci-host-generic.c) to get PCIe
> > >> host root complex functionality on Qualcomm SA8775P auto platform.
> > >>
> > >> Previously sent RFC patchset to have separate Qualcomm PCIe ECAM platform driver:
> > >> https://lore.kernel.org/all/d10199df-5fb3-407b-b404-a0a4d067341f@quicinc.com/T/
> > >>
> > >> 1. Interface to allow requesting firmware to manage system resources and performing
> > >> PCIe Link up (devicetree binding in terms of power domain and runtime PM APIs is used in driver)
> > >> 2. Performing D3 cold with system suspend and D0 with system resume (usage of GenPD
> > >> framework based power domain controls these operations)
> > >> 3. SA8775P is using Synopsys Designware PCIe controller which supports MSI controller.
> > >> This MSI functionality is used with PCIe host generic driver after splitting existing MSI
> > >> functionality from pcie-designware-host.c file into pcie-designware-msi.c file.
> > >
> > > Please excuse me my ignorance if this is described somewhere. Why are
> > > you using DWC-specific MSI handling instead of using GIC ITS?
> > Due to usage of GIC v3 on SA8775p with Gunyah hypervisor, we have
> > limitation of not supporting GIC ITS
> > functionality. We considered other approach as usage of free SPIs (not
> > available, limitation in terms of mismatch between number of SPIs
> > available with physical GIC vs hypervisor) and extended SPIs (not
> > supported with GIC hardware). Hence we just left with DWC-specific MSI
> > controller here for MSI functionality.
> 
> ... or extend Gunyah to support GIC ITS. I'd say it is a significant
> deficiency if one can not use GIC ITS on Gunyah platforms.
> 

It if were possible, Qcom would've went with that. Unfortunately, it is not.

- Mani
Dmitry Baryshkov July 24, 2024, 1:34 p.m. UTC | #5
On Wed, 24 Jul 2024 at 16:31, Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
>
> On Wed, Jul 24, 2024 at 10:12:17AM +0300, Dmitry Baryshkov wrote:
> > On Wed, 24 Jul 2024 at 06:58, Mayank Rana <quic_mrana@quicinc.com> wrote:
> > >
> > >
> > >
> > > On 7/23/2024 7:13 PM, Dmitry Baryshkov wrote:
> > > > On Mon, Jul 15, 2024 at 11:13:28AM GMT, Mayank Rana wrote:
> > > >> Based on previously received feedback, this patch series adds functionalities
> > > >> with existing PCIe host generic ECAM driver (pci-host-generic.c) to get PCIe
> > > >> host root complex functionality on Qualcomm SA8775P auto platform.
> > > >>
> > > >> Previously sent RFC patchset to have separate Qualcomm PCIe ECAM platform driver:
> > > >> https://lore.kernel.org/all/d10199df-5fb3-407b-b404-a0a4d067341f@quicinc.com/T/
> > > >>
> > > >> 1. Interface to allow requesting firmware to manage system resources and performing
> > > >> PCIe Link up (devicetree binding in terms of power domain and runtime PM APIs is used in driver)
> > > >> 2. Performing D3 cold with system suspend and D0 with system resume (usage of GenPD
> > > >> framework based power domain controls these operations)
> > > >> 3. SA8775P is using Synopsys Designware PCIe controller which supports MSI controller.
> > > >> This MSI functionality is used with PCIe host generic driver after splitting existing MSI
> > > >> functionality from pcie-designware-host.c file into pcie-designware-msi.c file.
> > > >
> > > > Please excuse me my ignorance if this is described somewhere. Why are
> > > > you using DWC-specific MSI handling instead of using GIC ITS?
> > > Due to usage of GIC v3 on SA8775p with Gunyah hypervisor, we have
> > > limitation of not supporting GIC ITS
> > > functionality. We considered other approach as usage of free SPIs (not
> > > available, limitation in terms of mismatch between number of SPIs
> > > available with physical GIC vs hypervisor) and extended SPIs (not
> > > supported with GIC hardware). Hence we just left with DWC-specific MSI
> > > controller here for MSI functionality.
> >
> > ... or extend Gunyah to support GIC ITS. I'd say it is a significant
> > deficiency if one can not use GIC ITS on Gunyah platforms.
> >
>
> It if were possible, Qcom would've went with that. Unfortunately, it is not.

Ack.
Mayank, if the patch gets resent for any reason, please add this to
the commit message.

>
> - Mani
>
> --
> மணிவண்ணன் சதாசிவம்
Mayank Rana July 24, 2024, 4:51 p.m. UTC | #6
On 7/24/2024 6:34 AM, Dmitry Baryshkov wrote:
> On Wed, 24 Jul 2024 at 16:31, Manivannan Sadhasivam
> <manivannan.sadhasivam@linaro.org> wrote:
>>
>> On Wed, Jul 24, 2024 at 10:12:17AM +0300, Dmitry Baryshkov wrote:
>>> On Wed, 24 Jul 2024 at 06:58, Mayank Rana <quic_mrana@quicinc.com> wrote:
>>>>
>>>>
>>>>
>>>> On 7/23/2024 7:13 PM, Dmitry Baryshkov wrote:
>>>>> On Mon, Jul 15, 2024 at 11:13:28AM GMT, Mayank Rana wrote:
>>>>>> Based on previously received feedback, this patch series adds functionalities
>>>>>> with existing PCIe host generic ECAM driver (pci-host-generic.c) to get PCIe
>>>>>> host root complex functionality on Qualcomm SA8775P auto platform.
>>>>>>
>>>>>> Previously sent RFC patchset to have separate Qualcomm PCIe ECAM platform driver:
>>>>>> https://lore.kernel.org/all/d10199df-5fb3-407b-b404-a0a4d067341f@quicinc.com/T/
>>>>>>
>>>>>> 1. Interface to allow requesting firmware to manage system resources and performing
>>>>>> PCIe Link up (devicetree binding in terms of power domain and runtime PM APIs is used in driver)
>>>>>> 2. Performing D3 cold with system suspend and D0 with system resume (usage of GenPD
>>>>>> framework based power domain controls these operations)
>>>>>> 3. SA8775P is using Synopsys Designware PCIe controller which supports MSI controller.
>>>>>> This MSI functionality is used with PCIe host generic driver after splitting existing MSI
>>>>>> functionality from pcie-designware-host.c file into pcie-designware-msi.c file.
>>>>>
>>>>> Please excuse me my ignorance if this is described somewhere. Why are
>>>>> you using DWC-specific MSI handling instead of using GIC ITS?
>>>> Due to usage of GIC v3 on SA8775p with Gunyah hypervisor, we have
>>>> limitation of not supporting GIC ITS
>>>> functionality. We considered other approach as usage of free SPIs (not
>>>> available, limitation in terms of mismatch between number of SPIs
>>>> available with physical GIC vs hypervisor) and extended SPIs (not
>>>> supported with GIC hardware). Hence we just left with DWC-specific MSI
>>>> controller here for MSI functionality.
>>>
>>> ... or extend Gunyah to support GIC ITS. I'd say it is a significant
>>> deficiency if one can not use GIC ITS on Gunyah platforms.
>>>
>>
>> It if were possible, Qcom would've went with that. Unfortunately, it is not.
> 
> Ack.
> Mayank, if the patch gets resent for any reason, please add this to
> the commit message.
ACK.

Regards,
Mayank
>>
>> - Mani
>>
>> --
>> மணிவண்ணன் சதாசிவம்
> 
> 
>
Mayank Rana July 29, 2024, 5:19 p.m. UTC | #7
Hi Bjorn / Mani

Gentle ping for your review/feedback on this series.
Thank you.

Regards,
Mayank

On 7/15/2024 11:13 AM, Mayank Rana wrote:
> Based on previously received feedback, this patch series adds functionalities
> with existing PCIe host generic ECAM driver (pci-host-generic.c) to get PCIe
> host root complex functionality on Qualcomm SA8775P auto platform.
> 
> Previously sent RFC patchset to have separate Qualcomm PCIe ECAM platform driver:
> https://lore.kernel.org/all/d10199df-5fb3-407b-b404-a0a4d067341f@quicinc.com/T/
> 
> 1. Interface to allow requesting firmware to manage system resources and performing
> PCIe Link up (devicetree binding in terms of power domain and runtime PM APIs is used in driver)
> 2. Performing D3 cold with system suspend and D0 with system resume (usage of GenPD
> framework based power domain controls these operations)
> 3. SA8775P is using Synopsys Designware PCIe controller which supports MSI controller.
> This MSI functionality is used with PCIe host generic driver after splitting existing MSI
> functionality from pcie-designware-host.c file into pcie-designware-msi.c file.
> 
> Below architecture is used on Qualcomm SA8775P auto platform to get ECAM compliant PCIe
> controller based functionality. Here firmware VM based PCIe driver takes care of resource
> management and performing PCIe link related handling (D0 and D3cold). Linux VM based PCIe
> host generic driver uses power domain to request firmware VM to perform these operations
> using SCMI interface.
> ----------------
> 
> 
>                                     ┌────────────────────────┐
>                                     │                        │
>    ┌──────────────────────┐         │     SHARED MEMORY      │            ┌──────────────────────────┐
>    │     Firmware VM      │         │                        │            │         Linux VM         │
>    │ ┌─────────┐          │         │                        │            │    ┌────────────────┐    │
>    │ │ Drivers │ ┌──────┐ │         │                        │            │    │   PCIE host    │    │
>    │ │ PCIE PHY◄─┤      │ │         │   ┌────────────────┐   │            │    │  generic driver│    │
>    │ │         │ │ SCMI │ │         │   │                │   │            │    │                │    │
>    │ │PCIE CTL │ │      │ ├─────────┼───►    PCIE        ◄───┼─────┐      │    └──┬──────────▲──┘    │
>    │ │         ├─►Server│ │         │   │    SHMEM       │   │     │      │       │          │       │
>    │ │Clk, Vreg│ │      │ │         │   │                │   │     │      │    ┌──▼──────────┴──┐    │
>    │ │GPIO,GDSC│ └─▲──┬─┘ │         │   └────────────────┘   │     └──────┼────┤PCIE SCMI Inst  │    │
>    │ └─────────┘   │  │   │         │                        │            │    └──▲──────────┬──┘    │
>    │               │  │   │         │                        │            │       │          │       │
>    └───────────────┼──┼───┘         │                        │            └───────┼──────────┼───────┘
>                    │  │             │                        │                    │          │
>                    │  │             └────────────────────────┘                    │          │
>                    │  │                                                           │          │
>                    │  │                                                           │          │
>                    │  │                                                           │          │
>                    │  │                                                           │IRQ       │HVC
>                IRQ │  │HVC                                                        │          │
>                    │  │                                                           │          │
>                    │  │                                                           │          │
>                    │  │                                                           │          │
> ┌─────────────────┴──▼───────────────────────────────────────────────────────────┴──────────▼──────────────┐
> │                                                                                                          │
> │                                                                                                          │
> │                                      HYPERVISOR                                                          │
> │                                                                                                          │
> │                                                                                                          │
> │                                                                                                          │
> └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
>                                                                                                              
>    ┌─────────────┐    ┌─────────────┐  ┌──────────┐   ┌───────────┐   ┌─────────────┐  ┌────────────┐
>    │             │    │             │  │          │   │           │   │  PCIE       │  │   PCIE     │
>    │   CLOCK     │    │   REGULATOR │  │   GPIO   │   │   GDSC    │   │  PHY        │  │ controller │
>    └─────────────┘    └─────────────┘  └──────────┘   └───────────┘   └─────────────┘  └────────────┘
>                                                                                                              
> ----------
> Changes in V2:
> - Drop new PCIe Qcom ECAM driver, and use existing PCIe designware based MSI functionality
> - Add power domain based functionality within existing ECAM driver
> 
> Tested:
> - Validated NVME functionality with PCIe0 and PCIe1 on SA8775P-RIDE platform
> 
> Mayank Rana (7):
>    PCI: dwc: Move MSI related code to separate file
>    PCI: dwc: Add msi_ops to allow DBI based MSI register access
>    PCI: dwc: Add pcie-designware-msi driver kconfig option
>    dt-bindings: PCI: host-generic-pci: Add power-domains binding
>    PCI: host-generic: Add power domain based handling for PCIe controller
>    dt-bindings: PCI: host-generic-pci: Add snps,dw-pcie-ecam-msi binding
>    PCI: host-generic: Add dwc MSI based MSI functionality
> 
>   .../devicetree/bindings/pci/host-generic-pci.yaml  |  64 +++
>   drivers/pci/controller/dwc/Kconfig                 |   8 +
>   drivers/pci/controller/dwc/Makefile                |   1 +
>   drivers/pci/controller/dwc/pci-keystone.c          |  12 +-
>   drivers/pci/controller/dwc/pcie-designware-host.c  | 438 ++-------------------
>   drivers/pci/controller/dwc/pcie-designware-msi.c   | 413 +++++++++++++++++++
>   drivers/pci/controller/dwc/pcie-designware-msi.h   |  63 +++
>   drivers/pci/controller/dwc/pcie-designware.c       |   1 +
>   drivers/pci/controller/dwc/pcie-designware.h       |  26 +-
>   drivers/pci/controller/dwc/pcie-rcar-gen4.c        |   1 +
>   drivers/pci/controller/dwc/pcie-tegra194.c         |   5 +-
>   drivers/pci/controller/pci-host-generic.c          | 127 +++++-
>   12 files changed, 723 insertions(+), 436 deletions(-)
>   create mode 100644 drivers/pci/controller/dwc/pcie-designware-msi.c
>   create mode 100644 drivers/pci/controller/dwc/pcie-designware-msi.h
>
Manivannan Sadhasivam July 30, 2024, 5:34 a.m. UTC | #8
On Mon, Jul 29, 2024 at 10:19:45AM -0700, Mayank Rana wrote:
> Hi Bjorn / Mani
> 
> Gentle ping for your review/feedback on this series.
> Thank you.
> 

I was waiting for your reply for my comment [1]. Because that will have
influence on this series.

- Mani

[1] https://lore.kernel.org/linux-pci/20240724095407.GA2347@thinkpad/

> Regards,
> Mayank
> 
> On 7/15/2024 11:13 AM, Mayank Rana wrote:
> > Based on previously received feedback, this patch series adds functionalities
> > with existing PCIe host generic ECAM driver (pci-host-generic.c) to get PCIe
> > host root complex functionality on Qualcomm SA8775P auto platform.
> > 
> > Previously sent RFC patchset to have separate Qualcomm PCIe ECAM platform driver:
> > https://lore.kernel.org/all/d10199df-5fb3-407b-b404-a0a4d067341f@quicinc.com/T/
> > 
> > 1. Interface to allow requesting firmware to manage system resources and performing
> > PCIe Link up (devicetree binding in terms of power domain and runtime PM APIs is used in driver)
> > 2. Performing D3 cold with system suspend and D0 with system resume (usage of GenPD
> > framework based power domain controls these operations)
> > 3. SA8775P is using Synopsys Designware PCIe controller which supports MSI controller.
> > This MSI functionality is used with PCIe host generic driver after splitting existing MSI
> > functionality from pcie-designware-host.c file into pcie-designware-msi.c file.
> > 
> > Below architecture is used on Qualcomm SA8775P auto platform to get ECAM compliant PCIe
> > controller based functionality. Here firmware VM based PCIe driver takes care of resource
> > management and performing PCIe link related handling (D0 and D3cold). Linux VM based PCIe
> > host generic driver uses power domain to request firmware VM to perform these operations
> > using SCMI interface.
> > ----------------
> > 
> > 
> >                                     ┌────────────────────────┐
> >                                     │                        │
> >    ┌──────────────────────┐         │     SHARED MEMORY      │            ┌──────────────────────────┐
> >    │     Firmware VM      │         │                        │            │         Linux VM         │
> >    │ ┌─────────┐          │         │                        │            │    ┌────────────────┐    │
> >    │ │ Drivers │ ┌──────┐ │         │                        │            │    │   PCIE host    │    │
> >    │ │ PCIE PHY◄─┤      │ │         │   ┌────────────────┐   │            │    │  generic driver│    │
> >    │ │         │ │ SCMI │ │         │   │                │   │            │    │                │    │
> >    │ │PCIE CTL │ │      │ ├─────────┼───►    PCIE        ◄───┼─────┐      │    └──┬──────────▲──┘    │
> >    │ │         ├─►Server│ │         │   │    SHMEM       │   │     │      │       │          │       │
> >    │ │Clk, Vreg│ │      │ │         │   │                │   │     │      │    ┌──▼──────────┴──┐    │
> >    │ │GPIO,GDSC│ └─▲──┬─┘ │         │   └────────────────┘   │     └──────┼────┤PCIE SCMI Inst  │    │
> >    │ └─────────┘   │  │   │         │                        │            │    └──▲──────────┬──┘    │
> >    │               │  │   │         │                        │            │       │          │       │
> >    └───────────────┼──┼───┘         │                        │            └───────┼──────────┼───────┘
> >                    │  │             │                        │                    │          │
> >                    │  │             └────────────────────────┘                    │          │
> >                    │  │                                                           │          │
> >                    │  │                                                           │          │
> >                    │  │                                                           │          │
> >                    │  │                                                           │IRQ       │HVC
> >                IRQ │  │HVC                                                        │          │
> >                    │  │                                                           │          │
> >                    │  │                                                           │          │
> >                    │  │                                                           │          │
> > ┌─────────────────┴──▼───────────────────────────────────────────────────────────┴──────────▼──────────────┐
> > │                                                                                                          │
> > │                                                                                                          │
> > │                                      HYPERVISOR                                                          │
> > │                                                                                                          │
> > │                                                                                                          │
> > │                                                                                                          │
> > └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
> >    ┌─────────────┐    ┌─────────────┐  ┌──────────┐   ┌───────────┐   ┌─────────────┐  ┌────────────┐
> >    │             │    │             │  │          │   │           │   │  PCIE       │  │   PCIE     │
> >    │   CLOCK     │    │   REGULATOR │  │   GPIO   │   │   GDSC    │   │  PHY        │  │ controller │
> >    └─────────────┘    └─────────────┘  └──────────┘   └───────────┘   └─────────────┘  └────────────┘
> > ----------
> > Changes in V2:
> > - Drop new PCIe Qcom ECAM driver, and use existing PCIe designware based MSI functionality
> > - Add power domain based functionality within existing ECAM driver
> > 
> > Tested:
> > - Validated NVME functionality with PCIe0 and PCIe1 on SA8775P-RIDE platform
> > 
> > Mayank Rana (7):
> >    PCI: dwc: Move MSI related code to separate file
> >    PCI: dwc: Add msi_ops to allow DBI based MSI register access
> >    PCI: dwc: Add pcie-designware-msi driver kconfig option
> >    dt-bindings: PCI: host-generic-pci: Add power-domains binding
> >    PCI: host-generic: Add power domain based handling for PCIe controller
> >    dt-bindings: PCI: host-generic-pci: Add snps,dw-pcie-ecam-msi binding
> >    PCI: host-generic: Add dwc MSI based MSI functionality
> > 
> >   .../devicetree/bindings/pci/host-generic-pci.yaml  |  64 +++
> >   drivers/pci/controller/dwc/Kconfig                 |   8 +
> >   drivers/pci/controller/dwc/Makefile                |   1 +
> >   drivers/pci/controller/dwc/pci-keystone.c          |  12 +-
> >   drivers/pci/controller/dwc/pcie-designware-host.c  | 438 ++-------------------
> >   drivers/pci/controller/dwc/pcie-designware-msi.c   | 413 +++++++++++++++++++
> >   drivers/pci/controller/dwc/pcie-designware-msi.h   |  63 +++
> >   drivers/pci/controller/dwc/pcie-designware.c       |   1 +
> >   drivers/pci/controller/dwc/pcie-designware.h       |  26 +-
> >   drivers/pci/controller/dwc/pcie-rcar-gen4.c        |   1 +
> >   drivers/pci/controller/dwc/pcie-tegra194.c         |   5 +-
> >   drivers/pci/controller/pci-host-generic.c          | 127 +++++-
> >   12 files changed, 723 insertions(+), 436 deletions(-)
> >   create mode 100644 drivers/pci/controller/dwc/pcie-designware-msi.c
> >   create mode 100644 drivers/pci/controller/dwc/pcie-designware-msi.h
> >
Mayank Rana July 30, 2024, 4:16 p.m. UTC | #9
On 7/29/2024 10:34 PM, Manivannan Sadhasivam wrote:
> On Mon, Jul 29, 2024 at 10:19:45AM -0700, Mayank Rana wrote:
>> Hi Bjorn / Mani
>>
>> Gentle ping for your review/feedback on this series.
>> Thank you.
>>
> 
> I was waiting for your reply for my comment [1]. Because that will have
> influence on this series.
> 
> - Mani
> 
> [1] https://lore.kernel.org/linux-pci/20240724095407.GA2347@thinkpad/
ok. Thanks for above response, and suggesting that you are ok with 
either new ECAM driver or updating PCIE qcom driver with ECAM mode as 
well utilizing DWC specific functionality. I still believe having 
separate PCIe QCOM ecam driver would be more useful and allow decoupling 
dwc host specific code base.

I am requesting above if you can review current MSI split functionality, 
and provide feedback on that.

Regards,
Mayank
> 
>> Regards,
>> Mayank
>>
>> On 7/15/2024 11:13 AM, Mayank Rana wrote:
>>> Based on previously received feedback, this patch series adds functionalities
>>> with existing PCIe host generic ECAM driver (pci-host-generic.c) to get PCIe
>>> host root complex functionality on Qualcomm SA8775P auto platform.
>>>
>>> Previously sent RFC patchset to have separate Qualcomm PCIe ECAM platform driver:
>>> https://lore.kernel.org/all/d10199df-5fb3-407b-b404-a0a4d067341f@quicinc.com/T/
>>>
>>> 1. Interface to allow requesting firmware to manage system resources and performing
>>> PCIe Link up (devicetree binding in terms of power domain and runtime PM APIs is used in driver)
>>> 2. Performing D3 cold with system suspend and D0 with system resume (usage of GenPD
>>> framework based power domain controls these operations)
>>> 3. SA8775P is using Synopsys Designware PCIe controller which supports MSI controller.
>>> This MSI functionality is used with PCIe host generic driver after splitting existing MSI
>>> functionality from pcie-designware-host.c file into pcie-designware-msi.c file.
>>>
>>> Below architecture is used on Qualcomm SA8775P auto platform to get ECAM compliant PCIe
>>> controller based functionality. Here firmware VM based PCIe driver takes care of resource
>>> management and performing PCIe link related handling (D0 and D3cold). Linux VM based PCIe
>>> host generic driver uses power domain to request firmware VM to perform these operations
>>> using SCMI interface.
>>> ----------------
>>>
>>>
>>>                                      ┌────────────────────────┐
>>>                                      │                        │
>>>     ┌──────────────────────┐         │     SHARED MEMORY      │            ┌──────────────────────────┐
>>>     │     Firmware VM      │         │                        │            │         Linux VM         │
>>>     │ ┌─────────┐          │         │                        │            │    ┌────────────────┐    │
>>>     │ │ Drivers │ ┌──────┐ │         │                        │            │    │   PCIE host    │    │
>>>     │ │ PCIE PHY◄─┤      │ │         │   ┌────────────────┐   │            │    │  generic driver│    │
>>>     │ │         │ │ SCMI │ │         │   │                │   │            │    │                │    │
>>>     │ │PCIE CTL │ │      │ ├─────────┼───►    PCIE        ◄───┼─────┐      │    └──┬──────────▲──┘    │
>>>     │ │         ├─►Server│ │         │   │    SHMEM       │   │     │      │       │          │       │
>>>     │ │Clk, Vreg│ │      │ │         │   │                │   │     │      │    ┌──▼──────────┴──┐    │
>>>     │ │GPIO,GDSC│ └─▲──┬─┘ │         │   └────────────────┘   │     └──────┼────┤PCIE SCMI Inst  │    │
>>>     │ └─────────┘   │  │   │         │                        │            │    └──▲──────────┬──┘    │
>>>     │               │  │   │         │                        │            │       │          │       │
>>>     └───────────────┼──┼───┘         │                        │            └───────┼──────────┼───────┘
>>>                     │  │             │                        │                    │          │
>>>                     │  │             └────────────────────────┘                    │          │
>>>                     │  │                                                           │          │
>>>                     │  │                                                           │          │
>>>                     │  │                                                           │          │
>>>                     │  │                                                           │IRQ       │HVC
>>>                 IRQ │  │HVC                                                        │          │
>>>                     │  │                                                           │          │
>>>                     │  │                                                           │          │
>>>                     │  │                                                           │          │
>>> ┌─────────────────┴──▼───────────────────────────────────────────────────────────┴──────────▼──────────────┐
>>> │                                                                                                          │
>>> │                                                                                                          │
>>> │                                      HYPERVISOR                                                          │
>>> │                                                                                                          │
>>> │                                                                                                          │
>>> │                                                                                                          │
>>> └──────────────────────────────────────────────────────────────────────────────────────────────────────────┘
>>>     ┌─────────────┐    ┌─────────────┐  ┌──────────┐   ┌───────────┐   ┌─────────────┐  ┌────────────┐
>>>     │             │    │             │  │          │   │           │   │  PCIE       │  │   PCIE     │
>>>     │   CLOCK     │    │   REGULATOR │  │   GPIO   │   │   GDSC    │   │  PHY        │  │ controller │
>>>     └─────────────┘    └─────────────┘  └──────────┘   └───────────┘   └─────────────┘  └────────────┘
>>> ----------
>>> Changes in V2:
>>> - Drop new PCIe Qcom ECAM driver, and use existing PCIe designware based MSI functionality
>>> - Add power domain based functionality within existing ECAM driver
>>>
>>> Tested:
>>> - Validated NVME functionality with PCIe0 and PCIe1 on SA8775P-RIDE platform
>>>
>>> Mayank Rana (7):
>>>     PCI: dwc: Move MSI related code to separate file
>>>     PCI: dwc: Add msi_ops to allow DBI based MSI register access
>>>     PCI: dwc: Add pcie-designware-msi driver kconfig option
>>>     dt-bindings: PCI: host-generic-pci: Add power-domains binding
>>>     PCI: host-generic: Add power domain based handling for PCIe controller
>>>     dt-bindings: PCI: host-generic-pci: Add snps,dw-pcie-ecam-msi binding
>>>     PCI: host-generic: Add dwc MSI based MSI functionality
>>>
>>>    .../devicetree/bindings/pci/host-generic-pci.yaml  |  64 +++
>>>    drivers/pci/controller/dwc/Kconfig                 |   8 +
>>>    drivers/pci/controller/dwc/Makefile                |   1 +
>>>    drivers/pci/controller/dwc/pci-keystone.c          |  12 +-
>>>    drivers/pci/controller/dwc/pcie-designware-host.c  | 438 ++-------------------
>>>    drivers/pci/controller/dwc/pcie-designware-msi.c   | 413 +++++++++++++++++++
>>>    drivers/pci/controller/dwc/pcie-designware-msi.h   |  63 +++
>>>    drivers/pci/controller/dwc/pcie-designware.c       |   1 +
>>>    drivers/pci/controller/dwc/pcie-designware.h       |  26 +-
>>>    drivers/pci/controller/dwc/pcie-rcar-gen4.c        |   1 +
>>>    drivers/pci/controller/dwc/pcie-tegra194.c         |   5 +-
>>>    drivers/pci/controller/pci-host-generic.c          | 127 +++++-
>>>    12 files changed, 723 insertions(+), 436 deletions(-)
>>>    create mode 100644 drivers/pci/controller/dwc/pcie-designware-msi.c
>>>    create mode 100644 drivers/pci/controller/dwc/pcie-designware-msi.h
>>>
>