From: Bjorn Helgaas <bhelgaas@google.com>
To: Russell Joyce <russell.joyce@york.ac.uk>
Cc: michal.simek@xilinx.com, soren.brinkmann@xilinx.com,
sthokal@xilinx.com, jiang.liu@linux.intel.com, arnd@arndb.de,
tglx@linutronix.de, wangyijing@huawei.com, wsa@the-dreams.de,
robh@kernel.org, linux-pci@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: xilinx: Add check for MSI interrupt flag before handling as INTx
Date: Tue, 14 Jul 2015 17:24:40 -0500 [thread overview]
Message-ID: <20150714222440.GO24416@google.com> (raw)
In-Reply-To: <1436288059-22925-1-git-send-email-russell.joyce@york.ac.uk>
On Tue, Jul 07, 2015 at 05:54:19PM +0100, Russell Joyce wrote:
> Occasionally both MSI and INTx bits in the interrupt decode register are
> set at once by the Xilinx AXI PCIe Bridge, so the MSI flag in the
> interrupt message should be checked to ensure that the correct handler is
> used.
>
> If this check is not in place and the interrupt message type is MSI, the
> INTx handler will be used erroneously when both type bits are set.
> This will also be followed by a second read of the message FIFO, which can
> result in the function returning early and the interrupt decode register
> not being cleared if the FIFO is now empty.
>
> Signed-off-by: Russell Joyce <russell.joyce@york.ac.uk>
> ---
> drivers/pci/host/pcie-xilinx.c | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
> index f1a06a0..dcb9b57 100644
> --- a/drivers/pci/host/pcie-xilinx.c
> +++ b/drivers/pci/host/pcie-xilinx.c
> @@ -449,14 +449,17 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
> return IRQ_HANDLED;
> }
>
> - /* Clear interrupt FIFO register 1 */
> - pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK,
> - XILINX_PCIE_REG_RPIFR1);
> -
> - /* Handle INTx Interrupt */
> - val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
> - XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
> - generic_handle_irq(irq_find_mapping(port->irq_domain, val));
> + if (!(val & XILINX_PCIE_RPIFR1_MSI_INTR)) {
> + /* Clear interrupt FIFO register 1 */
> + pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK,
> + XILINX_PCIE_REG_RPIFR1);
> +
> + /* Handle INTx Interrupt */
> + val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
> + XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
> + generic_handle_irq(irq_find_mapping(port->irq_domain,
> + val));
Xilinx folks, any comments?
Russell, is there a good way to reproduce this so others can verify the
problem and the fix?
> + }
> }
>
> if (status & XILINX_PCIE_INTR_MSI) {
> --
> 2.1.4
>
WARNING: multiple messages have this Message-ID (diff)
From: bhelgaas@google.com (Bjorn Helgaas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] PCI: xilinx: Add check for MSI interrupt flag before handling as INTx
Date: Tue, 14 Jul 2015 17:24:40 -0500 [thread overview]
Message-ID: <20150714222440.GO24416@google.com> (raw)
In-Reply-To: <1436288059-22925-1-git-send-email-russell.joyce@york.ac.uk>
On Tue, Jul 07, 2015 at 05:54:19PM +0100, Russell Joyce wrote:
> Occasionally both MSI and INTx bits in the interrupt decode register are
> set at once by the Xilinx AXI PCIe Bridge, so the MSI flag in the
> interrupt message should be checked to ensure that the correct handler is
> used.
>
> If this check is not in place and the interrupt message type is MSI, the
> INTx handler will be used erroneously when both type bits are set.
> This will also be followed by a second read of the message FIFO, which can
> result in the function returning early and the interrupt decode register
> not being cleared if the FIFO is now empty.
>
> Signed-off-by: Russell Joyce <russell.joyce@york.ac.uk>
> ---
> drivers/pci/host/pcie-xilinx.c | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
> index f1a06a0..dcb9b57 100644
> --- a/drivers/pci/host/pcie-xilinx.c
> +++ b/drivers/pci/host/pcie-xilinx.c
> @@ -449,14 +449,17 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
> return IRQ_HANDLED;
> }
>
> - /* Clear interrupt FIFO register 1 */
> - pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK,
> - XILINX_PCIE_REG_RPIFR1);
> -
> - /* Handle INTx Interrupt */
> - val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
> - XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
> - generic_handle_irq(irq_find_mapping(port->irq_domain, val));
> + if (!(val & XILINX_PCIE_RPIFR1_MSI_INTR)) {
> + /* Clear interrupt FIFO register 1 */
> + pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK,
> + XILINX_PCIE_REG_RPIFR1);
> +
> + /* Handle INTx Interrupt */
> + val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
> + XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
> + generic_handle_irq(irq_find_mapping(port->irq_domain,
> + val));
Xilinx folks, any comments?
Russell, is there a good way to reproduce this so others can verify the
problem and the fix?
> + }
> }
>
> if (status & XILINX_PCIE_INTR_MSI) {
> --
> 2.1.4
>
next prev parent reply other threads:[~2015-07-14 22:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 16:54 [PATCH] PCI: xilinx: Add check for MSI interrupt flag before handling as INTx Russell Joyce
2015-07-07 16:54 ` Russell Joyce
2015-07-14 22:24 ` Bjorn Helgaas [this message]
2015-07-14 22:24 ` Bjorn Helgaas
2015-07-17 10:41 ` Russell Joyce
2015-07-17 10:41 ` Russell Joyce
2015-07-21 15:40 ` Bjorn Helgaas
2015-07-21 15:40 ` Bjorn Helgaas
2015-07-21 16:31 ` Michal Simek
2015-07-21 16:31 ` Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150714222440.GO24416@google.com \
--to=bhelgaas@google.com \
--cc=arnd@arndb.de \
--cc=jiang.liu@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=robh@kernel.org \
--cc=russell.joyce@york.ac.uk \
--cc=soren.brinkmann@xilinx.com \
--cc=sthokal@xilinx.com \
--cc=tglx@linutronix.de \
--cc=wangyijing@huawei.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.