[openib-general] [PATCH] mthca: Test interrupts during initialization

Roland Dreier roland at topspin.com
Mon Jan 17 08:56:53 PST 2005


I just committed this, patch, which tests interrupt generation during
initialization.  If it fails, we'll now get a nice error message like

    ib_mthca 0000:04:00.0: NOP command failed to generate interrupt, aborting.
    ib_mthca 0000:04:00.0: Try again with MSI/MSI-X disabled.

instead of a cryptic message about QP table init failing.  Also, the
failure is much faster (we only wait 1/10 sec for the interrupt to
arrive).  When things are working (with debug messages enabled), we
now print

    ib_mthca 0000:04:00.0: NOP command IRQ test passed

 - Roland

Index: infiniband/hw/mthca/mthca_main.c
===================================================================
--- infiniband/hw/mthca/mthca_main.c	(revision 1537)
+++ infiniband/hw/mthca/mthca_main.c	(working copy)
@@ -570,6 +570,7 @@
 static int __devinit mthca_setup_hca(struct mthca_dev *dev)
 {
 	int err;
+	u8 status;
 
 	MTHCA_INIT_DOORBELL_LOCK(&dev->doorbell_lock);
 
@@ -615,6 +616,18 @@
 		goto err_eq_table_free;
 	}
 
+	err = mthca_NOP(dev, &status);
+	if (err || status) {
+		mthca_err(dev, "NOP command failed to generate interrupt, aborting.\n");
+		if (dev->mthca_flags & (MTHCA_FLAG_MSI | MTHCA_FLAG_MSI_X))
+			mthca_err(dev, "Try again with MSI/MSI-X disabled.\n");
+		else
+			mthca_err(dev, "BIOS or ACPI interrupt routing problem?\n");
+
+		goto err_cmd_poll;
+	} else
+		mthca_dbg(dev, "NOP command IRQ test passed\n");
+
 	err = mthca_init_cq_table(dev);
 	if (err) {
 		mthca_err(dev, "Failed to initialize "
Index: infiniband/hw/mthca/mthca_cmd.c
===================================================================
--- infiniband/hw/mthca/mthca_cmd.c	(revision 1544)
+++ infiniband/hw/mthca/mthca_cmd.c	(working copy)
@@ -1757,3 +1757,8 @@
 	pci_unmap_single(dev->pdev, indma, 16, PCI_DMA_TODEVICE);
 	return err;
 }
+
+int mthca_NOP(struct mthca_dev *dev, u8 *status)
+{
+	return mthca_cmd(dev, 0, 0x1f, 0, CMD_NOP, msecs_to_jiffies(100), status);
+}
Index: infiniband/hw/mthca/mthca_cmd.h
===================================================================
--- infiniband/hw/mthca/mthca_cmd.h	(revision 1544)
+++ infiniband/hw/mthca/mthca_cmd.h	(working copy)
@@ -289,6 +289,7 @@
 		    u8 *status);
 int mthca_MGID_HASH(struct mthca_dev *dev, void *gid, u16 *hash,
 		    u8 *status);
+int mthca_NOP(struct mthca_dev *dev, u8 *status);
 
 #define MAILBOX_ALIGN(x) ((void *) ALIGN((unsigned long) (x), MTHCA_CMD_MAILBOX_ALIGN))
 



More information about the general mailing list