linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
@ 2019-05-02 17:04 Vidya Sagar
  2019-05-02 17:04 ` [PATCH V4 2/2] PCI: dwc: Export APIs to support .remove() implementation Vidya Sagar
  2019-05-03 11:23 ` [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host Lorenzo Pieralisi
  0 siblings, 2 replies; 15+ messages in thread
From: Vidya Sagar @ 2019-05-02 17:04 UTC (permalink / raw)
  To: jingoohan1, gustavo.pimentel, lorenzo.pieralisi, bhelgaas,
	Jisheng.Zhang, thierry.reding
  Cc: linux-pci, linux-kernel, kthota, mmaddireddy, sagar.tv, vidyas

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(+)

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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH V4 2/2] PCI: dwc: Export APIs to support .remove() implementation
  2019-05-02 17:04 [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host Vidya Sagar
@ 2019-05-02 17:04 ` Vidya Sagar
  2019-05-03 11:23 ` [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host Lorenzo Pieralisi
  1 sibling, 0 replies; 15+ messages in thread
From: Vidya Sagar @ 2019-05-02 17:04 UTC (permalink / raw)
  To: jingoohan1, gustavo.pimentel, lorenzo.pieralisi, bhelgaas,
	Jisheng.Zhang, thierry.reding
  Cc: linux-pci, linux-kernel, kthota, mmaddireddy, sagar.tv, vidyas

Export all configuration space access APIs and also other APIs to
support host controller drivers of DesignWare core based implementations
while adding support for .remove() hook to build their respective drivers
as modules

Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
Changes from v3:
* Exported only __dw_pcie_{read/write}_dbi() APIs instead of
  dw_pcie_read{l/w/b}_dbi & dw_pcie_write{l/w/b}_dbi APIs.

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 | 4 ++++
 drivers/pci/controller/dwc/pcie-designware.c      | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index d069e4290180..f93252d0da5b 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -311,6 +311,7 @@ void dw_pcie_msi_init(struct pcie_port *pp)
 	dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_HI, 4,
 			    upper_32_bits(msi_target));
 }
+EXPORT_SYMBOL_GPL(dw_pcie_msi_init);
 
 int dw_pcie_host_init(struct pcie_port *pp)
 {
@@ -495,6 +496,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
 		dw_pcie_free_msi(pp);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(dw_pcie_host_init);
 
 void dw_pcie_host_deinit(struct pcie_port *pp)
 {
@@ -503,6 +505,7 @@ void dw_pcie_host_deinit(struct pcie_port *pp)
 	if (pci_msi_enabled() && !pp->ops->msi_host_init)
 		dw_pcie_free_msi(pp);
 }
+EXPORT_SYMBOL_GPL(dw_pcie_host_deinit);
 
 static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus,
 				     u32 devfn, int where, int size, u32 *val,
@@ -695,3 +698,4 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
 	val |= PORT_LOGIC_SPEED_CHANGE;
 	dw_pcie_wr_own_conf(pp, PCIE_LINK_WIDTH_SPEED_CONTROL, 4, val);
 }
+EXPORT_SYMBOL_GPL(dw_pcie_setup_rc);
diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
index d7cc1a0c1de6..6401e1c5b398 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -40,6 +40,7 @@ int dw_pcie_read(void __iomem *addr, int size, u32 *val)
 
 	return PCIBIOS_SUCCESSFUL;
 }
+EXPORT_SYMBOL_GPL(dw_pcie_read);
 
 int dw_pcie_write(void __iomem *addr, int size, u32 val)
 {
@@ -57,6 +58,7 @@ int dw_pcie_write(void __iomem *addr, int size, u32 val)
 
 	return PCIBIOS_SUCCESSFUL;
 }
+EXPORT_SYMBOL_GPL(dw_pcie_write);
 
 u32 __dw_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg,
 		       size_t size)
@@ -73,6 +75,7 @@ u32 __dw_pcie_read_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg,
 
 	return val;
 }
+EXPORT_SYMBOL_GPL(__dw_pcie_read_dbi);
 
 void __dw_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg,
 			 size_t size, u32 val)
@@ -88,6 +91,7 @@ void __dw_pcie_write_dbi(struct dw_pcie *pci, void __iomem *base, u32 reg,
 	if (ret)
 		dev_err(pci->dev, "Write DBI address failed\n");
 }
+EXPORT_SYMBOL_GPL(__dw_pcie_write_dbi);
 
 u32 __dw_pcie_read_dbi2(struct dw_pcie *pci, void __iomem *base, u32 reg,
 			size_t size)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-05-02 17:04 [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host Vidya Sagar
  2019-05-02 17:04 ` [PATCH V4 2/2] PCI: dwc: Export APIs to support .remove() implementation Vidya Sagar
@ 2019-05-03 11:23 ` Lorenzo Pieralisi
  2019-05-07  5:49   ` Vidya Sagar
  1 sibling, 1 reply; 15+ messages in thread
From: Lorenzo Pieralisi @ 2019-05-03 11:23 UTC (permalink / raw)
  To: Vidya Sagar
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-05-03 11:23 ` [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host Lorenzo Pieralisi
@ 2019-05-07  5:49   ` Vidya Sagar
  2019-05-07  6:55     ` Vidya Sagar
  0 siblings, 1 reply; 15+ messages in thread
From: Vidya Sagar @ 2019-05-07  5:49 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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
>>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-05-07  5:49   ` Vidya Sagar
@ 2019-05-07  6:55     ` Vidya Sagar
  2019-05-27 11:09       ` Vidya Sagar
  0 siblings, 1 reply; 15+ messages in thread
From: Vidya Sagar @ 2019-05-07  6:55 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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
>>>
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-05-07  6:55     ` Vidya Sagar
@ 2019-05-27 11:09       ` Vidya Sagar
  2019-06-07 13:13         ` Vidya Sagar
  0 siblings, 1 reply; 15+ messages in thread
From: Vidya Sagar @ 2019-05-27 11:09 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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
>>>>
>>
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-05-27 11:09       ` Vidya Sagar
@ 2019-06-07 13:13         ` Vidya Sagar
  2019-06-13 18:24           ` Vidya Sagar
  0 siblings, 1 reply; 15+ messages in thread
From: Vidya Sagar @ 2019-06-07 13:13 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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
>>>>>
>>>
>>
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-06-07 13:13         ` Vidya Sagar
@ 2019-06-13 18:24           ` Vidya Sagar
  2019-06-18  4:49             ` Vidya Sagar
  0 siblings, 1 reply; 15+ messages in thread
From: Vidya Sagar @ 2019-06-13 18:24 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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
>>>>>>
>>>>
>>>
>>
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-06-13 18:24           ` Vidya Sagar
@ 2019-06-18  4:49             ` Vidya Sagar
  2019-06-18  9:36               ` Lorenzo Pieralisi
  0 siblings, 1 reply; 15+ messages in thread
From: Vidya Sagar @ 2019-06-18  4:49 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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
>>>>>>>
>>>>>
>>>>
>>>
>>
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-06-18  4:49             ` Vidya Sagar
@ 2019-06-18  9:36               ` Lorenzo Pieralisi
  2019-06-18 10:51                 ` Vidya Sagar
  0 siblings, 1 reply; 15+ messages in thread
From: Lorenzo Pieralisi @ 2019-06-18  9:36 UTC (permalink / raw)
  To: Vidya Sagar
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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
> > > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-06-18  9:36               ` Lorenzo Pieralisi
@ 2019-06-18 10:51                 ` Vidya Sagar
  2019-06-18 14:28                   ` Lorenzo Pieralisi
  0 siblings, 1 reply; 15+ messages in thread
From: Vidya Sagar @ 2019-06-18 10:51 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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
>>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-06-18 10:51                 ` Vidya Sagar
@ 2019-06-18 14:28                   ` Lorenzo Pieralisi
  2019-06-19  5:11                     ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 15+ messages in thread
From: Lorenzo Pieralisi @ 2019-06-18 14:28 UTC (permalink / raw)
  To: Vidya Sagar
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv, kishon

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
> > > > > > > > > > 
> > > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-06-18 14:28                   ` Lorenzo Pieralisi
@ 2019-06-19  5:11                     ` Kishon Vijay Abraham I
  2019-06-20 16:52                       ` Lorenzo Pieralisi
  0 siblings, 1 reply; 15+ messages in thread
From: Kishon Vijay Abraham I @ 2019-06-19  5:11 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Vidya Sagar
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-06-19  5:11                     ` Kishon Vijay Abraham I
@ 2019-06-20 16:52                       ` Lorenzo Pieralisi
  2019-06-21  5:33                         ` Vidya Sagar
  0 siblings, 1 reply; 15+ messages in thread
From: Lorenzo Pieralisi @ 2019-06-20 16:52 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Vidya Sagar, jingoohan1, gustavo.pimentel, bhelgaas,
	Jisheng.Zhang, thierry.reding, linux-pci, linux-kernel, kthota,
	mmaddireddy, sagar.tv

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host
  2019-06-20 16:52                       ` Lorenzo Pieralisi
@ 2019-06-21  5:33                         ` Vidya Sagar
  0 siblings, 0 replies; 15+ messages in thread
From: Vidya Sagar @ 2019-06-21  5:33 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Kishon Vijay Abraham I
  Cc: jingoohan1, gustavo.pimentel, bhelgaas, Jisheng.Zhang,
	thierry.reding, linux-pci, linux-kernel, kthota, mmaddireddy,
	sagar.tv

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-06-21  5:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-02 17:04 [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host Vidya Sagar
2019-05-02 17:04 ` [PATCH V4 2/2] PCI: dwc: Export APIs to support .remove() implementation Vidya Sagar
2019-05-03 11:23 ` [PATCH V4 1/2] PCI: dwc: Add API support to de-initialize host Lorenzo Pieralisi
2019-05-07  5:49   ` Vidya Sagar
2019-05-07  6:55     ` Vidya Sagar
2019-05-27 11:09       ` Vidya Sagar
2019-06-07 13:13         ` Vidya Sagar
2019-06-13 18:24           ` Vidya Sagar
2019-06-18  4:49             ` Vidya Sagar
2019-06-18  9:36               ` Lorenzo Pieralisi
2019-06-18 10:51                 ` Vidya Sagar
2019-06-18 14:28                   ` Lorenzo Pieralisi
2019-06-19  5:11                     ` Kishon Vijay Abraham I
2019-06-20 16:52                       ` Lorenzo Pieralisi
2019-06-21  5:33                         ` Vidya Sagar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).