diff mbox

pci: designware: fix missing msi irqs

Message ID 20131212182903.409515738@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Harro Haan Dec. 12, 2013, 6:29 p.m. UTC
The interrupts were cleared after the irq handler was called.
This means that new interrupts that occur after the handler handled
the previous irq but before the interrupt is cleared will be missed.

Signed-off-by: Harro Haan <hrhaan@gmail.com>
Cc: Mohit Kumar <mohit.kumar@st.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Richard Zhu <hong-xing.zhu@freescale.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Pratyush Anand <pratyush.anand@st.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Juergen Beisert <jbe@pengutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Siva Reddy Kallam <siva.kallam@samsung.com>
Cc: Srikanth T Shivanand <ts.srikanth@samsung.com>
Cc: Sean Cross <xobs@kosagi.com>
Cc: linux-pci@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/pci/host/pcie-designware.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Matthias Mann Dec. 12, 2013, 7:29 p.m. UTC | #1
Am 12.12.2013 19:29, schrieb Harro Haan:
> The interrupts were cleared after the irq handler was called.
> This means that new interrupts that occur after the handler handled
> the previous irq but before the interrupt is cleared will be missed.

I discovered the same issue today. I'll test that patch tomorrow.
Marek Vasut Dec. 12, 2013, 10:01 p.m. UTC | #2
On Thursday, December 12, 2013 at 07:29:03 PM, Harro Haan wrote:
> The interrupts were cleared after the irq handler was called.
> This means that new interrupts that occur after the handler handled
> the previous irq but before the interrupt is cleared will be missed.
> 
> Signed-off-by: Harro Haan <hrhaan@gmail.com>
> Cc: Mohit Kumar <mohit.kumar@st.com>
> Cc: Jingoo Han <jg1.han@samsung.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Richard Zhu <hong-xing.zhu@freescale.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Pratyush Anand <pratyush.anand@st.com>
> Cc: Tim Harvey <tharvey@gateworks.com>
> Cc: Juergen Beisert <jbe@pengutronix.de>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Siva Reddy Kallam <siva.kallam@samsung.com>
> Cc: Srikanth T Shivanand <ts.srikanth@samsung.com>
> Cc: Sean Cross <xobs@kosagi.com>
> Cc: linux-pci@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  drivers/pci/host/pcie-designware.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/host/pcie-designware.c
> b/drivers/pci/host/pcie-designware.c index 1ce0453..762f596 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -167,11 +167,13 @@ void dw_handle_msi_irq(struct pcie_port *pp)
>  			while ((pos = find_next_bit(&val, 32, pos)) != 32) {
>  				irq = irq_find_mapping(pp->irq_domain,
>  						i * 32 + pos);
> +				dw_pcie_wr_own_conf(pp,
> +						PCIE_MSI_INTR0_STATUS + i * 12,
> +						4, 1 << pos);
>  				generic_handle_irq(irq);
>  				pos++;
>  			}
>  		}
> -		dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_STATUS + i * 12, 4, val);
>  	}
>  }

On imx6-sabrelite:

Tested-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
Matthias Mann Dec. 13, 2013, 8:42 a.m. UTC | #3
Am 12.12.2013 20:29, schrieb Matthias Mann:
> Am 12.12.2013 19:29, schrieb Harro Haan:
>> The interrupts were cleared after the irq handler was called.
>> This means that new interrupts that occur after the handler handled
>> the previous irq but before the interrupt is cleared will be missed.
>
> I discovered the same issue today. I'll test that patch tomorrow.
>
I tested this patch on our custom i.MX6 board with an Altera FPGA as PCIe
device and it fixed the missed MSI interrupts.

Tested-by:  Matthias Mann <m.mann@arkona-technologies.de>

Regards
Matthias Mann
Jingoo Han Dec. 16, 2013, 12:54 a.m. UTC | #4
On Friday, December 13, 2013 3:29 AM, Harro Haan wrote:
> 
> The interrupts were cleared after the irq handler was called.
> This means that new interrupts that occur after the handler handled
> the previous irq but before the interrupt is cleared will be missed.
> 
> Signed-off-by: Harro Haan <hrhaan@gmail.com>
> Cc: Mohit Kumar <mohit.kumar@st.com>
> Cc: Jingoo Han <jg1.han@samsung.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Richard Zhu <hong-xing.zhu@freescale.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Pratyush Anand <pratyush.anand@st.com>
> Cc: Tim Harvey <tharvey@gateworks.com>
> Cc: Juergen Beisert <jbe@pengutronix.de>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Siva Reddy Kallam <siva.kallam@samsung.com>
> Cc: Srikanth T Shivanand <ts.srikanth@samsung.com>
> Cc: Sean Cross <xobs@kosagi.com>
> Cc: linux-pci@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org

Acked-by: Jingoo Han <jg1.han@samsung.com>

I was not able to reproduce the problem, however it looks
good. Also, there is no side effect on Exynos platform.

Mohit,
If you have some comments, please let us know.

Best regards,
Jingoo Han

> ---
>  drivers/pci/host/pcie-designware.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
Mohit KUMAR DCG Dec. 16, 2013, 6:48 a.m. UTC | #5
> -----Original Message-----
> From: Jingoo Han [mailto:jg1.han@samsung.com]
> Sent: Monday, December 16, 2013 6:24 AM
> To: 'Harro Haan'; Mohit KUMAR DCG
> Cc: 'Bjorn Helgaas'; 'Marek Vasut'; 'Richard Zhu'; 'Shawn Guo'; Pratyush
> ANAND; 'Tim Harvey'; 'Juergen Beisert'; 'Arnd Bergmann'; 'Siva Reddy
> Kallam'; 'Srikanth T Shivanand'; 'Sean Cross'; linux-pci@vger.kernel.org; linux-
> arm-kernel@lists.infradead.org; 'Jingoo Han'
> Subject: Re: [PATCH] pci: designware: fix missing msi irqs
> 
> On Friday, December 13, 2013 3:29 AM, Harro Haan wrote:
> >
> > The interrupts were cleared after the irq handler was called.
> > This means that new interrupts that occur after the handler handled
> > the previous irq but before the interrupt is cleared will be missed.
> >
> > Signed-off-by: Harro Haan <hrhaan@gmail.com>
> > Cc: Mohit Kumar <mohit.kumar@st.com>
> > Cc: Jingoo Han <jg1.han@samsung.com>
> > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > Cc: Marek Vasut <marex@denx.de>
> > Cc: Richard Zhu <hong-xing.zhu@freescale.com>
> > Cc: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Pratyush Anand <pratyush.anand@st.com>
> > Cc: Tim Harvey <tharvey@gateworks.com>
> > Cc: Juergen Beisert <jbe@pengutronix.de>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Siva Reddy Kallam <siva.kallam@samsung.com>
> > Cc: Srikanth T Shivanand <ts.srikanth@samsung.com>
> > Cc: Sean Cross <xobs@kosagi.com>
> > Cc: linux-pci@vger.kernel.org
> > Cc: linux-arm-kernel@lists.infradead.org
> 
> Acked-by: Jingoo Han <jg1.han@samsung.com>
> 
> I was not able to reproduce the problem, however it looks good. Also, there
> is no side effect on Exynos platform.
> 
> Mohit,
> If you have some comments, please let us know.

- Quickly tested on SPEAr1310, working fine without any side effect. So is,
Acked-by: Mohit Kumar <mohit.kumar@st.com>
..
> 
> > ---
> >  drivers/pci/host/pcie-designware.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
Jingoo Han Dec. 20, 2013, 2:41 a.m. UTC | #6
On Monday, December 16, 2013 3:49 PM, Mohit KUMAR DCG wrote:
> On Monday, December 16, 2013 6:24 AM, Jingoo Han wrote:
> > On Friday, December 13, 2013 3:29 AM, Harro Haan wrote:
> > >
> > > The interrupts were cleared after the irq handler was called.
> > > This means that new interrupts that occur after the handler handled
> > > the previous irq but before the interrupt is cleared will be missed.
> > >
> > > Signed-off-by: Harro Haan <hrhaan@gmail.com>
> > > Cc: Mohit Kumar <mohit.kumar@st.com>
> > > Cc: Jingoo Han <jg1.han@samsung.com>
> > > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > > Cc: Marek Vasut <marex@denx.de>
> > > Cc: Richard Zhu <hong-xing.zhu@freescale.com>
> > > Cc: Shawn Guo <shawn.guo@linaro.org>
> > > Cc: Pratyush Anand <pratyush.anand@st.com>
> > > Cc: Tim Harvey <tharvey@gateworks.com>
> > > Cc: Juergen Beisert <jbe@pengutronix.de>
> > > Cc: Arnd Bergmann <arnd@arndb.de>
> > > Cc: Siva Reddy Kallam <siva.kallam@samsung.com>
> > > Cc: Srikanth T Shivanand <ts.srikanth@samsung.com>
> > > Cc: Sean Cross <xobs@kosagi.com>
> > > Cc: linux-pci@vger.kernel.org
> > > Cc: linux-arm-kernel@lists.infradead.org
> >
> > Acked-by: Jingoo Han <jg1.han@samsung.com>
> >
> > I was not able to reproduce the problem, however it looks good. Also, there
> > is no side effect on Exynos platform.
> >
> > Mohit,
> > If you have some comments, please let us know.
> 
> - Quickly tested on SPEAr1310, working fine without any side effect. So is,
> Acked-by: Mohit Kumar <mohit.kumar@st.com>

Hi Bjorn Helgaas,

Would you apply this patch to your 'pci/host-designware' branch
with the following Tested-by and Acked-by?

Tested-by: Marek Vasut <marex@denx.de>
Tested-by:  Matthias Mann <m.mann@arkona-technologies.de>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Mohit Kumar <mohit.kumar@st.com>


> ..
> >
> > > ---
> > >  drivers/pci/host/pcie-designware.c |    4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
Bjorn Helgaas Dec. 20, 2013, 4:09 p.m. UTC | #7
On Thu, Dec 19, 2013 at 7:41 PM, Jingoo Han <jg1.han@samsung.com> wrote:
> On Monday, December 16, 2013 3:49 PM, Mohit KUMAR DCG wrote:
>> On Monday, December 16, 2013 6:24 AM, Jingoo Han wrote:
>> > On Friday, December 13, 2013 3:29 AM, Harro Haan wrote:
>> > >
>> > > The interrupts were cleared after the irq handler was called.
>> > > This means that new interrupts that occur after the handler handled
>> > > the previous irq but before the interrupt is cleared will be missed.
>> > >
>> > > Signed-off-by: Harro Haan <hrhaan@gmail.com>
>> > > Cc: Mohit Kumar <mohit.kumar@st.com>
>> > > Cc: Jingoo Han <jg1.han@samsung.com>
>> > > Cc: Bjorn Helgaas <bhelgaas@google.com>
>> > > Cc: Marek Vasut <marex@denx.de>
>> > > Cc: Richard Zhu <hong-xing.zhu@freescale.com>
>> > > Cc: Shawn Guo <shawn.guo@linaro.org>
>> > > Cc: Pratyush Anand <pratyush.anand@st.com>
>> > > Cc: Tim Harvey <tharvey@gateworks.com>
>> > > Cc: Juergen Beisert <jbe@pengutronix.de>
>> > > Cc: Arnd Bergmann <arnd@arndb.de>
>> > > Cc: Siva Reddy Kallam <siva.kallam@samsung.com>
>> > > Cc: Srikanth T Shivanand <ts.srikanth@samsung.com>
>> > > Cc: Sean Cross <xobs@kosagi.com>
>> > > Cc: linux-pci@vger.kernel.org
>> > > Cc: linux-arm-kernel@lists.infradead.org
>> >
>> > Acked-by: Jingoo Han <jg1.han@samsung.com>
>> >
>> > I was not able to reproduce the problem, however it looks good. Also, there
>> > is no side effect on Exynos platform.
>> >
>> > Mohit,
>> > If you have some comments, please let us know.
>>
>> - Quickly tested on SPEAr1310, working fine without any side effect. So is,
>> Acked-by: Mohit Kumar <mohit.kumar@st.com>
>
> Hi Bjorn Helgaas,
>
> Would you apply this patch to your 'pci/host-designware' branch
> with the following Tested-by and Acked-by?
>
> Tested-by: Marek Vasut <marex@denx.de>
> Tested-by:  Matthias Mann <m.mann@arkona-technologies.de>
> Acked-by: Jingoo Han <jg1.han@samsung.com>
> Acked-by: Mohit Kumar <mohit.kumar@st.com>

Applied to pci/host-designware for v3.14, thanks for the reminder!

Bjorn
diff mbox

Patch

diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index 1ce0453..762f596 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -167,11 +167,13 @@  void dw_handle_msi_irq(struct pcie_port *pp)
 			while ((pos = find_next_bit(&val, 32, pos)) != 32) {
 				irq = irq_find_mapping(pp->irq_domain,
 						i * 32 + pos);
+				dw_pcie_wr_own_conf(pp,
+						PCIE_MSI_INTR0_STATUS + i * 12,
+						4, 1 << pos);
 				generic_handle_irq(irq);
 				pos++;
 			}
 		}
-		dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_STATUS + i * 12, 4, val);
 	}
 }