linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
To: Alex Shi <alex.shi@intel.com>
Cc: stern@rowland.harvard.edu, Greg KH <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, andiry.xu@amd.com,
	linux-kernel@vger.kernel.org, Oliver Neukum <oneukum@suse.de>,
	Takashi Iwai <tiwai@suse.de>,
	trenn@suse.de, linux-pci@vger.kernel.org,
	Michal Marek <MMarek@suse.com>
Subject: [RFT] USB: Try MSI first before line IRQ for Intel PCIe USB3 HCD
Date: Mon, 13 Feb 2012 16:25:57 -0800	[thread overview]
Message-ID: <20120214002557.GA13003@xanatos> (raw)
In-Reply-To: <20120214002030.GA10364@xanatos>

We have a PCI USB xhci host controller on a new platform. It doesn't
have a line IRQ definition in BIOS. The Linux driver refuses to
initial this controller, but Windows works well because it only depends
on MSI.

Actually, Linux also can work for MSI. This patch skips the first line
IRQ checking for our HCD in usb-core pci probe, then try to enable MSI
firstly. That make this HCD works well under Linux.

This patch should be backported to kernels as old as 2.6.32.

Signed-off-by: Alex Shi <alex.shi@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
---

Hi Alex,

Please test this on your Panther Point system that doesn't have a BIOS
provided IRQ line.  I think this is a much simpler solution.

Sarah Sharp

 drivers/usb/core/hcd-pci.c |    5 ++++-
 drivers/usb/core/hcd.c     |    6 ++++--
 drivers/usb/host/xhci.c    |    5 +++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index d136b8f..81e2c0d 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -187,7 +187,10 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 		return -ENODEV;
 	dev->current_state = PCI_D0;
 
-	if (!dev->irq) {
+	/* The xHCI driver supports MSI and MSI-X,
+	 * so don't fail if the BIOS doesn't provide a legacy IRQ.
+	 */
+	if (!dev->irq && (driver->flags & HCD_MASK) != HCD_USB3) {
 		dev_err(&dev->dev,
 			"Found HC with no IRQ.  Check BIOS/PCI %s setup!\n",
 			pci_name(dev));
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index eb19cba..e128232 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2447,8 +2447,10 @@ int usb_add_hcd(struct usb_hcd *hcd,
 			&& device_can_wakeup(&hcd->self.root_hub->dev))
 		dev_dbg(hcd->self.controller, "supports USB remote wakeup\n");
 
-	/* enable irqs just before we start the controller */
-	if (usb_hcd_is_primary_hcd(hcd)) {
+	/* enable irqs just before we start the controller,
+	 * if the BIOS provides legacy PCI irqs.
+	 */
+	if (usb_hcd_is_primary_hcd(hcd) && irqnum) {
 		retval = usb_hcd_request_irqs(hcd, irqnum, irqflags);
 		if (retval)
 			goto err_request_irq;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6bbe3c3..c939f5f 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -352,6 +352,11 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
 		/* hcd->irq is -1, we have MSI */
 		return 0;
 
+	if (!pdev->irq) {
+		xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n");
+		return -EINVAL;
+	}
+
 	/* fall back to legacy interrupt*/
 	ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED,
 			hcd->irq_descr, hcd);
-- 
1.7.9


  reply	other threads:[~2012-02-14  0:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1328531341-22705-1-git-send-email-alex.shi@intel.com>
     [not found] ` <4F311233.9070404@intel.com>
     [not found]   ` <20120207144204.GA7214@kroah.com>
2012-02-07 17:27     ` [PATCH] usb: enable pci MSI/MSIX in usb core Sarah Sharp
2012-02-07 22:13       ` Sarah Sharp
2012-02-08  1:26         ` Alex,Shi
2012-02-08  6:27           ` Alex,Shi
2012-02-08  9:11             ` Alex,Shi
2012-02-14  0:20               ` Sarah Sharp
2012-02-14  0:25                 ` Sarah Sharp [this message]
2012-02-14  4:43                   ` [RFT] USB: Try MSI first before line IRQ for Intel PCIe USB3 HCD Alex,Shi
2012-02-16  2:36                 ` [PATCH] usb: enable pci MSI/MSIX in usb core Alex,Shi
2012-02-17  6:44                   ` Alex,Shi
2012-02-17  8:13                     ` Clemens Ladisch
2012-02-17  8:46                       ` Alex,Shi
2012-02-17 10:15                         ` Clemens Ladisch
2012-02-18  6:28                           ` Andiry Xu
2012-02-20  0:57                             ` Alex,Shi
2012-02-20  3:52                     ` Alex,Shi
2012-02-08 15:07         ` Alan Stern

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=20120214002557.GA13003@xanatos \
    --to=sarah.a.sharp@linux.intel.com \
    --cc=MMarek@suse.com \
    --cc=alex.shi@intel.com \
    --cc=andiry.xu@amd.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.de \
    --cc=stern@rowland.harvard.edu \
    --cc=tiwai@suse.de \
    --cc=trenn@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).