aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 18:04:45 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 18:04:45 -0400
commitacbb67d51ef0ff942d592d44fb8abb4c931041ff (patch)
treedcb18c0a192083632177b34610ed3457a68f4727
parent22a60f1951256ed493bf1430f8c3edcb31c0dbaa (diff)
parent1f5c23e2c10d642a23aa3ebb449670a5184b6aab (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: IB/mthca: Use mmiowb after doorbell ring IB/ipath: Initialize diagpkt file on device init only RDMA/amso1100: Fix a NULL dereference in error path RDMA/amso1100: pci_module_init() conversion
-rw-r--r--drivers/infiniband/hw/amso1100/c2.c2
-rw-r--r--drivers/infiniband/hw/amso1100/c2_rnic.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_diag.c65
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c10
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h3
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c7
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c19
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c8
8 files changed, 75 insertions, 43 deletions
diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c
index dc1ebeac35c7..9e7bd94b958a 100644
--- a/drivers/infiniband/hw/amso1100/c2.c
+++ b/drivers/infiniband/hw/amso1100/c2.c
@@ -1243,7 +1243,7 @@ static struct pci_driver c2_pci_driver = {
1243 1243
1244static int __init c2_init_module(void) 1244static int __init c2_init_module(void)
1245{ 1245{
1246 return pci_module_init(&c2_pci_driver); 1246 return pci_register_driver(&c2_pci_driver);
1247} 1247}
1248 1248
1249static void __exit c2_exit_module(void) 1249static void __exit c2_exit_module(void)
diff --git a/drivers/infiniband/hw/amso1100/c2_rnic.c b/drivers/infiniband/hw/amso1100/c2_rnic.c
index e37c5688c214..30409e179606 100644
--- a/drivers/infiniband/hw/amso1100/c2_rnic.c
+++ b/drivers/infiniband/hw/amso1100/c2_rnic.c
@@ -150,8 +150,8 @@ static int c2_rnic_query(struct c2_dev *c2dev, struct ib_device_attr *props)
150 (struct c2wr_rnic_query_rep *) (unsigned long) (vq_req->reply_msg); 150 (struct c2wr_rnic_query_rep *) (unsigned long) (vq_req->reply_msg);
151 if (!reply) 151 if (!reply)
152 err = -ENOMEM; 152 err = -ENOMEM;
153 153 else
154 err = c2_errno(reply); 154 err = c2_errno(reply);
155 if (err) 155 if (err)
156 goto bail2; 156 goto bail2;
157 157
diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
index 29958b6e0214..28c087b824c2 100644
--- a/drivers/infiniband/hw/ipath/ipath_diag.c
+++ b/drivers/infiniband/hw/ipath/ipath_diag.c
@@ -67,19 +67,54 @@ static struct file_operations diag_file_ops = {
67 .release = ipath_diag_release 67 .release = ipath_diag_release
68}; 68};
69 69
70static ssize_t ipath_diagpkt_write(struct file *fp,
71 const char __user *data,
72 size_t count, loff_t *off);
73
74static struct file_operations diagpkt_file_ops = {
75 .owner = THIS_MODULE,
76 .write = ipath_diagpkt_write,
77};
78
79static atomic_t diagpkt_count = ATOMIC_INIT(0);
80static struct cdev *diagpkt_cdev;
81static struct class_device *diagpkt_class_dev;
82
70int ipath_diag_add(struct ipath_devdata *dd) 83int ipath_diag_add(struct ipath_devdata *dd)
71{ 84{
72 char name[16]; 85 char name[16];
86 int ret = 0;
87
88 if (atomic_inc_return(&diagpkt_count) == 1) {
89 ret = ipath_cdev_init(IPATH_DIAGPKT_MINOR,
90 "ipath_diagpkt", &diagpkt_file_ops,
91 &diagpkt_cdev, &diagpkt_class_dev);
92
93 if (ret) {
94 ipath_dev_err(dd, "Couldn't create ipath_diagpkt "
95 "device: %d", ret);
96 goto done;
97 }
98 }
73 99
74 snprintf(name, sizeof(name), "ipath_diag%d", dd->ipath_unit); 100 snprintf(name, sizeof(name), "ipath_diag%d", dd->ipath_unit);
75 101
76 return ipath_cdev_init(IPATH_DIAG_MINOR_BASE + dd->ipath_unit, name, 102 ret = ipath_cdev_init(IPATH_DIAG_MINOR_BASE + dd->ipath_unit, name,
77 &diag_file_ops, &dd->diag_cdev, 103 &diag_file_ops, &dd->diag_cdev,
78 &dd->diag_class_dev); 104 &dd->diag_class_dev);
105 if (ret)
106 ipath_dev_err(dd, "Couldn't create %s device: %d",
107 name, ret);
108
109done:
110 return ret;
79} 111}
80 112
81void ipath_diag_remove(struct ipath_devdata *dd) 113void ipath_diag_remove(struct ipath_devdata *dd)
82{ 114{
115 if (atomic_dec_and_test(&diagpkt_count))
116 ipath_cdev_cleanup(&diagpkt_cdev, &diagpkt_class_dev);
117
83 ipath_cdev_cleanup(&dd->diag_cdev, &dd->diag_class_dev); 118 ipath_cdev_cleanup(&dd->diag_cdev, &dd->diag_class_dev);
84} 119}
85 120
@@ -275,30 +310,6 @@ bail:
275 return ret; 310 return ret;
276} 311}
277 312
278static ssize_t ipath_diagpkt_write(struct file *fp,
279 const char __user *data,
280 size_t count, loff_t *off);
281
282static struct file_operations diagpkt_file_ops = {
283 .owner = THIS_MODULE,
284 .write = ipath_diagpkt_write,
285};
286
287static struct cdev *diagpkt_cdev;
288static struct class_device *diagpkt_class_dev;
289
290int __init ipath_diagpkt_add(void)
291{
292 return ipath_cdev_init(IPATH_DIAGPKT_MINOR,
293 "ipath_diagpkt", &diagpkt_file_ops,
294 &diagpkt_cdev, &diagpkt_class_dev);
295}
296
297void __exit ipath_diagpkt_remove(void)
298{
299 ipath_cdev_cleanup(&diagpkt_cdev, &diagpkt_class_dev);
300}
301
302/** 313/**
303 * ipath_diagpkt_write - write an IB packet 314 * ipath_diagpkt_write - write an IB packet
304 * @fp: the diag data device file pointer 315 * @fp: the diag data device file pointer
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index 12cefa658f3b..b4ffaa7bcbb7 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -2005,18 +2005,8 @@ static int __init infinipath_init(void)
2005 goto bail_group; 2005 goto bail_group;
2006 } 2006 }
2007 2007
2008 ret = ipath_diagpkt_add();
2009 if (ret < 0) {
2010 printk(KERN_ERR IPATH_DRV_NAME ": Unable to create "
2011 "diag data device: error %d\n", -ret);
2012 goto bail_ipathfs;
2013 }
2014
2015 goto bail; 2008 goto bail;
2016 2009
2017bail_ipathfs:
2018 ipath_exit_ipathfs();
2019
2020bail_group: 2010bail_group:
2021 ipath_driver_remove_group(&ipath_driver.driver); 2011 ipath_driver_remove_group(&ipath_driver.driver);
2022 2012
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 7c436697d0e4..06d5020a2f60 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -869,9 +869,6 @@ int ipath_device_create_group(struct device *, struct ipath_devdata *);
869void ipath_device_remove_group(struct device *, struct ipath_devdata *); 869void ipath_device_remove_group(struct device *, struct ipath_devdata *);
870int ipath_expose_reset(struct device *); 870int ipath_expose_reset(struct device *);
871 871
872int ipath_diagpkt_add(void);
873void ipath_diagpkt_remove(void);
874
875int ipath_init_ipathfs(void); 872int ipath_init_ipathfs(void);
876void ipath_exit_ipathfs(void); 873void ipath_exit_ipathfs(void);
877int ipathfs_add_device(struct ipath_devdata *); 874int ipathfs_add_device(struct ipath_devdata *);
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index e393681ba7d4..149b36901239 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -39,6 +39,8 @@
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/hardirq.h> 40#include <linux/hardirq.h>
41 41
42#include <asm/io.h>
43
42#include <rdma/ib_pack.h> 44#include <rdma/ib_pack.h>
43 45
44#include "mthca_dev.h" 46#include "mthca_dev.h"
@@ -210,6 +212,11 @@ static inline void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq,
210 mthca_write64(doorbell, 212 mthca_write64(doorbell,
211 dev->kar + MTHCA_CQ_DOORBELL, 213 dev->kar + MTHCA_CQ_DOORBELL,
212 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); 214 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
215 /*
216 * Make sure doorbells don't leak out of CQ spinlock
217 * and reach the HCA out of order:
218 */
219 mmiowb();
213 } 220 }
214} 221}
215 222
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 5e5c58b9920b..6a7822e0fc19 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -39,6 +39,8 @@
39#include <linux/string.h> 39#include <linux/string.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41 41
42#include <asm/io.h>
43
42#include <rdma/ib_verbs.h> 44#include <rdma/ib_verbs.h>
43#include <rdma/ib_cache.h> 45#include <rdma/ib_cache.h>
44#include <rdma/ib_pack.h> 46#include <rdma/ib_pack.h>
@@ -1732,6 +1734,11 @@ out:
1732 mthca_write64(doorbell, 1734 mthca_write64(doorbell,
1733 dev->kar + MTHCA_SEND_DOORBELL, 1735 dev->kar + MTHCA_SEND_DOORBELL,
1734 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); 1736 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
1737 /*
1738 * Make sure doorbells don't leak out of SQ spinlock
1739 * and reach the HCA out of order:
1740 */
1741 mmiowb();
1735 } 1742 }
1736 1743
1737 qp->sq.next_ind = ind; 1744 qp->sq.next_ind = ind;
@@ -1851,6 +1858,12 @@ out:
1851 qp->rq.next_ind = ind; 1858 qp->rq.next_ind = ind;
1852 qp->rq.head += nreq; 1859 qp->rq.head += nreq;
1853 1860
1861 /*
1862 * Make sure doorbells don't leak out of RQ spinlock and reach
1863 * the HCA out of order:
1864 */
1865 mmiowb();
1866
1854 spin_unlock_irqrestore(&qp->rq.lock, flags); 1867 spin_unlock_irqrestore(&qp->rq.lock, flags);
1855 return err; 1868 return err;
1856} 1869}
@@ -2112,6 +2125,12 @@ out:
2112 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); 2125 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
2113 } 2126 }
2114 2127
2128 /*
2129 * Make sure doorbells don't leak out of SQ spinlock and reach
2130 * the HCA out of order:
2131 */
2132 mmiowb();
2133
2115 spin_unlock_irqrestore(&qp->sq.lock, flags); 2134 spin_unlock_irqrestore(&qp->sq.lock, flags);
2116 return err; 2135 return err;
2117} 2136}
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index 92a72f521528..f5d7677d1079 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -35,6 +35,8 @@
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/string.h> 36#include <linux/string.h>
37 37
38#include <asm/io.h>
39
38#include "mthca_dev.h" 40#include "mthca_dev.h"
39#include "mthca_cmd.h" 41#include "mthca_cmd.h"
40#include "mthca_memfree.h" 42#include "mthca_memfree.h"
@@ -595,6 +597,12 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
595 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); 597 MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
596 } 598 }
597 599
600 /*
601 * Make sure doorbells don't leak out of SRQ spinlock and
602 * reach the HCA out of order:
603 */
604 mmiowb();
605
598 spin_unlock_irqrestore(&srq->lock, flags); 606 spin_unlock_irqrestore(&srq->lock, flags);
599 return err; 607 return err;
600} 608}