Skip to contentSkip to conversation

ieee1394: misc updates

PATCH In review Stefan Richter 2 participants 24 messages Jun 2, 2006 Documentation

lore
Share & tools
lore
#0 lore raw

cover ieee1394: misc updates

Andrew,

here is a bunch of IEEE 1394 subsystem patches which have been floating around for a while. Some of them have already been in git-ieee1394 and/ or in -mm (before git-ieee1394 dropout). All of them went through linux1394-devel, except the sem2mutex patch. They do not depend on each other except where noted. Noted below are the dates of first posts, not of subsequent patch updates or resubmissions. Two or three recent 1394 subsystem patches which may need more review or rework are not included here.

Dear lkml readers, the age of some of the patches does not mean they have become perfect. Yell if you spot any goofiness.

[01/18] video1394: be quiet
2006-02-24 Daniel Drake

[02/18] ohci1394.c: function calls without effect
2006-03-09 me, ripped from a patch by Adrian Bunk

[03/18] sbp2: make TSB42AA9 workaround specific to Momobay CX-1 2006-03-19 me

[04/18] Semaphore to mutex conversion. (a.k.a. sem2mutex-drivers-ieee1394) 2006-01 or before, Arjan van de Ven

[05/18] raw1394: fix whitespace after x86_64 compat patch 2006-03-26 me

[06/18] ieee1394/ohci1394: CycleTooLong interrupt management 2006-03-17 Jean-Baptiste Mur

[07/18] ieee1394: support for slow links or slow 1394b phy ports 2006-03-26 me
Fixes a long-standing incompatibility to two less common classes of IEEE 1394a and IEEE 1394b devices (devices with link speed slower than PHY speed, devices with S100B...S400B PHY ports) and to the case of two 1394b PHYs connected via 1394a cable.
Still missing feature: expose negotiated port speeds to userspace

[08/18] ieee1394: save RAM by using a single tlabel for broadcast transactions 2006-03-26 me
saves much less RAM than length of title suggests :-)

[09/18] sbp2: remove manipulation of inquiry response 2006-04-08 me

[10/18] sbp2: log number of supported concurrent logins 2006-04-14 me, Jody

[11/18] ieee1394: extend lowlevel API for address range properties 2006-04-15 me
apply together with 12/18

[12/18] ohci1394: set address range properties
2006-04-15 me

[13/18] ohci1394: make phys_dma parameter read-only 2006-04-15 me

[14/18] sbp2: sbp2 remove ohci1394 specific constant 2006-04-23 me
depends on 11/18 + 12/18

[15/18] sbp2: fix S800 transfers if phys_dma is off 2006-04-15 me

[16/18] Update feature removal of obsolete raw1394 ISO requests. 2006-04-18 Jody
This documentation patch could go into Linux 2.6.17. Necessity of delay was discussed in http://lkml.org/lkml/2006/4/8/72

[17/18] sbp2: provide helptext for CONFIG_IEEE1394_SBP2_PHYS_DMA and mark it experimental 2006-05-07 me

[18/18] sbp2: use __attribute__((packed)) for on-the-wire structures 2006-05-07 me

Signature · 3 lines
Stefan Richter
-=====-=-==- -==- ---=-
http://arcgraph.de/sr/
#1 lore raw

PATCH 1/18 video1394: be quiet

From: Daniel Drake <[email protected]>

When working with multiple cameras and intensive applications, our logs get flooded with video1394 information which isn't of much interest.

---

drivers/ieee1394/video1394.c +8 -8
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/video1394.c
===================================================================
@@ -331,7 +331,7 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci, 
 
         spin_lock_init(&d->lock);
 
-	PRINT(KERN_INFO, ohci->host->id, "Iso %s DMA: %d buffers "
+	DBGMSG(ohci->host->id, "Iso %s DMA: %d buffers "
 	      "of size %d allocated for a frame size %d, each with %d prgs",
 	      (type == OHCI_ISO_RECEIVE) ? "receive" : "transmit",
 	      d->num_desc - 1, d->buf_size, d->frame_size, d->nb_cmd);
@@ -759,7 +759,7 @@ static int __video1394_ioctl(struct file
 		} else {
 			mask = (u64)0x1<<v.channel;
 		}
-		PRINT(KERN_INFO, ohci->host->id, "mask: %08X%08X usage: %08X%08X\n",
+		DBGMSG(ohci->host->id, "mask: %08X%08X usage: %08X%08X\n",
 			(u32)(mask>>32),(u32)(mask&0xffffffff),
 			(u32)(ohci->ISO_channel_usage>>32),
 			(u32)(ohci->ISO_channel_usage&0xffffffff));
@@ -805,7 +805,7 @@ static int __video1394_ioctl(struct file
 			v.buf_size = d->buf_size;
 			list_add_tail(&d->link, &ctx->context_list);
 
-			PRINT(KERN_INFO, ohci->host->id,
+			DBGMSG(ohci->host->id,
 			      "iso context %d listen on channel %d",
 			      d->ctx, v.channel);
 		}
@@ -828,7 +828,7 @@ static int __video1394_ioctl(struct file
 
 			list_add_tail(&d->link, &ctx->context_list);
 
-			PRINT(KERN_INFO, ohci->host->id,
+			DBGMSG(ohci->host->id,
 			      "Iso context %d talk on channel %d", d->ctx,
 			      v.channel);
 		}
@@ -873,7 +873,7 @@ static int __video1394_ioctl(struct file
 			d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, channel);
 
 		if (d == NULL) return -ESRCH;
-		PRINT(KERN_INFO, ohci->host->id, "Iso context %d "
+		DBGMSG(ohci->host->id, "Iso context %d "
 		      "stop talking on channel %d", d->ctx, channel);
 		free_dma_iso_ctx(d);
 
@@ -935,7 +935,7 @@ static int __video1394_ioctl(struct file
 		else {
 			/* Wake up dma context if necessary */
 			if (!(reg_read(ohci, d->ctrlSet) & 0x400)) {
-				PRINT(KERN_INFO, ohci->host->id,
+				DBGMSG(ohci->host->id,
 				      "Waking up iso dma ctx=%d", d->ctx);
 				reg_write(ohci, d->ctrlSet, 0x1000);
 			}
@@ -1106,7 +1106,7 @@ static int __video1394_ioctl(struct file
 		else {
 			/* Wake up dma context if necessary */
 			if (!(reg_read(ohci, d->ctrlSet) & 0x400)) {
-				PRINT(KERN_INFO, ohci->host->id,
+				DBGMSG(ohci->host->id,
 				      "Waking up iso transmit dma ctx=%d",
 				      d->ctx);
 				put_timestamp(ohci, d, d->last_buffer);
@@ -1232,7 +1232,7 @@ static int video1394_release(struct inod
 			      "is not being used", d->channel);
 		else
 			ohci->ISO_channel_usage &= ~mask;
-		PRINT(KERN_INFO, ohci->host->id, "On release: Iso %s context "
+		DBGMSG(ohci->host->id, "On release: Iso %s context "
 		      "%d stop listening on channel %d",
 		      d->type == OHCI_ISO_RECEIVE ? "receive" : "transmit",
 		      d->ctx, d->channel);
#2 lore raw

PATCH 2/18 ohci1394.c: function calls without effect

ohci1394: Remove superfluous call to free_dma_rcv_ctx, spotted by Adrian Bunk. Also remove some superfluous comments.

drivers/ieee1394/ohci1394.c +0 -11
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/ohci1394.c
===================================================================
@@ -3463,24 +3463,13 @@ static void ohci1394_pci_remove(struct p
 	case OHCI_INIT_HAVE_TXRX_BUFFERS__MAYBE:
 		/* The ohci_soft_reset() stops all DMA contexts, so we
 		 * dont need to do this.  */
-		/* Free AR dma */
 		free_dma_rcv_ctx(&ohci->ar_req_context);
 		free_dma_rcv_ctx(&ohci->ar_resp_context);
-
-		/* Free AT dma */
 		free_dma_trm_ctx(&ohci->at_req_context);
 		free_dma_trm_ctx(&ohci->at_resp_context);
-
-		/* Free IR dma */
 		free_dma_rcv_ctx(&ohci->ir_legacy_context);
-
-		/* Free IT dma */
 		free_dma_trm_ctx(&ohci->it_legacy_context);
 
-		/* Free IR legacy dma */
-		free_dma_rcv_ctx(&ohci->ir_legacy_context);
-
-
 	case OHCI_INIT_HAVE_SELFID_BUFFER:
 		pci_free_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE,
 				    ohci->selfid_buf_cpu,
#3 lore raw

PATCH 3/18 sbp2: make TSB42AA9 workaround specific to Momobay CX-1

The workarounds are not required for DViCO Momobay FX-3A and AFAIR not for Momobay CX-2. These contain an TSB42AA9A but feature the same firmware_revision value as the older DViCO Momobay CX-1.

drivers/ieee1394/sbp2.c +2 -1
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/sbp2.c
===================================================================
@@ -306,8 +306,9 @@ static const struct {
 	u32 model_id;
 	unsigned workarounds;
 } sbp2_workarounds_table[] = {
-	/* TSB42AA9 */ {
+	/* DViCO Momobay CX-1 with TSB42AA9 bridge */ {
 		.firmware_revision	= 0x002800,
+		.model_id		= 0x001010,
 		.workarounds		= SBP2_WORKAROUND_INQUIRY_36 |
 					  SBP2_WORKAROUND_MODE_SENSE_8,
 	},
#4 lore raw

PATCH 4/18 Semaphore to mutex conversion.

From: Arjan van de Ven <[email protected]>

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated automatically via a script as well.

drivers/ieee1394/hosts.c +4 -3
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/hosts.c
===================================================================
@@ -19,6 +19,7 @@
 #include <linux/pci.h>
 #include <linux/timer.h>
 #include <linux/jiffies.h>
+#include <linux/mutex.h>
 
 #include "csr1212.h"
 #include "ieee1394.h"
@@ -105,7 +106,7 @@ static int alloc_hostnum_cb(struct hpsb_
  * Return Value: a pointer to the &hpsb_host if succesful, %NULL if
  * no memory was available.
  */
-static DECLARE_MUTEX(host_num_alloc);
+static DEFINE_MUTEX(host_num_alloc);
 
 struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
 				  struct device *dev)
@@ -148,7 +149,7 @@ struct hpsb_host *hpsb_alloc_host(struct
 	h->topology_map = h->csr.topology_map + 3;
 	h->speed_map = (u8 *)(h->csr.speed_map + 2);
 
-	down(&host_num_alloc);
+	mutex_lock(&host_num_alloc);
 
 	while (nodemgr_for_each_host(&hostnum, alloc_hostnum_cb))
 		hostnum++;
@@ -167,7 +168,7 @@ struct hpsb_host *hpsb_alloc_host(struct
 	class_device_register(&h->class_dev);
 	get_device(&h->device);
 
-	up(&host_num_alloc);
+	mutex_unlock(&host_num_alloc);
 
 	return h;
 }
#5 lore raw

PATCH 5/18 raw1394: fix whitespace after x86_64 compat patch

drivers/ieee1394/raw1394.c +26 -28
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/raw1394.c
===================================================================
@@ -407,34 +407,34 @@ static void fcp_request(struct hpsb_host
 
 #ifdef CONFIG_COMPAT
 struct compat_raw1394_req {
-        __u32 type;
-        __s32 error;
-        __u32 misc;
+	__u32 type;
+	__s32 error;
+	__u32 misc;
 
-        __u32 generation;
-        __u32 length;
+	__u32 generation;
+	__u32 length;
 
-        __u64 address;
+	__u64 address;
 
-        __u64 tag;
+	__u64 tag;
 
-        __u64 sendb;
-        __u64 recvb;
-}  __attribute__((packed));
+	__u64 sendb;
+	__u64 recvb;
+} __attribute__((packed));
 
 static const char __user *raw1394_compat_write(const char __user *buf)
 {
-	struct compat_raw1394_req __user *cr = (typeof(cr)) buf; 
+	struct compat_raw1394_req __user *cr = (typeof(cr)) buf;
 	struct raw1394_request __user *r;
 	r = compat_alloc_user_space(sizeof(struct raw1394_request));
 
 #define C(x) __copy_in_user(&r->x, &cr->x, sizeof(r->x))
 
 	if (copy_in_user(r, cr, sizeof(struct compat_raw1394_req)) ||
-		C(address) ||
-		C(tag) ||
-		C(sendb) ||
-		C(recvb))
+	    C(address) ||
+	    C(tag) ||
+	    C(sendb) ||
+	    C(recvb))
 		return ERR_PTR(-EFAULT);
 	return (const char __user *)r;
 }
@@ -442,11 +442,11 @@ static const char __user *raw1394_compat
 
 #define P(x) __put_user(r->x, &cr->x)
 
-static int 
+static int
 raw1394_compat_read(const char __user *buf, struct raw1394_request *r)
 {
-	struct compat_raw1394_req __user *cr = (typeof(cr)) r; 
-	if (!access_ok(VERIFY_WRITE,cr,sizeof(struct compat_raw1394_req)) ||
+	struct compat_raw1394_req __user *cr = (typeof(cr)) r;
+	if (!access_ok(VERIFY_WRITE, cr, sizeof(struct compat_raw1394_req)) ||
 	    P(type) ||
 	    P(error) ||
 	    P(misc) ||
@@ -511,18 +511,17 @@ static ssize_t raw1394_read(struct file 
 	}
 
 #ifdef CONFIG_COMPAT
-	if (count == sizeof(struct compat_raw1394_req) && 
-   		sizeof(struct compat_raw1394_req) != 
-			sizeof(struct raw1394_request)) { 
+	if (count == sizeof(struct compat_raw1394_req) &&
+   	    sizeof(struct compat_raw1394_req) !=
+			sizeof(struct raw1394_request)) {
 		ret = raw1394_compat_read(buffer, &req->req);
-
-	} else	
+	} else
 #endif
 	{
 		if (copy_to_user(buffer, &req->req, sizeof(req->req))) {
 			ret = -EFAULT;
 			goto out;
-		}		
+		}
 		ret = (ssize_t) sizeof(struct raw1394_request);
 	}
       out:
@@ -2347,7 +2346,6 @@ static int state_connected(struct file_i
 	return handle_async_request(fi, req, node);
 }
 
-
 static ssize_t raw1394_write(struct file *file, const char __user * buffer,
 			     size_t count, loff_t * offset_is_ignored)
 {
@@ -2356,9 +2354,9 @@ static ssize_t raw1394_write(struct file
 	ssize_t retval = 0;
 
 #ifdef CONFIG_COMPAT
-	if (count == sizeof(struct compat_raw1394_req) && 
-   		sizeof(struct compat_raw1394_req) != 
-			sizeof(struct raw1394_request)) { 
+	if (count == sizeof(struct compat_raw1394_req) &&
+   	    sizeof(struct compat_raw1394_req) !=
+			sizeof(struct raw1394_request)) {
 		buffer = raw1394_compat_write(buffer);
 		if (IS_ERR(buffer))
 			return PTR_ERR(buffer);
#6 lore raw

PATCH 6/18 ieee1394/ohci1394: CycleTooLong interrupt management

This patch modifies the ohci1394.c file to enable and manage the "cycle too long" interrupt.
If this interrupt occurs, the "LinkControl.CycleMaster" bit of the host controller is reseted. This implies, that the host controller does not send "cycle start" packet anymore freezing then the isochronous communication. The management of the interrupt added by the patch is that when the interrupt occurs, the OHCI irq handler prints a kernel log warning and then sets the "LinkControl.CycleMaster" bit again resuming the isochronous communication.

drivers/ieee1394/ohci1394.c +10 -0
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/ohci1394.c
===================================================================
@@ -580,6 +580,7 @@ static void ohci_initialize(struct ti_oh
 		  OHCI1394_isochRx |
 		  OHCI1394_isochTx |
 		  OHCI1394_postedWriteErr |
+		  OHCI1394_cycleTooLong |
 		  OHCI1394_cycleInconsistent);
 
 	/* Enable link */
@@ -2386,6 +2387,15 @@ static irqreturn_t ohci_irq_handler(int 
 		PRINT(KERN_ERR, "physical posted write error");
 		/* no recovery strategy yet, had to involve protocol drivers */
 	}
+	if (event & OHCI1394_cycleTooLong) {
+		if(printk_ratelimit())
+			PRINT(KERN_WARNING, "isochronous cycle too long");
+		else
+			DBGMSG("OHCI1394_cycleTooLong");
+		reg_write(ohci, OHCI1394_LinkControlSet,
+			  OHCI1394_LinkControl_CycleMaster);
+		event &= ~OHCI1394_cycleTooLong;
+	}
 	if (event & OHCI1394_cycleInconsistent) {
 		/* We subscribe to the cycleInconsistent event only to
 		 * clear the corresponding event bit... otherwise,
#7 lore raw

PATCH 7/18 ieee1394: support for slow links or slow 1394b phy ports

ieee1394: support for slow links or slow 1394b phy ports

Add support for the following types of hardware:
+ nodes that have a link speed < PHY speed
+ 1394b PHYs that are less than S800 capable
+ 1394b/1394a adapter cable between two 1394b PHYs
Also, S1600 and S3200 are now supported if IEEE1394_SPEED_MAX is raised.

A probing function is added to nodemgr's config ROM fetching routine which adjusts the allowable speed if an access problem was encountered. Pros and Cons of the approach:
+ minimum code footprint to support this less widely used hardware
+ nearly no overhead for unaffected hardware
- ineffective before nodemgr began to read the ROM of affected nodes
- ineffective if ieee1394 is loaded with disable_nodemgr=1
The speed map CSRs which are published to the bus are not touched by the patch.

---

Previous discussion:
http://marc.theaimsgroup.com/?t=107781458700006
http://marc.theaimsgroup.com/?t=112126523600002
http://marc.theaimsgroup.com/?t=112835623100003
http://marc.theaimsgroup.com/?t=113139375500008
http://marc.theaimsgroup.com/?t=114072686500005

TODO:
Update the speed map CSRs to reflect actual speeds. Although the speed map CSRs have been deprecated by IEEE 1394a-2000, there was a request to continue to publish it on the bus to help application programs figure out the correct speed. The patch only probes connections between local node and remote nodes though, not between two remote nodes. The latter requires to read phy port registers unless the local node is situated between the two remote nodes. IMO this should be implemented as a separate helper thread.

 drivers/ieee1394/eth1394.c       |    6 +--
 drivers/ieee1394/hosts.h         |   11 +++----
 drivers/ieee1394/ieee1394_core.c |   14 +++++---
 drivers/ieee1394/nodemgr.c       |   61 +++++++++++++++++++++++++++++++++++++--
 drivers/ieee1394/sbp2.c          |    4 --
 5 files changed, 76 insertions(+), 20 deletions(-)
drivers/ieee1394/hosts.h +6 -5
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/hosts.h
===================================================================
@@ -30,12 +30,13 @@ struct hpsb_host {
 
 	unsigned char iso_listen_count[64];
 
-	int node_count; /* number of identified nodes on this bus */
-	int selfid_count; /* total number of SelfIDs received */
-	int nodes_active; /* number of nodes that are actually active */
+	int node_count;     /* number of identified nodes on this bus */
+	int selfid_count;   /* total number of SelfIDs received */
+	int nodes_active;   /* number of nodes with active link layer */
+	u8 speed[63];       /* speed between each node and local node */
 
-	nodeid_t node_id; /* node ID of this host */
-	nodeid_t irm_id; /* ID of this bus' isochronous resource manager */
+	nodeid_t node_id;   /* node ID of this host */
+	nodeid_t irm_id;    /* ID of this bus' isochronous resource manager */
 	nodeid_t busmgr_id; /* ID of this bus' bus manager */
 
 	/* this nodes state */
drivers/ieee1394/ieee1394_core.c +9 -5
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/ieee1394_core.c
===================================================================
@@ -286,9 +286,9 @@ static int check_selfids(struct hpsb_hos
 
 static void build_speed_map(struct hpsb_host *host, int nodecount)
 {
-	u8 speedcap[nodecount];
 	u8 cldcnt[nodecount];
 	u8 *map = host->speed_map;
+	u8 *speedcap = host->speed;
 	struct selfid *sid;
 	struct ext_selfid *esid;
 	int i, j, n;
@@ -355,6 +355,11 @@ static void build_speed_map(struct hpsb_
 			}
 		}
 	}
+
+	/* assume maximum speed for 1394b PHYs, nodemgr will correct it */
+	for (n = 0; n < nodecount; n++)
+		if (speedcap[n] == 3)
+			speedcap[n] = IEEE1394_SPEED_MAX;
 }
 
 
@@ -555,11 +560,10 @@ int hpsb_send_packet(struct hpsb_packet 
 		return 0;
 	}
 
-	if (packet->type == hpsb_async && packet->node_id != ALL_NODES) {
+	if (packet->type == hpsb_async &&
+	    NODEID_TO_NODE(packet->node_id) != ALL_NODES)
 		packet->speed_code =
-			host->speed_map[NODEID_TO_NODE(host->node_id) * 64
-				       + NODEID_TO_NODE(packet->node_id)];
-	}
+			host->speed[NODEID_TO_NODE(packet->node_id)];
 
 	dump_packet("send packet", packet->header, packet->header_size, packet->speed_code);
 
drivers/ieee1394/nodemgr.c +58 -3

93 lines not on this page · raw message

drivers/ieee1394/eth1394.c +2 -4
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/eth1394.c
===================================================================
@@ -502,10 +502,8 @@ static void ether1394_reset_priv (struct
 
 	/* Determine speed limit */
 	for (i = 0; i < host->node_count; i++)
-		if (max_speed > host->speed_map[NODEID_TO_NODE(host->node_id) *
-						64 + i])
-			max_speed = host->speed_map[NODEID_TO_NODE(host->node_id) *
-						    64 + i];
+		if (max_speed > host->speed[i])
+			max_speed = host->speed[i];
 	priv->bc_sspd = max_speed;
 
 	/* We'll use our maxpayload as the default mtu */
drivers/ieee1394/sbp2.c +1 -3
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/sbp2.c
===================================================================
@@ -1664,10 +1664,8 @@ static int sbp2_max_speed_and_size(struc
 
 	SBP2_DEBUG_ENTER();
 
-	/* Initial setting comes from the hosts speed map */
 	scsi_id->speed_code =
-	    hi->host->speed_map[NODEID_TO_NODE(hi->host->node_id) * 64 +
-				NODEID_TO_NODE(scsi_id->ne->nodeid)];
+	    hi->host->speed[NODEID_TO_NODE(scsi_id->ne->nodeid)];
 
 	/* Bump down our speed if the user requested it */
 	if (scsi_id->speed_code > max_speed) {
#8 lore raw

PATCH 8/18 ieee1394: save RAM by using a single tlabel for broadcast transactions

Since broadcast transactions are already complete when the request has been sent, the same transaction label can be reused all over again, see IEEE 1394 7.3.2.5 and 6.2.4.3. Therefore we can reduce the footprint of struct hpsb_host by the size of one struct hpsb_tlabel_pool.

---
 drivers/ieee1394/hosts.h                 |   18 +++++++++---------
 drivers/ieee1394/ieee1394_transactions.c |   10 ++++++++--
 2 files changed, 17 insertions(+), 11 deletions(-)
drivers/ieee1394/hosts.h +9 -9
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/hosts.h
===================================================================
@@ -30,14 +30,14 @@ struct hpsb_host {
 
 	unsigned char iso_listen_count[64];
 
-	int node_count;     /* number of identified nodes on this bus */
-	int selfid_count;   /* total number of SelfIDs received */
-	int nodes_active;   /* number of nodes with active link layer */
-	u8 speed[63];       /* speed between each node and local node */
-
-	nodeid_t node_id;   /* node ID of this host */
-	nodeid_t irm_id;    /* ID of this bus' isochronous resource manager */
-	nodeid_t busmgr_id; /* ID of this bus' bus manager */
+	int node_count;      /* number of identified nodes on this bus */
+	int selfid_count;    /* total number of SelfIDs received */
+	int nodes_active;    /* number of nodes with active link layer */
+	u8 speed[ALL_NODES]; /* speed between each node and local node */
+
+	nodeid_t node_id;    /* node ID of this host */
+	nodeid_t irm_id;     /* ID of this bus' isochronous resource manager */
+	nodeid_t busmgr_id;  /* ID of this bus' bus manager */
 
 	/* this nodes state */
 	unsigned in_bus_reset:1;
@@ -56,7 +56,7 @@ struct hpsb_host {
 	struct csr_control csr;
 
 	/* Per node tlabel pool allocation */
-	struct hpsb_tlabel_pool tpool[64];
+	struct hpsb_tlabel_pool tpool[ALL_NODES];
 
 	struct hpsb_host_driver *driver;
 
drivers/ieee1394/ieee1394_transactions.c +8 -2
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/ieee1394_transactions.c
===================================================================
@@ -136,8 +136,11 @@ int hpsb_get_tlabel(struct hpsb_packet *
 {
 	unsigned long flags;
 	struct hpsb_tlabel_pool *tp;
+	int n = NODEID_TO_NODE(packet->node_id);
 
-	tp = &packet->host->tpool[packet->node_id & NODE_MASK];
+	if (unlikely(n == ALL_NODES))
+		return 0;
+	tp = &packet->host->tpool[n];
 
 	if (irqs_disabled() || in_atomic()) {
 		if (down_trylock(&tp->count))
@@ -175,8 +178,11 @@ void hpsb_free_tlabel(struct hpsb_packet
 {
 	unsigned long flags;
 	struct hpsb_tlabel_pool *tp;
+	int n = NODEID_TO_NODE(packet->node_id);
 
-	tp = &packet->host->tpool[packet->node_id & NODE_MASK];
+	if (unlikely(n == ALL_NODES))
+		return;
+	tp = &packet->host->tpool[n];
 
 	BUG_ON(packet->tlabel > 63 || packet->tlabel < 0);
 
#9 lore raw

PATCH 9/18 sbp2: remove manipulation of inquiry response

This code became ineffective a few Linux releases ago and is not required anyway.

drivers/ieee1394/sbp2.c +0 -34
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/sbp2.c
===================================================================
@@ -2112,33 +2112,6 @@ static unsigned int sbp2_status_to_sense
 }
 
 /*
- * This function is called after a command is completed, in order to do any necessary SBP-2
- * response data translations for the SCSI stack
- */
-static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
-				     struct scsi_cmnd *SCpnt)
-{
-	u8 *scsi_buf = SCpnt->request_buffer;
-
-	SBP2_DEBUG_ENTER();
-
-	if (SCpnt->cmnd[0] == INQUIRY && (SCpnt->cmnd[1] & 3) == 0) {
-		/*
-		 * Make sure data length is ok. Minimum length is 36 bytes
-		 */
-		if (scsi_buf[4] == 0) {
-			scsi_buf[4] = 36 - 5;
-		}
-
-		/*
-		 * Fix ansi revision and response data format
-		 */
-		scsi_buf[2] |= 2;
-		scsi_buf[3] = (scsi_buf[3] & 0xf0) | 2;
-	}
-}
-
-/*
  * This function deals with status writes from the SBP-2 device
  */
 static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int destid,
@@ -2477,13 +2450,6 @@ static void sbp2scsi_complete_command(st
 	}
 
 	/*
-	 * Take care of any sbp2 response data mucking here (RBC stuff, etc.)
-	 */
-	if (SCpnt->result == DID_OK << 16) {
-		sbp2_check_sbp2_response(scsi_id, SCpnt);
-	}
-
-	/*
 	 * If a bus reset is in progress and there was an error, complete
 	 * the command as busy so that it will get retried.
 	 */
drivers/ieee1394/sbp2.h +2 -3
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/sbp2.h
===================================================================
@@ -395,9 +395,8 @@ static int sbp2_link_orb_command(struct 
 static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
 			     struct scsi_cmnd *SCpnt,
 			     void (*done)(struct scsi_cmnd *));
-static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data);
-static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
-				     struct scsi_cmnd *SCpnt);
+static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status,
+					      unchar *sense_data);
 static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
 				      struct unit_directory *ud);
 static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id);
#10 lore raw

PATCH 10/18 sbp2: log number of supported concurrent logins

Since this is useful information, promote it from a debug macro to a regular log message. The message appears only if the user set exclusive_login=0, therefore won't clutter the logs in normal use. Also update the comment on exclusive_login.

drivers/ieee1394/sbp2.c +8 -8
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/sbp2.c
===================================================================
@@ -127,10 +127,12 @@ MODULE_PARM_DESC(max_sectors, "Change ma
  * talking to a single sbp2 device at the same time (filesystem coherency,
  * etc.). If you're running an sbp2 device that supports multiple logins,
  * and you're either running read-only filesystems or some sort of special
- * filesystem supporting multiple hosts (one such filesystem is OpenGFS,
- * see opengfs.sourceforge.net for more info), then set exclusive_login
- * to zero. Note: The Oxsemi OXFW911 sbp2 chipset supports up to four
- * concurrent logins.
+ * filesystem supporting multiple hosts, e.g. OpenGFS, Oracle Cluster
+ * File System, or Lustre, then set exclusive_login to zero.
+ *
+ * So far only bridges from Oxford Semiconductor are known to support
+ * concurrent logins. Depending on firmware, four or two concurrent logins
+ * are possible on OXFW911 and newer Oxsemi bridges.
  */
 static int exclusive_login = 1;
 module_param(exclusive_login, int, 0644);
@@ -1214,13 +1216,11 @@ static int sbp2_query_logins(struct scsi
 	SBP2_DEBUG("length_max_logins = %x",
 		   (unsigned int)scsi_id->query_logins_response->length_max_logins);
 
-	SBP2_DEBUG("Query logins to SBP-2 device successful");
-
 	max_logins = RESPONSE_GET_MAX_LOGINS(scsi_id->query_logins_response->length_max_logins);
-	SBP2_DEBUG("Maximum concurrent logins supported: %d", max_logins);
+	SBP2_INFO("Maximum concurrent logins supported: %d", max_logins);
 
 	active_logins = RESPONSE_GET_ACTIVE_LOGINS(scsi_id->query_logins_response->length_max_logins);
-	SBP2_DEBUG("Number of active logins: %d", active_logins);
+	SBP2_INFO("Number of active logins: %d", active_logins);
 
 	if (active_logins >= max_logins) {
 		return -EIO;
#11 lore raw

PATCH 11/18 ieee1394: extend lowlevel API for address range properties

Host adapter hardware imposes certain restrictions and features on address ranges. Instead of hard-wiring such ranges into the ieee1394 core or even into protocol drivers, let lowlevel drivers specify these ranges via struct hpsb_host.

Patch "ohci1394: set address range properties" must be applied too, else hpsb_allocate_and_register_addrspace() won't work properly.

drivers/ieee1394/hosts.h +2 -0
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/hosts.h
===================================================================
@@ -73,6 +73,8 @@ struct hpsb_host {
 	unsigned int config_roms;
 
 	struct list_head addr_space;
+	u64 low_addr_space;	/* upper bound of physical DMA area */
+	u64 middle_addr_space;	/* upper bound of posted write area */
 };
 
 
drivers/ieee1394/highlevel.c +3 -1
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/highlevel.c
===================================================================
@@ -312,8 +312,10 @@ u64 hpsb_allocate_and_register_addrspace
 		return retval;
 	}
 
+	/* default range,
+	 * avoids controller's posted write area (see OHCI 1.1 clause 1.5) */
 	if (start == ~0ULL && end == ~0ULL) {
-		start = CSR1212_ALL_SPACE_BASE + 0xffff00000000ULL;  /* ohci1394.c limit */
+		start = host->middle_addr_space;
 		end = CSR1212_ALL_SPACE_END;
 	}
 
#12 lore raw

PATCH 12/18 ohci1394: set address range properties

This patch supplies the API extension introduced by patch "ieee1394: extend lowlevel API for address range properties" with proper addresses.

Like in patch ''ohci1394, sbp2: fix "scsi_add_device failed" with PL-3507 based devices'', 1 TeraByte is chosen as physical upper bound. This leaves a window for the middle address range. This choice is only relevant for adapters which actually have a programmable pysical upper bound register. (Only ALi and Fujitsu adapters are known for this. Most adapters have a fixed bound at 4 GB.) The middle address range is suitable for posted writes.

AFAICS, PCILynx does not support physical DMA nor posted writes, at least as programmed under Linux. Therefore no equivalent change in the pcilynx driver is necessary. There is also a an out-of-tree driver for GP2Lynx. I assume this hardware does not support these OHCI features either.

drivers/ieee1394/ohci1394.h +10 -0
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/ohci1394.h
===================================================================
@@ -443,6 +443,16 @@ static inline u32 reg_read(const struct 
 
 #define OHCI1394_TCODE_PHY               0xE
 
+/* Node offset map (phys DMA area, posted write area).
+ * The value of OHCI1394_PHYS_UPPER_BOUND_PROGRAMMED may be modified but must
+ * be lower than OHCI1394_MIDDLE_ADDRESS_SPACE.
+ * OHCI1394_PHYS_UPPER_BOUND_FIXED and OHCI1394_MIDDLE_ADDRESS_SPACE are
+ * constants given by the OHCI spec.
+ */
+#define OHCI1394_PHYS_UPPER_BOUND_FIXED		0x000100000000ULL /* 4 GB */
+#define OHCI1394_PHYS_UPPER_BOUND_PROGRAMMED	0x010000000000ULL /* 1 TB */
+#define OHCI1394_MIDDLE_ADDRESS_SPACE		0xffff00000000ULL
+
 void ohci1394_init_iso_tasklet(struct ohci1394_iso_tasklet *tasklet,
 			       int type,
 			       void (*func)(unsigned long),
drivers/ieee1394/ohci1394.c +10 -1
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/ohci1394.c
===================================================================
@@ -553,7 +553,8 @@ static void ohci_initialize(struct ti_oh
 	 * register content.
 	 * To actually enable physical responses is the job of our interrupt
 	 * handler which programs the physical request filter. */
-	reg_write(ohci, OHCI1394_PhyUpperBound, 0x01000000);
+	reg_write(ohci, OHCI1394_PhyUpperBound,
+		  OHCI1394_PHYS_UPPER_BOUND_PROGRAMMED >> 16);
 
 	DBGMSG("physUpperBoundOffset=%08x",
 	       reg_read(ohci, OHCI1394_PhyUpperBound));
@@ -3415,6 +3416,14 @@ static int __devinit ohci1394_pci_probe(
 	host->csr.max_rec = (reg_read(ohci, OHCI1394_BusOptions) >> 12) & 0xf;
 	host->csr.lnk_spd = reg_read(ohci, OHCI1394_BusOptions) & 0x7;
 
+	if (phys_dma) {
+		host->low_addr_space =
+			(u64) reg_read(ohci, OHCI1394_PhyUpperBound) << 16;
+		if (!host->low_addr_space)
+			host->low_addr_space = OHCI1394_PHYS_UPPER_BOUND_FIXED;
+	}
+	host->middle_addr_space = OHCI1394_MIDDLE_ADDRESS_SPACE;
+
 	/* Tell the highlevel this host is ready */
 	if (hpsb_add_host(host))
 		FAIL(-ENOMEM, "Failed to register host with highlevel");
#13 lore raw

PATCH 13/18 ohci1394: make phys_dma parameter read-only

Ability to switch physical DMA on and off at run time would be a nice feature but a PITA to support by highlevel drivers and userspace apps. Therefore allow it only to be set when the driver is being loaded.

drivers/ieee1394/ohci1394.c +1 -1
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/ohci1394.c
===================================================================
@@ -163,7 +163,7 @@ printk(level "%s: fw-host%d: " fmt "\n" 
 
 /* Module Parameters */
 static int phys_dma = 1;
-module_param(phys_dma, int, 0644);
+module_param(phys_dma, int, 0444);
 MODULE_PARM_DESC(phys_dma, "Enable physical dma (default = 1).");
 
 static void dma_trm_tasklet(unsigned long data);
#14 lore raw

PATCH 14/18 sbp2: sbp2 remove ohci1394 specific constant

---
Requires patches
"ieee1394: extend lowlevel API for address range properties" and "ohci1394: set address range properties"

drivers/ieee1394/sbp2.c +1 -1
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/sbp2.c
===================================================================
@@ -847,7 +847,7 @@ static struct scsi_id_instance_data *sbp
 	scsi_id->status_fifo_addr = hpsb_allocate_and_register_addrspace(
 			&sbp2_highlevel, ud->ne->host, &sbp2_ops,
 			sizeof(struct sbp2_status_block), sizeof(quadlet_t),
-			0x010000000000ULL, CSR1212_ALL_SPACE_END);
+			ud->ne->host->low_addr_space, CSR1212_ALL_SPACE_END);
 	if (!scsi_id->status_fifo_addr) {
 		SBP2_ERR("failed to allocate status FIFO address range");
 		goto failed_alloc;
#15 lore raw

PATCH 15/18 sbp2: fix S800 transfers if phys_dma is off

If sbp2 is forced to move data via ARM handler, the maximum packet size allowed for S800 transfers exceeds ohci1394's buffer size on platforms where PAGE_SIZE is 4096.

drivers/ieee1394/sbp2.c +14 -4
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/sbp2.c
===================================================================
@@ -1649,6 +1649,8 @@ static void sbp2_parse_unit_directory(st
 	}
 }
 
+#define SBP2_PAYLOAD_TO_BYTES(p) (1 << ((p) + 2))
+
 /*
  * This function is called in order to determine the max speed and packet
  * size we can use in our ORBs. Note, that we (the driver and host) only
@@ -1661,6 +1663,7 @@ static void sbp2_parse_unit_directory(st
 static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)
 {
 	struct sbp2scsi_host_info *hi = scsi_id->hi;
+	u8 payload;
 
 	SBP2_DEBUG_ENTER();
 
@@ -1676,15 +1679,22 @@ static int sbp2_max_speed_and_size(struc
 
 	/* Payload size is the lesser of what our speed supports and what
 	 * our host supports.  */
-	scsi_id->max_payload_size =
-	    min(sbp2_speedto_max_payload[scsi_id->speed_code],
-		(u8) (hi->host->csr.max_rec - 1));
+	payload = min(sbp2_speedto_max_payload[scsi_id->speed_code],
+		      (u8) (hi->host->csr.max_rec - 1));
+
+	/* If physical DMA is off, work around limitation in ohci1394:
+	 * packet size must not exceed PAGE_SIZE */
+	if (scsi_id->ne->host->low_addr_space < (1ULL << 32))
+		while (SBP2_PAYLOAD_TO_BYTES(payload) + 24 > PAGE_SIZE &&
+		       payload)
+			payload--;
 
 	HPSB_DEBUG("Node " NODE_BUS_FMT ": Max speed [%s] - Max payload [%u]",
 		   NODE_BUS_ARGS(hi->host, scsi_id->ne->nodeid),
 		   hpsb_speedto_str[scsi_id->speed_code],
-		   1 << ((u32) scsi_id->max_payload_size + 2));
+		   SBP2_PAYLOAD_TO_BYTES(payload));
 
+	scsi_id->max_payload_size = payload;
 	return 0;
 }
 
#16 lore raw

PATCH 16/18 Update feature removal of obsolete raw1394 ISO requests.

Documentation/feature-removal-schedule.txt +2 -2
Index: linux-2.6.17-rc5-mm2/Documentation/feature-removal-schedule.txt
===================================================================
@@ -34,11 +34,11 @@ Who:	Adrian Bunk <[email protected]>
 ---------------------------
 
 What:	raw1394: requests of type RAW1394_REQ_ISO_SEND, RAW1394_REQ_ISO_LISTEN
-When:	November 2005
+When:	November 2006
 Why:	Deprecated in favour of the new ioctl-based rawiso interface, which is
 	more efficient.  You should really be using libraw1394 for raw1394
 	access anyway.
-Who:	Jody McIntyre <[email protected]>
+Who:	Jody McIntyre <[email protected]>
 
 ---------------------------
 
#17 lore raw

PATCH 17/18 sbp2: provide helptext for CONFIG_IEEE1394_SBP2_PHYS_DMA and mark it experimental

It appears I will not get it fixed overnight.

drivers/ieee1394/Kconfig +11 -2
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/Kconfig
===================================================================
@@ -128,8 +128,17 @@ config IEEE1394_SBP2
 	  1394 bus.  SBP-2 devices include harddrives and DVD devices.
 
 config IEEE1394_SBP2_PHYS_DMA
-	bool "Enable Phys DMA support for SBP2 (Debug)"
-	depends on IEEE1394 && IEEE1394_SBP2
+	bool "Enable replacement for physical DMA in SBP2"
+	depends on IEEE1394 && IEEE1394_SBP2 && EXPERIMENTAL
+	help
+	  This builds sbp2 for use with non-OHCI host adapters which do not
+	  support physical DMA or for when ohci1394 is run with phys_dma=0.
+	  Physical DMA is data movement without assistence of the drivers'
+	  interrupt handlers.  This option includes the interrupt handlers
+	  that are required in absence of this hardware feature.
+
+	  This option is buggy and currently broken on some architectures.
+	  If unsure, say N.
 
 config IEEE1394_ETH1394
 	tristate "Ethernet over 1394"
#18 lore raw

PATCH 18/18 sbp2: use __attribute__((packed)) for on-the-wire structures

It seems to have worked without the attribute during all the years just because sizes of all struct members are multiples of octlets.

drivers/ieee1394/sbp2.h +9 -9
Index: linux-2.6.17-rc5-mm2/drivers/ieee1394/sbp2.h
===================================================================
@@ -52,7 +52,7 @@ struct sbp2_command_orb {
 	u32 data_descriptor_lo;
 	u32 misc;
 	u8 cdb[12];
-};
+} __attribute__((packed));
 
 #define SBP2_LOGIN_REQUEST		0x0
 #define SBP2_QUERY_LOGINS_REQUEST	0x1
@@ -80,7 +80,7 @@ struct sbp2_login_orb {
 	u32 passwd_resp_lengths;
 	u32 status_fifo_hi;
 	u32 status_fifo_lo;
-};
+} __attribute__((packed));
 
 #define RESPONSE_GET_LOGIN_ID(value)            (value & 0xffff)
 #define RESPONSE_GET_LENGTH(value)              ((value >> 16) & 0xffff)
@@ -91,7 +91,7 @@ struct sbp2_login_response {
 	u32 command_block_agent_hi;
 	u32 command_block_agent_lo;
 	u32 reconnect_hold;
-};
+} __attribute__((packed));
 
 #define ORB_SET_LOGIN_ID(value)                 (value & 0xffff)
 
@@ -106,7 +106,7 @@ struct sbp2_query_logins_orb {
 	u32 reserved_resp_length;
 	u32 status_fifo_hi;
 	u32 status_fifo_lo;
-};
+} __attribute__((packed));
 
 #define RESPONSE_GET_MAX_LOGINS(value)          (value & 0xffff)
 #define RESPONSE_GET_ACTIVE_LOGINS(value)       ((RESPONSE_GET_LENGTH(value) - 4) / 12)
@@ -116,7 +116,7 @@ struct sbp2_query_logins_response {
 	u32 misc_IDs;
 	u32 initiator_misc_hi;
 	u32 initiator_misc_lo;
-};
+} __attribute__((packed));
 
 struct sbp2_reconnect_orb {
 	u32 reserved1;
@@ -127,7 +127,7 @@ struct sbp2_reconnect_orb {
 	u32 reserved5;
 	u32 status_fifo_hi;
 	u32 status_fifo_lo;
-};
+} __attribute__((packed));
 
 struct sbp2_logout_orb {
 	u32 reserved1;
@@ -138,7 +138,7 @@ struct sbp2_logout_orb {
 	u32 reserved5;
 	u32 status_fifo_hi;
 	u32 status_fifo_lo;
-};
+} __attribute__((packed));
 
 #define PAGE_TABLE_SET_SEGMENT_BASE_HI(value)   (value & 0xffff)
 #define PAGE_TABLE_SET_SEGMENT_LENGTH(value)    ((value & 0xffff) << 16)
@@ -146,7 +146,7 @@ struct sbp2_logout_orb {
 struct sbp2_unrestricted_page_table {
 	u32 length_segment_base_hi;
 	u32 segment_base_lo;
-};
+} __attribute__((packed));
 
 #define RESP_STATUS_REQUEST_COMPLETE		0x0
 #define RESP_STATUS_TRANSPORT_FAILURE		0x1
@@ -191,7 +191,7 @@ struct sbp2_status_block {
 	u32 ORB_offset_hi_misc;
 	u32 ORB_offset_lo;
 	u8 command_set_dependent[24];
-};
+} __attribute__((packed));
 
 /*
  * Miscellaneous SBP2 related config rom defines
#19 lore raw

Re: [PATCH 2.6.17-rc5-mm2 17/18] sbp2: provide helptext for CONFIG_IEEE1394_SBP2_PHYS_DMA and mark it experimental

In reply to Stefan Richter

drivers/ieee1394/Kconfig config IEEE1394_SBP2 · line 132

Quoted 6 lines · Stefan Richter

It appears I will not get it fixed overnight.

drivers/ieee1394/Kconfig +2 -2
-	bool "Enable Phys DMA support for SBP2 (Debug)"
-	depends on IEEE1394 && IEEE1394_SBP2
+	bool "Enable replacement for physical DMA in SBP2"
+	depends on IEEE1394 && IEEE1394_SBP2 && EXPERIMENTAL

Please add '&& !SPARC' to the depends line. Other architectures may apply, but I know for sure that this cannot be enabled on SPARC or SPARC64 since the module will be unloadable due to missing symbols (virt_to_bus, bus_to_virt).

Signature · 4 lines
Ubuntu     - http://www.ubuntu.com/
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
SwissDisk  - http://www.swissdisk.com/
#20 lore raw

Re: [PATCH 2.6.17-rc5-mm2 17/18] sbp2: provide helptext for CONFIG_IEEE1394_SBP2_PHYS_DMA and mark it experimental

Quoted 13 lines · Ben Collins

drivers/ieee1394/Kconfig config IEEE1394_SBP2 · line 132

Quoted 6 lines · Stefan Richter

It appears I will not get it fixed overnight.

drivers/ieee1394/Kconfig +2 -2
-	bool "Enable Phys DMA support for SBP2 (Debug)"
-	depends on IEEE1394 && IEEE1394_SBP2
+	bool "Enable replacement for physical DMA in SBP2"
+	depends on IEEE1394 && IEEE1394_SBP2 && EXPERIMENTAL

Please add '&& !SPARC' to the depends line. Other architectures may apply, but I know for sure that this cannot be enabled on SPARC or SPARC64 since the module will be unloadable due to missing symbols (virt_to_bus, bus_to_virt).

Are there suggestions for more architectures? PPC64?

Or maybe I should put something into sbp2 like

#if defined(CONFIG_X86_32) || defined(CONFIG_PPC32)
	a = bus_to_virt(b);
#else
	printk("this functionality will be brought to you RSN");

#endif
until I had time to implement a proper mapping.

Signature · 3 lines
Stefan Richter
-=====-=-==- -==- ---=-
http://arcgraph.de/sr/
#21 lore raw

Re: [PATCH 2.6.17-rc5-mm2 17/18] sbp2: provide helptext for CONFIG_IEEE1394_SBP2_PHYS_DMA and mark it experimental

Quoted 15 lines · Stefan Richter
Quoted 13 lines · Ben Collins

drivers/ieee1394/Kconfig config IEEE1394_SBP2 · line 132

Quoted 6 lines · Stefan Richter

It appears I will not get it fixed overnight.

drivers/ieee1394/Kconfig +2 -2
-	bool "Enable Phys DMA support for SBP2 (Debug)"
-	depends on IEEE1394 && IEEE1394_SBP2
+	bool "Enable replacement for physical DMA in SBP2"
+	depends on IEEE1394 && IEEE1394_SBP2 && EXPERIMENTAL

Please add '&& !SPARC' to the depends line. Other architectures may apply, but I know for sure that this cannot be enabled on SPARC or SPARC64 since the module will be unloadable due to missing symbols (virt_to_bus, bus_to_virt).

Quoted 1 line

Are there suggestions for more architectures? PPC64?

Rather it be in the config. Plus your suggestion still makes it unusable :)

I suggest instead doing '&& X86_32'. That should affect the least people and keep it where it's known to work.

Signature · 4 lines
Ubuntu     - http://www.ubuntu.com/
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
SwissDisk  - http://www.swissdisk.com/
#22 lore raw

Re: [PATCH 2.6.17-rc5-mm2 17/18] sbp2: provide helptext for CONFIG_IEEE1394_SBP2_PHYS_DMA and mark it experimental

Quoted 2 lines · Ben Collins

Rather it be in the config. Plus your suggestion still makes it unusable :)

Right. But only if ohci1394 is loaded with phys_dma=0 or a controller without phys DMA is used. Only these conditions let sbp2 run into the routine which currently uses bus_to_virt.

Right now, sbp2 is unusable _on all platforms_ if these conditions apply and if CONFIG_IEEE1394_SBP2_PHYS_DMA=N.

The previously sent "address range properties" patches would allow sbp2 to check for phys DMA at runtime. If phys DMA is off, sbp2 may either proceed to use the old bus_to_virt mapping or say: "Sorry lad, I won't connect unless you get this phys DMA thing going." (Until sbp2 learns platform independent DMA mapping.) IOW we could get rid of the CONFIG_IEEE1394_SBP2_PHYS_DMA switch immediately.

But since the non-phys-DMA mode of sbp2 is currently prone to lock-ups, runtime detection of non-phys-DMA is of lower priority to me.

Quoted 2 lines

I suggest instead doing '&& X86_32'. That should affect the least people and keep it where it's known to work.

Would '&& (X86_32 || PPC_32)' work too?

Signature · 3 lines
Stefan Richter
-=====-=-==- -==- ---==
http://arcgraph.de/sr/
#23 lore raw

Re: [PATCH 2.6.17-rc5-mm2 17/18] sbp2: provide helptext for CONFIG_IEEE1394_SBP2_PHYS_DMA and mark it experimental

Quoted 7 lines · Stefan Richter
Quoted 2 lines · Ben Collins

Rather it be in the config. Plus your suggestion still makes it unusable :)

Right. But only if ohci1394 is loaded with phys_dma=0 or a controller without phys DMA is used. Only these conditions let sbp2 run into the routine which currently uses bus_to_virt.

Sure, that's not a problem. I just don't think we should make the option available on platforms where it cannot work at all. No need to add to the confusion.

Quoted 1 line

Would '&& (X86_32 || PPC_32)' work too?

Perfect.

Signature · 4 lines
Ubuntu     - http://www.ubuntu.com/
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
SwissDisk  - http://www.swissdisk.com/