Skip to contentSkip to conversation

IB/ipath - program intconfig register using new HT irq hook

PATCH In review Bryan O'Sullivan 3 participants 5 messages Nov 8, 2006 – Nov 9, 2006 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/ipath - program intconfig register using new HT irq hook

Eric's changes to the htirq infrastructure require corresponding modifications to the ipath HT driver code so that interrupts are still delivered properly.

Cc Eric W. Biederman <[email protected]>
Cc Roland Dreier <[email protected]>
drivers/infiniband/hw/ipath/ipath_driver.c +8 -9
diff -r 69779e2890e3 -r 545156d49f88 drivers/infiniband/hw/ipath/ipath_driver.c
@@ -304,7 +304,7 @@ static int __devinit ipath_init_one(stru
 	}
 	addr = pci_resource_start(pdev, 0);
 	len = pci_resource_len(pdev, 0);
-	ipath_cdbg(VERBOSE, "regbase (0) %llx len %d irq %x, vend %x/%x "
+	ipath_cdbg(VERBOSE, "regbase (0) %llx len %d pdev->irq %d, vend %x/%x "
 		   "driver_data %lx\n", addr, len, pdev->irq, ent->vendor,
 		   ent->device, ent->driver_data);
 
@@ -467,15 +467,15 @@ static int __devinit ipath_init_one(stru
 	 * check 0 irq after we return from chip-specific bus setup, since
 	 * that can affect this due to setup
 	 */
-	if (!pdev->irq)
+	if (!dd->ipath_irq)
 		ipath_dev_err(dd, "irq is 0, BIOS error?  Interrupts won't "
 			      "work\n");
 	else {
-		ret = request_irq(pdev->irq, ipath_intr, IRQF_SHARED,
+		ret = request_irq(dd->ipath_irq, ipath_intr, IRQF_SHARED,
 				  IPATH_DRV_NAME, dd);
 		if (ret) {
 			ipath_dev_err(dd, "Couldn't setup irq handler, "
-				      "irq=%u: %d\n", pdev->irq, ret);
+				      "irq=%d: %d\n", dd->ipath_irq, ret);
 			goto bail_iounmap;
 		}
 	}
@@ -637,11 +637,10 @@ static void __devexit ipath_remove_one(s
 	 * free up port 0 (kernel) rcvhdr, egr bufs, and eventually tid bufs
 	 * for all versions of the driver, if they were allocated
 	 */
-	if (pdev->irq) {
-		ipath_cdbg(VERBOSE,
-			   "unit %u free_irq of irq %x\n",
-			   dd->ipath_unit, pdev->irq);
-		free_irq(pdev->irq, dd);
+	if (dd->ipath_irq) {
+		ipath_cdbg(VERBOSE, "unit %u free irq %d\n",
+			   dd->ipath_unit, dd->ipath_irq);
+		dd->ipath_f_free_irq(dd);
 	} else
 		ipath_dbg("irq is 0, not doing free_irq "
 			  "for unit %u\n", dd->ipath_unit);
drivers/infiniband/hw/ipath/ipath_iba6110.c +57 -76

177 lines not on this page · raw message

drivers/infiniband/hw/ipath/ipath_iba6120.c +8 -0
diff -r 69779e2890e3 -r 545156d49f88 drivers/infiniband/hw/ipath/ipath_iba6120.c
@@ -851,6 +851,7 @@ static int ipath_setup_pe_config(struct 
 	int pos, ret;
 
 	dd->ipath_msi_lo = 0;	/* used as a flag during reset processing */
+	dd->ipath_irq = pdev->irq;
 	ret = pci_enable_msi(dd->pcidev);
 	if (ret)
 		ipath_dev_err(dd, "pci_enable_msi failed: %d, "
@@ -1323,6 +1324,12 @@ done:
 	return 0;
 }
 
+static void ipath_pe_free_irq(struct ipath_devdata *dd)
+{
+	free_irq(dd->ipath_irq, dd);
+	dd->ipath_irq = 0;
+}
+
 /**
  * ipath_init_iba6120_funcs - set up the chip-specific function pointers
  * @dd: the infinipath device
@@ -1349,6 +1356,7 @@ void ipath_init_iba6120_funcs(struct ipa
 	dd->ipath_f_cleanup = ipath_setup_pe_cleanup;
 	dd->ipath_f_setextled = ipath_setup_pe_setextled;
 	dd->ipath_f_get_base_info = ipath_pe_get_base_info;
+	dd->ipath_f_free_irq = ipath_pe_free_irq;
 
 	/* initialize chip-specific variables */
 	dd->ipath_f_tidtemplate = ipath_pe_tidtemplate;
drivers/infiniband/hw/ipath/ipath_intr.c +5 -5
diff -r 69779e2890e3 -r 545156d49f88 drivers/infiniband/hw/ipath/ipath_intr.c
@@ -710,14 +710,14 @@ static void ipath_bad_intr(struct ipath_
 			 * linuxbios development work, and it may happen in
 			 * the future again.
 			 */
-			if (dd->pcidev && dd->pcidev->irq) {
+			if (dd->pcidev && dd->ipath_irq) {
 				ipath_dev_err(dd, "Now %u unexpected "
 					      "interrupts, unregistering "
 					      "interrupt handler\n",
 					      *unexpectp);
-				ipath_dbg("free_irq of irq %x\n",
-					  dd->pcidev->irq);
-				free_irq(dd->pcidev->irq, dd);
+				ipath_dbg("free_irq of irq %d\n",
+					  dd->ipath_irq);
+				dd->ipath_f_free_irq(dd);
 			}
 		}
 		if (ipath_read_kreg32(dd, dd->ipath_kregs->kr_intmask)) {
@@ -753,7 +753,7 @@ static void ipath_bad_regread(struct ipa
 		if (allbits == 2) {
 			ipath_dev_err(dd, "Still bad interrupt status, "
 				      "unregistering interrupt\n");
-			free_irq(dd->pcidev->irq, dd);
+			dd->ipath_f_free_irq(dd);
 		} else if (allbits > 2) {
 			if ((allbits % 10000) == 0)
 				printk(".");
drivers/infiniband/hw/ipath/ipath_kernel.h +4 -0
diff -r 69779e2890e3 -r 545156d49f88 drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -213,6 +213,8 @@ struct ipath_devdata {
 	void (*ipath_f_setextled)(struct ipath_devdata *, u64, u64);
 	/* fill out chip-specific fields */
 	int (*ipath_f_get_base_info)(struct ipath_portdata *, void *);
+	/* free irq */
+	void (*ipath_f_free_irq)(struct ipath_devdata *);
 	struct ipath_ibdev *verbs_dev;
 	struct timer_list verbs_timer;
 	/* total dwords sent (summed from counter) */
@@ -328,6 +330,8 @@ struct ipath_devdata {
 	/* so we can rewrite it after a chip reset */
 	u32 ipath_pcibar1;
 
+	/* interrupt number */
+	int ipath_irq;
 	/* HT/PCI Vendor ID (here for NodeInfo) */
 	u16 ipath_vendorid;
 	/* HT/PCI Device ID (here for NodeInfo) */
#1 lore raw

drivers/infiniband/hw/ipath/ipath_driver.c

Quoted 11 lines · On Wed, 08 Nov 2006 14:21:26 -0700 "Bryan O'Sullivan" <[email protected]> wrote:

Eric's changes to the htirq infrastructure require corresponding modifications to the ipath HT driver code so that interrupts are still delivered properly.

Cc Eric W. Biederman <[email protected]>
Cc Roland Dreier <[email protected]>

diff -r 69779e2890e3 -r 545156d49f88 drivers/infiniband/hw/ipath/ipath_driver.c

drivers/infiniband/hw/ipath/ipath_driver.c +0 -0

so... Is this:

htirq-refactor-so-we-only-have-one-function-that-writes-to-the-chip.patch htirq-allow-buggy-drivers-of-buggy-hardware-to-write-the-registers.patch htirq-allow-buggy-drivers-of-buggy-hardware-to-write-the-registers-update.patch ib-ipath-program-intconfig-register-using-new-ht-irq-hook.patch

considered 2.6.19 material?

#2 lore raw
Quoted 4 lines · Andrew Morton

so... Is this:

htirq-refactor-so-we-only-have-one-function-that-writes-to-the-chip.patch htirq-allow-buggy-drivers-of-buggy-hardware-to-write-the-registers.patch

You should drop the above patch from Eric...

Quoted 1 line

htirq-allow-buggy-drivers-of-buggy-hardware-to-write-the-registers-update.patch

...in favour of this one, which is my rework of Eric's patch.

Quoted 3 lines

ib-ipath-program-intconfig-register-using-new-ht-irq-hook.patch

considered 2.6.19 material?

Yes, please. I might be able to simplify the ib-ipath patch (by a matter of a few lines), but it works fine as it stands.

	<b
#3 lore raw
Quoted 4 lines · On Wed, 08 Nov 2006 15:08:30 -0800 "Bryan O'Sullivan" <[email protected]> wrote:
Quoted 2 lines · Andrew Morton

so... Is this:

Quoted 10 lines
Quoted 2 lines

htirq-refactor-so-we-only-have-one-function-that-writes-to-the-chip.patch htirq-allow-buggy-drivers-of-buggy-hardware-to-write-the-registers.patch

You should drop the above patch from Eric...

Quoted 1 line

htirq-allow-buggy-drivers-of-buggy-hardware-to-write-the-registers-update.patch

...in favour of this one, which is my rework of Eric's patch.

Quoted 1 line

ib-ipath-program-intconfig-register-using-new-ht-irq-hook.patch

If you look, you'll see that the htirq-allow-buggy-drivers-of-buggy-hardware-to-write-the-registers-update.patch which I merged is the diff between Eric's patch and yours (ie: the diff which you should have sent ;))

Quoted 5 lines
Quoted 1 line

considered 2.6.19 material?

Yes, please. I might be able to simplify the ib-ipath patch (by a matter of a few lines), but it works fine as it stands.

ho hum, OK.

#4 lore raw
Quoted 5 lines · Andrew Morton
Quoted 1 line · On Wed, 08 Nov 2006 15:08:30 -0800 "Bryan O'Sullivan" <[email protected]> wrote:

Andrew Morton wrote:

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

considered 2.6.19 material?

Yes, please. I might be able to simplify the ib-ipath patch (by a matter of a few lines), but it works fine as it stands.

ho hum, OK.

There is only one driver in the kernel that currently uses the htirq the infrastructure so the chance of actually breaking something else is exactly 0. :)

Thanks for collecting the patches up Andrew.

I know of a couple out of tree drivers but I don't think their hardware has escaped the lab yet.

Eric