[PATCH 21 of 33] IB/ipath - force PIOAvail update entry point

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Bryan O'Sullivan
Date: Thursday, March 15, 2007 - 2:45 pm

# HG changeset patch
# User Arthur Jones <arthur.jones@qlogic.com>
# Date 1173994465 25200
# Node ID 68302e9dbd8803f937af9f02ca26a63ff43e9afa
# Parent  8a013b707785accfd71589334bbf8e4029ffa892
IB/ipath - force PIOAvail update entry point.

Due to a chip bug, the PIOAvail register is not always updated to memory.
This patch allows userspace to force an update.

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>

diff -r 8a013b707785 -r 68302e9dbd88 drivers/infiniband/hw/ipath/ipath_common.h
--- a/drivers/infiniband/hw/ipath/ipath_common.h	Thu Mar 15 14:34:25 2007 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_common.h	Thu Mar 15 14:34:25 2007 -0700
@@ -352,7 +352,7 @@ struct ipath_base_info {
  * may not be implemented; the user code must deal with this if it
  * cares, or it must abort after initialization reports the difference.
  */
-#define IPATH_USER_SWMINOR 4
+#define IPATH_USER_SWMINOR 5
 
 #define IPATH_USER_SWVERSION ((IPATH_USER_SWMAJOR<<16) | IPATH_USER_SWMINOR)
 
@@ -429,8 +429,11 @@ struct ipath_user_info {
 #define __IPATH_CMD_SLAVE_INFO	22	/* return info on slave processes (for old user code) */
 #define IPATH_CMD_ASSIGN_PORT	23	/* allocate HCA and port */
 #define IPATH_CMD_USER_INIT 	24	/* set up userspace */
-
-#define IPATH_CMD_MAX		24
+#define IPATH_CMD_UNUSED_1	25
+#define IPATH_CMD_UNUSED_2	26
+#define IPATH_CMD_PIOAVAILUPD	27	/* force an update of PIOAvail reg */
+
+#define IPATH_CMD_MAX		27
 
 struct ipath_port_info {
 	__u32 num_active;	/* number of active units */
diff -r 8a013b707785 -r 68302e9dbd88 drivers/infiniband/hw/ipath/ipath_file_ops.c
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c	Thu Mar 15 14:34:25 2007 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c	Thu Mar 15 14:34:25 2007 -0700
@@ -2047,6 +2047,17 @@ static int ipath_get_slave_info(struct i
 	return ret;
 }
 
+static int ipath_force_pio_avail_update(struct ipath_devdata *dd)
+{
+	u64 reg = dd->ipath_sendctrl;
+
+	clear_bit(IPATH_S_PIOBUFAVAILUPD, &reg);
+	ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, reg);
+	ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, dd->ipath_sendctrl);
+
+	return 0;
+}
+
 static ssize_t ipath_write(struct file *fp, const char __user *data,
 			   size_t count, loff_t *off)
 {
@@ -2106,22 +2117,30 @@ static ssize_t ipath_write(struct file *
 		dest = &cmd.cmd.slave_mask_addr;
 		src = &ucmd->cmd.slave_mask_addr;
 		break;
+	case IPATH_CMD_PIOAVAILUPD:	// force an update of PIOAvail reg
+		copy = 0;
+		src = NULL;
+		dest = NULL;
+		break;
 	default:
 		ret = -EINVAL;
 		goto bail;
 	}
 
-	if ((count - consumed) < copy) {
-		ret = -EINVAL;
-		goto bail;
-	}
-
-	if (copy_from_user(dest, src, copy)) {
-		ret = -EFAULT;
-		goto bail;
-	}
-
-	consumed += copy;
+	if (copy) {
+		if ((count - consumed) < copy) {
+			ret = -EINVAL;
+			goto bail;
+		}
+
+		if (copy_from_user(dest, src, copy)) {
+			ret = -EFAULT;
+			goto bail;
+		}
+
+		consumed += copy;
+	}
+
 	pd = port_fp(fp);
 	if (!pd && cmd.type != __IPATH_CMD_USER_INIT &&
 		cmd.type != IPATH_CMD_ASSIGN_PORT) {
@@ -2172,6 +2191,9 @@ static ssize_t ipath_write(struct file *
 					   (void __user *) (unsigned long)
 					   cmd.cmd.slave_mask_addr);
 		break;
+	case IPATH_CMD_PIOAVAILUPD:
+		ret = ipath_force_pio_avail_update(pd->port_dd);
+		break;
 	}
 
 	if (ret >= 0)
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00 of 33] Set of ipath patches for 2.6.22, Bryan O'Sullivan, (Thu Mar 15, 2:44 pm)
[PATCH 08 of 33] IB/ipath - fix up some debug messages, Bryan O'Sullivan, (Thu Mar 15, 2:44 pm)
[PATCH 09 of 33] IB/ipath - fix QP error completion queue ..., Bryan O'Sullivan, (Thu Mar 15, 2:44 pm)
[PATCH 10 of 33] IB/ipath - fix PSN update for RC retries, Bryan O'Sullivan, (Thu Mar 15, 2:44 pm)
[PATCH 12 of 33] IB/ipath - fix bad argument to clear_bit ..., Bryan O'Sullivan, (Thu Mar 15, 2:44 pm)
[PATCH 14 of 33] IB/ipath - fix port sharing on powerpc, Bryan O'Sullivan, (Thu Mar 15, 2:44 pm)
[PATCH 16 of 33] IB/ipath - fix RDMA reads of length zero ..., Bryan O'Sullivan, (Thu Mar 15, 2:45 pm)
[PATCH 18 of 33] IB/ipath - Fix calculation for number of ..., Bryan O'Sullivan, (Thu Mar 15, 2:45 pm)
[PATCH 21 of 33] IB/ipath - force PIOAvail update entry point, Bryan O'Sullivan, (Thu Mar 15, 2:45 pm)
[PATCH 26 of 33] IB/ipath - prevent random program use of ..., Bryan O'Sullivan, (Thu Mar 15, 2:45 pm)
[PATCH 29 of 33] IB/ipath - fix unit selection due to all ..., Bryan O'Sullivan, (Thu Mar 15, 2:45 pm)
[PATCH 30 of 33] IB/ipath - check reserved keys, Bryan O'Sullivan, (Thu Mar 15, 2:45 pm)
[PATCH 33 of 33] IB/ipath - fix drift between WCs in user ..., Bryan O'Sullivan, (Thu Mar 15, 2:45 pm)
Re: [PATCH 00 of 33] Set of ipath patches for 2.6.22, Roland Dreier, (Mon Mar 19, 2:17 pm)
Re: [PATCH 01 of 33] IB/ipath - add ability to set and cle ..., Bryan O'Sullivan, (Wed Mar 21, 11:50 am)
Re: [PATCH 00 of 33] Set of ipath patches for 2.6.22, Roland Dreier, (Tue Apr 10, 3:30 pm)