rpms/kernel/devel linux-2.6-firewire-config-rom-read-fixup.patch, NONE, 1.1 kernel.spec, 1.377, 1.378 linux-2.6-firewire-git-update.patch, 1.2, 1.3 linux-2.6-firewire-increase-login-orb-timeout.patch, 1.1, NONE

Jarod Wilson (jwilson) fedora-extras-commits at redhat.com
Wed Jan 23 20:09:14 UTC 2008


Author: jwilson

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12884

Modified Files:
	kernel.spec linux-2.6-firewire-git-update.patch 
Added Files:
	linux-2.6-firewire-config-rom-read-fixup.patch 
Removed Files:
	linux-2.6-firewire-increase-login-orb-timeout.patch 
Log Message:
* Wed Jan 23 2008 Jarod Wilson <jwilson at redhat.com>
- improve locking in firewire config rom read routines
  to fix (most?) 'giving up on config rom' problems (#429598)


linux-2.6-firewire-config-rom-read-fixup.patch:

--- NEW FILE linux-2.6-firewire-config-rom-read-fixup.patch ---
diff -Naurp linux-2.6.23.noarch/drivers/firewire.old/fw-device.c linux-2.6.23.noarch/drivers/firewire/fw-device.c
--- linux-2.6.23.noarch/drivers/firewire.old/fw-device.c	2008-01-23 14:35:53.000000000 -0500
+++ linux-2.6.23.noarch/drivers/firewire/fw-device.c	2008-01-23 14:48:55.000000000 -0500
@@ -404,6 +404,10 @@ static int read_rom(struct fw_device *de
 	return callback_data.rcode;
 }
 
+/*
+ * Read the bus info block, perform a speed probe and read all of the
+ * rest of the device's config ROM.
+ */
 static int read_bus_info_block(struct fw_device *device)
 {
 	static u32 rom[256];
@@ -801,6 +805,7 @@ void fw_node_event(struct fw_card *card,
 
 		device = node->data;
 		device->node_id = node->node_id;
+		smp_wmb();
 		device->generation = card->generation;
 		if (atomic_read(&device->state) == FW_DEVICE_RUNNING) {
 			PREPARE_DELAYED_WORK(&device->work, fw_device_update);
diff -Naurp linux-2.6.23.noarch/drivers/firewire.old/fw-ohci.c linux-2.6.23.noarch/drivers/firewire/fw-ohci.c
--- linux-2.6.23.noarch/drivers/firewire.old/fw-ohci.c	2008-01-23 14:36:14.000000000 -0500
+++ linux-2.6.23.noarch/drivers/firewire/fw-ohci.c	2008-01-23 14:48:55.000000000 -0500
@@ -1023,14 +1023,14 @@ static void bus_reset_tasklet(unsigned l
 
 	self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff;
 	generation = (le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff;
-	rmb();
+	smp_rmb();
 
 	for (i = 1, j = 0; j < self_id_count; i += 2, j++) {
 		if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1])
 			fw_error("inconsistent self IDs\n");
 		ohci->self_id_buffer[j] = le32_to_cpu(ohci->self_id_cpu[i]);
 	}
-	rmb();
+	smp_rmb();
 
 	/*
 	 * Check the consistency of the self IDs we just read.  The
diff -Naurp linux-2.6.23.noarch/drivers/firewire.old/fw-sbp2.c linux-2.6.23.noarch/drivers/firewire/fw-sbp2.c
--- linux-2.6.23.noarch/drivers/firewire.old/fw-sbp2.c	2008-01-23 14:36:14.000000000 -0500
+++ linux-2.6.23.noarch/drivers/firewire/fw-sbp2.c	2008-01-23 14:48:55.000000000 -0500
@@ -678,9 +678,10 @@ static void sbp2_login(struct work_struc
 	struct sbp2_login_response response;
 	int generation, node_id, local_node_id;
 
-	generation    = device->card->generation;
-	node_id       = device->node->node_id;
-	local_node_id = device->card->local_node->node_id;
+	generation    = device->generation;
+	smp_rmb();
+	node_id       = device->node_id;
+	local_node_id = device->card->node_id;
 
 	if (sbp2_send_management_orb(lu, node_id, generation,
 				SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
@@ -928,9 +929,10 @@ static void sbp2_reconnect(struct work_s
 	struct fw_device *device = fw_device(unit->device.parent);
 	int generation, node_id, local_node_id;
 
-	generation    = device->card->generation;
-	node_id       = device->node->node_id;
-	local_node_id = device->card->local_node->node_id;
+	generation    = device->generation;
+	smp_rmb();
+	node_id       = device->node_id;
+	local_node_id = device->card->node_id;
 
 	if (sbp2_send_management_orb(lu, node_id, generation,
 				     SBP2_RECONNECT_REQUEST,
diff -Naurp linux-2.6.23.noarch/drivers/firewire.old/fw-topology.c linux-2.6.23.noarch/drivers/firewire/fw-topology.c
--- linux-2.6.23.noarch/drivers/firewire.old/fw-topology.c	2008-01-23 14:35:53.000000000 -0500
+++ linux-2.6.23.noarch/drivers/firewire/fw-topology.c	2008-01-23 14:48:55.000000000 -0500
@@ -518,6 +518,7 @@ fw_core_handle_bus_reset(struct fw_card 
 		card->bm_retries = 0;
 
 	card->node_id = node_id;
+	smp_wmb();
 	card->generation = generation;
 	card->reset_jiffies = jiffies;
 	schedule_delayed_work(&card->work, 0);
diff -Naurp linux-2.6.23.noarch/drivers/firewire.old/fw-transaction.c linux-2.6.23.noarch/drivers/firewire/fw-transaction.c
--- linux-2.6.23.noarch/drivers/firewire.old/fw-transaction.c	2008-01-23 14:36:14.000000000 -0500
+++ linux-2.6.23.noarch/drivers/firewire/fw-transaction.c	2008-01-23 14:48:55.000000000 -0500
@@ -153,7 +153,7 @@ fw_fill_request(struct fw_packet *packet
 	int ext_tcode;
 
 	if (tcode > 0x10) {
-		ext_tcode = tcode - 0x10;
+		ext_tcode = tcode & ~0x10;
 		tcode = TCODE_LOCK_REQUEST;
 	} else
 		ext_tcode = 0;


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.377
retrieving revision 1.378
diff -u -r1.377 -r1.378
--- kernel.spec	23 Jan 2008 19:26:34 -0000	1.377
+++ kernel.spec	23 Jan 2008 20:08:21 -0000	1.378
@@ -655,7 +655,7 @@
 
 # linux1394 git patches
 Patch2200: linux-2.6-firewire-git-update.patch
-Patch2201: linux-2.6-firewire-increase-login-orb-timeout.patch
+Patch2201: linux-2.6-firewire-config-rom-read-fixup.patch
 
 # make USB EHCI driver respect "nousb" parameter
 Patch2300: linux-2.6-usb-ehci-hcd-respect-nousb.patch
@@ -1180,7 +1180,7 @@
 
 # linux1394 git patches
 ApplyPatch linux-2.6-firewire-git-update.patch
-ApplyPatch linux-2.6-firewire-increase-login-orb-timeout.patch
+ApplyPatch linux-2.6-firewire-config-rom-read-fixup.patch
 
 # ---------- below all scheduled for 2.6.24 -----------------
 
@@ -1750,6 +1750,10 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL} -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.conf %{with_xen} xen
 
 %changelog
+* Wed Jan 23 2008 Jarod Wilson <jwilson at redhat.com>
+- improve locking in firewire config rom read routines
+  to fix (most?) 'giving up on config rom' problems (#429598)
+
 * Wed Jan 23 2008 Chuck Ebbert <cebbert at redhat.com>
 - Make the USB EHCI driver repect the "nousb" parameter. (F8#429863)
 

linux-2.6-firewire-git-update.patch:

Index: linux-2.6-firewire-git-update.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-firewire-git-update.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-firewire-git-update.patch	11 Jan 2008 20:56:53 -0000	1.2
+++ linux-2.6-firewire-git-update.patch	23 Jan 2008 20:08:21 -0000	1.3
@@ -1,15 +1,48 @@
-IEEE 1394 updates for Linux 2.6.24-rc6 (v601 2008-01-11)
+IEEE 1394 updates for Linux 2.6.24-rc8 (v603 2008-01-19)
 
+ MAINTAINERS                              |    4 
  drivers/firewire/fw-ohci.c               |  386 ++++++++++++++---------
- drivers/firewire/fw-sbp2.c               |   85 ++---
+ drivers/firewire/fw-sbp2.c               |  100 +++--
  drivers/firewire/fw-transaction.c        |    2 
  drivers/ieee1394/dma.c                   |   37 --
  drivers/ieee1394/ieee1394_transactions.c |   68 ----
  drivers/ieee1394/ohci1394.c              |   12 
  drivers/ieee1394/raw1394.c               |    4 
- drivers/ieee1394/sbp2.c                  |   53 +--
+ drivers/ieee1394/sbp2.c                  |   52 +--
  drivers/ieee1394/sbp2.h                  |    1 
- 9 files changed, 337 insertions(+), 311 deletions(-)
+ 10 files changed, 350 insertions(+), 316 deletions(-)
+
+========================================================================
+Date: Sat, 19 Jan 2008 13:15:05 +0100 (CET)
+From: Jarod Wilson <jwilson at redhat.com>
+Subject: firewire: fw-sbp2: increase login orb reply timeout, fix "failed to login"
+
+Increase (and rename) the management orb reply timeout value
+to 20s to match that of the old firewire stack. 2s simply didn't
+give many devices enough time to spin up and reply.
+
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
+
+Fixes inability to recognize some devices.
+Failure mode was "orb reply timed out"/"failed to login".
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de> (style, comments, changelog)
+---
+ drivers/firewire/fw-sbp2.c |   16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+========================================================================
+Date: Sat, 12 Jan 2008 12:32:44 +0100 (CET)
+From: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Subject: firewire vs. ieee1394: clarify MAINTAINERS
+
+Maintainers like to receive less mail, and submitters like to have to Cc
+less recipients.
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+ MAINTAINERS |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
 
 ========================================================================
 Date: Sun, 06 Jan 2008 17:21:41 -0500
@@ -189,6 +222,55 @@
  1 file changed, 24 insertions(+), 20 deletions(-)
 
 ========================================================================
+Date: Sun, 16 Dec 2007 17:32:11 +0100 (CET)
+From: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Subject: firewire: fw-sbp2: remove unused misleading macro
+
+SBP2_MAX_SECTORS is nowhere used in fw-sbp2.
+It merely got copied over from sbp2 where it played a role in the past.
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+ drivers/firewire/fw-sbp2.c |    2 --
+ 1 file changed, 2 deletions(-)
+
+========================================================================
+Date: Wed, 7 Nov 2007 17:39:00 -0500
+From: Jay Fenlason <fenlason at redhat.com>
+Subject: firewire: fw-sbp2: quiet logout errors on device removal
+
+This suppresses both reply timed out and management write failed
+errors on LOGOUT requests.
+
+Signed-off-by: Jay Fenlason <fenlason at redhat.com>
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+ fw-sbp2.c |   20 ++++++++++++++++----
+ 1 file changed, 16 insertions(+), 4 deletions(-)
+
+========================================================================
+Date: Tue, 15 Jan 2008 21:10:50 +0100 (CET)
+From: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Subject: firewire: fw-sbp2: prepare for s/g chaining
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+ drivers/firewire/fw-sbp2.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+========================================================================
+Date: Wed, 7 Nov 2007 01:12:51 +0100 (CET)
+From: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Subject: firewire: fw-sbp2: refactor workq and kref handling
+
+This somewhat reduces the size of firewire-sbp2.ko.
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+ drivers/firewire/fw-sbp2.c |   56 +++++++++++++++++++------------------
+ 1 file changed, 30 insertions(+), 26 deletions(-)
+
+========================================================================
 Date: Sun, 16 Dec 2007 20:53:13 +0100 (CET)
 From: Stefan Richter <stefanr at s5r6.in-berlin.de>
 Subject: ieee1394: ohci1394: don't schedule IT tasklets on IR events
@@ -205,19 +287,6 @@
  1 file changed, 8 insertions(+), 4 deletions(-)
 
 ========================================================================
-Date: Sun, 16 Dec 2007 17:32:11 +0100 (CET)
-From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: firewire: fw-sbp2: remove unused misleading macro
-
-SBP2_MAX_SECTORS is nowhere used in fw-sbp2.
-It merely got copied over from sbp2 where it played a role in the past.
-
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
----
- drivers/firewire/fw-sbp2.c |    2 --
- 1 file changed, 2 deletions(-)
-
-========================================================================
 Date: Sun, 16 Dec 2007 17:31:26 +0100 (CET)
 From: Stefan Richter <stefanr at s5r6.in-berlin.de>
 Subject: ieee1394: sbp2: raise default transfer size limit
@@ -296,20 +365,6 @@
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 ========================================================================
-Date: Wed, 7 Nov 2007 17:39:00 -0500
-From: Jay Fenlason <fenlason at redhat.com>
-Subject: firewire: fw-sbp2: quiet logout errors on device removal
-
-This suppresses both reply timed out and management write failed
-errors on LOGOUT requests.
-
-Signed-off-by: Jay Fenlason <fenlason at redhat.com>
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
----
- fw-sbp2.c |   20 ++++++++++++++++----
- 1 file changed, 16 insertions(+), 4 deletions(-)
-
-========================================================================
 Date: Sun, 4 Nov 2007 14:59:24 +0100 (CET)
 From: Stefan Richter <stefanr at s5r6.in-berlin.de>
 Subject: ieee1394: sbp2: s/g list access cosmetics
@@ -323,222 +378,16 @@
  1 file changed, 12 insertions(+), 14 deletions(-)
 
 ========================================================================
-Date: Sun, 4 Nov 2007 14:58:43 +0100 (CET)
-From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: ieee1394: sbp2: enable s/g chaining
-
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
----
- drivers/ieee1394/sbp2.c |    3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-========================================================================
-Date: Sun, 4 Nov 2007 14:58:11 +0100 (CET)
+Date: Tue, 15 Jan 2008 21:11:28 +0100 (CET)
 From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: firewire: fw-sbp2: enable s/g chaining
+Subject: ieee1394: sbp2: prepare for s/g chaining
 
 Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
 ---
- drivers/firewire/fw-sbp2.c |    7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
+ drivers/ieee1394/sbp2.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
 ========================================================================
-Date: Wed, 7 Nov 2007 01:12:51 +0100 (CET)
-From: Stefan Richter <stefanr at s5r6.in-berlin.de>
-Subject: firewire: fw-sbp2: refactor workq and kref handling
-
-This somewhat reduces the size of firewire-sbp2.ko.
-
-Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
----
- drivers/firewire/fw-sbp2.c |   56 +++++++++++++++++++------------------
- 1 file changed, 30 insertions(+), 26 deletions(-)
-
-========================================================================
-Index: linux/drivers/firewire/fw-sbp2.c
-===================================================================
---- linux.orig/drivers/firewire/fw-sbp2.c
-+++ linux/drivers/firewire/fw-sbp2.c
-@@ -151,9 +151,7 @@ struct sbp2_target {
- };
- 
- #define SBP2_MAX_SG_ELEMENT_LENGTH	0xf000
--#define SBP2_MAX_SECTORS		255	/* Max sectors supported */
- #define SBP2_ORB_TIMEOUT		2000	/* Timeout in ms */
--
- #define SBP2_ORB_NULL			0x80000000
- 
- #define SBP2_DIRECTION_TO_MEDIA		0x0
-@@ -540,14 +538,26 @@ sbp2_send_management_orb(struct sbp2_log
- 
- 	retval = -EIO;
- 	if (sbp2_cancel_orbs(lu) == 0) {
--		fw_error("orb reply timed out, rcode=0x%02x\n",
--			 orb->base.rcode);
-+		/*
-+		 * Logout requests frequently get sent to devices that aren't
-+		 * there any more, resulting in extraneous error messages in
-+		 * the logs.  Unfortunately, this means logout requests that
-+		 * actually fail don't get logged.
-+		 */
-+		if (function != SBP2_LOGOUT_REQUEST)
-+			fw_error("orb reply timed out, rcode=0x%02x\n",
-+				 orb->base.rcode);
- 		goto out;
- 	}
- 
- 	if (orb->base.rcode != RCODE_COMPLETE) {
--		fw_error("management write failed, rcode 0x%02x\n",
--			 orb->base.rcode);
-+		/*
-+		 * On device removal from the bus, sometimes the logout
-+		 * request times out, sometimes it just fails.
-+		 */
-+		if (function != SBP2_LOGOUT_REQUEST)
-+			fw_error("management write failed, rcode 0x%02x\n",
-+				 orb->base.rcode);
- 		goto out;
- 	}
- 
-@@ -628,6 +638,21 @@ static void sbp2_release_target(struct k
- 
- static struct workqueue_struct *sbp2_wq;
- 
-+/*
-+ * Always get the target's kref when scheduling work on one its units.
-+ * Each workqueue job is responsible to call sbp2_target_put() upon return.
-+ */
-+static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay)
-+{
-+	if (queue_delayed_work(sbp2_wq, &lu->work, delay))
-+		kref_get(&lu->tgt->kref);
-+}
-+
-+static void sbp2_target_put(struct sbp2_target *tgt)
-+{
-+	kref_put(&tgt->kref, sbp2_release_target);
-+}
-+
- static void sbp2_reconnect(struct work_struct *work);
- 
- static void sbp2_login(struct work_struct *work)
-@@ -649,16 +674,12 @@ static void sbp2_login(struct work_struc
- 
- 	if (sbp2_send_management_orb(lu, node_id, generation,
- 				SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
--		if (lu->retries++ < 5) {
--			if (queue_delayed_work(sbp2_wq, &lu->work,
--					       DIV_ROUND_UP(HZ, 5)))
--				kref_get(&lu->tgt->kref);
--		} else {
-+		if (lu->retries++ < 5)
-+			sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
-+		else
- 			fw_error("failed to login to %s LUN %04x\n",
- 				 unit->device.bus_id, lu->lun);
--		}
--		kref_put(&lu->tgt->kref, sbp2_release_target);
--		return;
-+		goto out;
- 	}
- 
- 	lu->generation        = generation;
-@@ -700,7 +721,8 @@ static void sbp2_login(struct work_struc
- 		lu->sdev = sdev;
- 		scsi_device_put(sdev);
- 	}
--	kref_put(&lu->tgt->kref, sbp2_release_target);
-+ out:
-+	sbp2_target_put(lu->tgt);
- }
- 
- static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)
-@@ -865,18 +887,13 @@ static int sbp2_probe(struct device *dev
- 
- 	get_device(&unit->device);
- 
--	/*
--	 * We schedule work to do the login so we can easily
--	 * reschedule retries. Always get the ref before scheduling
--	 * work.
--	 */
-+	/* Do the login in a workqueue so we can easily reschedule retries. */
- 	list_for_each_entry(lu, &tgt->lu_list, link)
--		if (queue_delayed_work(sbp2_wq, &lu->work, 0))
--			kref_get(&tgt->kref);
-+		sbp2_queue_work(lu, 0);
- 	return 0;
- 
-  fail_tgt_put:
--	kref_put(&tgt->kref, sbp2_release_target);
-+	sbp2_target_put(tgt);
- 	return -ENOMEM;
- 
-  fail_shost_put:
-@@ -889,7 +906,7 @@ static int sbp2_remove(struct device *de
- 	struct fw_unit *unit = fw_unit(dev);
- 	struct sbp2_target *tgt = unit->device.driver_data;
- 
--	kref_put(&tgt->kref, sbp2_release_target);
-+	sbp2_target_put(tgt);
- 	return 0;
- }
- 
-@@ -915,10 +932,8 @@ static void sbp2_reconnect(struct work_s
- 			lu->retries = 0;
- 			PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
- 		}
--		if (queue_delayed_work(sbp2_wq, &lu->work, DIV_ROUND_UP(HZ, 5)))
--			kref_get(&lu->tgt->kref);
--		kref_put(&lu->tgt->kref, sbp2_release_target);
--		return;
-+		sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
-+		goto out;
- 	}
- 
- 	lu->generation        = generation;
-@@ -930,8 +945,8 @@ static void sbp2_reconnect(struct work_s
- 
- 	sbp2_agent_reset(lu);
- 	sbp2_cancel_orbs(lu);
--
--	kref_put(&lu->tgt->kref, sbp2_release_target);
-+ out:
-+	sbp2_target_put(lu->tgt);
- }
- 
- static void sbp2_update(struct fw_unit *unit)
-@@ -947,8 +962,7 @@ static void sbp2_update(struct fw_unit *
- 	 */
- 	list_for_each_entry(lu, &tgt->lu_list, link) {
- 		lu->retries = 0;
--		if (queue_delayed_work(sbp2_wq, &lu->work, 0))
--			kref_get(&tgt->kref);
-+		sbp2_queue_work(lu, 0);
- 	}
- }
- 
-@@ -1103,9 +1117,9 @@ sbp2_map_scatterlist(struct sbp2_command
- 	 * elements larger than 65535 bytes, some IOMMUs may merge sg elements
- 	 * during DMA mapping, and Linux currently doesn't prevent this.
- 	 */
--	for (i = 0, j = 0; i < count; i++) {
--		sg_len = sg_dma_len(sg + i);
--		sg_addr = sg_dma_address(sg + i);
-+	for (i = 0, j = 0; i < count; i++, sg = sg_next(sg)) {
-+		sg_len = sg_dma_len(sg);
-+		sg_addr = sg_dma_address(sg);
- 		while (sg_len) {
- 			/* FIXME: This won't get us out of the pinch. */
- 			if (unlikely(j >= ARRAY_SIZE(orb->page_table))) {
-@@ -1325,6 +1339,7 @@ static struct scsi_host_template scsi_dr
- 	.this_id		= -1,
- 	.sg_tablesize		= SG_ALL,
- 	.use_clustering		= ENABLE_CLUSTERING,
-+	.use_sg_chaining	= ENABLE_SG_CHAINING,
- 	.cmd_per_lun		= 1,
- 	.can_queue		= 1,
- 	.sdev_attrs		= sbp2_scsi_sysfs_attrs,
 Index: linux/drivers/ieee1394/sbp2.c
 ===================================================================
 --- linux.orig/drivers/ieee1394/sbp2.c
@@ -581,15 +430,7 @@
  
  /*
   * Exclusive login to sbp2 device? In most cases, the sbp2 driver should
-@@ -326,6 +331,7 @@ static struct scsi_host_template sbp2_sh
- 	.this_id		 = -1,
- 	.sg_tablesize		 = SG_ALL,
- 	.use_clustering		 = ENABLE_CLUSTERING,
-+	.use_sg_chaining	 = ENABLE_SG_CHAINING,
- 	.cmd_per_lun		 = SBP2_MAX_CMDS,
- 	.can_queue		 = SBP2_MAX_CMDS,
- 	.sdev_attrs		 = sbp2_sysfs_sdev_attrs,
-@@ -1451,7 +1457,7 @@ static void sbp2_prep_command_orb_sg(str
+@@ -1451,7 +1456,7 @@ static void sbp2_prep_command_orb_sg(str
  				     struct sbp2_fwhost_info *hi,
  				     struct sbp2_command_info *cmd,
  				     unsigned int scsi_use_sg,
@@ -598,7 +439,7 @@
  				     u32 orb_direction,
  				     enum dma_data_direction dma_dir)
  {
-@@ -1461,12 +1467,12 @@ static void sbp2_prep_command_orb_sg(str
+@@ -1461,12 +1466,12 @@ static void sbp2_prep_command_orb_sg(str
  
  	/* special case if only one element (and less than 64KB in size) */
  	if ((scsi_use_sg == 1) &&
@@ -614,7 +455,7 @@
  					    cmd->dma_size, cmd->dma_dir);
  
  		orb->data_descriptor_lo = cmd->cmd_dma;
-@@ -1477,11 +1483,11 @@ static void sbp2_prep_command_orb_sg(str
+@@ -1477,11 +1482,11 @@ static void sbp2_prep_command_orb_sg(str
  						&cmd->scatter_gather_element[0];
  		u32 sg_count, sg_len;
  		dma_addr_t sg_addr;
@@ -628,7 +469,7 @@
  
  		/* use page tables (s/g) */
  		orb->misc |= ORB_SET_PAGE_TABLE_PRESENT(0x1);
-@@ -1489,9 +1495,9 @@ static void sbp2_prep_command_orb_sg(str
+@@ -1489,9 +1494,9 @@ static void sbp2_prep_command_orb_sg(str
  
  		/* loop through and fill out our SBP-2 page tables
  		 * (and split up anything too large) */
@@ -641,7 +482,7 @@
  			while (sg_len) {
  				sg_element[sg_count].segment_base_lo = sg_addr;
  				if (sg_len > SBP2_MAX_SG_ELEMENT_LENGTH) {
-@@ -1521,11 +1527,10 @@ static void sbp2_create_command_orb(stru
+@@ -1521,11 +1526,10 @@ static void sbp2_create_command_orb(stru
  				    unchar *scsi_cmd,
  				    unsigned int scsi_use_sg,
  				    unsigned int scsi_request_bufflen,
@@ -654,7 +495,7 @@
  	struct sbp2_command_orb *orb = &cmd->command_orb;
  	u32 orb_direction;
  
-@@ -1560,7 +1565,7 @@ static void sbp2_create_command_orb(stru
+@@ -1560,7 +1564,7 @@ static void sbp2_create_command_orb(stru
  		orb->data_descriptor_lo = 0x0;
  		orb->misc |= ORB_SET_DIRECTION(1);
  	} else
@@ -663,7 +504,7 @@
  					 orb_direction, dma_dir);
  
  	sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb));
-@@ -1650,7 +1655,6 @@ static int sbp2_send_command(struct sbp2
+@@ -1650,7 +1654,6 @@ static int sbp2_send_command(struct sbp2
  			     void (*done)(struct scsi_cmnd *))
  {
  	unchar *scsi_cmd = (unchar *)SCpnt->cmnd;
@@ -671,7 +512,7 @@
  	struct sbp2_command_info *cmd;
  
  	cmd = sbp2util_allocate_command_orb(lu, SCpnt, done);
-@@ -1658,7 +1662,7 @@ static int sbp2_send_command(struct sbp2
+@@ -1658,7 +1661,7 @@ static int sbp2_send_command(struct sbp2
  		return -EIO;
  
  	sbp2_create_command_orb(lu, cmd, scsi_cmd, scsi_sg_count(SCpnt),
@@ -680,7 +521,7 @@
  				SCpnt->sc_data_direction);
  	sbp2_link_orb_command(lu, cmd);
  
-@@ -1981,6 +1985,8 @@ static int sbp2scsi_slave_configure(stru
+@@ -1981,6 +1984,8 @@ static int sbp2scsi_slave_configure(stru
  		sdev->skip_ms_page_8 = 1;
  	if (lu->workarounds & SBP2_WORKAROUND_FIX_CAPACITY)
  		sdev->fix_capacity = 1;
@@ -689,7 +530,7 @@
  	return 0;
  }
  
-@@ -2087,9 +2093,6 @@ static int sbp2_module_init(void)
+@@ -2087,9 +2092,6 @@ static int sbp2_module_init(void)
  		sbp2_shost_template.cmd_per_lun = 1;
  	}
  
@@ -894,6 +735,216 @@
  	}
  
  	spin_unlock_irqrestore(&ohci->iso_tasklet_list_lock, flags);
+Index: linux/drivers/firewire/fw-sbp2.c
+===================================================================
+--- linux.orig/drivers/firewire/fw-sbp2.c
++++ linux/drivers/firewire/fw-sbp2.c
+@@ -150,11 +150,16 @@ struct sbp2_target {
+ 	struct list_head lu_list;
+ };
+ 
+-#define SBP2_MAX_SG_ELEMENT_LENGTH	0xf000
+-#define SBP2_MAX_SECTORS		255	/* Max sectors supported */
++/*
++ * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be
++ * provided in the config rom.  A high timeout value really only matters
++ * on initial login, where we'll just use 20s rather than hassling with
++ * reading the config rom, since it really wouldn't buy us much.
++ */
++#define SBP2_LOGIN_ORB_TIMEOUT		20000	/* Timeout in ms */
+ #define SBP2_ORB_TIMEOUT		2000	/* Timeout in ms */
+-
+ #define SBP2_ORB_NULL			0x80000000
++#define SBP2_MAX_SG_ELEMENT_LENGTH	0xf000
+ 
+ #define SBP2_DIRECTION_TO_MEDIA		0x0
+ #define SBP2_DIRECTION_FROM_MEDIA	0x1
+@@ -489,6 +494,7 @@ sbp2_send_management_orb(struct sbp2_log
+ {
+ 	struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
+ 	struct sbp2_management_orb *orb;
++	unsigned int timeout;
+ 	int retval = -ENOMEM;
+ 
+ 	orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
+@@ -519,6 +525,9 @@ sbp2_send_management_orb(struct sbp2_log
+ 		orb->request.misc |=
+ 			MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login) |
+ 			MANAGEMENT_ORB_RECONNECT(0);
++		timeout = SBP2_LOGIN_ORB_TIMEOUT;
++	} else {
++		timeout = SBP2_ORB_TIMEOUT;
+ 	}
+ 
+ 	fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
+@@ -535,19 +544,30 @@ sbp2_send_management_orb(struct sbp2_log
+ 	sbp2_send_orb(&orb->base, lu, node_id, generation,
+ 		      lu->tgt->management_agent_address);
+ 
+-	wait_for_completion_timeout(&orb->done,
+-				    msecs_to_jiffies(SBP2_ORB_TIMEOUT));
++	wait_for_completion_timeout(&orb->done, msecs_to_jiffies(timeout));
+ 
+ 	retval = -EIO;
+ 	if (sbp2_cancel_orbs(lu) == 0) {
+-		fw_error("orb reply timed out, rcode=0x%02x\n",
+-			 orb->base.rcode);
++		/*
++		 * Logout requests frequently get sent to devices that aren't
++		 * there any more, resulting in extraneous error messages in
++		 * the logs.  Unfortunately, this means logout requests that
++		 * actually fail don't get logged.
++		 */
++		if (function != SBP2_LOGOUT_REQUEST)
++			fw_error("orb reply timed out, rcode=0x%02x\n",
++				 orb->base.rcode);
+ 		goto out;
+ 	}
+ 
+ 	if (orb->base.rcode != RCODE_COMPLETE) {
+-		fw_error("management write failed, rcode 0x%02x\n",
+-			 orb->base.rcode);
++		/*
++		 * On device removal from the bus, sometimes the logout
++		 * request times out, sometimes it just fails.
++		 */
++		if (function != SBP2_LOGOUT_REQUEST)
++			fw_error("management write failed, rcode 0x%02x\n",
++				 orb->base.rcode);
+ 		goto out;
+ 	}
+ 
+@@ -628,6 +648,21 @@ static void sbp2_release_target(struct k
+ 
+ static struct workqueue_struct *sbp2_wq;
+ 
++/*
++ * Always get the target's kref when scheduling work on one its units.
++ * Each workqueue job is responsible to call sbp2_target_put() upon return.
++ */
++static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay)
++{
++	if (queue_delayed_work(sbp2_wq, &lu->work, delay))
++		kref_get(&lu->tgt->kref);
++}
++
++static void sbp2_target_put(struct sbp2_target *tgt)
++{
++	kref_put(&tgt->kref, sbp2_release_target);
++}
++
+ static void sbp2_reconnect(struct work_struct *work);
+ 
+ static void sbp2_login(struct work_struct *work)
+@@ -649,16 +684,12 @@ static void sbp2_login(struct work_struc
+ 
+ 	if (sbp2_send_management_orb(lu, node_id, generation,
+ 				SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
+-		if (lu->retries++ < 5) {
+-			if (queue_delayed_work(sbp2_wq, &lu->work,
+-					       DIV_ROUND_UP(HZ, 5)))
+-				kref_get(&lu->tgt->kref);
+-		} else {
++		if (lu->retries++ < 5)
++			sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
++		else
+ 			fw_error("failed to login to %s LUN %04x\n",
+ 				 unit->device.bus_id, lu->lun);
+-		}
+-		kref_put(&lu->tgt->kref, sbp2_release_target);
+-		return;
++		goto out;
+ 	}
+ 
+ 	lu->generation        = generation;
+@@ -700,7 +731,8 @@ static void sbp2_login(struct work_struc
+ 		lu->sdev = sdev;
+ 		scsi_device_put(sdev);
+ 	}
+-	kref_put(&lu->tgt->kref, sbp2_release_target);
++ out:
++	sbp2_target_put(lu->tgt);
+ }
+ 
+ static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)
+@@ -865,18 +897,13 @@ static int sbp2_probe(struct device *dev
+ 
+ 	get_device(&unit->device);
+ 
+-	/*
+-	 * We schedule work to do the login so we can easily
+-	 * reschedule retries. Always get the ref before scheduling
+-	 * work.
+-	 */
++	/* Do the login in a workqueue so we can easily reschedule retries. */
+ 	list_for_each_entry(lu, &tgt->lu_list, link)
+-		if (queue_delayed_work(sbp2_wq, &lu->work, 0))
+-			kref_get(&tgt->kref);
++		sbp2_queue_work(lu, 0);
+ 	return 0;
+ 
+  fail_tgt_put:
+-	kref_put(&tgt->kref, sbp2_release_target);
++	sbp2_target_put(tgt);
+ 	return -ENOMEM;
+ 
+  fail_shost_put:
+@@ -889,7 +916,7 @@ static int sbp2_remove(struct device *de
+ 	struct fw_unit *unit = fw_unit(dev);
+ 	struct sbp2_target *tgt = unit->device.driver_data;
+ 
+-	kref_put(&tgt->kref, sbp2_release_target);
++	sbp2_target_put(tgt);
+ 	return 0;
+ }
+ 
+@@ -915,10 +942,8 @@ static void sbp2_reconnect(struct work_s
+ 			lu->retries = 0;
+ 			PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
+ 		}
+-		if (queue_delayed_work(sbp2_wq, &lu->work, DIV_ROUND_UP(HZ, 5)))
+-			kref_get(&lu->tgt->kref);
+-		kref_put(&lu->tgt->kref, sbp2_release_target);
+-		return;
++		sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
++		goto out;
+ 	}
+ 
+ 	lu->generation        = generation;
+@@ -930,8 +955,8 @@ static void sbp2_reconnect(struct work_s
+ 
+ 	sbp2_agent_reset(lu);
+ 	sbp2_cancel_orbs(lu);
+-
+-	kref_put(&lu->tgt->kref, sbp2_release_target);
++ out:
++	sbp2_target_put(lu->tgt);
+ }
+ 
+ static void sbp2_update(struct fw_unit *unit)
+@@ -947,8 +972,7 @@ static void sbp2_update(struct fw_unit *
+ 	 */
+ 	list_for_each_entry(lu, &tgt->lu_list, link) {
+ 		lu->retries = 0;
+-		if (queue_delayed_work(sbp2_wq, &lu->work, 0))
+-			kref_get(&tgt->kref);
++		sbp2_queue_work(lu, 0);
+ 	}
+ }
+ 
+@@ -1103,9 +1127,9 @@ sbp2_map_scatterlist(struct sbp2_command
+ 	 * elements larger than 65535 bytes, some IOMMUs may merge sg elements
+ 	 * during DMA mapping, and Linux currently doesn't prevent this.
+ 	 */
+-	for (i = 0, j = 0; i < count; i++) {
+-		sg_len = sg_dma_len(sg + i);
+-		sg_addr = sg_dma_address(sg + i);
++	for (i = 0, j = 0; i < count; i++, sg = sg_next(sg)) {
++		sg_len = sg_dma_len(sg);
++		sg_addr = sg_dma_address(sg);
+ 		while (sg_len) {
+ 			/* FIXME: This won't get us out of the pinch. */
+ 			if (unlikely(j >= ARRAY_SIZE(orb->page_table))) {
 Index: linux/drivers/firewire/fw-ohci.c
 ===================================================================
 --- linux.orig/drivers/firewire/fw-ohci.c
@@ -1544,3 +1595,25 @@
  
  	spin_lock_irqsave(&address_handler_lock, flags);
  	handler = lookup_enclosing_address_handler(&address_handler_list,
+Index: linux/MAINTAINERS
+===================================================================
+--- linux.orig/MAINTAINERS
++++ linux/MAINTAINERS
+@@ -1571,7 +1571,7 @@ P:	Alexander Viro
+ M:	viro at zeniv.linux.org.uk
+ S:	Maintained
+ 
+-FIREWIRE SUBSYSTEM
++FIREWIRE SUBSYSTEM (drivers/firewire, <linux/firewire*.h>)
+ P:	Kristian Hoegsberg, Stefan Richter
+ M:	krh at redhat.com, stefanr at s5r6.in-berlin.de
+ L:	linux1394-devel at lists.sourceforge.net
+@@ -1891,7 +1891,7 @@ L:	linux-ide at vger.kernel.org
+ L:	linux-scsi at vger.kernel.org
+ S:	Orphan
+ 
+-IEEE 1394 SUBSYSTEM
++IEEE 1394 SUBSYSTEM (drivers/ieee1394)
+ P:	Ben Collins
+ M:	ben.collins at ubuntu.com
+ P:	Stefan Richter


--- linux-2.6-firewire-increase-login-orb-timeout.patch DELETED ---




More information about the fedora-extras-commits mailing list