Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp623633imu; Thu, 13 Dec 2018 01:22:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/UdTN6A3xLKVG6A48uQWW5D9XMau5jSMQTHQIo6pK7D2QisNlUd+kMgVphALOo6cq6IDzpc X-Received: by 2002:a17:902:9047:: with SMTP id w7mr23192490plz.270.1544692929119; Thu, 13 Dec 2018 01:22:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544692929; cv=none; d=google.com; s=arc-20160816; b=uxs32FNBPftrIC2a8pOUxj+Yo93x/O6/PB8zEzrf2bJkDs5LhRwu8G2tPR7SLIcXP+ R/RwIBVrbGiZnOwwvPUhCmeWq4bMlTLkfnJ21ZfrTqMayfAdb74Fx7JmF7jfAjTtOvbH Gk0t9jwi76OS/ACzUr6PGomqJO4pNISCrYu+yzKKbF01jwfi1soQE9Z7N2GGGsiHuke5 h5XdvoZtYVSeX9vIRYxWChQGeTI3RkCoUfjiCKyYknM9vRjvDtLLsIzZQ5APmdrldYdQ xAlRZ9UXEZXzrf4dGx0x8egdnYn5NkhEkFxkH3DAvWFebdNXRZxQKtrZOrHxPHj6tAe+ 5fiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=q7cZIF+aS/XENyWNkMUHqUBsl+cH8M/Eb/+yYulCKuA=; b=CfyOUE/3NX3bzQzDohiERqEyZLclcN1Cdmt5tZ+qSqpOKg9sYaGfJp7LnGN2CsdJC8 i+rRqezaMIIkRqF0GiRKZqsTxsew0Nh6pveSWkD7OOC5jiziX2EvVaDTz/lkHUxvUzjg fGntsv0pD+ZaNUD6TsR7xuJxA0AiocXcvHwU+ZmroM9ViTtzmpyfNu1IIYA7uK75pDak +GKGeWgX+ziICWFVJEa79OQyKqWo5L+eFikPF+A+ZRlvW9YI8Pq4p3Tg+gPxm7hIZwAI hFwpIa5qP0MjIohh5DXitP23FYYIXFVAvDBcDjIEn26k5PtEEpzdCwSrlm2BJ6DO6vQe 9gSg== 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 d15si381122pgt.498.2018.12.13.01.21.54; Thu, 13 Dec 2018 01:22:09 -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 S1727890AbeLMJTd (ORCPT + 99 others); Thu, 13 Dec 2018 04:19:33 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:34313 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726578AbeLMJTc (ORCPT ); Thu, 13 Dec 2018 04:19:32 -0500 Received: from kresse.hi.pengutronix.de ([2001:67c:670:100:1d::2a]) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1gXN9U-0005cg-Pk; Thu, 13 Dec 2018 10:19:28 +0100 Message-ID: <1544692768.3137.25.camel@pengutronix.de> Subject: Re: [v2] PCI: imx: make msi work without pcieportbus From: Lucas Stach To: Richard Zhu , "bhelgaas@google.com" , "lorenzo.pieralisi@arm.com" , "andrew.smirnov@gmail.com" Cc: "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Date: Thu, 13 Dec 2018 10:19:28 +0100 In-Reply-To: <1544687042-16595-1-git-send-email-hongxing.zhu@nxp.com> References: <1544687042-16595-1-git-send-email-hongxing.zhu@nxp.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::2a X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Richard, Am Donnerstag, den 13.12.2018, 08:02 +0000 schrieb Richard Zhu: > MSI_EN of iMX PCIe RC would be asserted when > PCIEPORTBUS driver is selected. > Thus, the MSI works fine on iMX PCIe before. > Assert it unconditionally when MSI is supported. > Otherwise, the MSI wouldn't be triggered although > the EP is present and the MSIs are assigned. Thanks for digging into this issue. This seems like the right way forward. However, did you test this with devices using legacy IRQs? I.e. booting with "nomsi" on the kernel command line to see if legacy IRQs still work if this bit is set, or if we need to avoid setting this when the user explicitly requests to disable MSIs? Regards, Lucas > Signed-off-by: Richard Zhu > --- >  drivers/pci/controller/dwc/pci-imx6.c | 7 +++++++ >  1 file changed, 7 insertions(+) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index 26087b3..d3e4296 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -74,6 +74,7 @@ struct imx6_pcie { > >  #define PHY_PLL_LOCK_WAIT_USLEEP_MAX 200 >   >  /* PCIe Root Complex registers (memory-mapped) */ > > +#define PCI_MSI_CAP 0x50 > >  #define PCIE_RC_LCR 0x7c > >  #define PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN1 0x1 > >  #define PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN2 0x2 > @@ -926,6 +927,7 @@ static int imx6_pcie_probe(struct platform_device *pdev) > >   struct resource *dbi_base; > >   struct device_node *node = dev->of_node; > >   int ret; > > + u16 val; >   > >   imx6_pcie = devm_kzalloc(dev, sizeof(*imx6_pcie), GFP_KERNEL); > >   if (!imx6_pcie) > @@ -1070,6 +1072,11 @@ static int imx6_pcie_probe(struct platform_device *pdev) > >   ret = imx6_add_pcie_port(imx6_pcie, pdev); > >   if (ret < 0) > >   return ret; > > + if (IS_ENABLED(CONFIG_PCI_MSI)) { > > + val = dw_pcie_readw_dbi(pci, PCI_MSI_CAP + PCI_MSI_FLAGS); > > + val |= PCI_MSI_FLAGS_ENABLE; > > + dw_pcie_writew_dbi(pci, PCI_MSI_CAP + PCI_MSI_FLAGS, val); > > + } >   > >   return 0; >  }