diff mbox series

[V4,1/2] PCI: dwc: Add API support to de-initialize host

Message ID 20190502170426.28688-1-vidyas@nvidia.com (mailing list archive)
State Superseded, archived
Headers show
Series [V4,1/2] PCI: dwc: Add API support to de-initialize host | expand

Commit Message

Vidya Sagar May 2, 2019, 5:04 p.m. UTC
Add an API to group all the tasks to be done to de-initialize host which
can then be called by any DesignWare core based driver implementations
while adding .remove() support in their respective drivers.

Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
Changes from v3:
* Added check if (pci_msi_enabled() && !pp->ops->msi_host_init) before calling
  dw_pcie_free_msi() API to mimic init path

Changes from v2:
* Rebased on top of linux-next top of the tree branch

Changes from v1:
* s/Designware/DesignWare

 drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++
 drivers/pci/controller/dwc/pcie-designware.h      | 5 +++++
 2 files changed, 13 insertions(+)

Comments

Lorenzo Pieralisi May 3, 2019, 11:23 a.m. UTC | #1
On Thu, May 02, 2019 at 10:34:25PM +0530, Vidya Sagar wrote:
> Add an API to group all the tasks to be done to de-initialize host which
> can then be called by any DesignWare core based driver implementations
> while adding .remove() support in their respective drivers.
> 
> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
> Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> ---
> Changes from v3:
> * Added check if (pci_msi_enabled() && !pp->ops->msi_host_init) before calling
>   dw_pcie_free_msi() API to mimic init path
> 
> Changes from v2:
> * Rebased on top of linux-next top of the tree branch
> 
> Changes from v1:
> * s/Designware/DesignWare
> 
>  drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++
>  drivers/pci/controller/dwc/pcie-designware.h      | 5 +++++
>  2 files changed, 13 insertions(+)

Series doesn't apply to v5.1-rc1, what's based on ? I suspect
there is a dependency on pci/keystone, given the tight timeline
for the merge window, would you mind postponing it to v5.3 ?

I do not think it is urgent, I am happy to create a branch
for it as soon as v5.2-rc1 is released.

Thanks,
Lorenzo

> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 77db32529319..d069e4290180 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
>  	return ret;
>  }
>  
> +void dw_pcie_host_deinit(struct pcie_port *pp)
> +{
> +	pci_stop_root_bus(pp->root_bus);
> +	pci_remove_root_bus(pp->root_bus);
> +	if (pci_msi_enabled() && !pp->ops->msi_host_init)
> +		dw_pcie_free_msi(pp);
> +}
> +
>  static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
>  				     u32 devfn, int where, int size, u32 *val,
>  				     bool write)
> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> index deab426affd3..4f48ec78c7b9 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.h
> +++ b/drivers/pci/controller/dwc/pcie-designware.h
> @@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
>  void dw_pcie_free_msi(struct pcie_port *pp);
>  void dw_pcie_setup_rc(struct pcie_port *pp);
>  int dw_pcie_host_init(struct pcie_port *pp);
> +void dw_pcie_host_deinit(struct pcie_port *pp);
>  int dw_pcie_allocate_domains(struct pcie_port *pp);
>  #else
>  static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
> @@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
>  	return 0;
>  }
>  
> +static inline void dw_pcie_host_deinit(struct pcie_port *pp)
> +{
> +}
> +
>  static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
>  {
>  	return 0;
> -- 
> 2.17.1
>
Vidya Sagar May 7, 2019, 5:49 a.m. UTC | #2
On 5/3/2019 4:53 PM, Lorenzo Pieralisi wrote:
> On Thu, May 02, 2019 at 10:34:25PM +0530, Vidya Sagar wrote:
>> Add an API to group all the tasks to be done to de-initialize host which
>> can then be called by any DesignWare core based driver implementations
>> while adding .remove() support in their respective drivers.
>>
>> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
>> Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
>> ---
>> Changes from v3:
>> * Added check if (pci_msi_enabled() && !pp->ops->msi_host_init) before calling
>>    dw_pcie_free_msi() API to mimic init path
>>
>> Changes from v2:
>> * Rebased on top of linux-next top of the tree branch
>>
>> Changes from v1:
>> * s/Designware/DesignWare
>>
>>   drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++
>>   drivers/pci/controller/dwc/pcie-designware.h      | 5 +++++
>>   2 files changed, 13 insertions(+)
> 
> Series doesn't apply to v5.1-rc1, what's based on ? I suspect
> there is a dependency on pci/keystone, given the tight timeline
> for the merge window, would you mind postponing it to v5.3 ?
> 
> I do not think it is urgent, I am happy to create a branch
> for it as soon as v5.2-rc1 is released.
I rebased my changes on top of linux-next. I see that they have conflicts
on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
of linux-next?
I'm fine with v5.2-rc1 as well.

> 
> Thanks,
> Lorenzo
> 
>> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
>> index 77db32529319..d069e4290180 100644
>> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
>> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
>> @@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
>>   	return ret;
>>   }
>>   
>> +void dw_pcie_host_deinit(struct pcie_port *pp)
>> +{
>> +	pci_stop_root_bus(pp->root_bus);
>> +	pci_remove_root_bus(pp->root_bus);
>> +	if (pci_msi_enabled() && !pp->ops->msi_host_init)
>> +		dw_pcie_free_msi(pp);
>> +}
>> +
>>   static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
>>   				     u32 devfn, int where, int size, u32 *val,
>>   				     bool write)
>> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
>> index deab426affd3..4f48ec78c7b9 100644
>> --- a/drivers/pci/controller/dwc/pcie-designware.h
>> +++ b/drivers/pci/controller/dwc/pcie-designware.h
>> @@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
>>   void dw_pcie_free_msi(struct pcie_port *pp);
>>   void dw_pcie_setup_rc(struct pcie_port *pp);
>>   int dw_pcie_host_init(struct pcie_port *pp);
>> +void dw_pcie_host_deinit(struct pcie_port *pp);
>>   int dw_pcie_allocate_domains(struct pcie_port *pp);
>>   #else
>>   static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
>> @@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
>>   	return 0;
>>   }
>>   
>> +static inline void dw_pcie_host_deinit(struct pcie_port *pp)
>> +{
>> +}
>> +
>>   static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
>>   {
>>   	return 0;
>> -- 
>> 2.17.1
>>
Vidya Sagar May 7, 2019, 6:55 a.m. UTC | #3
On 5/7/2019 11:19 AM, Vidya Sagar wrote:
> On 5/3/2019 4:53 PM, Lorenzo Pieralisi wrote:
>> On Thu, May 02, 2019 at 10:34:25PM +0530, Vidya Sagar wrote:
>>> Add an API to group all the tasks to be done to de-initialize host which
>>> can then be called by any DesignWare core based driver implementations
>>> while adding .remove() support in their respective drivers.
>>>
>>> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
>>> Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
>>> ---
>>> Changes from v3:
>>> * Added check if (pci_msi_enabled() && !pp->ops->msi_host_init) before calling
>>>    dw_pcie_free_msi() API to mimic init path
>>>
>>> Changes from v2:
>>> * Rebased on top of linux-next top of the tree branch
>>>
>>> Changes from v1:
>>> * s/Designware/DesignWare
>>>
>>>   drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++
>>>   drivers/pci/controller/dwc/pcie-designware.h      | 5 +++++
>>>   2 files changed, 13 insertions(+)
>>
>> Series doesn't apply to v5.1-rc1, what's based on ? I suspect
>> there is a dependency on pci/keystone, given the tight timeline
>> for the merge window, would you mind postponing it to v5.3 ?
>>
>> I do not think it is urgent, I am happy to create a branch
>> for it as soon as v5.2-rc1 is released.
> I rebased my changes on top of linux-next. I see that they have conflicts
> on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
> of linux-next?
> I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made on top of Jisheng's patches
FWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1968324.html

> 
>>
>> Thanks,
>> Lorenzo
>>
>>> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
>>> index 77db32529319..d069e4290180 100644
>>> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
>>> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
>>> @@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
>>>       return ret;
>>>   }
>>> +void dw_pcie_host_deinit(struct pcie_port *pp)
>>> +{
>>> +    pci_stop_root_bus(pp->root_bus);
>>> +    pci_remove_root_bus(pp->root_bus);
>>> +    if (pci_msi_enabled() && !pp->ops->msi_host_init)
>>> +        dw_pcie_free_msi(pp);
>>> +}
>>> +
>>>   static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
>>>                        u32 devfn, int where, int size, u32 *val,
>>>                        bool write)
>>> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
>>> index deab426affd3..4f48ec78c7b9 100644
>>> --- a/drivers/pci/controller/dwc/pcie-designware.h
>>> +++ b/drivers/pci/controller/dwc/pcie-designware.h
>>> @@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
>>>   void dw_pcie_free_msi(struct pcie_port *pp);
>>>   void dw_pcie_setup_rc(struct pcie_port *pp);
>>>   int dw_pcie_host_init(struct pcie_port *pp);
>>> +void dw_pcie_host_deinit(struct pcie_port *pp);
>>>   int dw_pcie_allocate_domains(struct pcie_port *pp);
>>>   #else
>>>   static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
>>> @@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
>>>       return 0;
>>>   }
>>> +static inline void dw_pcie_host_deinit(struct pcie_port *pp)
>>> +{
>>> +}
>>> +
>>>   static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
>>>   {
>>>       return 0;
>>> -- 
>>> 2.17.1
>>>
>
Vidya Sagar May 27, 2019, 11:09 a.m. UTC | #4
On 5/7/2019 12:25 PM, Vidya Sagar wrote:
> On 5/7/2019 11:19 AM, Vidya Sagar wrote:
>> On 5/3/2019 4:53 PM, Lorenzo Pieralisi wrote:
>>> On Thu, May 02, 2019 at 10:34:25PM +0530, Vidya Sagar wrote:
>>>> Add an API to group all the tasks to be done to de-initialize host which
>>>> can then be called by any DesignWare core based driver implementations
>>>> while adding .remove() support in their respective drivers.
>>>>
>>>> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
>>>> Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
>>>> ---
>>>> Changes from v3:
>>>> * Added check if (pci_msi_enabled() && !pp->ops->msi_host_init) before calling
>>>>    dw_pcie_free_msi() API to mimic init path
>>>>
>>>> Changes from v2:
>>>> * Rebased on top of linux-next top of the tree branch
>>>>
>>>> Changes from v1:
>>>> * s/Designware/DesignWare
>>>>
>>>>   drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++
>>>>   drivers/pci/controller/dwc/pcie-designware.h      | 5 +++++
>>>>   2 files changed, 13 insertions(+)
>>>
>>> Series doesn't apply to v5.1-rc1, what's based on ? I suspect
>>> there is a dependency on pci/keystone, given the tight timeline
>>> for the merge window, would you mind postponing it to v5.3 ?
>>>
>>> I do not think it is urgent, I am happy to create a branch
>>> for it as soon as v5.2-rc1 is released.
>> I rebased my changes on top of linux-next. I see that they have conflicts
>> on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
>> of linux-next?
>> I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made on top of Jisheng's patches
> FWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
> https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1968324.html

Hi Lorenzo,
Now that v5.2-rc2 is also available, could you please pick up this series?

Thanks,
Vidya Sagar

> 
>>
>>>
>>> Thanks,
>>> Lorenzo
>>>
>>>> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
>>>> index 77db32529319..d069e4290180 100644
>>>> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
>>>> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
>>>> @@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
>>>>       return ret;
>>>>   }
>>>> +void dw_pcie_host_deinit(struct pcie_port *pp)
>>>> +{
>>>> +    pci_stop_root_bus(pp->root_bus);
>>>> +    pci_remove_root_bus(pp->root_bus);
>>>> +    if (pci_msi_enabled() && !pp->ops->msi_host_init)
>>>> +        dw_pcie_free_msi(pp);
>>>> +}
>>>> +
>>>>   static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
>>>>                        u32 devfn, int where, int size, u32 *val,
>>>>                        bool write)
>>>> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
>>>> index deab426affd3..4f48ec78c7b9 100644
>>>> --- a/drivers/pci/controller/dwc/pcie-designware.h
>>>> +++ b/drivers/pci/controller/dwc/pcie-designware.h
>>>> @@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
>>>>   void dw_pcie_free_msi(struct pcie_port *pp);
>>>>   void dw_pcie_setup_rc(struct pcie_port *pp);
>>>>   int dw_pcie_host_init(struct pcie_port *pp);
>>>> +void dw_pcie_host_deinit(struct pcie_port *pp);
>>>>   int dw_pcie_allocate_domains(struct pcie_port *pp);
>>>>   #else
>>>>   static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
>>>> @@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
>>>>       return 0;
>>>>   }
>>>> +static inline void dw_pcie_host_deinit(struct pcie_port *pp)
>>>> +{
>>>> +}
>>>> +
>>>>   static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
>>>>   {
>>>>       return 0;
>>>> -- 
>>>> 2.17.1
>>>>
>>
>
Vidya Sagar June 7, 2019, 1:13 p.m. UTC | #5
On 5/27/2019 4:39 PM, Vidya Sagar wrote:
> On 5/7/2019 12:25 PM, Vidya Sagar wrote:
>> On 5/7/2019 11:19 AM, Vidya Sagar wrote:
>>> On 5/3/2019 4:53 PM, Lorenzo Pieralisi wrote:
>>>> On Thu, May 02, 2019 at 10:34:25PM +0530, Vidya Sagar wrote:
>>>>> Add an API to group all the tasks to be done to de-initialize host which
>>>>> can then be called by any DesignWare core based driver implementations
>>>>> while adding .remove() support in their respective drivers.
>>>>>
>>>>> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
>>>>> Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
>>>>> ---
>>>>> Changes from v3:
>>>>> * Added check if (pci_msi_enabled() && !pp->ops->msi_host_init) before calling
>>>>>    dw_pcie_free_msi() API to mimic init path
>>>>>
>>>>> Changes from v2:
>>>>> * Rebased on top of linux-next top of the tree branch
>>>>>
>>>>> Changes from v1:
>>>>> * s/Designware/DesignWare
>>>>>
>>>>>   drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++
>>>>>   drivers/pci/controller/dwc/pcie-designware.h      | 5 +++++
>>>>>   2 files changed, 13 insertions(+)
>>>>
>>>> Series doesn't apply to v5.1-rc1, what's based on ? I suspect
>>>> there is a dependency on pci/keystone, given the tight timeline
>>>> for the merge window, would you mind postponing it to v5.3 ?
>>>>
>>>> I do not think it is urgent, I am happy to create a branch
>>>> for it as soon as v5.2-rc1 is released.
>>> I rebased my changes on top of linux-next. I see that they have conflicts
>>> on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
>>> of linux-next?
>>> I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made on top of Jisheng's patches
>> FWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
>> https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1968324.html
> 
> Hi Lorenzo,
> Now that v5.2-rc2 is also available, could you please pick up this series?
> 
> Thanks,
> Vidya Sagar
> 
Hi Bjorn / Lorenzo,
Can you please pick up these two patches?

Thanks,
Vidya Sagar

>>
>>>
>>>>
>>>> Thanks,
>>>> Lorenzo
>>>>
>>>>> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>> index 77db32529319..d069e4290180 100644
>>>>> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>> @@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
>>>>>       return ret;
>>>>>   }
>>>>> +void dw_pcie_host_deinit(struct pcie_port *pp)
>>>>> +{
>>>>> +    pci_stop_root_bus(pp->root_bus);
>>>>> +    pci_remove_root_bus(pp->root_bus);
>>>>> +    if (pci_msi_enabled() && !pp->ops->msi_host_init)
>>>>> +        dw_pcie_free_msi(pp);
>>>>> +}
>>>>> +
>>>>>   static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
>>>>>                        u32 devfn, int where, int size, u32 *val,
>>>>>                        bool write)
>>>>> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
>>>>> index deab426affd3..4f48ec78c7b9 100644
>>>>> --- a/drivers/pci/controller/dwc/pcie-designware.h
>>>>> +++ b/drivers/pci/controller/dwc/pcie-designware.h
>>>>> @@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
>>>>>   void dw_pcie_free_msi(struct pcie_port *pp);
>>>>>   void dw_pcie_setup_rc(struct pcie_port *pp);
>>>>>   int dw_pcie_host_init(struct pcie_port *pp);
>>>>> +void dw_pcie_host_deinit(struct pcie_port *pp);
>>>>>   int dw_pcie_allocate_domains(struct pcie_port *pp);
>>>>>   #else
>>>>>   static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
>>>>> @@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
>>>>>       return 0;
>>>>>   }
>>>>> +static inline void dw_pcie_host_deinit(struct pcie_port *pp)
>>>>> +{
>>>>> +}
>>>>> +
>>>>>   static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
>>>>>   {
>>>>>       return 0;
>>>>> -- 
>>>>> 2.17.1
>>>>>
>>>
>>
>
Vidya Sagar June 13, 2019, 6:24 p.m. UTC | #6
On 6/7/2019 6:43 PM, Vidya Sagar wrote:
> On 5/27/2019 4:39 PM, Vidya Sagar wrote:
>> On 5/7/2019 12:25 PM, Vidya Sagar wrote:
>>> On 5/7/2019 11:19 AM, Vidya Sagar wrote:
>>>> On 5/3/2019 4:53 PM, Lorenzo Pieralisi wrote:
>>>>> On Thu, May 02, 2019 at 10:34:25PM +0530, Vidya Sagar wrote:
>>>>>> Add an API to group all the tasks to be done to de-initialize host which
>>>>>> can then be called by any DesignWare core based driver implementations
>>>>>> while adding .remove() support in their respective drivers.
>>>>>>
>>>>>> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
>>>>>> Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
>>>>>> ---
>>>>>> Changes from v3:
>>>>>> * Added check if (pci_msi_enabled() && !pp->ops->msi_host_init) before calling
>>>>>>    dw_pcie_free_msi() API to mimic init path
>>>>>>
>>>>>> Changes from v2:
>>>>>> * Rebased on top of linux-next top of the tree branch
>>>>>>
>>>>>> Changes from v1:
>>>>>> * s/Designware/DesignWare
>>>>>>
>>>>>>   drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++
>>>>>>   drivers/pci/controller/dwc/pcie-designware.h      | 5 +++++
>>>>>>   2 files changed, 13 insertions(+)
>>>>>
>>>>> Series doesn't apply to v5.1-rc1, what's based on ? I suspect
>>>>> there is a dependency on pci/keystone, given the tight timeline
>>>>> for the merge window, would you mind postponing it to v5.3 ?
>>>>>
>>>>> I do not think it is urgent, I am happy to create a branch
>>>>> for it as soon as v5.2-rc1 is released.
>>>> I rebased my changes on top of linux-next. I see that they have conflicts
>>>> on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
>>>> of linux-next?
>>>> I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made on top of Jisheng's patches
>>> FWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
>>> https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1968324.html
>>
>> Hi Lorenzo,
>> Now that v5.2-rc2 is also available, could you please pick up this series?
>>
>> Thanks,
>> Vidya Sagar
>>
> Hi Bjorn / Lorenzo,
> Can you please pick up these two patches?
> 
> Thanks,
> Vidya Sagar
Apologies for pinging again. These two patches can be applied directly on top of
v5.2-rc4. Please do let me know if there is anything required from my side.

Thanks,
Vidya Sagar


> 
>>>
>>>>
>>>>>
>>>>> Thanks,
>>>>> Lorenzo
>>>>>
>>>>>> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>>> index 77db32529319..d069e4290180 100644
>>>>>> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>>> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>>> @@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
>>>>>>       return ret;
>>>>>>   }
>>>>>> +void dw_pcie_host_deinit(struct pcie_port *pp)
>>>>>> +{
>>>>>> +    pci_stop_root_bus(pp->root_bus);
>>>>>> +    pci_remove_root_bus(pp->root_bus);
>>>>>> +    if (pci_msi_enabled() && !pp->ops->msi_host_init)
>>>>>> +        dw_pcie_free_msi(pp);
>>>>>> +}
>>>>>> +
>>>>>>   static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
>>>>>>                        u32 devfn, int where, int size, u32 *val,
>>>>>>                        bool write)
>>>>>> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
>>>>>> index deab426affd3..4f48ec78c7b9 100644
>>>>>> --- a/drivers/pci/controller/dwc/pcie-designware.h
>>>>>> +++ b/drivers/pci/controller/dwc/pcie-designware.h
>>>>>> @@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
>>>>>>   void dw_pcie_free_msi(struct pcie_port *pp);
>>>>>>   void dw_pcie_setup_rc(struct pcie_port *pp);
>>>>>>   int dw_pcie_host_init(struct pcie_port *pp);
>>>>>> +void dw_pcie_host_deinit(struct pcie_port *pp);
>>>>>>   int dw_pcie_allocate_domains(struct pcie_port *pp);
>>>>>>   #else
>>>>>>   static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
>>>>>> @@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
>>>>>>       return 0;
>>>>>>   }
>>>>>> +static inline void dw_pcie_host_deinit(struct pcie_port *pp)
>>>>>> +{
>>>>>> +}
>>>>>> +
>>>>>>   static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
>>>>>>   {
>>>>>>       return 0;
>>>>>> -- 
>>>>>> 2.17.1
>>>>>>
>>>>
>>>
>>
>
Vidya Sagar June 18, 2019, 4:49 a.m. UTC | #7
On 6/13/2019 11:54 PM, Vidya Sagar wrote:
> On 6/7/2019 6:43 PM, Vidya Sagar wrote:
>> On 5/27/2019 4:39 PM, Vidya Sagar wrote:
>>> On 5/7/2019 12:25 PM, Vidya Sagar wrote:
>>>> On 5/7/2019 11:19 AM, Vidya Sagar wrote:
>>>>> On 5/3/2019 4:53 PM, Lorenzo Pieralisi wrote:
>>>>>> On Thu, May 02, 2019 at 10:34:25PM +0530, Vidya Sagar wrote:
>>>>>>> Add an API to group all the tasks to be done to de-initialize host which
>>>>>>> can then be called by any DesignWare core based driver implementations
>>>>>>> while adding .remove() support in their respective drivers.
>>>>>>>
>>>>>>> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
>>>>>>> Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
>>>>>>> ---
>>>>>>> Changes from v3:
>>>>>>> * Added check if (pci_msi_enabled() && !pp->ops->msi_host_init) before calling
>>>>>>>    dw_pcie_free_msi() API to mimic init path
>>>>>>>
>>>>>>> Changes from v2:
>>>>>>> * Rebased on top of linux-next top of the tree branch
>>>>>>>
>>>>>>> Changes from v1:
>>>>>>> * s/Designware/DesignWare
>>>>>>>
>>>>>>>   drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++++
>>>>>>>   drivers/pci/controller/dwc/pcie-designware.h      | 5 +++++
>>>>>>>   2 files changed, 13 insertions(+)
>>>>>>
>>>>>> Series doesn't apply to v5.1-rc1, what's based on ? I suspect
>>>>>> there is a dependency on pci/keystone, given the tight timeline
>>>>>> for the merge window, would you mind postponing it to v5.3 ?
>>>>>>
>>>>>> I do not think it is urgent, I am happy to create a branch
>>>>>> for it as soon as v5.2-rc1 is released.
>>>>> I rebased my changes on top of linux-next. I see that they have conflicts
>>>>> on top of v5.1-rc1. Do you want me to rebase them on top of v5.1-rc1 instead
>>>>> of linux-next?
>>>>> I'm fine with v5.2-rc1 as well.I forgot to mention that these changes are made on top of Jisheng's patches
>>>> FWIW, Jisheng's patches are approved and applied to pci/dwc for v5.2
>>>> https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1968324.html
>>>
>>> Hi Lorenzo,
>>> Now that v5.2-rc2 is also available, could you please pick up this series?
>>>
>>> Thanks,
>>> Vidya Sagar
>>>
>> Hi Bjorn / Lorenzo,
>> Can you please pick up these two patches?
>>
>> Thanks,
>> Vidya Sagar
> Apologies for pinging again. These two patches can be applied directly on top of
> v5.2-rc4. Please do let me know if there is anything required from my side.
> 
> Thanks,
> Vidya Sagar
> 
Sorry for pinging again. Please let me know if these patches need to be sent again.

Thanks,
Vidya Sagar

> 
>>
>>>>
>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Lorenzo
>>>>>>
>>>>>>> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>>>> index 77db32529319..d069e4290180 100644
>>>>>>> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>>>> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>>>> @@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
>>>>>>>       return ret;
>>>>>>>   }
>>>>>>> +void dw_pcie_host_deinit(struct pcie_port *pp)
>>>>>>> +{
>>>>>>> +    pci_stop_root_bus(pp->root_bus);
>>>>>>> +    pci_remove_root_bus(pp->root_bus);
>>>>>>> +    if (pci_msi_enabled() && !pp->ops->msi_host_init)
>>>>>>> +        dw_pcie_free_msi(pp);
>>>>>>> +}
>>>>>>> +
>>>>>>>   static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
>>>>>>>                        u32 devfn, int where, int size, u32 *val,
>>>>>>>                        bool write)
>>>>>>> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
>>>>>>> index deab426affd3..4f48ec78c7b9 100644
>>>>>>> --- a/drivers/pci/controller/dwc/pcie-designware.h
>>>>>>> +++ b/drivers/pci/controller/dwc/pcie-designware.h
>>>>>>> @@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
>>>>>>>   void dw_pcie_free_msi(struct pcie_port *pp);
>>>>>>>   void dw_pcie_setup_rc(struct pcie_port *pp);
>>>>>>>   int dw_pcie_host_init(struct pcie_port *pp);
>>>>>>> +void dw_pcie_host_deinit(struct pcie_port *pp);
>>>>>>>   int dw_pcie_allocate_domains(struct pcie_port *pp);
>>>>>>>   #else
>>>>>>>   static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
>>>>>>> @@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
>>>>>>>       return 0;
>>>>>>>   }
>>>>>>> +static inline void dw_pcie_host_deinit(struct pcie_port *pp)
>>>>>>> +{
>>>>>>> +}
>>>>>>> +
>>>>>>>   static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
>>>>>>>   {
>>>>>>>       return 0;
>>>>>>> -- 
>>>>>>> 2.17.1
>>>>>>>
>>>>>
>>>>
>>>
>>
>
Lorenzo Pieralisi June 18, 2019, 9:36 a.m. UTC | #8
On Tue, Jun 18, 2019 at 10:19:14AM +0530, Vidya Sagar wrote:

[...]

> Sorry for pinging again. Please let me know if these patches need to
> be sent again.

No problem. We can merge the code as-is even though I have a couple
of questions.

1) What about dbi2 interfaces (what an horrible name it is :() ? It
   is true that it is probably best to export just what we need.
2) It is not related to this patch but I fail to see the reasoning
   behind the __ in __dw_pci_read_dbi(), there is no no-underscore
   equivalent so its definition is somewhat questionable, maybe
   we should clean-it up (for dbi2 alike).

Lorenzo

> Thanks,
> Vidya Sagar
> 
> > 
> > > 
> > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > Thanks,
> > > > > > > Lorenzo
> > > > > > > 
> > > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> > > > > > > > index 77db32529319..d069e4290180 100644
> > > > > > > > --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> > > > > > > > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> > > > > > > > @@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
> > > > > > > >       return ret;
> > > > > > > >   }
> > > > > > > > +void dw_pcie_host_deinit(struct pcie_port *pp)
> > > > > > > > +{
> > > > > > > > +    pci_stop_root_bus(pp->root_bus);
> > > > > > > > +    pci_remove_root_bus(pp->root_bus);
> > > > > > > > +    if (pci_msi_enabled() && !pp->ops->msi_host_init)
> > > > > > > > +        dw_pcie_free_msi(pp);
> > > > > > > > +}
> > > > > > > > +
> > > > > > > >   static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
> > > > > > > >                        u32 devfn, int where, int size, u32 *val,
> > > > > > > >                        bool write)
> > > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> > > > > > > > index deab426affd3..4f48ec78c7b9 100644
> > > > > > > > --- a/drivers/pci/controller/dwc/pcie-designware.h
> > > > > > > > +++ b/drivers/pci/controller/dwc/pcie-designware.h
> > > > > > > > @@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
> > > > > > > >   void dw_pcie_free_msi(struct pcie_port *pp);
> > > > > > > >   void dw_pcie_setup_rc(struct pcie_port *pp);
> > > > > > > >   int dw_pcie_host_init(struct pcie_port *pp);
> > > > > > > > +void dw_pcie_host_deinit(struct pcie_port *pp);
> > > > > > > >   int dw_pcie_allocate_domains(struct pcie_port *pp);
> > > > > > > >   #else
> > > > > > > >   static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
> > > > > > > > @@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
> > > > > > > >       return 0;
> > > > > > > >   }
> > > > > > > > +static inline void dw_pcie_host_deinit(struct pcie_port *pp)
> > > > > > > > +{
> > > > > > > > +}
> > > > > > > > +
> > > > > > > >   static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
> > > > > > > >   {
> > > > > > > >       return 0;
> > > > > > > > -- 
> > > > > > > > 2.17.1
> > > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
>
Vidya Sagar June 18, 2019, 10:51 a.m. UTC | #9
On 6/18/2019 3:06 PM, Lorenzo Pieralisi wrote:
> On Tue, Jun 18, 2019 at 10:19:14AM +0530, Vidya Sagar wrote:
> 
> [...]
> 
>> Sorry for pinging again. Please let me know if these patches need to
>> be sent again.
> 
> No problem. We can merge the code as-is even though I have a couple
> of questions.
> 
> 1) What about dbi2 interfaces (what an horrible name it is :() ? It
>     is true that it is probably best to export just what we need.
I see that dbi2 API (that too only write) is used by pci-keystone and it
is described as a bool driver currently. I'm not sure if it will ever be
made as a modular driver.

> 2) It is not related to this patch but I fail to see the reasoning
>     behind the __ in __dw_pci_read_dbi(), there is no no-underscore
>     equivalent so its definition is somewhat questionable, maybe
>     we should clean-it up (for dbi2 alike).
Separate no-underscore versions are present in pcie-designware.h for each width
(i.e. l/w/b) as inline and are calling __ versions passing size as argument.

> 
> Lorenzo
> 
>> Thanks,
>> Vidya Sagar
>>
>>>
>>>>
>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Lorenzo
>>>>>>>>
>>>>>>>>> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>>>>>> index 77db32529319..d069e4290180 100644
>>>>>>>>> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>>>>>> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
>>>>>>>>> @@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
>>>>>>>>>        return ret;
>>>>>>>>>    }
>>>>>>>>> +void dw_pcie_host_deinit(struct pcie_port *pp)
>>>>>>>>> +{
>>>>>>>>> +    pci_stop_root_bus(pp->root_bus);
>>>>>>>>> +    pci_remove_root_bus(pp->root_bus);
>>>>>>>>> +    if (pci_msi_enabled() && !pp->ops->msi_host_init)
>>>>>>>>> +        dw_pcie_free_msi(pp);
>>>>>>>>> +}
>>>>>>>>> +
>>>>>>>>>    static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
>>>>>>>>>                         u32 devfn, int where, int size, u32 *val,
>>>>>>>>>                         bool write)
>>>>>>>>> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
>>>>>>>>> index deab426affd3..4f48ec78c7b9 100644
>>>>>>>>> --- a/drivers/pci/controller/dwc/pcie-designware.h
>>>>>>>>> +++ b/drivers/pci/controller/dwc/pcie-designware.h
>>>>>>>>> @@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
>>>>>>>>>    void dw_pcie_free_msi(struct pcie_port *pp);
>>>>>>>>>    void dw_pcie_setup_rc(struct pcie_port *pp);
>>>>>>>>>    int dw_pcie_host_init(struct pcie_port *pp);
>>>>>>>>> +void dw_pcie_host_deinit(struct pcie_port *pp);
>>>>>>>>>    int dw_pcie_allocate_domains(struct pcie_port *pp);
>>>>>>>>>    #else
>>>>>>>>>    static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
>>>>>>>>> @@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
>>>>>>>>>        return 0;
>>>>>>>>>    }
>>>>>>>>> +static inline void dw_pcie_host_deinit(struct pcie_port *pp)
>>>>>>>>> +{
>>>>>>>>> +}
>>>>>>>>> +
>>>>>>>>>    static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
>>>>>>>>>    {
>>>>>>>>>        return 0;
>>>>>>>>> -- 
>>>>>>>>> 2.17.1
>>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
Lorenzo Pieralisi June 18, 2019, 2:28 p.m. UTC | #10
On Tue, Jun 18, 2019 at 04:21:17PM +0530, Vidya Sagar wrote:

[...]

> > 2) It is not related to this patch but I fail to see the reasoning
> >     behind the __ in __dw_pci_read_dbi(), there is no no-underscore
> >     equivalent so its definition is somewhat questionable, maybe
> >     we should clean-it up (for dbi2 alike).
> Separate no-underscore versions are present in pcie-designware.h for
> each width (i.e. l/w/b) as inline and are calling __ versions passing
> size as argument.

I understand - the __ prologue was added in b50b2db266d8 maybe
Kishon can help us understand the __ rationale.

I am happy to merge it as is, I was just curious about the
__ annotation (not related to this patch).

Lorenzo

> > Lorenzo
> > 
> > > Thanks,
> > > Vidya Sagar
> > > 
> > > > 
> > > > > 
> > > > > > > 
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > Thanks,
> > > > > > > > > Lorenzo
> > > > > > > > > 
> > > > > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> > > > > > > > > > index 77db32529319..d069e4290180 100644
> > > > > > > > > > --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> > > > > > > > > > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> > > > > > > > > > @@ -496,6 +496,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
> > > > > > > > > >        return ret;
> > > > > > > > > >    }
> > > > > > > > > > +void dw_pcie_host_deinit(struct pcie_port *pp)
> > > > > > > > > > +{
> > > > > > > > > > +    pci_stop_root_bus(pp->root_bus);
> > > > > > > > > > +    pci_remove_root_bus(pp->root_bus);
> > > > > > > > > > +    if (pci_msi_enabled() && !pp->ops->msi_host_init)
> > > > > > > > > > +        dw_pcie_free_msi(pp);
> > > > > > > > > > +}
> > > > > > > > > > +
> > > > > > > > > >    static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
> > > > > > > > > >                         u32 devfn, int where, int size, u32 *val,
> > > > > > > > > >                         bool write)
> > > > > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> > > > > > > > > > index deab426affd3..4f48ec78c7b9 100644
> > > > > > > > > > --- a/drivers/pci/controller/dwc/pcie-designware.h
> > > > > > > > > > +++ b/drivers/pci/controller/dwc/pcie-designware.h
> > > > > > > > > > @@ -348,6 +348,7 @@ void dw_pcie_msi_init(struct pcie_port *pp);
> > > > > > > > > >    void dw_pcie_free_msi(struct pcie_port *pp);
> > > > > > > > > >    void dw_pcie_setup_rc(struct pcie_port *pp);
> > > > > > > > > >    int dw_pcie_host_init(struct pcie_port *pp);
> > > > > > > > > > +void dw_pcie_host_deinit(struct pcie_port *pp);
> > > > > > > > > >    int dw_pcie_allocate_domains(struct pcie_port *pp);
> > > > > > > > > >    #else
> > > > > > > > > >    static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
> > > > > > > > > > @@ -372,6 +373,10 @@ static inline int dw_pcie_host_init(struct pcie_port *pp)
> > > > > > > > > >        return 0;
> > > > > > > > > >    }
> > > > > > > > > > +static inline void dw_pcie_host_deinit(struct pcie_port *pp)
> > > > > > > > > > +{
> > > > > > > > > > +}
> > > > > > > > > > +
> > > > > > > > > >    static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
> > > > > > > > > >    {
> > > > > > > > > >        return 0;
> > > > > > > > > > -- 
> > > > > > > > > > 2.17.1
> > > > > > > > > > 
> > > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
>
Kishon Vijay Abraham I June 19, 2019, 5:11 a.m. UTC | #11
Hi Lorenzo,

On 18/06/19 7:58 PM, Lorenzo Pieralisi wrote:
> On Tue, Jun 18, 2019 at 04:21:17PM +0530, Vidya Sagar wrote:
> 
> [...]
> 
>>> 2) It is not related to this patch but I fail to see the reasoning
>>>     behind the __ in __dw_pci_read_dbi(), there is no no-underscore
>>>     equivalent so its definition is somewhat questionable, maybe
>>>     we should clean-it up (for dbi2 alike).
>> Separate no-underscore versions are present in pcie-designware.h for
>> each width (i.e. l/w/b) as inline and are calling __ versions passing
>> size as argument.
> 
> I understand - the __ prologue was added in b50b2db266d8 maybe
> Kishon can help us understand the __ rationale.
> 
> I am happy to merge it as is, I was just curious about the
> __ annotation (not related to this patch).

In commit b50b2db266d8a8c303e8d88590 ("PCI: dwc: all: Modify dbi accessors to
take dbi_base as argument"), dbi accessors was modified to take dbi_base as
argument (since we wanted to write to dbics2 address space). We didn't want to
change all the drivers invoking dbi accessors to pass the dbi_base. So we added
"__" variant to take dbi_base as argument and the drivers continued to invoke
existing dbi accessors which in-turn invoked "__" version with dbi_base as
argument.

I agree there could be some cleanup since in commit
a509d7d9af5ebf86ffbefa98e49761d ("PCI: dwc: all: Modify dbi accessors to access
data of 4/2/1 bytes"), we modified __dw_pcie_readl_dbi() to
__dw_pcie_write_dbi() when it could have been directly modified to
dw_pcie_write_dbi().

Thanks
Kishon
Lorenzo Pieralisi June 20, 2019, 4:52 p.m. UTC | #12
On Wed, Jun 19, 2019 at 10:41:26AM +0530, Kishon Vijay Abraham I wrote:
> Hi Lorenzo,
> 
> On 18/06/19 7:58 PM, Lorenzo Pieralisi wrote:
> > On Tue, Jun 18, 2019 at 04:21:17PM +0530, Vidya Sagar wrote:
> > 
> > [...]
> > 
> >>> 2) It is not related to this patch but I fail to see the reasoning
> >>>     behind the __ in __dw_pci_read_dbi(), there is no no-underscore
> >>>     equivalent so its definition is somewhat questionable, maybe
> >>>     we should clean-it up (for dbi2 alike).
> >> Separate no-underscore versions are present in pcie-designware.h for
> >> each width (i.e. l/w/b) as inline and are calling __ versions passing
> >> size as argument.
> > 
> > I understand - the __ prologue was added in b50b2db266d8 maybe
> > Kishon can help us understand the __ rationale.
> > 
> > I am happy to merge it as is, I was just curious about the
> > __ annotation (not related to this patch).
> 
> In commit b50b2db266d8a8c303e8d88590 ("PCI: dwc: all: Modify dbi accessors to
> take dbi_base as argument"), dbi accessors was modified to take dbi_base as
> argument (since we wanted to write to dbics2 address space). We didn't want to
> change all the drivers invoking dbi accessors to pass the dbi_base. So we added
> "__" variant to take dbi_base as argument and the drivers continued to invoke
> existing dbi accessors which in-turn invoked "__" version with dbi_base as
> argument.
> 
> I agree there could be some cleanup since in commit
> a509d7d9af5ebf86ffbefa98e49761d ("PCI: dwc: all: Modify dbi accessors to access
> data of 4/2/1 bytes"), we modified __dw_pcie_readl_dbi() to
> __dw_pcie_write_dbi() when it could have been directly modified to
> dw_pcie_write_dbi().

Thanks. Vidya can do it as a preliminary patch, I will merge then
code to export the symbols.

Lorenzo
Vidya Sagar June 21, 2019, 5:33 a.m. UTC | #13
On 6/20/2019 10:22 PM, Lorenzo Pieralisi wrote:
> On Wed, Jun 19, 2019 at 10:41:26AM +0530, Kishon Vijay Abraham I wrote:
>> Hi Lorenzo,
>>
>> On 18/06/19 7:58 PM, Lorenzo Pieralisi wrote:
>>> On Tue, Jun 18, 2019 at 04:21:17PM +0530, Vidya Sagar wrote:
>>>
>>> [...]
>>>
>>>>> 2) It is not related to this patch but I fail to see the reasoning
>>>>>      behind the __ in __dw_pci_read_dbi(), there is no no-underscore
>>>>>      equivalent so its definition is somewhat questionable, maybe
>>>>>      we should clean-it up (for dbi2 alike).
>>>> Separate no-underscore versions are present in pcie-designware.h for
>>>> each width (i.e. l/w/b) as inline and are calling __ versions passing
>>>> size as argument.
>>>
>>> I understand - the __ prologue was added in b50b2db266d8 maybe
>>> Kishon can help us understand the __ rationale.
>>>
>>> I am happy to merge it as is, I was just curious about the
>>> __ annotation (not related to this patch).
>>
>> In commit b50b2db266d8a8c303e8d88590 ("PCI: dwc: all: Modify dbi accessors to
>> take dbi_base as argument"), dbi accessors was modified to take dbi_base as
>> argument (since we wanted to write to dbics2 address space). We didn't want to
>> change all the drivers invoking dbi accessors to pass the dbi_base. So we added
>> "__" variant to take dbi_base as argument and the drivers continued to invoke
>> existing dbi accessors which in-turn invoked "__" version with dbi_base as
>> argument.
>>
>> I agree there could be some cleanup since in commit
>> a509d7d9af5ebf86ffbefa98e49761d ("PCI: dwc: all: Modify dbi accessors to access
>> data of 4/2/1 bytes"), we modified __dw_pcie_readl_dbi() to
>> __dw_pcie_write_dbi() when it could have been directly modified to
>> dw_pcie_write_dbi().
> 
> Thanks. Vidya can do it as a preliminary patch, I will merge then
> code to export the symbols.
> 
> Lorenzo
> 
Do you want me to make the change that removes "__" as part of 2/2 patch itself and
then send V5 or as a separate patch?

Vidya Sagar
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 77db32529319..d069e4290180 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -496,6 +496,14 @@  int dw_pcie_host_init(struct pcie_port *pp)
 	return ret;
 }
 
+void dw_pcie_host_deinit(struct pcie_port *pp)
+{
+	pci_stop_root_bus(pp->root_bus);
+	pci_remove_root_bus(pp->root_bus);
+	if (pci_msi_enabled() && !pp->ops->msi_host_init)
+		dw_pcie_free_msi(pp);
+}
+
 static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
 				     u32 devfn, int where, int size, u32 *val,
 				     bool write)
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index deab426affd3..4f48ec78c7b9 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -348,6 +348,7 @@  void dw_pcie_msi_init(struct pcie_port *pp);
 void dw_pcie_free_msi(struct pcie_port *pp);
 void dw_pcie_setup_rc(struct pcie_port *pp);
 int dw_pcie_host_init(struct pcie_port *pp);
+void dw_pcie_host_deinit(struct pcie_port *pp);
 int dw_pcie_allocate_domains(struct pcie_port *pp);
 #else
 static inline irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)
@@ -372,6 +373,10 @@  static inline int dw_pcie_host_init(struct pcie_port *pp)
 	return 0;
 }
 
+static inline void dw_pcie_host_deinit(struct pcie_port *pp)
+{
+}
+
 static inline int dw_pcie_allocate_domains(struct pcie_port *pp)
 {
 	return 0;