Received: by 10.223.185.116 with SMTP id b49csp2466601wrg; Mon, 12 Feb 2018 10:00:28 -0800 (PST) X-Google-Smtp-Source: AH8x2253NY0vuBQQBYEo/Npo9o5WIMBortn/uLI7k3C+wCZNHnSM39dEfgYd1CygS+QD126ni2kU X-Received: by 2002:a17:902:68ca:: with SMTP id x10-v6mr11130165plm.367.1518458428799; Mon, 12 Feb 2018 10:00:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518458428; cv=none; d=google.com; s=arc-20160816; b=J44M2mOj5Beg5IJKAIHU2wqcZ6UIzVuIz8WpdVeyneq/Wo2O9sv3vMbkcbPowcEs5t n/ZEeg+8qUq4K08Dha3LoAw7usGJf4noZ7uQltbGDDqqf7RN+R627edi8uF0QXIvTTNg 4wk+HM7GXMmAu/boei/ph+pPJ+F8nI0Mi3NJaF29Al5yGPdYIRwEjygB7h3rB2S2JIcs 0e9SLpsvqctlUqjEpl2DNquHHYBwVC9IeIEkj/acgy7IQP12z0FRBLBxj4CI+Tsu1b+z ZasLVTkFitRed6dE+FguqoluayvK7RBouwaBPsSTjF/pnwz92wScNtEr4l54ee6OXwDb kQyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=DtWlMcmRPXRsxwUkEr9Isd/7R1HJZNdYQUIOe2zEqHo=; b=nQaImSf94YnvX7K/qj5up+kzQChFPwGsoVZYvoB5BYiM24jK8gMIvL1V5LNwGlNZ+8 HE2l/tgQdEeb0whOrDsxxud2atC7G6igREBYPIqiM3/FgZtvb8Wawk0NDnaedSiyO/ld gA9bKa4eDyEp05KQDoZMaAIVrVTpvJGfGYH6ZOjjLM5r/TnfKl865cwVoFH37wd7mANE adOiWsGeBl9/Ml3L0iMraaL1ATKBl2OktUQkkFz+LZ1ikPzUZZ5YldymlJtHRfq2Zufv 96zlYCBUiv5rvRgXA/sNKPBsIkhrAX90Ao5+NF8sXQzMlATqm1qIZ5R7PytZNku78y1s FYIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si117696plx.742.2018.02.12.10.00.13; Mon, 12 Feb 2018 10:00:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932271AbeBLR6K (ORCPT + 99 others); Mon, 12 Feb 2018 12:58:10 -0500 Received: from foss.arm.com ([217.140.101.70]:44404 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752564AbeBLR6I (ORCPT ); Mon, 12 Feb 2018 12:58:08 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5AB851435; Mon, 12 Feb 2018 09:58:08 -0800 (PST) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.207.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B02033F487; Mon, 12 Feb 2018 09:58:06 -0800 (PST) Date: Mon, 12 Feb 2018 17:58:01 +0000 From: Lorenzo Pieralisi To: Vignesh R Cc: Jingoo Han , Joao Pinto , Kishon Vijay Abraham I , Bjorn Helgaas , Niklas Cassel , linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] PCI: dwc: pci-dra7xx: Improve MSI IRQ handling Message-ID: <20180212175801.GA29070@e107981-ln.cambridge.arm.com> References: <20180209120415.17590-1-vigneshr@ti.com> <20180209120415.17590-3-vigneshr@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180209120415.17590-3-vigneshr@ti.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 09, 2018 at 05:34:14PM +0530, Vignesh R wrote: > We need to ensure that there are no pending MSI IRQ vector set (i.e > PCIE_MSI_INTR0_STATUS reads 0 at least once) before exiting > dra7xx_pcie_msi_irq_handler(). Else, the dra7xx PCIe wrapper will not > register new MSI IRQs even though PCIE_MSI_INTR0_STATUS shows IRQs are > pending. Therefore, keep calling dra7xx_pcie_msi_irq_handler() until it > returns IRQ_NONE, which suggests that PCIE_MSI_INTR0_STATUS is 0. > > This fixes a bug, where PCIe wifi cards with 4 DMA queues like Intel > 8260 used to throw following error and stall during ping/iperf3 tests. > > [ 97.776310] iwlwifi 0000:01:00.0: Queue 9 stuck for 2500 ms. > > Signed-off-by: Vignesh R > --- > drivers/pci/dwc/pci-dra7xx.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/pci/dwc/pci-dra7xx.c b/drivers/pci/dwc/pci-dra7xx.c > index ed8558d638e5..3420cbf7b60a 100644 > --- a/drivers/pci/dwc/pci-dra7xx.c > +++ b/drivers/pci/dwc/pci-dra7xx.c > @@ -254,14 +254,31 @@ static irqreturn_t dra7xx_pcie_msi_irq_handler(int irq, void *arg) > struct dra7xx_pcie *dra7xx = arg; > struct dw_pcie *pci = dra7xx->pci; > struct pcie_port *pp = &pci->pp; > + int count = 0; > unsigned long reg; > u32 virq, bit; > > reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI); > + dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI, reg); > > switch (reg) { > case MSI: > - dw_handle_msi_irq(pp); > + /* > + * Need to make sure no MSI IRQs are pending before > + * exiting handler, else the wrapper will not catch new > + * IRQs. So loop around till dw_handle_msi_irq() returns > + * IRQ_NONE > + */ > + while (dw_handle_msi_irq(pp) != IRQ_NONE && count < 1000) > + count++; > + > + if (count == 1000) { > + dev_err(pci->dev, "too much work in msi irq\n"); > + dra7xx_pcie_writel(dra7xx, > + PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI, > + reg); > + return IRQ_HANDLED; I am not merging any code patching this IRQ handling routine anymore unless you thoroughly explain to me how this CONF_IRQSTATUS_MSI register works (and how it is related to DW registers) and why this specific host controller needs handling that is not required by any other host controller relying on dw_handle_msi_irq(). I suspect there is a code design flaw with the way this host handles IRQs and we are going to find it and fix it the way it should, not with any plaster like this patch. Lorenzo > + } > break; > case INTA: > case INTB: > @@ -275,8 +292,6 @@ static irqreturn_t dra7xx_pcie_msi_irq_handler(int irq, void *arg) > break; > } > > - dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI, reg); > - > return IRQ_HANDLED; > } > > -- > 2.16.1 >