diff mbox series

[PATCHv5,04/20] PCI: mobiveil: Remove the flag MSI_FLAG_MULTI_PCI_MSI

Message ID 20190412083635.33626-5-Zhiqiang.Hou@nxp.com (mailing list archive)
State New, archived
Headers show
Series PCI: mobiveil: fixes for Mobiveil PCIe Host Bridge IP driver | expand

Commit Message

Z.Q. Hou April 12, 2019, 8:35 a.m. UTC
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

The current code does not support multiple MSIs, so remove
the corresponding flag from the msi_domain_info structure.

Fixes: 1e913e58335f ("PCI: mobiveil: Add MSI support")
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
---
V5:
 - Corrected the subject.

 drivers/pci/controller/pcie-mobiveil.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lorenzo Pieralisi June 11, 2019, 4:59 p.m. UTC | #1
On Fri, Apr 12, 2019 at 08:35:36AM +0000, Z.q. Hou wrote:
> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> 
> The current code does not support multiple MSIs, so remove
> the corresponding flag from the msi_domain_info structure.

Please explain me what's the problem before removing multi MSI
support.

Thanks,
Lorenzo

> Fixes: 1e913e58335f ("PCI: mobiveil: Add MSI support")
> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> ---
> V5:
>  - Corrected the subject.
> 
>  drivers/pci/controller/pcie-mobiveil.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c
> index 563210e731d3..a0dd337c6214 100644
> --- a/drivers/pci/controller/pcie-mobiveil.c
> +++ b/drivers/pci/controller/pcie-mobiveil.c
> @@ -703,7 +703,7 @@ static struct irq_chip mobiveil_msi_irq_chip = {
>  
>  static struct msi_domain_info mobiveil_msi_domain_info = {
>  	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
> -		   MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX),
> +		   MSI_FLAG_PCI_MSIX),
>  	.chip	= &mobiveil_msi_irq_chip,
>  };
>  
> -- 
> 2.17.1
>
Marc Zyngier June 11, 2019, 5:29 p.m. UTC | #2
On 11/06/2019 17:59, Lorenzo Pieralisi wrote:
> On Fri, Apr 12, 2019 at 08:35:36AM +0000, Z.q. Hou wrote:
>> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>>
>> The current code does not support multiple MSIs, so remove
>> the corresponding flag from the msi_domain_info structure.
> 
> Please explain me what's the problem before removing multi MSI
> support.

The reason seems to be the following code in the allocator:

        WARN_ON(nr_irqs != 1);
        mutex_lock(&msi->lock);

        bit = find_first_zero_bit(msi->msi_irq_in_use, msi->num_of_vectors);
        if (bit >= msi->num_of_vectors) {
                mutex_unlock(&msi->lock);
                return -ENOSPC;
        }

        set_bit(bit, msi->msi_irq_in_use);

So instead of fixing the allocator, the author prefers disabling
the feature. I'm not sure whether that is an acceptable outcome...

Thanks,

	M.
Lorenzo Pieralisi June 12, 2019, 10:54 a.m. UTC | #3
On Tue, Jun 11, 2019 at 06:29:49PM +0100, Marc Zyngier wrote:
> On 11/06/2019 17:59, Lorenzo Pieralisi wrote:
> > On Fri, Apr 12, 2019 at 08:35:36AM +0000, Z.q. Hou wrote:
> >> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> >>
> >> The current code does not support multiple MSIs, so remove
> >> the corresponding flag from the msi_domain_info structure.
> > 
> > Please explain me what's the problem before removing multi MSI
> > support.
> 
> The reason seems to be the following code in the allocator:
> 
>         WARN_ON(nr_irqs != 1);
>         mutex_lock(&msi->lock);
> 
>         bit = find_first_zero_bit(msi->msi_irq_in_use, msi->num_of_vectors);
>         if (bit >= msi->num_of_vectors) {
>                 mutex_unlock(&msi->lock);
>                 return -ENOSPC;
>         }
> 
>         set_bit(bit, msi->msi_irq_in_use);
> 
> So instead of fixing the allocator, the author prefers disabling
> the feature. I'm not sure whether that is an acceptable outcome...

:) No it is not that's why I asked and I am waiting for an answer.

Lorenzo
Marc Zyngier June 12, 2019, 11:22 a.m. UTC | #4
On Tue, 11 Jun 2019 18:29:49 +0100,
Marc Zyngier <marc.zyngier@arm.com> wrote:
> 
> On 11/06/2019 17:59, Lorenzo Pieralisi wrote:
> > On Fri, Apr 12, 2019 at 08:35:36AM +0000, Z.q. Hou wrote:
> >> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> >>
> >> The current code does not support multiple MSIs, so remove
> >> the corresponding flag from the msi_domain_info structure.
> > 
> > Please explain me what's the problem before removing multi MSI
> > support.
> 
> The reason seems to be the following code in the allocator:
> 
>         WARN_ON(nr_irqs != 1);
>         mutex_lock(&msi->lock);
> 
>         bit = find_first_zero_bit(msi->msi_irq_in_use, msi->num_of_vectors);
>         if (bit >= msi->num_of_vectors) {
>                 mutex_unlock(&msi->lock);
>                 return -ENOSPC;
>         }
> 
>         set_bit(bit, msi->msi_irq_in_use);
> 
> So instead of fixing the allocator, the author prefers disabling
> the feature. I'm not sure whether that is an acceptable outcome...

Actually, there is a much deeper issue, and the compose_msi_msg
callback gives a clue:

  phys_addr_t addr = pcie->pcie_reg_base + (data->hwirq * sizeof(int));

This thing is using a separate target address per MSI, which is the
killer argument. Bad hardware...

Thanks,

	M.
Z.Q. Hou June 12, 2019, 11:34 a.m. UTC | #5
Hi Lorenzo,

Thanks a lot for your comments!

> -----Original Message-----
> From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Sent: 2019年6月12日 1:00
> To: Z.q. Hou <zhiqiang.hou@nxp.com>
> Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> l.subrahmanya@mobiveil.co.in; shawnguo@kernel.org; Leo Li
> <leoyang.li@nxp.com>; catalin.marinas@arm.com; will.deacon@arm.com;
> Mingkai Hu <mingkai.hu@nxp.com>; M.h. Lian <minghuan.lian@nxp.com>;
> Xiaowei Bao <xiaowei.bao@nxp.com>
> Subject: Re: [PATCHv5 04/20] PCI: mobiveil: Remove the flag
> MSI_FLAG_MULTI_PCI_MSI
> 
> On Fri, Apr 12, 2019 at 08:35:36AM +0000, Z.q. Hou wrote:
> > From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> >
> > The current code does not support multiple MSIs, so remove the
> > corresponding flag from the msi_domain_info structure.
> 
> Please explain me what's the problem before removing multi MSI support.

NXP LX2 PCIe use the GIC-ITS instead of Mobiveil IP internal MSI controller,
so, I didn't encounter problem.
Subbu, did you test with Endpoint supporting multi MSI?

Thanks,
Zhiqiang

> 
> Thanks,
> Lorenzo
> 
> > Fixes: 1e913e58335f ("PCI: mobiveil: Add MSI support")
> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> > ---
> > V5:
> >  - Corrected the subject.
> >
> >  drivers/pci/controller/pcie-mobiveil.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pci/controller/pcie-mobiveil.c
> > b/drivers/pci/controller/pcie-mobiveil.c
> > index 563210e731d3..a0dd337c6214 100644
> > --- a/drivers/pci/controller/pcie-mobiveil.c
> > +++ b/drivers/pci/controller/pcie-mobiveil.c
> > @@ -703,7 +703,7 @@ static struct irq_chip mobiveil_msi_irq_chip = {
> >
> >  static struct msi_domain_info mobiveil_msi_domain_info = {
> >  	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS |
> MSI_FLAG_USE_DEF_CHIP_OPS |
> > -		   MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX),
> > +		   MSI_FLAG_PCI_MSIX),
> >  	.chip	= &mobiveil_msi_irq_chip,
> >  };
> >
> > --
> > 2.17.1
> >
Lorenzo Pieralisi June 12, 2019, 1:08 p.m. UTC | #6
On Wed, Jun 12, 2019 at 11:34:51AM +0000, Z.q. Hou wrote:
> Hi Lorenzo,
> 
> Thanks a lot for your comments!
> 
> > -----Original Message-----
> > From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > Sent: 2019年6月12日 1:00
> > To: Z.q. Hou <zhiqiang.hou@nxp.com>
> > Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> > bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> > l.subrahmanya@mobiveil.co.in; shawnguo@kernel.org; Leo Li
> > <leoyang.li@nxp.com>; catalin.marinas@arm.com; will.deacon@arm.com;
> > Mingkai Hu <mingkai.hu@nxp.com>; M.h. Lian <minghuan.lian@nxp.com>;
> > Xiaowei Bao <xiaowei.bao@nxp.com>
> > Subject: Re: [PATCHv5 04/20] PCI: mobiveil: Remove the flag
> > MSI_FLAG_MULTI_PCI_MSI
> > 
> > On Fri, Apr 12, 2019 at 08:35:36AM +0000, Z.q. Hou wrote:
> > > From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > >
> > > The current code does not support multiple MSIs, so remove the
> > > corresponding flag from the msi_domain_info structure.
> > 
> > Please explain me what's the problem before removing multi MSI support.
> 
> NXP LX2 PCIe use the GIC-ITS instead of Mobiveil IP internal MSI
> controller, so, I didn't encounter problem.

Well, you sent a patch to fix an issue, explain me the issue you
are fixing then, aka what have you sent this patch for ?

Lorenzo

> Subbu, did you test with Endpoint supporting multi MSI?
> 
> Thanks,
> Zhiqiang
> 
> > 
> > Thanks,
> > Lorenzo
> > 
> > > Fixes: 1e913e58335f ("PCI: mobiveil: Add MSI support")
> > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > > Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> > > ---
> > > V5:
> > >  - Corrected the subject.
> > >
> > >  drivers/pci/controller/pcie-mobiveil.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/pci/controller/pcie-mobiveil.c
> > > b/drivers/pci/controller/pcie-mobiveil.c
> > > index 563210e731d3..a0dd337c6214 100644
> > > --- a/drivers/pci/controller/pcie-mobiveil.c
> > > +++ b/drivers/pci/controller/pcie-mobiveil.c
> > > @@ -703,7 +703,7 @@ static struct irq_chip mobiveil_msi_irq_chip = {
> > >
> > >  static struct msi_domain_info mobiveil_msi_domain_info = {
> > >  	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS |
> > MSI_FLAG_USE_DEF_CHIP_OPS |
> > > -		   MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX),
> > > +		   MSI_FLAG_PCI_MSIX),
> > >  	.chip	= &mobiveil_msi_irq_chip,
> > >  };
> > >
> > > --
> > > 2.17.1
> > >
Z.Q. Hou June 15, 2019, 1:30 a.m. UTC | #7
Hi Lorenzo,

> -----Original Message-----
> From: Lorenzo Pieralisi [mailto:lorenzo.pieralisi@arm.com]
> Sent: 2019年6月12日 21:08
> To: Z.q. Hou <zhiqiang.hou@nxp.com>
> Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> l.subrahmanya@mobiveil.co.in; shawnguo@kernel.org; Leo Li
> <leoyang.li@nxp.com>; catalin.marinas@arm.com; will.deacon@arm.com;
> Mingkai Hu <mingkai.hu@nxp.com>; M.h. Lian <minghuan.lian@nxp.com>;
> Xiaowei Bao <xiaowei.bao@nxp.com>
> Subject: Re: [PATCHv5 04/20] PCI: mobiveil: Remove the flag
> MSI_FLAG_MULTI_PCI_MSI
> 
> On Wed, Jun 12, 2019 at 11:34:51AM +0000, Z.q. Hou wrote:
> > Hi Lorenzo,
> >
> > Thanks a lot for your comments!
> >
> > > -----Original Message-----
> > > From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > > Sent: 2019年6月12日 1:00
> > > To: Z.q. Hou <zhiqiang.hou@nxp.com>
> > > Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> > > bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> > > l.subrahmanya@mobiveil.co.in; shawnguo@kernel.org; Leo Li
> > > <leoyang.li@nxp.com>; catalin.marinas@arm.com;
> will.deacon@arm.com;
> > > Mingkai Hu <mingkai.hu@nxp.com>; M.h. Lian
> <minghuan.lian@nxp.com>;
> > > Xiaowei Bao <xiaowei.bao@nxp.com>
> > > Subject: Re: [PATCHv5 04/20] PCI: mobiveil: Remove the flag
> > > MSI_FLAG_MULTI_PCI_MSI
> > >
> > > On Fri, Apr 12, 2019 at 08:35:36AM +0000, Z.q. Hou wrote:
> > > > From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > > >
> > > > The current code does not support multiple MSIs, so remove the
> > > > corresponding flag from the msi_domain_info structure.
> > >
> > > Please explain me what's the problem before removing multi MSI support.
> >
> > NXP LX2 PCIe use the GIC-ITS instead of Mobiveil IP internal MSI
> > controller, so, I didn't encounter problem.
> 
> Well, you sent a patch to fix an issue, explain me the issue you are fixing then,
> aka what have you sent this patch for ?

I did not face issue, as I have explained NXP does not use the Mobiveil IP's MSI controller.
But obviously the MSI allocate function does not support multiple MSI, so I submitted this patch.

Thanks,
Zhiqiang

> 
> Lorenzo
> 
> > Subbu, did you test with Endpoint supporting multi MSI?
> >
> > Thanks,
> > Zhiqiang
> >
> > >
> > > Thanks,
> > > Lorenzo
> > >
> > > > Fixes: 1e913e58335f ("PCI: mobiveil: Add MSI support")
> > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > > > Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> > > > ---
> > > > V5:
> > > >  - Corrected the subject.
> > > >
> > > >  drivers/pci/controller/pcie-mobiveil.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/pci/controller/pcie-mobiveil.c
> > > > b/drivers/pci/controller/pcie-mobiveil.c
> > > > index 563210e731d3..a0dd337c6214 100644
> > > > --- a/drivers/pci/controller/pcie-mobiveil.c
> > > > +++ b/drivers/pci/controller/pcie-mobiveil.c
> > > > @@ -703,7 +703,7 @@ static struct irq_chip mobiveil_msi_irq_chip =
> > > > {
> > > >
> > > >  static struct msi_domain_info mobiveil_msi_domain_info = {
> > > >  	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS |
> > > MSI_FLAG_USE_DEF_CHIP_OPS |
> > > > -		   MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX),
> > > > +		   MSI_FLAG_PCI_MSIX),
> > > >  	.chip	= &mobiveil_msi_irq_chip,
> > > >  };
> > > >
> > > > --
> > > > 2.17.1
> > > >
Lorenzo Pieralisi June 17, 2019, 9:33 a.m. UTC | #8
On Sat, Jun 15, 2019 at 01:30:39AM +0000, Z.q. Hou wrote:
> Hi Lorenzo,
> 
> > -----Original Message-----
> > From: Lorenzo Pieralisi [mailto:lorenzo.pieralisi@arm.com]
> > Sent: 2019年6月12日 21:08
> > To: Z.q. Hou <zhiqiang.hou@nxp.com>
> > Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> > bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> > l.subrahmanya@mobiveil.co.in; shawnguo@kernel.org; Leo Li
> > <leoyang.li@nxp.com>; catalin.marinas@arm.com; will.deacon@arm.com;
> > Mingkai Hu <mingkai.hu@nxp.com>; M.h. Lian <minghuan.lian@nxp.com>;
> > Xiaowei Bao <xiaowei.bao@nxp.com>
> > Subject: Re: [PATCHv5 04/20] PCI: mobiveil: Remove the flag
> > MSI_FLAG_MULTI_PCI_MSI
> > 
> > On Wed, Jun 12, 2019 at 11:34:51AM +0000, Z.q. Hou wrote:
> > > Hi Lorenzo,
> > >
> > > Thanks a lot for your comments!
> > >
> > > > -----Original Message-----
> > > > From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > > > Sent: 2019年6月12日 1:00
> > > > To: Z.q. Hou <zhiqiang.hou@nxp.com>
> > > > Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> > > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> > > > bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> > > > l.subrahmanya@mobiveil.co.in; shawnguo@kernel.org; Leo Li
> > > > <leoyang.li@nxp.com>; catalin.marinas@arm.com;
> > will.deacon@arm.com;
> > > > Mingkai Hu <mingkai.hu@nxp.com>; M.h. Lian
> > <minghuan.lian@nxp.com>;
> > > > Xiaowei Bao <xiaowei.bao@nxp.com>
> > > > Subject: Re: [PATCHv5 04/20] PCI: mobiveil: Remove the flag
> > > > MSI_FLAG_MULTI_PCI_MSI
> > > >
> > > > On Fri, Apr 12, 2019 at 08:35:36AM +0000, Z.q. Hou wrote:
> > > > > From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > > > >
> > > > > The current code does not support multiple MSIs, so remove the
> > > > > corresponding flag from the msi_domain_info structure.
> > > >
> > > > Please explain me what's the problem before removing multi MSI support.
> > >
> > > NXP LX2 PCIe use the GIC-ITS instead of Mobiveil IP internal MSI
> > > controller, so, I didn't encounter problem.
> > 
> > Well, you sent a patch to fix an issue, explain me the issue you are fixing then,
> > aka what have you sent this patch for ?
> 
> I did not face issue, as I have explained NXP does not use the
> Mobiveil IP's MSI controller.  But obviously the MSI allocate function
> does not support multiple MSI, so I submitted this patch.

There is nothing obvious. Write what you are fixing in the commit log
and I will apply the patch, I won't write the commit log for you. Anyone
should be able to understand why a patch was needed by reading the
commit log, it is as important as writing the code itself.

Thanks,
Lorenzo

> Thanks,
> Zhiqiang
> 
> > 
> > Lorenzo
> > 
> > > Subbu, did you test with Endpoint supporting multi MSI?
> > >
> > > Thanks,
> > > Zhiqiang
> > >
> > > >
> > > > Thanks,
> > > > Lorenzo
> > > >
> > > > > Fixes: 1e913e58335f ("PCI: mobiveil: Add MSI support")
> > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > > > > Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> > > > > ---
> > > > > V5:
> > > > >  - Corrected the subject.
> > > > >
> > > > >  drivers/pci/controller/pcie-mobiveil.c | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/pci/controller/pcie-mobiveil.c
> > > > > b/drivers/pci/controller/pcie-mobiveil.c
> > > > > index 563210e731d3..a0dd337c6214 100644
> > > > > --- a/drivers/pci/controller/pcie-mobiveil.c
> > > > > +++ b/drivers/pci/controller/pcie-mobiveil.c
> > > > > @@ -703,7 +703,7 @@ static struct irq_chip mobiveil_msi_irq_chip =
> > > > > {
> > > > >
> > > > >  static struct msi_domain_info mobiveil_msi_domain_info = {
> > > > >  	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS |
> > > > MSI_FLAG_USE_DEF_CHIP_OPS |
> > > > > -		   MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX),
> > > > > +		   MSI_FLAG_PCI_MSIX),
> > > > >  	.chip	= &mobiveil_msi_irq_chip,
> > > > >  };
> > > > >
> > > > > --
> > > > > 2.17.1
> > > > >
Z.Q. Hou June 17, 2019, 10:34 a.m. UTC | #9
Hi Lorenzo,

> -----Original Message-----
> From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Sent: 2019年6月17日 17:34
> To: Z.q. Hou <zhiqiang.hou@nxp.com>
> Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> l.subrahmanya@mobiveil.co.in; shawnguo@kernel.org; Leo Li
> <leoyang.li@nxp.com>; catalin.marinas@arm.com; will.deacon@arm.com;
> Mingkai Hu <mingkai.hu@nxp.com>; M.h. Lian <minghuan.lian@nxp.com>;
> Xiaowei Bao <xiaowei.bao@nxp.com>
> Subject: Re: [PATCHv5 04/20] PCI: mobiveil: Remove the flag
> MSI_FLAG_MULTI_PCI_MSI
> 
> On Sat, Jun 15, 2019 at 01:30:39AM +0000, Z.q. Hou wrote:
> > Hi Lorenzo,
> >
> > > -----Original Message-----
> > > From: Lorenzo Pieralisi [mailto:lorenzo.pieralisi@arm.com]
> > > Sent: 2019年6月12日 21:08
> > > To: Z.q. Hou <zhiqiang.hou@nxp.com>
> > > Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> > > bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> > > l.subrahmanya@mobiveil.co.in; shawnguo@kernel.org; Leo Li
> > > <leoyang.li@nxp.com>; catalin.marinas@arm.com;
> will.deacon@arm.com;
> > > Mingkai Hu <mingkai.hu@nxp.com>; M.h. Lian
> <minghuan.lian@nxp.com>;
> > > Xiaowei Bao <xiaowei.bao@nxp.com>
> > > Subject: Re: [PATCHv5 04/20] PCI: mobiveil: Remove the flag
> > > MSI_FLAG_MULTI_PCI_MSI
> > >
> > > On Wed, Jun 12, 2019 at 11:34:51AM +0000, Z.q. Hou wrote:
> > > > Hi Lorenzo,
> > > >
> > > > Thanks a lot for your comments!
> > > >
> > > > > -----Original Message-----
> > > > > From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > > > > Sent: 2019年6月12日 1:00
> > > > > To: Z.q. Hou <zhiqiang.hou@nxp.com>
> > > > > Cc: linux-pci@vger.kernel.org;
> > > > > linux-arm-kernel@lists.infradead.org;
> > > > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> > > > > bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> > > > > l.subrahmanya@mobiveil.co.in; shawnguo@kernel.org; Leo Li
> > > > > <leoyang.li@nxp.com>; catalin.marinas@arm.com;
> > > will.deacon@arm.com;
> > > > > Mingkai Hu <mingkai.hu@nxp.com>; M.h. Lian
> > > <minghuan.lian@nxp.com>;
> > > > > Xiaowei Bao <xiaowei.bao@nxp.com>
> > > > > Subject: Re: [PATCHv5 04/20] PCI: mobiveil: Remove the flag
> > > > > MSI_FLAG_MULTI_PCI_MSI
> > > > >
> > > > > On Fri, Apr 12, 2019 at 08:35:36AM +0000, Z.q. Hou wrote:
> > > > > > From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > > > > >
> > > > > > The current code does not support multiple MSIs, so remove the
> > > > > > corresponding flag from the msi_domain_info structure.
> > > > >
> > > > > Please explain me what's the problem before removing multi MSI
> support.
> > > >
> > > > NXP LX2 PCIe use the GIC-ITS instead of Mobiveil IP internal MSI
> > > > controller, so, I didn't encounter problem.
> > >
> > > Well, you sent a patch to fix an issue, explain me the issue you are
> > > fixing then, aka what have you sent this patch for ?
> >
> > I did not face issue, as I have explained NXP does not use the
> > Mobiveil IP's MSI controller.  But obviously the MSI allocate function
> > does not support multiple MSI, so I submitted this patch.
> 
> There is nothing obvious. Write what you are fixing in the commit log and I will
> apply the patch, I won't write the commit log for you. Anyone should be able
> to understand why a patch was needed by reading the commit log, it is as
> important as writing the code itself.

With the flag MSI_FLAG_MULTI_PCI_MSI, when the Endpoint allocates multiple
MSI, it will trigger the "WARN_ON(nr_irqs != 1);" in mobiveil_irq_msi_domain_alloc(),
this is the issue this patch want to fix. 

Thanks,
Zhiqiang

> 
> Thanks,
> Lorenzo
> 
> > Thanks,
> > Zhiqiang
> >
> > >
> > > Lorenzo
> > >
> > > > Subbu, did you test with Endpoint supporting multi MSI?
> > > >
> > > > Thanks,
> > > > Zhiqiang
> > > >
> > > > >
> > > > > Thanks,
> > > > > Lorenzo
> > > > >
> > > > > > Fixes: 1e913e58335f ("PCI: mobiveil: Add MSI support")
> > > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > > > > > Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> > > > > > ---
> > > > > > V5:
> > > > > >  - Corrected the subject.
> > > > > >
> > > > > >  drivers/pci/controller/pcie-mobiveil.c | 2 +-
> > > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/drivers/pci/controller/pcie-mobiveil.c
> > > > > > b/drivers/pci/controller/pcie-mobiveil.c
> > > > > > index 563210e731d3..a0dd337c6214 100644
> > > > > > --- a/drivers/pci/controller/pcie-mobiveil.c
> > > > > > +++ b/drivers/pci/controller/pcie-mobiveil.c
> > > > > > @@ -703,7 +703,7 @@ static struct irq_chip
> > > > > > mobiveil_msi_irq_chip = {
> > > > > >
> > > > > >  static struct msi_domain_info mobiveil_msi_domain_info = {
> > > > > >  	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS |
> > > > > MSI_FLAG_USE_DEF_CHIP_OPS |
> > > > > > -		   MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX),
> > > > > > +		   MSI_FLAG_PCI_MSIX),
> > > > > >  	.chip	= &mobiveil_msi_irq_chip,
> > > > > >  };
> > > > > >
> > > > > > --
> > > > > > 2.17.1
> > > > > >
Lorenzo Pieralisi June 28, 2019, 11:35 a.m. UTC | #10
On Mon, Jun 17, 2019 at 10:34:35AM +0000, Z.q. Hou wrote:

[...]

> > There is nothing obvious. Write what you are fixing in the commit log and I will
> > apply the patch, I won't write the commit log for you. Anyone should be able
> > to understand why a patch was needed by reading the commit log, it is as
> > important as writing the code itself.
> 
> With the flag MSI_FLAG_MULTI_PCI_MSI, when the Endpoint allocates
> multiple MSI, it will trigger the "WARN_ON(nr_irqs != 1);" in
> mobiveil_irq_msi_domain_alloc(), this is the issue this patch want to
> fix. 

And that's wrong. Marc explained why this controller does not support
Multi MSI and that's what should go in the commit log, triggering
a WARN_ON is the least of the problems (and the WARN_ON can even
be removed after this patch is applied), if it was used as a bandaid
to prevent allocating Multi MSI it is even more broken.

Lorenzo

> Thanks,
> Zhiqiang
> 
> > 
> > Thanks,
> > Lorenzo
> > 
> > > Thanks,
> > > Zhiqiang
> > >
> > > >
> > > > Lorenzo
> > > >
> > > > > Subbu, did you test with Endpoint supporting multi MSI?
> > > > >
> > > > > Thanks,
> > > > > Zhiqiang
> > > > >
> > > > > >
> > > > > > Thanks,
> > > > > > Lorenzo
> > > > > >
> > > > > > > Fixes: 1e913e58335f ("PCI: mobiveil: Add MSI support")
> > > > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > > > > > > Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> > > > > > > ---
> > > > > > > V5:
> > > > > > >  - Corrected the subject.
> > > > > > >
> > > > > > >  drivers/pci/controller/pcie-mobiveil.c | 2 +-
> > > > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > >
> > > > > > > diff --git a/drivers/pci/controller/pcie-mobiveil.c
> > > > > > > b/drivers/pci/controller/pcie-mobiveil.c
> > > > > > > index 563210e731d3..a0dd337c6214 100644
> > > > > > > --- a/drivers/pci/controller/pcie-mobiveil.c
> > > > > > > +++ b/drivers/pci/controller/pcie-mobiveil.c
> > > > > > > @@ -703,7 +703,7 @@ static struct irq_chip
> > > > > > > mobiveil_msi_irq_chip = {
> > > > > > >
> > > > > > >  static struct msi_domain_info mobiveil_msi_domain_info = {
> > > > > > >  	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS |
> > > > > > MSI_FLAG_USE_DEF_CHIP_OPS |
> > > > > > > -		   MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX),
> > > > > > > +		   MSI_FLAG_PCI_MSIX),
> > > > > > >  	.chip	= &mobiveil_msi_irq_chip,
> > > > > > >  };
> > > > > > >
> > > > > > > --
> > > > > > > 2.17.1
> > > > > > >
Z.Q. Hou July 1, 2019, 10:07 a.m. UTC | #11
Hi Lorenzo,

Thanks a lot for your comments!

> -----Original Message-----
> From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Sent: 2019年6月28日 19:36
> To: Z.q. Hou <zhiqiang.hou@nxp.com>
> Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> bhelgaas@google.com; robh+dt@kernel.org; mark.rutland@arm.com;
> l.subrahmanya@mobiveil.co.in; shawnguo@kernel.org; Leo Li
> <leoyang.li@nxp.com>; catalin.marinas@arm.com; will.deacon@arm.com;
> Mingkai Hu <mingkai.hu@nxp.com>; M.h. Lian <minghuan.lian@nxp.com>;
> Xiaowei Bao <xiaowei.bao@nxp.com>
> Subject: Re: [PATCHv5 04/20] PCI: mobiveil: Remove the flag
> MSI_FLAG_MULTI_PCI_MSI
> 
> On Mon, Jun 17, 2019 at 10:34:35AM +0000, Z.q. Hou wrote:
> 
> [...]
> 
> > > There is nothing obvious. Write what you are fixing in the commit
> > > log and I will apply the patch, I won't write the commit log for
> > > you. Anyone should be able to understand why a patch was needed by
> > > reading the commit log, it is as important as writing the code itself.
> >
> > With the flag MSI_FLAG_MULTI_PCI_MSI, when the Endpoint allocates
> > multiple MSI, it will trigger the "WARN_ON(nr_irqs != 1);" in
> > mobiveil_irq_msi_domain_alloc(), this is the issue this patch want to
> > fix.
> 
> And that's wrong. Marc explained why this controller does not support Multi
> MSI and that's what should go in the commit log, triggering a WARN_ON is
> the least of the problems (and the WARN_ON can even be removed after
> this patch is applied), if it was used as a bandaid to prevent allocating Multi
> MSI it is even more broken.
>

Yes, I agree, the root cause is hardware limitation, is the following changelog
acceptable?

Changelog:
The Mobiveil internal MSI controller uses separate target address per MSI,
so, it is unable to support Multiple MSI feature, which requires the same
target address and incremental MSI_DATA values. This patch is to remove
the flag MSI_FLAG_MULTI_PCI_MSI.

Thanks,
Zhiqiang
 
> Lorenzo
> 
> > Thanks,
> > Zhiqiang
> >
> > >
> > > Thanks,
> > > Lorenzo
> > >
> > > > Thanks,
> > > > Zhiqiang
> > > >
> > > > >
> > > > > Lorenzo
> > > > >
> > > > > > Subbu, did you test with Endpoint supporting multi MSI?
> > > > > >
> > > > > > Thanks,
> > > > > > Zhiqiang
> > > > > >
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Lorenzo
> > > > > > >
> > > > > > > > Fixes: 1e913e58335f ("PCI: mobiveil: Add MSI support")
> > > > > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> > > > > > > > Reviewed-by: Minghuan Lian <Minghuan.Lian@nxp.com>
> > > > > > > > ---
> > > > > > > > V5:
> > > > > > > >  - Corrected the subject.
> > > > > > > >
> > > > > > > >  drivers/pci/controller/pcie-mobiveil.c | 2 +-
> > > > > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > > >
> > > > > > > > diff --git a/drivers/pci/controller/pcie-mobiveil.c
> > > > > > > > b/drivers/pci/controller/pcie-mobiveil.c
> > > > > > > > index 563210e731d3..a0dd337c6214 100644
> > > > > > > > --- a/drivers/pci/controller/pcie-mobiveil.c
> > > > > > > > +++ b/drivers/pci/controller/pcie-mobiveil.c
> > > > > > > > @@ -703,7 +703,7 @@ static struct irq_chip
> > > > > > > > mobiveil_msi_irq_chip = {
> > > > > > > >
> > > > > > > >  static struct msi_domain_info mobiveil_msi_domain_info = {
> > > > > > > >  	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS |
> > > > > > > MSI_FLAG_USE_DEF_CHIP_OPS |
> > > > > > > > -		   MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX),
> > > > > > > > +		   MSI_FLAG_PCI_MSIX),
> > > > > > > >  	.chip	= &mobiveil_msi_irq_chip,
> > > > > > > >  };
> > > > > > > >
> > > > > > > > --
> > > > > > > > 2.17.1
> > > > > > > >
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c
index 563210e731d3..a0dd337c6214 100644
--- a/drivers/pci/controller/pcie-mobiveil.c
+++ b/drivers/pci/controller/pcie-mobiveil.c
@@ -703,7 +703,7 @@  static struct irq_chip mobiveil_msi_irq_chip = {
 
 static struct msi_domain_info mobiveil_msi_domain_info = {
 	.flags	= (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-		   MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX),
+		   MSI_FLAG_PCI_MSIX),
 	.chip	= &mobiveil_msi_irq_chip,
 };