[openib-general] [PATCH] uar size != 8M

Michael S. Tsirkin mst at mellanox.co.il
Mon Jan 23 08:34:15 PST 2006


There are some cards around that have UAR size different from 8M.
As a sanity check, compare it against the device reported limit instead.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: linux-2.6.15/drivers/infiniband/hw/mthca/mthca_main.c
===================================================================
--- linux-2.6.15.orig/drivers/infiniband/hw/mthca/mthca_main.c	2006-01-12 12:05:35.000000000 +0200
+++ linux-2.6.15/drivers/infiniband/hw/mthca/mthca_main.c	2006-01-23 21:06:47.000000000 +0200
@@ -155,6 +155,13 @@ static int __devinit mthca_dev_lim(struc
 		return -ENODEV;
 	}
 
+	if (dev_lim->uar_size > pci_resource_len(mdev->pdev, 2)) {
+		mthca_err(mdev, "HCA reported UAR size of 0x%x bigger than "
+			  "PCI resource 2 size of 0x%lx, aborting.\n",
+			  dev_lim->uar_size, pci_resource_len(mdev->pdev, 2));
+		return -ENODEV;
+	}
+
 	mdev->limits.num_ports      	= dev_lim->num_ports;
 	mdev->limits.vl_cap             = dev_lim->max_vl;
 	mdev->limits.mtu_cap            = dev_lim->max_mtu;
@@ -976,8 +983,7 @@ static int __devinit mthca_init_one(stru
 		err = -ENODEV;
 		goto err_disable_pdev;
 	}
-	if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM) ||
-	    pci_resource_len(pdev, 2) != 1 << 23) {
+	if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
 		dev_err(&pdev->dev, "Missing UAR, aborting.\n");
 		err = -ENODEV;
 		goto err_disable_pdev;

-- 
MST



More information about the general mailing list