Commit 6508750f authored by Roland Dreier's avatar Roland Dreier Committed by Linus Torvalds

[PATCH] InfiniBand/mthca: test IRQ routing during initialization

When we switch to interrupt-driven command mode, test interrupt generation
with a NOP firmware command.  Broken MSI/MSI-X and interrupt line routing
problems seem to be very common, and this makes the error message much clearer
-- before this change we would mysteriously fail when initializing the QP
table.
Signed-off-by: default avatarRoland Dreier <roland@topspin.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3254c902
......@@ -1757,3 +1757,8 @@ int mthca_MGID_HASH(struct mthca_dev *dev, void *gid, u16 *hash,
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);
}
......@@ -289,6 +289,7 @@ int mthca_WRITE_MGM(struct mthca_dev *dev, int index, void *mgm,
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))
......
......@@ -570,6 +570,7 @@ static int __devinit mthca_init_hca(struct mthca_dev *mdev)
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 @@ static int __devinit mthca_setup_hca(struct mthca_dev *dev)
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 "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment