aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_init_chip.c
diff options
context:
space:
mode:
authorJohn Gregor <john.gregor@qlogic.com>2007-09-05 04:57:14 -0400
committerRoland Dreier <rolandd@cisco.com>2008-01-25 17:15:27 -0500
commite342c119172f87f2d812bccfd0283f62e1bc1c2a (patch)
tree52eb0e75f5f894ab7f0f3c755f0876f18637e5a9 /drivers/infiniband/hw/ipath/ipath_init_chip.c
parent9ab4295d1d9ab10a249aea002060685f935a528c (diff)
IB/ipath: Fix sendctrl locking
Code review pointed out that the locking around uses of ipath_sendctrl and kr_sendctrl were, in several places, incorrect and/or inconsistent. Signed-off-by: John Gregor <john.gregor@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_init_chip.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_init_chip.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index 9e9d6fafcf0d..1c65ab907a33 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -345,7 +345,7 @@ static int init_chip_first(struct ipath_devdata *dd,
345 dd->ipath_piobcnt2k, dd->ipath_pio2kbase); 345 dd->ipath_piobcnt2k, dd->ipath_pio2kbase);
346 346
347 spin_lock_init(&dd->ipath_tid_lock); 347 spin_lock_init(&dd->ipath_tid_lock);
348 348 spin_lock_init(&dd->ipath_sendctrl_lock);
349 spin_lock_init(&dd->ipath_gpio_lock); 349 spin_lock_init(&dd->ipath_gpio_lock);
350 spin_lock_init(&dd->ipath_eep_st_lock); 350 spin_lock_init(&dd->ipath_eep_st_lock);
351 mutex_init(&dd->ipath_eep_lock); 351 mutex_init(&dd->ipath_eep_lock);
@@ -372,9 +372,9 @@ static int init_chip_reset(struct ipath_devdata *dd,
372 *pdp = dd->ipath_pd[0]; 372 *pdp = dd->ipath_pd[0];
373 /* ensure chip does no sends or receives while we re-initialize */ 373 /* ensure chip does no sends or receives while we re-initialize */
374 dd->ipath_control = dd->ipath_sendctrl = dd->ipath_rcvctrl = 0U; 374 dd->ipath_control = dd->ipath_sendctrl = dd->ipath_rcvctrl = 0U;
375 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, 0); 375 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, dd->ipath_rcvctrl);
376 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 0); 376 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, dd->ipath_sendctrl);
377 ipath_write_kreg(dd, dd->ipath_kregs->kr_control, 0); 377 ipath_write_kreg(dd, dd->ipath_kregs->kr_control, dd->ipath_control);
378 378
379 rtmp = ipath_read_kreg32(dd, dd->ipath_kregs->kr_portcnt); 379 rtmp = ipath_read_kreg32(dd, dd->ipath_kregs->kr_portcnt);
380 if (dd->ipath_portcnt != rtmp) 380 if (dd->ipath_portcnt != rtmp)
@@ -487,6 +487,7 @@ static void enable_chip(struct ipath_devdata *dd,
487 struct ipath_portdata *pd, int reinit) 487 struct ipath_portdata *pd, int reinit)
488{ 488{
489 u32 val; 489 u32 val;
490 unsigned long flags;
490 int i; 491 int i;
491 492
492 if (!reinit) 493 if (!reinit)
@@ -495,11 +496,13 @@ static void enable_chip(struct ipath_devdata *dd,
495 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, 496 ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
496 dd->ipath_rcvctrl); 497 dd->ipath_rcvctrl);
497 498
499 spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags);
498 /* Enable PIO send, and update of PIOavail regs to memory. */ 500 /* Enable PIO send, and update of PIOavail regs to memory. */
499 dd->ipath_sendctrl = INFINIPATH_S_PIOENABLE | 501 dd->ipath_sendctrl = INFINIPATH_S_PIOENABLE |
500 INFINIPATH_S_PIOBUFAVAILUPD; 502 INFINIPATH_S_PIOBUFAVAILUPD;
501 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 503 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, dd->ipath_sendctrl);
502 dd->ipath_sendctrl); 504 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
505 spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags);
503 506
504 /* 507 /*
505 * enable port 0 receive, and receive interrupt. other ports 508 * enable port 0 receive, and receive interrupt. other ports
@@ -696,6 +699,7 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
696 u64 val; 699 u64 val;
697 struct ipath_portdata *pd = NULL; /* keep gcc4 happy */ 700 struct ipath_portdata *pd = NULL; /* keep gcc4 happy */
698 gfp_t gfp_flags = GFP_USER | __GFP_COMP; 701 gfp_t gfp_flags = GFP_USER | __GFP_COMP;
702 unsigned long flags;
699 703
700 ret = init_housekeeping(dd, &pd, reinit); 704 ret = init_housekeeping(dd, &pd, reinit);
701 if (ret) 705 if (ret)
@@ -827,8 +831,12 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
827 ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrclear, 831 ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrclear,
828 ~0ULL&~INFINIPATH_HWE_MEMBISTFAILED); 832 ~0ULL&~INFINIPATH_HWE_MEMBISTFAILED);
829 ipath_write_kreg(dd, dd->ipath_kregs->kr_control, 0ULL); 833 ipath_write_kreg(dd, dd->ipath_kregs->kr_control, 0ULL);
830 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 834
831 INFINIPATH_S_PIOENABLE); 835 spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags);
836 dd->ipath_sendctrl = INFINIPATH_S_PIOENABLE;
837 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, dd->ipath_sendctrl);
838 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
839 spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags);
832 840
833 /* 841 /*
834 * before error clears, since we expect serdes pll errors during 842 * before error clears, since we expect serdes pll errors during